beta

REST API Design Reference

Skills

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

2203/23/2026

Version 1

Published

Initial version

Created 3/23/2026

Initial version — no previous version to compare

Reference Skill
# 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
```json
{
  "data": [...],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 150,
    "hasMore": true
  }
}
```

## Error Response
```json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Email is required",
    "details": [{"field": "email", "message": "Required"}]
  }
}
```