Add formats to a design
Sample request
curl -X POST "https://api.abyssale.com/designs/$DESIGN_ID/formats" \
-H "x-api-key: $ABYSSALE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"formats": [
{
"width": 1080,
"height": 1920,
"name": "story"
}
],
"source_format": "facebook-post"
}'Example request body
{
"formats": [
{
"width": 1080,
"height": 1920,
"name": "story"
}
],
"source_format": "facebook-post"
}Example 202 response
{
"job_id": "00000000-0000-0000-0000-000000000000",
"design_id": "00000000-0000-0000-0000-000000000000",
"operation": "add_formats",
"status": "PENDING",
"credits": {
"generation_credits": 0,
"ai_credits": 0
},
"created_at_ts": 0,
"started_at_ts": 0,
"finalized_at_ts": 0,
"details": {
"mode": "auto",
"formats": [
{
"name": "string",
"width": 0,
"height": 0,
"unit": "px",
"added": false,
"preview_url": "string"
}
],
"warnings": [
{
"code": "preview_generation_failed",
"message": "string"
}
]
},
"error": {
"code": "layout_refused",
"message": "string"
}
}Example 400 error response
{
"id": "format_unit_mismatch",
"message": "Every format of this design is in px, not mm"
}Lay out new formats of a design from one of its existing formats, as "Add new formats" does in the editor, and save them in the design as a new version. Every existing format is kept unchanged.
Behaviour, limits and caveats
Asynchronous. The request answers 202 with a job; poll it with GET /design-jobs/{jobId} (every 2 to 5 seconds) until status is COMPLETED or FAILED, or pass a callback_url to receive the ADD_FORMATS webhook when the job ends. A job is COMPLETED once the new formats are in the design and their previews are rendered (each added format then has its preview_url): a few seconds more for most designs, up to a few minutes for a print design. Previews that could not be rendered never fail the job: it is COMPLETED with a preview_generation_failed warning.
Two modes:
mode | What lays the formats out | Cost | Usual duration |
|---|---|---|---|
auto (default) | Abyssale's auto format rules | free | a few seconds |
ai | an AI layout of the source format | 10 AI credits per request, whatever the number of formats | up to 3 minutes |
An AI request is refused with 402 insufficient_credits when the workspace does not have the 10 AI credits; auto is always available.
Formats. 1 to 19 per request, and a design holds at most 20 formats: past that, 400 too_many_formats. unit defaults to the design's unit and must be that unit (a design's formats all share one). name defaults to {width}x{height}, the unit appended outside px (210x297mm), a decimal point written - (8-5x11in). A name is lowercase letters, digits, - and _, starting with a letter or digit (default is reserved), as in the editor. Names are compared case-insensitively: they must be unique within the request and not already exist in the design.
Multipage designs are refused (400 invalid_design_type): their formats are pages.
Sizes. The editor's bounds, by type of design: static 10 to 5000 px a side; animated 10 to 1980 px on the long side and 10 to 1200 px on the short one (1920x1080 or 1080x1920); print 5 to 10000 mm or 1 to 394 in a side. Sizes in px and mm are whole numbers, inches take decimals. Otherwise: 400 out_of_range. A new print format takes the first format's bleed, safe zone and DPI, the DPI lowered for a large format to what its area can render at (225 megapixels at most).
One job at a time per design. While a job is PENDING or PROCESSING, another request on the same design answers 409 design_job_in_progress: ask for every format in one request. Jobs on different designs run in parallel.
Path parameters
designId string (uuid) required
Unique identifier (UUID) of the design. A value that is not a UUID does not match the route and answers 404 with id: endpoint_not_found.
Request body
mode string
auto: free, rule-based. ai: an AI layout, 10 AI credits per request. One of "auto", "ai". Defaults to "auto".
formats array of object required
The formats to add. The design's formats plus these are at most 20. 1–19 items.
Show child attributes
width number required
Minimum 1.
height number required
Minimum 1.
unit string
The design's unit when absent; any other unit is refused. One of "px", "mm", "in".
name string
The format's name in the design. Default: {width}x{height}. At most 100 characters. Pattern ^[a-z0-9][a-z0-9_-]*$.
source_format string
Mode ai only: the existing format the AI reworks into the new ones. Default: the existing format closest in aspect ratio to the new ones. Ignored in auto mode, where each new format is derived from its own closest existing format.
callback_url string (uri)
The http(s) URL called once the job ends, completed or failed. Length 5–2048 characters.
More about callback_url
The http(s) URL called once the job ends, completed or failed.
We will do a POST request of the ADD_FORMATS event on this URL with a JSON payload.
Response 202
The job is queued; poll it with GET /design-jobs/{jobId}.
job_id string (uuid) always
Poll it with GET /design-jobs/{jobId}.
design_id string (uuid) always
operation string always
What the job does, named after its call: add_formats (POST /designs/{designId}/formats). Not a closed list.
status string always
One of "PENDING", "PROCESSING", "COMPLETED", "FAILED".
credits object always
What the job spent. A completed ai layout spent 10 AI credits; auto is free.
Show child attributes
generation_credits integer
ai_credits integer
created_at_ts integer always
started_at_ts integer | null always
finalized_at_ts integer | null always
Set once the job is COMPLETED or FAILED.
details AddFormatsDetails always
What is proper to the operation, its shape given by operation.
Show child attributes
AddFormatsDetails
details of an add_formats job.
mode string always
One of "auto", "ai".
formats array of object always
The formats asked for.
Show child attributes
name string
width number
height number
unit string
One of "px", "mm", "in".
added boolean
true once the format is in the design.
preview_url string (uri)
The added format's preview, present once the job is COMPLETED (the job waits for the previews to be rendered). The preview of the design's current version: a later save of the design replaces it.
warnings array of object
Present when the formats were added but some of their previews could not be rendered (preview_generation_failed): their preview_url may answer 403. The formats can be used for generation all the same.
Show child attributes
code string always
One of "preview_generation_failed".
message string always
error object
Present when status is FAILED.
Show child attributes
code string
One of "layout_refused", "not_enough_ai_credits", "design_changed", "design_not_found", "too_many_formats", "job_queue_unavailable", "internal_error".
message string
Errors
Every failure uses the shared error envelope — {id, message, errors?}. Branch on id, never on message. See Errors.
| Status | When |
|---|---|
400 | The body is invalid (invalid_payload, missing_required), two formats of the request have the same name (invalid_payload), a format is not in the design's unit (format_unit_mismatch), outside the size bounds (out_of_range), the design is multipage (invalid_design_type), has no format to start from (design_has_no_formats), or it would hold more than 20 formats, or the request asks for more than 19 (too_many_formats). |
401 | Unauthorized — missing or invalid API key. |
402 | mode: ai and the workspace does not have the 10 AI credits it costs (insufficient_credits). mode: auto is free. |
404 | No design of your workspace has this id (template_not_found), or it has no format named source_format (format_not_found). |
409 | The design already has a format with one of these names (format_already_exists), or formats are already being added to it (design_job_in_progress). |
429 | Too Many Requests. |
500 | Internal Server Error — an unexpected error occurred on our side. |
503 | The AI layout is unavailable for now (ai_service_unavailable; mode: auto still works), or the job could not be queued (job_queue_unavailable): nothing runs and the design stays free, retry later. |
