Skip to main content

API Endpoints

OpenSync exposes a REST API through Convex HTTP endpoints. All endpoints are authenticated with API keys.

Base URL

For the hosted version:
For self-hosted deployments, replace the base URL with your Convex deployment URL, substituting .convex.cloud with .convex.site:

Authentication

All endpoints (except /health) require an API key in the Authorization header:
Generate API keys from the Settings page in the dashboard. Keys start with osk_ and are tied to your user account.
API keys provide full access to your account data. Do not commit them to version control or share them publicly.

Sync endpoints

These endpoints are used by sync plugins to push session and message data.

POST /sync/session

Create or update a session. Uses upsert logic based on externalId, so calling this multiple times with the same externalId is safe. Request body:
Required fields: Optional fields: Response:

POST /sync/message

Create or update a message within a session. The session is identified by sessionExternalId and will be auto-created if it does not exist. Request body:
Required fields: Optional fields: Part types:

POST /sync/batch

Sync multiple sessions and messages in a single request. Preferred for bulk operations to reduce write conflicts. Request body:
Response:

Query endpoints

GET /api/sessions

List sessions for the authenticated user. Query parameters: Response:

GET /api/sessions/:id

Get a single session with all its messages. Response:

Search endpoints

POST /search

Search across all sessions using full-text or semantic search. Request body (full-text):
Full-text search matches against sessions.searchableText, which contains the session title and all message content. Results are ranked by relevance. Request body (semantic):
Semantic search converts the query to a 1536-dimension embedding using OpenAI’s text-embedding-3-small model and performs a vector similarity search against sessionEmbeddings. Results are ranked by cosine similarity. Response:

Export endpoints

GET /api/export

Export sessions in evaluation framework formats. Query parameters: Response: The response is the exported file content with the appropriate Content-Type header (application/json for DeepEval/OpenAI, text/plain for text format).

Context endpoint

GET /api/context

Retrieve relevant session context for RAG (Retrieval-Augmented Generation) pipelines. Returns the most relevant session snippets for a given query. Query parameters: Response:
Use this endpoint to inject past session knowledge into your AI prompts.

Health endpoint

GET /health

Public endpoint (no auth required). Returns the API status. Response:

Error responses

All endpoints return errors in this format:
Common HTTP status codes:

Rate limits

The API enforces rate limits per API key. Current limits: If you hit a rate limit, the response includes a Retry-After header with the number of seconds to wait.