Skip to content
  • Status codes · API Design

Status codes

LearnViaNotes @learnvianotes· 1 min read

Status codes are your API's communication language. Use the right code — don't return 200 for errors.

  1. 200

    OK

    GET success

  2. 201

    Created

    POST success. Include Location header.

  3. 202

    Accepted

    Async processing — not yet done

  4. 204

    No content

    DELETE / PATCH success — no body

  5. 301

    Moved permanently

    Resource URL changed forever

  6. 304

    Not modified

    Cache valid — use cached version

  7. 400

    Bad request

    Invalid params, malformed JSON — client's fault

  8. 401

    Unauthorized

    Not authenticated — send valid credentials

  9. 403

    Forbidden

    Authenticated but not authorized

  10. 404

    Not found

    Resource doesn't exist

  11. 409

    Conflict

    Duplicate resource or optimistic lock failed

  12. 422

    Unprocessable entity

    Valid syntax but semantic validation failed

  13. 429

    Too many requests

    Rate limit exceeded. Include Retry-After.

  14. 500

    Internal server error

    Unexpected server failure

  15. 503

    Service unavailable

    Overloaded or down for maintenance

Good error response shape

JSON
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid product ID",
    "field": "productId",
    "request_id": "req_abc123"
  }
}

Critical distinctions

Free for students and teachers

Write notes like this one

Cards for every idea, quizzes and flashcards, read aloud — on the web and your phone.

Something wrong with this note? Open it to report