Add Formats to a Design
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. Every existing format is kept unchanged. The call answers 202 with a job_id at once; the formats arrive by polling or by webhook.
How it works
- Start the job — one POST with every format you want. It answers
202with ajob_idbefore anything is laid out. - Follow it — poll
GET /design-jobs/{jobId}untilstatusisCOMPLETEDorFAILED, or pass acallback_urland receive theADD_FORMATSwebhook when the job ends. - Use the formats — once
COMPLETED, each format markedaddedcan be generated under itsnameright away. Its preview follows within minutes.
Sample request
curl -X POST \
-H "x-api-key: {YOUR-API-KEY}" \
-H "Content-Type: application/json" \
-d '{
"formats": [
{ "width": 1080, "height": 1920, "name": "story" },
{ "width": 728, "height": 90, "name": "leaderboard" },
{ "width": 300, "height": 250 }
]
}' \
https://api.abyssale.com/designs/64238d01-d402-474b-8c2d-fbc957e9d290/formats// No SDK method yet — plain fetch (Node 18+). Set ABYSSALE_API_KEY before running.
const response = await fetch(`https://api.abyssale.com/designs/${designId}/formats`, {
method: 'POST',
headers: { 'x-api-key': process.env.ABYSSALE_API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
formats: [
{ width: 1080, height: 1920, name: 'story' },
{ width: 728, height: 90, name: 'leaderboard' },
{ width: 300, height: 250 },
],
}),
});
const job = await response.json();
console.log(job.job_id, job.status);# No SDK method yet — plain requests. Set ABYSSALE_API_KEY before running.
import os
import requests
response = requests.post(
f"https://api.abyssale.com/designs/{design_id}/formats",
headers={"x-api-key": os.environ["ABYSSALE_API_KEY"]},
json={
"formats": [
{"width": 1080, "height": 1920, "name": "story"},
{"width": 728, "height": 90, "name": "leaderboard"},
{"width": 300, "height": 250},
]
},
timeout=30,
)
job = response.json()
print(job["job_id"], job["status"])Request body
| Field | Type | Required | Description |
|---|---|---|---|
formats | array | Yes | The formats to add, 1 to 19: a design holds at most 20 formats, its own included. See Formats. |
mode | string | No | auto (default) or ai — see Modes. |
source_format | string | No | Mode ai only: the existing format the AI reworks. Default: the existing format closest in aspect ratio to the new ones. Ignored in auto, where each new format starts from its own closest format. |
callback_url | string (uri) | No | http(s) URL that receives ADD_FORMATS once the job ends. 5 to 2048 characters. |
Modes
mode | What lays the formats out | AI credits | Usual duration |
|---|---|---|---|
auto | Abyssale's auto format, as in the editor | Free | A few seconds |
ai | An AI layout of the source format | 10 per request, whatever the number of formats | Up to 3 minutes |
An ai request checks the workspace's AI balance before anything is queued — see Credits. auto is always available.
Formats
Each entry of formats:
| Field | Type | Required | Description |
|---|---|---|---|
width | number | Yes | Width in the design's unit, within the size bounds. |
height | number | Yes | Height in the design's unit, within the size bounds. |
unit | string | No | px, mm or in. Default: the design's unit — any other is refused. |
name | string | No | The format's name in the design. Default: {width}x{height}. |
A design's formats all share one unit: px for static and animated designs, mm or in for print. Sending another answers 400 format_unit_mismatch.
name
Lowercase letters, digits, - and _, starting with a letter or digit, at most 100 characters — the editor's rule. default is reserved.
Without a name, the format is called {width}x{height}, the unit appended outside px, a decimal point written -:
| Format | Default name |
|---|---|
| 300 × 250 px | 300x250 |
| 210 × 297 mm | 210x297mm |
| 8.5 × 11 in | 8-5x11in |
Names are compared case-insensitively. Two formats of one request sharing a name answer 400 invalid_payload; a name the design already has answers 409 format_already_exists.
Size bounds
The editor's bounds, by type of design:
| Design type | Width | Height |
|---|---|---|
static | 10–5000 px | 10–5000 px |
animated | 10–1980 px on the long side | 10–1200 px on the short side (landscape or portrait) |
printer | 5–10000 mm, or 1–394 in | 5–10000 mm, or 1–394 in |
Sizes in px and mm are whole numbers; inches take decimals (8.5).
Outside them: 400 out_of_range. A new print format takes the first format's bleed, safe zone and DPI; for a large format the DPI is lowered to what its area can render (225 megapixels at most).
Multi-page print designs are refused (400 invalid_design_type): their formats are pages.
Response
202, before anything is laid out: the job as GET /design-jobs/{jobId} returns it, PENDING, every format added: false.
{
"job_id": "9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d",
"design_id": "64238d01-d402-474b-8c2d-fbc957e9d290",
"operation": "add_formats",
"status": "PENDING",
"credits": { "generation_credits": 0, "ai_credits": 0 },
"created_at_ts": 1762354800,
"started_at_ts": null,
"finalized_at_ts": null,
"details": {
"mode": "auto",
"formats": [
{ "name": "story", "width": 1080, "height": 1920, "unit": "px", "added": false },
{ "name": "leaderboard", "width": 728, "height": 90, "unit": "px", "added": false },
{ "name": "300x250", "width": 300, "height": 250, "unit": "px", "added": false }
]
}
}Poll the job
Always 200 while the job is kept — branch on status, not on the HTTP status. A failed job is still a 200, with error saying why. Poll every 2 to 5 seconds.
status | Meaning | Final |
|---|---|---|
PENDING | Queued. | No |
PROCESSING | Laying out the formats. | No |
COMPLETED | The formats marked added are in the design. | Yes |
FAILED | Ended without changing the design: error says why. | Yes |
curl -H "x-api-key: {YOUR-API-KEY}" https://api.abyssale.com/design-jobs/{jobId}// No SDK method yet — plain fetch (Node 18+). Set ABYSSALE_API_KEY before running.
const headers = { 'x-api-key': process.env.ABYSSALE_API_KEY };
let job;
do {
await new Promise((resolve) => setTimeout(resolve, 3000));
job = await (await fetch(`https://api.abyssale.com/design-jobs/${jobId}`, { headers })).json();
} while (job.status === 'PENDING' || job.status === 'PROCESSING');
if (job.status === 'COMPLETED') console.log(job.details.formats.filter((f) => f.added).map((f) => f.name));
else console.error(job.error.code, job.error.message);# No SDK method yet — plain requests. Set ABYSSALE_API_KEY before running.
import os
import time
import requests
headers = {"x-api-key": os.environ["ABYSSALE_API_KEY"]}
while True:
time.sleep(3)
job = requests.get(f"https://api.abyssale.com/design-jobs/{job_id}", headers=headers, timeout=30).json()
if job["status"] in ("COMPLETED", "FAILED"):
break
if job["status"] == "COMPLETED":
print([f["name"] for f in job["details"]["formats"] if f["added"]])
else:
print(job["error"]["code"], job["error"]["message"])Job fields
| Field | Type | Description |
|---|---|---|
job_id | string (uuid) | The job. |
design_id | string (uuid) | The design the formats are added to. |
operation | string | add_formats. Not a closed list: treat an unknown one as generic and skip its details. |
status | string | See the table above. |
credits | object | What the job spent: generation_credits (always 0) and ai_credits (10 for a completed ai job, else 0). Same names as GET /credits. |
created_at_ts | integer | When the job was started, Unix seconds. |
started_at_ts | integer | When the layout started; null while PENDING. |
finalized_at_ts | integer | When the job ended; null until the status is final. |
details.mode | string | auto or ai. |
details.formats | array | The formats asked for, each { name, width, height, unit, added }. added is true once the format is in the design. On a COMPLETED job, each added format also has its preview_url — see Previews. |
details.warnings | array | Only when a preview of an added format could not be rendered: [{ code: "preview_generation_failed", message }] — see Previews. |
error.code / error.message | string | Only on a FAILED job — see Job failures. |
{
"job_id": "9a8b7c6d-5e4f-4a3b-8c1d-0e9f8a7b6c5d",
"design_id": "64238d01-d402-474b-8c2d-fbc957e9d290",
"operation": "add_formats",
"status": "COMPLETED",
"credits": { "generation_credits": 0, "ai_credits": 10 },
"created_at_ts": 1762354800,
"started_at_ts": 1762354801,
"finalized_at_ts": 1762354862,
"details": {
"mode": "ai",
"formats": [
{
"name": "story", "width": 1080, "height": 1920, "unit": "px", "added": true,
"preview_url": "https://production-banners.s3.eu-west-1.amazonaws.com/templates/2c39f2a1-1d2b-4b8e-9f1e-3a4b5c6d7e8f/0f1e2d3c-4b5a-4968-8778-695a4b3c2d1e-story.png"
}
]
}
}Previews
A job ends once the previews of its new formats are rendered. It stays PROCESSING while they render — a few seconds more for most designs, longer for print — then turns COMPLETED with each added format's preview_url, ready to display.
If a preview cannot be rendered (an error, or nothing after 30 minutes), the job still ends COMPLETED: the formats are in the design and can be generated, and details.warnings holds a preview_generation_failed warning. That format's preview_url may then answer 403.
"warnings": [
{
"code": "preview_generation_failed",
"message": "The formats were added but some of their previews could not be rendered: their preview URL may answer 403. The formats can be used for generation."
}
]How long a job lasts
A job can be polled for 7 days after it was started. After that it answers 410 design_job_gone. A job of another workspace answers 404 design_job_not_found, exactly like one that does not exist; any API key of the workspace can read a job started with another key.
Get the result by webhook
Pass callback_url and Abyssale POSTs the ADD_FORMATS event to it once, when the job is COMPLETED or FAILED. Its payload is the job exactly as the poll returns it, plus event_type. There is no dashboard subscription for this event.
Credits
auto is free. ai costs 10 AI credits per request, whatever the number of formats, spent only when the job completes: a failed job costs nothing.
Before an ai job is queued, the workspace's AI balance is checked against those 10 credits, and a short balance answers 402 insufficient_credits. That check is not a reservation: a job can still end FAILED with not_enough_ai_credits if the balance runs out before it runs.
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 rather than one request per format. Jobs on different designs run in parallel.
POST /designs/{designId}/formats is in the Write tier, GET /design-jobs/{jobId} in Polling.
Errors
The starting call refuses the request before anything is queued:
id | Status | Trigger |
|---|---|---|
missing_required | 400 | formats, or a format's width or height, is missing. |
invalid_payload | 400 | Any other validation failure — more than 20 formats, a name breaking the rule, two formats with the same name. Read errors[]. |
format_unit_mismatch | 400 | A format is not in the design's unit. |
too_many_formats | 400 | The design would hold more than 20 formats; the message says how many more fit. |
out_of_range | 400 | A side is outside the size bounds of the design's type. |
invalid_design_type | 400 | The design is a multi-page print design. |
insufficient_credits | 402 | mode: ai and fewer than 10 AI credits in the workspace. |
template_not_found | 404 | No design of your workspace has this id — see below. |
format_not_found | 404 | The design has no format named source_format. |
format_already_exists | 409 | The design already has a format with one of these names. |
design_job_in_progress | 409 | Formats are already being added to this design. |
ai_service_unavailable | 503 | mode: ai and the credit check cannot be made right now. Nothing queued or charged; retry later, or use auto. |
Polling answers 404 design_job_not_found for an unknown job and 410 design_job_gone for one older than 7 days.
Job failures
A job that started but could not finish ends FAILED, the design left unchanged, with one of these in error.code:
error.code | Meaning |
|---|---|
layout_refused | The design could not be laid out in these formats. |
not_enough_ai_credits | The AI balance ran out between the request and the layout. |
design_changed | The design kept being saved by someone else while the job ran. Ask again. |
design_not_found | The design was deleted while the job waited. |
internal_error | Unexpected. Ask again, or contact support if it persists. |
Codes are added over time: treat one you do not know as generic and show error.message. The full envelope is on Errors.
Which designs can get formats
Exactly the designs GET /designs lists. Anything else answers 404 template_not_found, the same as an id that never existed:
- a design that is already deleted;
- a design in a deleted project;
- a workspace template;
- another workspace's design.
A designId that is not a UUID does not match the route and answers 404 endpoint_not_found.
Multi-page print designs are refused on top, with 400 invalid_design_type.
Related
- Design job events — the
ADD_FORMATSpayload - Design Format Details — read one of the new formats
- Credits — the AI balance an
ailayout spends - MCP
add_design_formats— the same action from an AI assistant - API Reference: addDesignFormats · getDesignJob
