API reference
Every REST operation with its parameters, body and responses. This page is built from the OpenAPI specification on every docs build.
- Base URL:
https://api.synesta.ai/v1 - Authentication:
Authorization: Bearer <key>header on every request, see Authentication. - Specification: OpenAPI 1.0.0
Error codes and what to do with them · Errors and retries.
Account
Plan, credit balance and limits of the key
GET /account
Responses
| Code | Description | Type |
|---|---|---|
200 | Account of the key owner. | data: Account |
401 | No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate. | ApiError |
403 | The account or the key cannot use the API. Codes: account_blocked, account_pending_deletion, api_access_required, api_not_enabled, rest_not_included, api_key_suspended, team_not_supported, plan_required. | ApiError |
429 | Too many requests, too many running generations or the daily credit limit of the key is reached. Retry after Retry-After seconds. Codes: rate_limit_exceeded, concurrency_limit, daily_limit_exceeded. Headers: Retry-After. | ApiError |
503 | Temporary problem, safe to retry with the same Idempotency-Key. Codes: upload_failed, model_unavailable, model_busy, service_unavailable, webhooks_disabled. A plain 500 internal_error is also possible. Headers: Retry-After. | ApiError |
Models
Models you can use, with their limits
GET /models
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
type | query | GenerationType | Return models of one type only. |
Responses
| Code | Description | Type |
|---|---|---|
200 | List of models. | data: array of Model |
401 | No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate. | ApiError |
403 | The account or the key cannot use the API. Codes: account_blocked, account_pending_deletion, api_access_required, api_not_enabled, rest_not_included, api_key_suspended, team_not_supported, plan_required. | ApiError |
422 | The request is wrong or cannot be priced. error.details.param names the field. Codes: invalid_parameters, unsupported_input, reference_not_allowed, reference_not_analyzed, moderation_blocked, pricing_not_configured, max_credits_exceeded, api_key_limit_reached, reference_fetch_failed, upload_too_large, reference_library_full, invalid_webhook_url, webhook_secret_required. | ApiError |
429 | Too many requests, too many running generations or the daily credit limit of the key is reached. Retry after Retry-After seconds. Codes: rate_limit_exceeded, concurrency_limit, daily_limit_exceeded. Headers: Retry-After. | ApiError |
503 | Temporary problem, safe to retry with the same Idempotency-Key. Codes: upload_failed, model_unavailable, model_busy, service_unavailable, webhooks_disabled. A plain 500 internal_error is also possible. Headers: Retry-After. | ApiError |
One model with its capabilities
GET /models/{id}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | Model id from GET /models. |
Responses
| Code | Description | Type |
|---|---|---|
200 | The model. | data: Model |
401 | No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate. | ApiError |
403 | The account or the key cannot use the API. Codes: account_blocked, account_pending_deletion, api_access_required, api_not_enabled, rest_not_included, api_key_suspended, team_not_supported, plan_required. | ApiError |
404 | Unknown model or an object that is not yours. Codes: unknown_model, not_found. | ApiError |
429 | Too many requests, too many running generations or the daily credit limit of the key is reached. Retry after Retry-After seconds. Codes: rate_limit_exceeded, concurrency_limit, daily_limit_exceeded. Headers: Retry-After. | ApiError |
503 | Temporary problem, safe to retry with the same Idempotency-Key. Codes: upload_failed, model_unavailable, model_busy, service_unavailable, webhooks_disabled. A plain 500 internal_error is also possible. Headers: Retry-After. | ApiError |
Generations
Price of a generation without starting it
POST /estimate
Takes the same body as POST /generations. Nothing is charged and no Idempotency-Key is needed.
Request body · application/json
Type: GenerationInput
Responses
| Code | Description | Type |
|---|---|---|
200 | Price in credits. | data: Estimate |
401 | No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate. | ApiError |
403 | The account or the key cannot use the API. Codes: account_blocked, account_pending_deletion, api_access_required, api_not_enabled, rest_not_included, api_key_suspended, team_not_supported, plan_required. | ApiError |
404 | Unknown model or an object that is not yours. Codes: unknown_model, not_found. | ApiError |
422 | The request is wrong or cannot be priced. error.details.param names the field. Codes: invalid_parameters, unsupported_input, reference_not_allowed, reference_not_analyzed, moderation_blocked, pricing_not_configured, max_credits_exceeded, api_key_limit_reached, reference_fetch_failed, upload_too_large, reference_library_full, invalid_webhook_url, webhook_secret_required. | ApiError |
429 | Too many requests, too many running generations or the daily credit limit of the key is reached. Retry after Retry-After seconds. Codes: rate_limit_exceeded, concurrency_limit, daily_limit_exceeded. Headers: Retry-After. | ApiError |
503 | Temporary problem, safe to retry with the same Idempotency-Key. Codes: upload_failed, model_unavailable, model_busy, service_unavailable, webhooks_disabled. A plain 500 internal_error is also possible. Headers: Retry-After. | ApiError |
Generations made with API keys, newest first
GET /generations
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
type | query | GenerationType | ||
limit | query | integer | Page size. The default is 20, the maximum is set by the service. min 1 | |
before | query | integer | Return generations with an id below this one. Use meta.next_before of the previous page. min 1 |
Responses
| Code | Description | Type |
|---|---|---|
200 | A page of generations. | data: array of Generation |
401 | No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate. | ApiError |
403 | The account or the key cannot use the API. Codes: account_blocked, account_pending_deletion, api_access_required, api_not_enabled, rest_not_included, api_key_suspended, team_not_supported, plan_required. | ApiError |
422 | The request is wrong or cannot be priced. error.details.param names the field. Codes: invalid_parameters, unsupported_input, reference_not_allowed, reference_not_analyzed, moderation_blocked, pricing_not_configured, max_credits_exceeded, api_key_limit_reached, reference_fetch_failed, upload_too_large, reference_library_full, invalid_webhook_url, webhook_secret_required. | ApiError |
429 | Too many requests, too many running generations or the daily credit limit of the key is reached. Retry after Retry-After seconds. Codes: rate_limit_exceeded, concurrency_limit, daily_limit_exceeded. Headers: Retry-After. | ApiError |
503 | Temporary problem, safe to retry with the same Idempotency-Key. Codes: upload_failed, model_unavailable, model_busy, service_unavailable, webhooks_disabled. A plain 500 internal_error is also possible. Headers: Retry-After. | ApiError |
Start a generation
POST /generations
Charges credits when accepted and answers 202 with the generation in its initial status. Poll GET /generations/{id} for the result. A repeat with the same Idempotency-Key and the same body returns the same generation with HTTP 200 and meta.replayed: true, without a second charge. The same key with a different body gives 409 idempotency_conflict. Optional webhook_url makes the service call you when the generation is finished (see the generation_finished webhook); it needs a signing secret created in your profile (API section), otherwise 422 webhook_secret_required. webhook_url is not part of the idempotency check: a replay keeps the address of the first request.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | yes | Unique string for one logical request (for example a UUID). Without it the request is rejected with 422 invalid_parameters before any charge. The key is remembered for 24 hours. min length 1, max length 255 |
Request body · application/json
Type: GenerationInput
Responses
| Code | Description | Type |
|---|---|---|
200 | Replay of an earlier request with the same Idempotency-Key. | GenerationStarted |
202 | Accepted. | GenerationStarted |
401 | No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate. | ApiError |
402 | Not enough credits (insufficient_credits) or, for REST, not enough API balance (insufficient_api_balance). | ApiError |
403 | The account or the key cannot use the API. Codes: account_blocked, account_pending_deletion, api_access_required, api_not_enabled, rest_not_included, api_key_suspended, team_not_supported, plan_required. | ApiError |
404 | Unknown model or an object that is not yours. Codes: unknown_model, not_found. | ApiError |
409 | Codes: idempotency_conflict (same key, different body), idempotency_in_progress (the first request is still running, retry). | ApiError |
422 | The request is wrong or cannot be priced. error.details.param names the field. Codes: invalid_parameters, unsupported_input, reference_not_allowed, reference_not_analyzed, moderation_blocked, pricing_not_configured, max_credits_exceeded, api_key_limit_reached, reference_fetch_failed, upload_too_large, reference_library_full, invalid_webhook_url, webhook_secret_required. | ApiError |
429 | Too many requests, too many running generations or the daily credit limit of the key is reached. Retry after Retry-After seconds. Codes: rate_limit_exceeded, concurrency_limit, daily_limit_exceeded. Headers: Retry-After. | ApiError |
503 | Temporary problem, safe to retry with the same Idempotency-Key. Codes: upload_failed, model_unavailable, model_busy, service_unavailable, webhooks_disabled. A plain 500 internal_error is also possible. Headers: Retry-After. | ApiError |
Status and result of one generation
GET /generations/{id}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | integer | yes | min 1 |
Responses
| Code | Description | Type |
|---|---|---|
200 | The generation. outputs is filled when status is done. | data: Generation |
401 | No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate. | ApiError |
403 | The account or the key cannot use the API. Codes: account_blocked, account_pending_deletion, api_access_required, api_not_enabled, rest_not_included, api_key_suspended, team_not_supported, plan_required. | ApiError |
404 | Unknown model or an object that is not yours. Codes: unknown_model, not_found. | ApiError |
429 | Too many requests, too many running generations or the daily credit limit of the key is reached. Retry after Retry-After seconds. Codes: rate_limit_exceeded, concurrency_limit, daily_limit_exceeded. Headers: Retry-After. | ApiError |
503 | Temporary problem, safe to retry with the same Idempotency-Key. Codes: upload_failed, model_unavailable, model_busy, service_unavailable, webhooks_disabled. A plain 500 internal_error is also possible. Headers: Retry-After. | ApiError |
References
Upload a reference file for later generations
POST /references
Send one of: multipart field file; JSON url (public https link); JSON file_base64 with mime. The returned id goes into reference_ids of a generation. Video and audio references are accepted through multipart only.
Request body · multipart/form-data
| Field | Type | Required | Description |
|---|---|---|---|
file | string (binary) | yes |
Request body · application/json
Variant 1
| Field | Type | Required | Description |
|---|---|---|---|
url | string (uri) | yes | max length 2048 |
Variant 2
| Field | Type | Required | Description |
|---|---|---|---|
file_base64 | string | yes | |
mime | string | yes | one of: image/jpeg, image/png, image/webp, image/gif |
name | string | max length 255 |
Responses
| Code | Description | Type |
|---|---|---|
201 | Reference stored. | data: Reference |
401 | No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate. | ApiError |
403 | The account or the key cannot use the API. Codes: account_blocked, account_pending_deletion, api_access_required, api_not_enabled, rest_not_included, api_key_suspended, team_not_supported, plan_required. | ApiError |
422 | The request is wrong or cannot be priced. error.details.param names the field. Codes: invalid_parameters, unsupported_input, reference_not_allowed, reference_not_analyzed, moderation_blocked, pricing_not_configured, max_credits_exceeded, api_key_limit_reached, reference_fetch_failed, upload_too_large, reference_library_full, invalid_webhook_url, webhook_secret_required. | ApiError |
429 | Too many requests, too many running generations or the daily credit limit of the key is reached. Retry after Retry-After seconds. Codes: rate_limit_exceeded, concurrency_limit, daily_limit_exceeded. Headers: Retry-After. | ApiError |
503 | Temporary problem, safe to retry with the same Idempotency-Key. Codes: upload_failed, model_unavailable, model_busy, service_unavailable, webhooks_disabled. A plain 500 internal_error is also possible. Headers: Retry-After. | ApiError |
Schemas
Objects the operations refer to.
GenerationType
image · video · music · voice · 3d
ErrorCode
Public error code. retryable in the error tells if a repeat can help.
unauthenticated · account_blocked · account_pending_deletion · api_access_required · api_not_enabled · rest_not_included · api_key_suspended · team_not_supported · plan_required · invalid_parameters · unsupported_input · invalid_webhook_url · webhook_secret_required · webhooks_disabled · unknown_model · not_found · reference_not_allowed · reference_not_analyzed · moderation_blocked · pricing_not_configured · max_credits_exceeded · api_key_limit_reached · reference_fetch_failed · upload_too_large · reference_library_full · upload_failed · method_not_allowed · insufficient_credits · insufficient_api_balance · idempotency_conflict · idempotency_in_progress · rate_limit_exceeded · concurrency_limit · daily_limit_exceeded · model_unavailable · model_busy · service_unavailable · internal_error
GenerationErrorCode
Why a started generation failed (Generation.error.code).
content_rejected · reference_rejected · invalid_input · no_result · result_unavailable · temporary_error · timeout · model_busy · service_unavailable
ApiError
| Field | Type | Required | Description |
|---|---|---|---|
error | object | yes |
Account
| Field | Type | Required | Description |
|---|---|---|---|
plan | string | yes | Plan slug of the account. |
credits | number | yes | Credit balance. |
api_balance_usd | number | REST only: API balance in US dollars. REST is paid from it, not from plan credits. | |
usd_per_credit | number | REST only: price of one credit charged from the API balance, in US dollars. | |
key | object | yes |
Model
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | Value for model in requests. |
type | GenerationType | yes | |
name | string | yes | |
brand | string | null | yes | |
credits_from | number | null | yes | Lowest price in credits. |
available | boolean | yes | |
reason | string | null | yes | Why the model is not available now. |
alternatives | array of string | yes | Ids of models to use instead. |
capabilities | Capabilities | yes | What the model accepts. A key is absent when it does not apply to the model. |
Capabilities
What the model accepts. A key is absent when it does not apply to the model.
| Field | Type | Required | Description |
|---|---|---|---|
aspects | array of string | ||
default_aspect | string | null | ||
resolutions | array of string | ||
image_resolutions | array of string | ||
default_resolution | string | null | ||
duration_options | array of number | ||
duration_min | number | null | ||
duration_max | number | null | ||
fixed_duration | number | null | ||
default_duration | number | null | ||
has_sound | boolean | ||
max_prompt_length | integer | null | ||
text_optional | boolean | ||
allow_reference_images | boolean | ||
requires_reference_image | boolean | ||
max_reference_images | integer | null | ||
supports_seed | boolean | ||
supports_negative_prompt | boolean | ||
max_negative_prompt_length | integer | null | ||
upscale_factors | array of string | ||
requires_mask | boolean | ||
voices | array of object | Voice models: voices to pass as voice_id. | |
default_voice | string | null | Voice used when voice_id is omitted. | |
speed_min | number | ||
speed_max | number |
GenerationInput
Strict body: an unknown field or a wrong type is rejected with 422 invalid_parameters, nothing is silently adjusted. Each type takes only its own fields (image: aspect, resolution, upscale_factor, reference_ids, mask_target, negative, seed; video: aspect, resolution, duration, sound, upscale_factor, video_mode, reference_ids, negative, seed; music: mode, instrumental, style, title, vocal_gender; voice: voice_id, speed). A known field that does not apply to the type or model (for example duration for music, or upscale_factor on a model without upscaling) is rejected with 422 unsupported_input, error.details.param names it. Which fields a model takes is in capabilities of GET /models/{id}.
| Field | Type | Required | Description |
|---|---|---|---|
type | GenerationType | yes | |
model | string | yes | max length 120 |
prompt | string | Maximum length is in capabilities.max_prompt_length. | |
negative | string | ||
aspect | string | max length 16 | |
aspect_ratio | string | max length 16 | |
resolution | string | max length 16 | |
duration | integer | Seconds. | |
sound | boolean | ||
upscale_factor | integer | ||
video_mode | string | max length 32 | |
reference_ids | array of integer | Ids from POST /references. max items 50 | |
mask_target | string | max length 80 | |
seed | integer | ||
mode | string | max length 32 | |
instrumental | boolean | ||
style | string | max length 1000 | |
title | string | max length 200 | |
vocal_gender | string | max length 16 | |
voice_id | string | An id from capabilities.voices of the model. Omitted: capabilities.default_voice. max length 120 | |
speed | number | ||
max_credits | number | Refuse the request if it costs more than this many credits (422 max_credits_exceeded). min 0 | |
webhook_url | string (uri) | Only for POST /generations. An https link on port 443 that is reachable from the internet (no credentials, no redirects followed). Called once when the generation becomes done or failed. Other addresses give 422 invalid_webhook_url. max length 2048 |
Applied
Parameters the service actually used.
| Field | Type | Required | Description |
|---|---|---|---|
model | string | yes | |
aspect | string | ||
resolution | string | ||
image_quality | string | ||
duration | number | ||
sound | boolean | ||
upscale_factor | integer | ||
video_mode | string | ||
negative | string | ||
seed | integer | ||
style | string | ||
title | string | ||
vocal_gender | string | ||
instrumental | boolean | ||
voice_id | string | ||
speed | number | ||
reference_count | integer |
Estimate
| Field | Type | Required | Description |
|---|---|---|---|
model | string | yes | |
credits | number | yes | Price of the generation in credits. |
cost_usd | number | REST only: what the launch will charge from the API balance, in US dollars. | |
base_credits | number | yes | |
exceeds_daily_limit | boolean | yes | True when this price does not fit into what is left of the daily limit of the key. |
applied | Applied | yes | Parameters the service actually used. |
Output
| Field | Type | Required | Description |
|---|---|---|---|
url | string (uri) | yes | Link to the result file. |
kind | string | yes | one of: image, video, audio, model, file |
mime | string | null | yes | |
preview_url | string | null (uri) | yes | |
thumb_url | string | null (uri) | yes |
GenerationError
| Field | Type | Required | Description |
|---|---|---|---|
code | GenerationErrorCode | yes | Why a started generation failed (Generation.error.code). |
message | string | yes | |
retryable | boolean | yes | |
retry_after_seconds | integer |
Generation
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | yes | |
type | GenerationType | yes | |
model | string | null | yes | |
status | string | yes | Waiting and running statuses end in done or failed. Poll until one of those two. |
prompt | string | null | yes | |
cost_credits | number | yes | |
cost_usd | number | Present when the generation was paid from the API balance (REST). Net amount in US dollars: charged minus refunded, so it matches cost_credits after a partial delivery or a full refund. | |
refunded | boolean | yes | True when the whole price was returned. |
credits_refunded | number | yes | |
created_at | string | null (date-time) | yes | |
finished_at | string | null (date-time) | yes | |
outputs | array of Output | yes | Empty until status is done. |
error | GenerationError | null | yes | Set when status is failed. Failed generations are refunded. |
queue | object | yes | |
partial_refund | object | null | yes | Set when fewer results than ordered were delivered and the difference was returned. |
applied | Applied | yes | Parameters the service actually used. |
GenerationStarted
| Field | Type | Required | Description |
|---|---|---|---|
data | Generation | yes | |
meta | object | yes |
Reference
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | yes | |
type | string | yes | one of: image, video, audio |
width | integer | null | yes | |
height | integer | null | yes | |
duration_seconds | number | null | yes | |
url | string | null (uri) | yes | |
face_status | string | yes | Some models do not take references with a recognisable face; pending means the check is still running. one of: not_applicable, pending, clear, face_detected |