Skip to main content
PocketBase provides a comprehensive REST API for managing your backend. The API allows you to perform CRUD operations on records, authenticate users, upload files, and manage your database in real-time.

Base URL

All API requests should be made to:
Replace with your actual PocketBase server URL in production.

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
Include the auth token in the Authorization header:

Request format

The API accepts and returns JSON by default. For file uploads, use multipart/form-data.

Content-Type headers

  • application/json - For JSON requests
  • multipart/form-data - For file uploads

Response format

All responses are returned in JSON format with appropriate HTTP status codes.

Success responses

number
HTTP status code (200, 201, 204, etc.)
string
Human-readable success message
object
Response payload (varies by endpoint)

Error responses

number
HTTP error code (400, 401, 403, 404, 500, etc.)
string
Human-readable error message
object
Additional error details including validation errors

Common HTTP status codes

Pagination

List endpoints support pagination using query parameters:
number
default:"1"
Page number to retrieve
number
default:"30"
Number of items per page (max 500)

Pagination response

number
Current page number
number
Items per page
number
Total number of items across all pages
number
Total number of pages
array
Array of items for the current page

Filtering and sorting

You can filter and sort list results using query parameters:
string
Filter expression (e.g., status='active' && created>'2023-01-01')
string
Sort fields (prefix with - for descending, e.g., -created,title)

Expanding relations

Use the expand parameter to include related records:
string
Comma-separated list of relation fields to expand (e.g., author,categories)

Field selection

Limit the fields returned in the response:
string
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