2xx · Successterminal
201Created
The request has been fulfilled and has resulted in one or more new resources being created.
What this code obliges you to do
Retry
Do not retry automatically
Repeating the same request produces the same result. A retry loop here just multiplies load and hides the real fault.
Caching
Not cacheable by default
Caches will not store this response unless you send explicit freshness headers saying they may.
Response body
Body allowed
You may return a payload explaining the outcome — for an error, a machine-readable problem document is worth the effort.
When you see it
21
User registration complete
2
New database record created successfully
Effect on search
Neutral. Mostly used for API POST responses rather than documents meant to be indexed.
How to send it
2Node.js (Express)
res.status(201).json({ id: newlyCreatedId });Go
w.WriteHeader(http.StatusCreated)Codes people confuse with this one
2Class2xx
RetryNo
CacheNo
BodyAllowed