API Endpoints

All endpoints are under /api/v1/. Table routes are at /api/v1/table/{table}/. For JavaScript examples of every operation, see the Frontend Guide. Your running server also has interactive docs at /api/v1/doc/ui (Swagger UI).

Database Level

EndpointMethodDescription
/healthGETHealth check
/docGETOpenAPI 3.1.0 JSON spec
/doc/uiGETSwagger UI
/pocket/GETAdmin panel UI
/settingsGETDatabase settings (admin)
/setup-dbPOSTInitialize database (superadmin)
/migrationsGET/POSTList or apply migrations (superadmin)
/files/{table}/{rid}/{path}GETDownload file from R2
/action/{name}POSTExecute an action

Table CRUD

All CRUD endpoints respect row-level security rules defined in your config. See the Config Reference for rule syntax.

INSERT -- POST /table/{t}/insert

json
{
  "values": { "title": "Hello", "body": "World" },
  "returning": "*"
}
FieldTypeRequiredDescription
valuesobject or object[]YesField values. Array for batch insert.
returningstring or string[]NoFields to return. "*" for all. Without this, response is empty.
orstringNoConflict handling: "IGNORE", "REPLACE", "ABORT", "FAIL", "ROLLBACK"

Common gotcha: Sending {"title": "x"} without the values wrapper silently fails.

SELECT -- GET/POST /table/{t}/select

GET with query params:

/table/{t}/select?where=published == true&order=-created&limit=10&select=id,title

POST with JSON body:

json
{
  "where": "published == true",
  "order": "-created",
  "limit": 10,
  "select": "id,title"
}
FieldTypeRequiredDescription
wherestringNoFilter expression (e.g., author_id == 'abc', published == true & title != null)
orderstring or string[]NoSort: "-created" (DESC), "+title" (ASC), "created DESC". Comma-separated or array for multiple.
sortstring or string[]NoAlias for order (PocketBase convention)
limitnumberNoMax records to return
offsetnumberNoSkip N records (pagination)
selectstring or string[]NoFields to return: "id,title,created" or ["id", "title"]
distinctbooleanNoDeduplicate results
groupstring or string[]NoGroup by fields

Returns: array of records.

LIST -- GET/POST /table/{t}/list

Same parameters as SELECT. Returns { items: [...], total: number }.

VIEW -- GET /table/{t}/view/{id}

No body. Returns single record or 404.

Optional query params: select (field filter), where (additional filter).

UPDATE -- POST /table/{t}/update

json
{
  "where": "author_id == 'abc123'",
  "setValues": { "published": true },
  "returning": "*"
}
FieldTypeRequiredDescription
wherestringYesFilter expression -- which rows to update
setValuesobjectNoField->value pairs
setobjectNoField->SQL expression pairs (e.g., { "count": "count + 1" })
returningstring or string[]NoFields to return
orstringNoConflict handling

EDIT -- POST /table/{t}/edit/{id}

json
{ "title": "Updated Title" }

Body is bare fields -- NOT wrapped in setValues. The endpoint wraps it internally.

ParamWhereDescription
Body fieldsJSON bodyField->value pairs to update
returningQuery paramFields to return (defaults to UID field)
orQuery param"INSERT" for upsert behavior

DELETE -- POST /table/{t}/delete

json
{
  "where": "id == 'abc123'",
  "returning": "*"
}
FieldTypeRequiredDescription
wherestringYesFilter expression -- which rows to delete
returningstring or string[]NoReturn deleted records

Authentication

Available when a table has the auth extension. See the Frontend Guide for complete auth flow examples and the OAuth Guide for provider setup.

Sign Up -- POST /table/{t}/auth/sign-up

json
{
  "username": "testuser",
  "email": "test@example.com",
  "password": "mypassword",
  "name": "Test User"
}

Body is bare fields matching the auth table schema. Returns { token, refresh_token, record }.

Login -- POST /table/{t}/auth/login-password

json
{
  "identity": "test@example.com",
  "password": "mypassword"
}

The identity field accepts email or username. Returns { token, refresh_token, record }.

Other Auth Endpoints

EndpointMethodBodyDescription
/auth/refresh-tokenPOST{ "refresh_token": "..." } + Authorization headerRefresh an expired token
/auth/change-passwordPOST{ "password": "new", "passwordCurrent": "old" }Change password (requires auth)
/auth/request-password-resetPOST{ "email": "..." }Request password reset email
/auth/confirm-password-resetPOST{ "token": "...", "password": "new" }Confirm reset with token
/auth/request-verificationPOST{ "email": "..." }Request email verification
/auth/confirm-verificationPOST{ "token": "..." }Confirm email with token
/auth/login-tokenPOST-- (uses Authorization header)Login with external JWT
/auth/google-loginPOST{ "token": "..." }Google One Tap login
/auth/oauth/{provider}GET--Start OAuth flow (Google, GitHub, Discord, LinkedIn)
/auth/oauth/{provider}/callbackGET--OAuth callback
/auth/logoutPOST-- (uses Authorization header)Logout (invalidates session)

Authenticated Requests

Add Authorization: Bearer <token> header to any request that needs auth context (for rules like auth.uid == id).