HTTP Status Codes: The Complete Developer Reference
Stop guessing what status code to return. Use this guide.
2xx — Success
Code Name When to Use
200 OK Successful GET, PUT, DELETE, or PATCH
201 Created Resource successfully created. Include Location header
202 Accepted Request accepted but not yet processed (async operations)
204 No Content Successful DELETE or PUT where no body is needed
// 200 — Standard success res . status ( 200 ). json ({ data : user });
// 201 — Resource created res . status ( 201 ). json ({ data : newUser }). location ( ' /api/users/123 ' );
// 202 — Async task started res . status ( 202 ). json ({ jobId : ' abc123 ' , status : ' pending ' , checkUrl : ' /api/jobs/abc123 ' });
// 204 — Deleted successfully res . status ( 204 ).…