REST API Reference

While the PaperDB SDK is the recommended way to interact with your database, you can also use the REST API directly from any language or framework.

All API requests must include your API key in the Authorization header:
Authorization: Bearer your_api_key

Authentication

Sign Up

POST /auth/sign-up
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "securepassword",
  "name": "Jane Doe"
}

Sign In

POST /auth/sign-in
Content-Type: application/json

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

Collection Documents

Insert Document

POST /:collection_name/docs
Content-Type: application/json

{
  "title": "My Post",
  "published": true
}

List Documents

GET /:collection_name/docs?limit=10&offset=0&sortBy=createdAt&sortOrder=desc

Get Document

GET /:collection_name/docs/:document_id

Update Document

PATCH /:collection_name/docs/:document_id
Content-Type: application/json

{
  "published": false
}

Delete Document

DELETE /:collection_name/docs/:document_id

Bulk Insert

POST /:collection_name/bulk
Content-Type: application/json

{
  "documents": [
    { "title": "Post 1" },
    { "title": "Post 2" }
  ]
}

Realtime

Generate Token

Generate a temporary token to establish a secure WebSocket connection from the frontend.

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

{
  "collections": ["messages", "users"]
}