Triplit Auth API

Authentication and token management

OpenAPI Specification

triplit-auth-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Triplit HTTP Advanced Auth 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: Auth
  description: Authentication and token management
paths:
  /update-token:
    post:
      operationId: updateToken
      summary: Update authentication token for a sync connection
      description: Updates the JWT token for an active WebSocket sync connection identified by clientId. Useful for token refresh without reconnecting. Roles must remain equivalent between old and new token.
      tags:
      - Auth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - clientId
              properties:
                clientId:
                  type: string
                  description: The client ID of the active sync connection
                  example: 550e8400-e29b-41d4-a716-446655440000
      responses:
        '200':
          description: Token updated successfully
          content:
            text/plain:
              schema:
                type: string
                example: OK
        '400':
          description: No connection found for clientId
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  responses:
    Unauthorized:
      description: Missing or invalid authentication token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  schemas:
    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.