Ir al contenido

REST & GraphQL API

Esta página aún no está disponible en tu idioma.

Rebase automatically generates a complete API from your collection definitions:

  • REST API — CRUD endpoints for every collection at /api/data/:slug
  • GraphQL API — Auto-generated schema at /api/graphql
  • OpenAPI spec — Machine-readable spec at /api/docs
  • Swagger UI — Interactive API explorer at /api/swagger (dev mode only)

No code is required — define your collections and the API appears automatically.

For each collection, the following endpoints are generated:

MethodPathDescription
GET/api/data/:slugList entities
GET/api/data/:slug/countCount entities
GET/api/data/:slug/:idGet a single entity
POST/api/data/:slugCreate an entity
PUT/api/data/:slug/:idUpdate an entity
DELETE/api/data/:slug/:idDelete an entity

Nested relations are accessible via URL paths:

GET /api/data/authors/42/posts → list author's posts
GET /api/data/authors/42/posts/7 → get a specific post by author
POST /api/data/authors/42/posts → create a post for author
PUT /api/data/authors/42/posts/7 → update the post
DELETE /api/data/authors/42/posts/7 → delete the post

All data endpoints require authentication by default. Include a Bearer token in the Authorization header:

curl -H "Authorization: Bearer <access-token>" \
https://api.example.com/api/data/products

For server-to-server calls, use the service key:

curl -H "Authorization: Bearer <service-key>" \
https://api.example.com/api/data/products

Use PostgREST-style query parameters to filter results. The format is ?field=operator.value:

# Exact match
GET /api/data/products?active=eq.true
# Comparison operators
GET /api/data/products?price=gt.100
GET /api/data/products?price=lte.50
# Multiple filters (AND)
GET /api/data/products?active=eq.true&price=gt.10
# IN operator — match any value in a set
GET /api/data/products?status=in.(draft,published)
# NOT IN
GET /api/data/products?status=nin.(archived,deleted)
# Array contains
GET /api/data/products?tags=cs.electronics
# Array contains any
GET /api/data/products?tags=csa.(electronics,books)
OperatorMeaningExample
eqEquals (==)?active=eq.true
neqNot equals (!=)?status=neq.draft
gtGreater than (>)?price=gt.100
gteGreater or equal (>=)?price=gte.100
ltLess than (<)?price=lt.50
lteLess or equal (<=)?price=lte.50
inIn array?status=in.(a,b,c)
ninNot in array?status=nin.(a,b)
csArray contains?tags=cs.value
csaArray contains any?tags=csa.(a,b)

Use or and and for complex conditions:

# OR: match products that are either cheap or on sale
GET /api/data/products?or=(price.lt.10,on_sale.eq.true)
# AND: explicit conjunction
GET /api/data/products?and=(active.eq.true,price.gt.0)

Use orderBy with the format field:direction:

# Sort by price descending
GET /api/data/products?orderBy=price:desc
# Sort by name ascending (default)
GET /api/data/products?orderBy=name:asc

Use limit and offset, or page:

# Limit and offset
GET /api/data/products?limit=20&offset=40
# Page-based (uses default limit of 20)
GET /api/data/products?page=3

The default limit is 20, the maximum is 100.

List responses include pagination metadata:

{
"data": [
{ "id": 1, "name": "Widget", "price": 29.99 },
{ "id": 2, "name": "Gadget", "price": 49.99 }
],
"meta": {
"total": 150,
"limit": 20,
"offset": 0,
"hasMore": true
}
}

Single entity responses return a flat object:

{
"id": 1,
"name": "Widget",
"price": 29.99,
"created_at": "2026-01-15T10:30:00Z"
}

Use searchString for full-text search across string fields:

GET /api/data/products?searchString=wireless%20keyboard

Use the include parameter to embed related entities:

# Include specific relations
GET /api/data/articles?include=author,categories
# Include all relations
GET /api/data/articles?include=*

Included relations are embedded directly in the response:

{
"id": 1,
"title": "Getting Started",
"author_id": 42,
"author": {
"id": 42,
"name": "Jane Doe",
"email": "jane@example.com"
}
}

Use fields to select specific columns:

GET /api/data/products?fields=id,name,price

A GraphQL endpoint is automatically generated at /api/graphql:

query {
products(limit: 10, orderBy: "price:desc") {
id
name
price
category {
id
name
}
}
}

In development mode, an interactive GraphiQL IDE is available at /api/graphiql.

  • OpenAPI spec: GET /api/docs — Returns the full OpenAPI 3.0 JSON specification
  • Swagger UI: GET /api/swagger — Interactive API explorer (dev mode only)

The OpenAPI spec is auto-generated from your collection definitions and includes all endpoints, query parameters, and response schemas.

For external integrations, you can use API keys instead of user tokens. API keys support per-collection permission scoping (read, write, delete).

Get a list of all available collections and their structure:

GET /api/collections