DevDocs
Home
Reference

API Reference

Base URL: https://api.yourdomain.com/v1

All requests must include the Authorization: Bearer <token> header.

Authentication

POST /auth/token
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "secret"
}

Response:

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR...",
  "expires_in": 3600
}

Documents

List documents

GET /documents?page=1&limit=20

Get document

GET /documents/:id

Create document

POST /documents
Content-Type: application/json

{
  "title": "My Document",
  "content": "<p>Hello world</p>",
  "category": "guides"
}

Update document

PATCH /documents/:id
Content-Type: application/json

{
  "title": "Updated Title"
}

Delete document

DELETE /documents/:id

Error Responses

All errors follow this shape:

{
  "error": {
    "code": "NOT_FOUND",
    "message": "Document not found",
    "status": 404
  }
}
CodeStatusDescription
UNAUTHORIZED401Missing or invalid token
FORBIDDEN403Insufficient permissions
NOT_FOUND404Resource does not exist
VALIDATION_ERROR422Request body is invalid
RATE_LIMITED429Too many requests