OpenAPI Specification
openapi: 3.0.3
info:
title: Triplit HTTP Advanced Schema API
description: RESTful HTTP API for interacting with a Triplit sync server. Supports fetch, insert, bulk-insert, update, delete, delete-all, schema, stats, clear, and healthcheck operations. Authenticated via JWT Bearer tokens (Service or Anonymous tokens). Base URL follows the pattern https://<project-id>.triplit.io.
version: 1.0.0
contact:
name: Triplit
url: https://www.triplit.dev
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: https://{projectId}.triplit.io
description: Triplit Cloud sync server
variables:
projectId:
description: Your Triplit project ID
default: your-project-id
- url: http://localhost:6543
description: Local development server
security:
- BearerAuth: []
tags:
- name: Schema
description: Database schema management
paths:
/schema:
post:
operationId: getSchema
summary: Get database schema
description: Returns the current schema definition for the database. Requires a service (admin) token.
tags:
- Schema
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
format:
type: string
enum:
- json
default: json
description: Format for the schema response
responses:
'200':
description: Schema definition
content:
application/json:
schema:
$ref: '#/components/schemas/SchemaResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
/override-schema:
post:
operationId: overrideSchema
summary: Override database schema
description: Replaces the current database schema with a new one. Requires a service (admin) token. If collections are provided without roles, default roles are applied automatically.
tags:
- Schema
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- schema
properties:
schema:
type: object
description: New schema definition
properties:
collections:
type: object
additionalProperties: true
roles:
type: object
additionalProperties: true
responses:
'200':
description: Schema override result
content:
application/json:
schema:
type: object
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
components:
responses:
Forbidden:
description: Service key (admin token) required for this operation
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
Unauthorized:
description: Missing or invalid authentication token
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
schemas:
SchemaResponse:
type: object
properties:
type:
type: string
enum:
- schema
- schemaless
example: schema
schema:
type: object
description: The database schema definition
additionalProperties: true
ErrorResponse:
type: object
properties:
name:
type: string
description: Error type name
example: TriplitError
message:
type: string
description: Human-readable error description
example: No token provided
status:
type: integer
description: HTTP status code
example: 401
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
description: JWT Bearer token. Use a Service Token (secret) for admin operations or an Anonymous token for standard user operations.