beta

REST API Design Reference

Skills

Reference skill for REST API design conventions, status codes, and pagination patterns.

1903/23/2026
markdown1 file
SKILL.md1.1 KB

REST API Design Patterns

URL Structure

  • Use nouns, not verbs: /users not /getUsers
  • Use plural: /users not /user
  • Nest for relationships: /users/:id/posts
  • Keep URLs shallow (max 2 levels deep)

HTTP Methods

  • GET — read (idempotent)
  • POST — create
  • PUT — full update (idempotent)
  • PATCH — partial update
  • DELETE — remove (idempotent)

Status Codes

  • 200 OK — successful GET/PUT/PATCH
  • 201 Created — successful POST
  • 204 No Content — successful DELETE
  • 400 Bad Request — validation error
  • 401 Unauthorized — not authenticated
  • 403 Forbidden — not authorized
  • 404 Not Found — resource doesn't exist
  • 409 Conflict — duplicate resource
  • 422 Unprocessable Entity — semantic error
  • 500 Internal Server Error — unexpected

Pagination

{
  "data": [...],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 150,
    "hasMore": true
  }
}

Error Response

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Email is required",
    "details": [{"field": "email", "message": "Required"}]
  }
}