REST API
The web edition of Charon exposes a REST API at https://charon.live/api/v1.
It covers the full feature set of the application — data CRUD, import/export,
branch management, code generation, validation, and more.
An interactive API explorer (Swagger UI) is available at https://charon.live/api/index.html.
Authentication
All endpoints require a bearer token in the Authorization header.
Two credential types are accepted:
- API Key (recommended for CI/CD and scripts)
Obtain an API key from User Profile → API Keys → Generate API Key. Use it directly as the bearer value:
Authorization: Bearer <api-key>
See CLI Access to charon.live for step-by-step instructions on generating one.
Request and Response Formats
All endpoints default to application/json. Use the Accept and
Content-Type headers to switch between supported formats.
Most data endpoints also support these formats for both request bodies and responses. Prefer MessagePack for large payloads in performance-sensitive pipelines.
Finding Your IDs
Most data endpoints require projectId and/or dataSourceId.
projectIdVisible in the browser URL when you open a project:
https://charon.live/view/project/<projectId>/.dataSourceIdEach branch has its own data source ID. Retrieve it via
GET /project/{projectId}/:curl -s "https://charon.live/api/v1/project/{projectId}/" \ -H "Authorization: Bearer $CHARON_API_KEY" | jq '.result.branches[]'
The response includes each branch name and its
id, which is thedataSourceIdused in all/datasource/endpoints.
Response Envelope
Every response — success or failure — shares the same top-level JSON structure:
{
"result": { ... },
"errors": []
}
One of fields are always present in the response body:
result— contains the operation’s output on success. The shape varies by endpoint (a single document, a list, a backup payload, etc.). On failure the field is absent.errors— an array of error objects. Absent on success; contains one or more entries on failure.
The intended semantics are a discriminated union — either result carries
meaningful data or errors is non-empty.
Success example — GET /datasource/{id}/collection/Item/
{
"result": {
"document": { "Id": "Sword", "Name": "Iron Sword", "Damage": 20 },
"meta": { "schemaId": "592fc86c983a36266c0912a0", "path": "/Item/Sword" }
}
}
No-content success — some write operations (create branch, commit
transaction, etc.) return HTTP 204 with no body.
The simplest way to detect success in code is to check the HTTP status code
first. A 2xx status means the operation succeeded; anything else means at
least one entry will be present in errors.
Error Responses
Every failed response uses the same JSON envelope regardless of the HTTP status code:
{
"errors": [
{
"code": "resourceNotFound",
"message": "Document with id 'Sword' not found in collection 'Item'."
}
]
}
Fields:
result— is absent on error.errors— array of one or more error objects. Each object has:code(string) — machine-readable error code from theErrorCodeenum (see below).message(string) — human-readable description of the problem.Additional fields may be present for specific error types (e.g.
parameterName,path).
HTTP status codes and their typical error codes:
HTTP |
Typical |
When it occurs |
|---|---|---|
400 |
|
Malformed JSON body |
|
Query/route parameter has wrong type or value |
|
|
Required parameter absent |
|
|
Imported document fails schema validation |
|
401 |
|
Missing or invalid |
403 |
|
Authenticated but lacks required permission |
|
Target resource is read-only |
|
404 |
|
Project, branch, or document does not exist |
409 |
|
Transaction ID already in use |
|
Transaction was rolled back by the server |
|
|
Transaction already committed or rolled back |
|
|
Document violates a unique-value constraint |
|
429 |
|
Rate limit exceeded |
503 |
|
Server temporarily unavailable |
5xx |
|
Unexpected server-side error |
Error code reference
The full set of code values, grouped by category:
General
Code |
Meaning |
|---|---|
|
Unexpected server error. |
|
Requested resource does not exist. |
|
Server is temporarily unavailable. |
|
Too many concurrent requests from this client. |
|
Operation is not supported by this resource. |
|
Credentials are missing or invalid. |
|
Permission denied for this operation. |
|
Target resource is read-only. |
Request validation
Code |
Meaning |
|---|---|
|
Request body could not be parsed. |
|
Parameter has an unacceptable value. |
|
Required parameter is absent. |
|
String parameter does not match the required pattern. |
|
Numeric parameter is below the minimum (exclusive / inclusive). |
|
Numeric parameter exceeds the maximum (exclusive / inclusive). |
|
String parameter is shorter than minimum length. |
|
String parameter exceeds maximum length. |
|
Collection parameter has fewer items than the minimum. |
|
Collection parameter exceeds maximum item count. |
|
Collection parameter contains duplicate values. |
|
Import payload does not match the expected schema. |
JSON Patch
Code |
Meaning |
|---|---|
|
Patch document is malformed. |
|
A |
``forbiddenJsonPatchOperation``| Patch attempts a prohibited operation. |
|
Data source / transaction
Code |
Meaning |
|---|---|
|
Operation references a schema that has been deleted. |
|
Document is protected and cannot be modified or deleted. |
|
Operation requires a root document but an embedded document was supplied. |
|
Transaction was aborted by the server (e.g. timeout or conflict). |
|
Transaction has already been committed or rolled back. |
|
A transaction with this ID already exists. |
|
The referenced transaction ID does not exist. |
|
Schema/metadata could not be loaded. |
Document value validation
These codes appear inside import or create/update responses when individual
field values fail validation. They are also returned by the POST /validity/
endpoint.
Code |
Meaning |
|---|---|
|
Value does not match the time format. |
|
Value does not match the date format. |
|
Localized text value is malformed. |
|
Text value is malformed. |
|
Boolean value is malformed. |
|
Decimal number value is malformed. |
|
Integer value is malformed. |
|
Pick list value does not match any defined option. |
|
Multi-pick list value is malformed. |
|
Embedded document value is malformed. |
|
Embedded document collection is malformed. |
|
Reference value is malformed. |
|
Reference collection is malformed. |
|
Formula expression is malformed. |
|
Required field is null. |
|
Required field is empty. |
|
Numeric value exceeds the type’s range. |
|
String value exceeds maximum length. |
|
Collection exceeds maximum item count. |
|
Reference points to a non-existent document. |
|
Localized text is missing a required translation. |
|
Value violates a unique constraint. |
|
Document |
|
Auto-generated ID does not match the schema’s ID generator format. |
|
Embedded documents were supplied as root documents. |
|
A required settings document is absent. |
|
More than one settings document exists. |
|
Tagged union has no selected option. |
|
Tagged union has more than one selected option. |
Schema / metadata validation
These codes appear when a schema definition itself is invalid (e.g. during schema create or update operations).
Code |
Meaning |
|---|---|
|
Schema or property name is not a valid C identifier. |
|
Name conflicts with a reserved keyword. |
|
Size value is out of the allowed range. |
|
Language code is not a valid BCP-47 tag. |
|
Schema has a circular reference that is not allowed. |
|
The |
|
Changing a property’s data type in a way that would corrupt existing data. |
|
Changing the ID generator in an incompatible way. |
|
Requirement level is incompatible with the property’s data type. |
|
A tagged-union property must be optional. |
Schema specification validation
Code |
Meaning |
|---|---|
|
Icon specification is malformed. |
|
Display text template expression is invalid. |
|
Pick list option name is invalid. |
|
Pick list has duplicate option names. |
|
Pick list option value is invalid. |
|
Formula parameter name is invalid. |
|
Formula has duplicate parameter names. |
|
Type name in specification is invalid. |
|
Type reference cannot be resolved. |
|
Decimal precision value is out of range. |
|
Row count specification is out of range. |