Base URL
All API requests should be made to:Authentication
PocketBase supports multiple authentication methods:- Admin authentication - For superuser access to all API endpoints
- User authentication - For auth collection records with specific permissions
- File tokens - For accessing protected files
Authorization header:
Request format
The API accepts and returns JSON by default. For file uploads, usemultipart/form-data.
Content-Type headers
application/json- For JSON requestsmultipart/form-data- For file uploads
Response format
All responses are returned in JSON format with appropriate HTTP status codes.Success responses
HTTP status code (200, 201, 204, etc.)
Human-readable success message
Response payload (varies by endpoint)
Error responses
HTTP error code (400, 401, 403, 404, 500, etc.)
Human-readable error message
Additional error details including validation errors
Common HTTP status codes
| Code | Description |
|---|---|
| 200 | Success |
| 201 | Created |
| 204 | No Content (success with no response body) |
| 400 | Bad Request (validation error) |
| 401 | Unauthorized (missing or invalid auth token) |
| 403 | Forbidden (insufficient permissions) |
| 404 | Not Found |
| 429 | Too Many Requests (rate limit exceeded) |
| 500 | Internal Server Error |
Pagination
List endpoints support pagination using query parameters:Page number to retrieve
Number of items per page (max 500)
Pagination response
Current page number
Items per page
Total number of items across all pages
Total number of pages
Array of items for the current page
Filtering and sorting
You can filter and sort list results using query parameters:Filter expression (e.g.,
status='active' && created>'2023-01-01')Sort fields (prefix with
- for descending, e.g., -created,title)Expanding relations
Use theexpand parameter to include related records:
Comma-separated list of relation fields to expand (e.g.,
author,categories)Field selection
Limit the fields returned in the response:Comma-separated list of fields to include (e.g.,
id,title,created)Rate limiting
PocketBase implements rate limiting on API endpoints to prevent abuse. When you exceed the rate limit, you’ll receive a 429 status code.Rate limits vary by endpoint and can be configured per collection.
CORS
Cross-Origin Resource Sharing (CORS) is enabled by default. You can configure allowed origins in the application settings.Next steps
Authentication
Learn how to authenticate users and manage sessions
Records
Perform CRUD operations on collection records
Realtime
Subscribe to real-time data changes
Files
Upload and download files