What does HTTP status code 201 mean?
The 201 Created status code indicates that the request was successful and resulted in the creation of one or more new resources on the server.
When to use it in APIs
Use 201 for successful POST requests that create new records (e.g. creating a lead, user, or charge). Ideally, include a Location header containing the URI of the newly created resource.
How it compares to other codes
- 200 OK: Reserves for successful reads or updates that do not create new records.
- 202 Accepted: Use 202 if the resource creation is queued or processed asynchronously rather than completed.