201 Created

The request succeeded and created a new resource.

2xx · Success

What it means

The request succeeded and created one or more new resources. The Location header should point to the new resource, and the body usually describes it.

Why you're seeing it

  • A POST to a collection, such as creating a user or an order.
  • A PUT to a URL where nothing existed yet.

How to fix it

  • Include Location so clients don't have to guess the new URL.
  • If the work isn't done yet, return 202 Accepted instead.
  • If you updated an existing resource, use 200 or 204.

Example response

HTTP/1.1 201 Created
Location: /users/42
Content-Type: application/json

{"id": 42, "name": "Ada"}