2xx Success

HTTP 201 Created

HTTP 201 Created means the request succeeded and a new resource was created, usually by a POST.

What 201 Created means

A 201 tells the client that something new now exists. The response should include a Location header with the URL of the new resource, and usually the created object in the body so the client does not need a second request.

Common causes

  • A POST to a collection endpoint created a record.
  • A PUT created a resource at a URL that did not exist before.

How to fix or use it

Use 201 for creation endpoints, set Location, and keep 200 for updates and reads. Make creation idempotent where clients retry (for example with an idempotency key).

Express (Node.js) example

app.post('/api/posts', async (req, res) => {
  const post = await Post.create(req.body);
  res.status(201).location(`/api/posts/${post.id}`).json(post);
});

SEO impact

No direct SEO effect: crawlers do not send POST requests. It matters for API clients and monitoring that count successes by code.

Other 2xx Success codes