Loading Depth Study
Preparing your workspace
HTTP status codes communicate whether an API request succeeded, failed because of the client, or failed because of the server.
Successful requests commonly use 2xx status codes such as 200 OK and 201 Created. Client-side problems can use 4xx responses such as 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, and 409 Conflict. Server-side failures commonly use 5xx responses such as 500 Internal Server Error. Consistent JSON response structures make APIs easier for frontend applications to consume and handle.
A course creation endpoint can return 201 when creation succeeds, 400 for invalid input, and 409 if the course slug already exists.
HTTP/1.1 201 Created
Content-Type: application/json
{
"data": {
"id": "c101",
"title": "HTML Basics"
}
}The API reports successful resource creation with HTTP 201 and returns the created resource.