Skip to content

Methods

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

CodeDescriptionType
200Account of the key owner.data: Account
401No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate.ApiError
403The 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
429Too 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
503Temporary 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

NameInTypeRequiredDescription
typequeryGenerationTypeReturn models of one type only.

Responses

CodeDescriptionType
200List of models.data: array of Model
401No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate.ApiError
403The 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
422The 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
429Too 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
503Temporary 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

NameInTypeRequiredDescription
idpathstringyesModel id from GET /models.

Responses

CodeDescriptionType
200The model.data: Model
401No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate.ApiError
403The 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
404Unknown model or an object that is not yours. Codes: unknown_model, not_found.ApiError
429Too 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
503Temporary 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

CodeDescriptionType
200Price in credits.data: Estimate
401No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate.ApiError
403The 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
404Unknown model or an object that is not yours. Codes: unknown_model, not_found.ApiError
422The 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
429Too 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
503Temporary 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

NameInTypeRequiredDescription
typequeryGenerationType
limitqueryintegerPage size. The default is 20, the maximum is set by the service. min 1
beforequeryintegerReturn generations with an id below this one. Use meta.next_before of the previous page. min 1

Responses

CodeDescriptionType
200A page of generations.data: array of Generation
401No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate.ApiError
403The 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
422The 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
429Too 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
503Temporary 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

NameInTypeRequiredDescription
Idempotency-KeyheaderstringyesUnique 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

CodeDescriptionType
200Replay of an earlier request with the same Idempotency-Key.GenerationStarted
202Accepted.GenerationStarted
401No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate.ApiError
402Not enough credits (insufficient_credits) or, for REST, not enough API balance (insufficient_api_balance).ApiError
403The 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
404Unknown model or an object that is not yours. Codes: unknown_model, not_found.ApiError
409Codes: idempotency_conflict (same key, different body), idempotency_in_progress (the first request is still running, retry).ApiError
422The 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
429Too 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
503Temporary 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

NameInTypeRequiredDescription
idpathintegeryesmin 1

Responses

CodeDescriptionType
200The generation. outputs is filled when status is done.data: Generation
401No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate.ApiError
403The 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
404Unknown model or an object that is not yours. Codes: unknown_model, not_found.ApiError
429Too 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
503Temporary 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

FieldTypeRequiredDescription
filestring (binary)yes

Request body · application/json

Variant 1

FieldTypeRequiredDescription
urlstring (uri)yesmax length 2048

Variant 2

FieldTypeRequiredDescription
file_base64stringyes
mimestringyesone of: image/jpeg, image/png, image/webp, image/gif
namestringmax length 255

Responses

CodeDescriptionType
201Reference stored.data: Reference
401No key, a wrong key, a revoked or expired key. Code unauthenticated. Headers: WWW-Authenticate.ApiError
403The 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
422The 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
429Too 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
503Temporary 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 ​

FieldTypeRequiredDescription
errorobjectyes

Account ​

FieldTypeRequiredDescription
planstringyesPlan slug of the account.
creditsnumberyesCredit balance.
api_balance_usdnumberREST only: API balance in US dollars. REST is paid from it, not from plan credits.
usd_per_creditnumberREST only: price of one credit charged from the API balance, in US dollars.
keyobjectyes

Model ​

FieldTypeRequiredDescription
idstringyesValue for model in requests.
typeGenerationTypeyes
namestringyes
brandstring | nullyes
credits_fromnumber | nullyesLowest price in credits.
availablebooleanyes
reasonstring | nullyesWhy the model is not available now.
alternativesarray of stringyesIds of models to use instead.
capabilitiesCapabilitiesyesWhat 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.

FieldTypeRequiredDescription
aspectsarray of string
default_aspectstring | null
resolutionsarray of string
image_resolutionsarray of string
default_resolutionstring | null
duration_optionsarray of number
duration_minnumber | null
duration_maxnumber | null
fixed_durationnumber | null
default_durationnumber | null
has_soundboolean
max_prompt_lengthinteger | null
text_optionalboolean
allow_reference_imagesboolean
requires_reference_imageboolean
max_reference_imagesinteger | null
supports_seedboolean
supports_negative_promptboolean
max_negative_prompt_lengthinteger | null
upscale_factorsarray of string
requires_maskboolean
voicesarray of objectVoice models: voices to pass as voice_id.
default_voicestring | nullVoice used when voice_id is omitted.
speed_minnumber
speed_maxnumber

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}.

FieldTypeRequiredDescription
typeGenerationTypeyes
modelstringyesmax length 120
promptstringMaximum length is in capabilities.max_prompt_length.
negativestring
aspectstringmax length 16
aspect_ratiostringmax length 16
resolutionstringmax length 16
durationintegerSeconds.
soundboolean
upscale_factorinteger
video_modestringmax length 32
reference_idsarray of integerIds from POST /references. max items 50
mask_targetstringmax length 80
seedinteger
modestringmax length 32
instrumentalboolean
stylestringmax length 1000
titlestringmax length 200
vocal_genderstringmax length 16
voice_idstringAn id from capabilities.voices of the model. Omitted: capabilities.default_voice. max length 120
speednumber
max_creditsnumberRefuse the request if it costs more than this many credits (422 max_credits_exceeded). min 0
webhook_urlstring (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.

FieldTypeRequiredDescription
modelstringyes
aspectstring
resolutionstring
image_qualitystring
durationnumber
soundboolean
upscale_factorinteger
video_modestring
negativestring
seedinteger
stylestring
titlestring
vocal_genderstring
instrumentalboolean
voice_idstring
speednumber
reference_countinteger

Estimate ​

FieldTypeRequiredDescription
modelstringyes
creditsnumberyesPrice of the generation in credits.
cost_usdnumberREST only: what the launch will charge from the API balance, in US dollars.
base_creditsnumberyes
exceeds_daily_limitbooleanyesTrue when this price does not fit into what is left of the daily limit of the key.
appliedAppliedyesParameters the service actually used.

Output ​

FieldTypeRequiredDescription
urlstring (uri)yesLink to the result file.
kindstringyesone of: image, video, audio, model, file
mimestring | nullyes
preview_urlstring | null (uri)yes
thumb_urlstring | null (uri)yes

GenerationError ​

FieldTypeRequiredDescription
codeGenerationErrorCodeyesWhy a started generation failed (Generation.error.code).
messagestringyes
retryablebooleanyes
retry_after_secondsinteger

Generation ​

FieldTypeRequiredDescription
idintegeryes
typeGenerationTypeyes
modelstring | nullyes
statusstringyesWaiting and running statuses end in done or failed. Poll until one of those two.
promptstring | nullyes
cost_creditsnumberyes
cost_usdnumberPresent 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.
refundedbooleanyesTrue when the whole price was returned.
credits_refundednumberyes
created_atstring | null (date-time)yes
finished_atstring | null (date-time)yes
outputsarray of OutputyesEmpty until status is done.
errorGenerationError | nullyesSet when status is failed. Failed generations are refunded.
queueobjectyes
partial_refundobject | nullyesSet when fewer results than ordered were delivered and the difference was returned.
appliedAppliedyesParameters the service actually used.

GenerationStarted ​

FieldTypeRequiredDescription
dataGenerationyes
metaobjectyes

Reference ​

FieldTypeRequiredDescription
idintegeryes
typestringyesone of: image, video, audio
widthinteger | nullyes
heightinteger | nullyes
duration_secondsnumber | nullyes
urlstring | null (uri)yes
face_statusstringyesSome models do not take references with a recognisable face; pending means the check is still running. one of: not_applicable, pending, clear, face_detected