Developers
Monstra API v1
Everything you do on the web screens — adding products and photos, generating and translating product pages, getting the results — your own program can do too. These docs are for the developer who builds it.
1.Getting started
Send every request under the base URL below, with the API key in an Authorization: Bearer mk_live_… header.
https://<api-host>/api/v1- Request and response bodies are JSON with
snake_casefield names. Ids are integers; times are ISO 8601 strings in UTC (2026-10-09T05:00:00.000Z). - A failure answers
{"error": "…", "code": "…"}.erroris a sentence for people, in Korean, and may change: branch oncode. Some errors add fields such asproduct_id,import_idorurlat the same level. - Ignore response fields you do not know (see the versioning policy). An unknown field in a request is 400
validation_failed. - Use API keys from servers only. A request with an
Originheader (a browser) is refused with 403browser_not_allowed. - A key is accepted on
/api/v1and on the signed file URLs in responses (/api/files/…) only. Anywhere else it is 401invalid_api_key.
export MONSTRA_BASE="https://<api-host>/api/v1"
export MONSTRA_KEY="mk_live_…" # from the "API keys & webhook" screen
curl -s "$MONSTRA_BASE/me" -H "Authorization: Bearer $MONSTRA_KEY"2.Creating an API key
Log in and create a key on the "API keys & webhook" screen of the account menu. The full key is shown once, when it is created — Monstra stores only its hash and cannot show it again. If you lose it, create a new one and revoke the old one.
- Format:
mk_live_+ 64 hex characters (72 in all). The fixed prefix makes it easy to register with secret scanners or check a repository withgrep -r mk_live_. - A key has the same rights as the account's web login, except payments, store connections and key and webhook settings, which are web-only.
- A revoked key is 401
invalid_api_keyat once. An account can have up to 10 active keys. - Up to 120 requests per minute per key, and 360 per minute for the whole account (all its keys plus v1 calls made with a web login token). Past either it is 429
rate_limitedwithRetry-After(seconds). - Responses that passed key authentication, and v1 responses to a login token, carry
X-RateLimit-Limit,X-RateLimit-RemainingandX-RateLimit-Reset(unix seconds) of whichever window is closer to its limit;X-RateLimit-Scope(keyoruser) says which. - Failures with an unknown key are capped at 30 per minute per IP; past that, key requests from the IP are refused with 429
rate_limitedfor a while. - Credit balance, the daily generation limit and concurrent generations are shared with the web.
3.End to end
Create a product, add photos from links, generate the product page and fetch its HTML. The examples use curl and jq.
Create a product
Put your own id in
external_idto find the product by it later and never create it twice (409external_id_taken+product_id). Every field may be left out.PRODUCT_ID=$(curl -s "$MONSTRA_BASE/products" \ -H "Authorization: Bearer $MONSTRA_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: ali-1005001-create" \ -d '{ "title": "Ceramic mug 350 ml", "description": "Supplier text, in any language", "external_id": "ali-1005001", "languages": ["EN", "KO"] }' | jq -r .product.id)Add photos from links
Up to 20 links per request. It answers 202 with an import job (
import) at once and fetches the photos in the background. To upload files yourself, see the multipart example under Photos.IMPORT_ID=$(curl -s "$MONSTRA_BASE/products/$PRODUCT_ID/images/from-urls" \ -H "Authorization: Bearer $MONSTRA_KEY" \ -H "Content-Type: application/json" \ -d '{"urls": ["https://example.com/mug-1.jpg", "https://example.com/mug-2.jpg"]}' \ | jq -r .import.id)Wait for the import
It is done when
statusiscompleted. Each link'sitems[].statusisaddedorfailed(+code). With a webhook you getimage_import.completed.while :; do IMPORT=$(curl -s "$MONSTRA_BASE/products/$PRODUCT_ID/image-imports/$IMPORT_ID" \ -H "Authorization: Bearer $MONSTRA_KEY") STATUS=$(echo "$IMPORT" | jq -r '.import.status // empty') case "$STATUS" in pending|running) sleep 3 ;; *) break ;; esac done echo "$STATUS" # completed, or empty when the call failed: see $IMPORT echo "$IMPORT" | jq '.import | {added, failed, items: [.items[] | {url, status, code}]}'Generate the product page
languagesare the languages to make (EN,KO,JA,ZH). With anIdempotency-Key, sending it again after a lost response does not generate twice. Answers 202 with thegeneration.GENERATION_ID=$(curl -s "$MONSTRA_BASE/products/$PRODUCT_ID/compose" \ -H "Authorization: Bearer $MONSTRA_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: ali-1005001-compose-1" \ -d '{"languages": ["EN", "KO"]}' | jq -r .generation.id)Wait for the generation
Take the webhook's
generation.completed,failedorcancelled, or checkGET /generations/{id}every few seconds. It has ended whenstatusis neitherpendingnorrunning. Per-language results are initems.while :; do STATUS=$(curl -s "$MONSTRA_BASE/generations/$GENERATION_ID" \ -H "Authorization: Bearer $MONSTRA_KEY" | jq -r '.generation.status // empty') case "$STATUS" in pending|running) sleep 5 ;; *) break ;; esac done echo "$STATUS" # completed | failed | cancelledGet the result
format=htmlreturns the HTML fragment; without it (json) you get the title, description, sections,rendered_htmlandimage_order. The page's photo URLs are in the JSONimage_orderand open for about an hour, so download them right away and host them yourself.curl -s "$MONSTRA_BASE/products/$PRODUCT_ID/pages/EN?format=html" \ -H "Authorization: Bearer $MONSTRA_KEY" -o page-en.html # The page's photos (JSON image_order) are signed links that open for about an hour: keep copies. curl -s "$MONSTRA_BASE/products/$PRODUCT_ID/pages/EN" -H "Authorization: Bearer $MONSTRA_KEY" | jq -r '.image_order[]' | while read -r url; do curl -s -o "$(basename "$url" | cut -d'?' -f1)" "$url"; done
4.Photos
- Upload files:
POST /products/{id}/imageswith one or more multipartfilesparts. A photo with the same bytes is not added again — the existing photo (same id) comes back — so after a failure simply upload again. - JPEG, PNG, WebP or AVIF still images. Up to 10 MiB each, 20000 px per side and 64 megapixels, and 50 originals per product.
- Add from links:
POST /products/{id}/images/from-urls{"urls": […]}— 1–20 distinct http/https links of at most 2048 characters. Only public internet addresses work — private or internal ones are always 400image_url_invalid(+url). Up to 3 redirects are followed, each target checked by the same rule. - One import at a time per product (409
image_import_in_progress+import_id). While it runs, generating that product is refused with the same code. Across the account, up to 5 products at once (409too_many_image_imports). - Refused at once: the current photos plus the links over 50 is 400
too_many_images; no storage left is 409storage_limit_reached. - Per-link failure
code:private_address,invalid_url,redirect,http_status,too_large,timeout,network,unsupported_image,image_dimensions_too_large,too_many_images,storage_limit_reached. An import still endscompletedwhen some links fail. - Photo URLs in responses (
/api/files/…?e=…&s=…) are signed and open for about an hour. Do not hotlink them from your site: download and keep them. After expiry they answer 401; reading again gives fresh URLs. Idempotency-Keycannot be used on file uploads (400). The duplicate handling above makes it unnecessary.
curl -s "$MONSTRA_BASE/products/$PRODUCT_ID/images" \
-H "Authorization: Bearer $MONSTRA_KEY" \
-F "files=@mug-1.jpg" -F "files=@mug-2.jpg"5.Webhooks
An account has one webhook. Save the receiving address (https) on the "API keys & webhook" screen and a signing secret (mk_whsec_…) is made. Every piece of work on the account notifies it when it ends, whether started on the web or through the API. Notifications carry a summary only — read the full state with GET afterwards. Polling with GET works without a webhook, always.
| Event | When | data |
|---|---|---|
generation.completed · generation.failed · generation.cancelled | A generation ended (succeeded, failed or cancelled) | generation: id, product_id, external_id, kind, status, items[] (language, status, error_message), error_message, cost, created_at, finished_at |
bulk.completed · bulk.cancelled | A bulk job ended | bulk: as bulk of GET /bulk/jobs/{id} |
store_job.completed · store_job.failed | A store import, update or restore ended | job: id, kind, status, connection_id, product_id, external_id, error_code, error, cost, created_at, finished_at |
image_import.completed | Adding photos from links ended | import: as GET …/image-imports/{id} (with its items) |
ping | "Send test notification" was pressed on the screen | {} |
POST /monstra/webhook HTTP/1.1
Content-Type: application/json
User-Agent: Monstra-Webhooks/1.0
Monstra-Event: generation.completed
Monstra-Delivery: 8123
Monstra-Signature: t=1760000000,v1=5f2b…(64 hex)
{
"id": 8123,
"event": "generation.completed",
"created_at": "2026-10-09T05:00:00.000Z",
"origin": "api",
"api_key_id": 7,
"data": {
"generation": {
"id": 912,
"product_id": 345,
"external_id": "ali-1005001",
"kind": "compose",
"status": "completed",
"items": [
{ "language": "EN", "status": "completed", "error_message": null },
{ "language": "KO", "status": "completed", "error_message": null }
],
"error_message": null,
"cost": 1830,
"created_at": "2026-10-09T04:58:41.000Z",
"finished_at": "2026-10-09T05:00:00.000Z"
}
}
}- The body's
idis the delivery id, the same as theMonstra-Deliveryheader. Retries keep it, so de-duplicate on it. originis"api"(work started with an API key) or"web";api_key_idis that key's id (nullfor the web).- Deleting a product drops the notifications of its generations and imports.
- When a
composeortranslaterequest itself ends in an error (5xx) — refused while handing the work over — nogeneration.failednotification is sent: the error response is the result.
Verifying the signature
Monstra-Signature: t=<unix seconds>,v1=<signature>— the signature is the hexHMAC-SHA256(t + "." + body)keyed with the secret (the wholemk_whsec_…string).- Use the body bytes exactly as received. Parsing the JSON and serializing it again changes spacing or order and the signature no longer matches.
- Reject a
tmore than 5 minutes away from now (replay protection). Compare signatures in constant time (timingSafeEqual,hmac.compare_digest). tis set at each attempt: retries of one notification have the same body and a different signature.- A new secret signs from that moment on, waiting retries included. Update the receiving side right away.
import crypto from 'node:crypto'
import express from 'express'
const TOLERANCE_SECONDS = 5 * 60
/**
* rawBody: the request body exactly as received (a Buffer), never re-serialized JSON.
* header: the Monstra-Signature header. secret: the whole "mk_whsec_…" string.
*/
export function verifyMonstraSignature(rawBody, header, secret, nowSeconds = Date.now() / 1000) {
// A parsed body (express.json) or a missing secret can never verify.
if (!Buffer.isBuffer(rawBody) || !secret) return false
const parts = {}
for (const piece of String(header ?? '').split(',')) {
const i = piece.indexOf('=')
if (i > 0) parts[piece.slice(0, i).trim()] = piece.slice(i + 1).trim()
}
const t = parts.t
if (!/^\d+$/.test(t ?? '') || !/^[0-9a-f]{64}$/.test(parts.v1 ?? '')) return false
if (Math.abs(nowSeconds - Number(t)) > TOLERANCE_SECONDS) return false
const expected = crypto.createHmac('sha256', secret).update(`${t}.`).update(rawBody).digest()
return crypto.timingSafeEqual(expected, Buffer.from(parts.v1, 'hex'))
}
const app = express()
// express.raw, not express.json: the signature is over the bytes as sent.
app.post('/monstra/webhook', express.raw({ type: 'application/json' }), (req, res) => {
if (!verifyMonstraSignature(req.body, req.get('Monstra-Signature'), process.env.MONSTRA_WEBHOOK_SECRET)) {
return res.sendStatus(400)
}
res.sendStatus(204) // answer first, work afterwards
const event = JSON.parse(req.body.toString('utf8'))
// De-duplicate on event.id (= Monstra-Delivery), then GET the current state.
console.log(event.event, event.id)
})
app.listen(3000)import hashlib
import hmac
import json
import os
import re
import time
from flask import Flask, request
TOLERANCE_SECONDS = 5 * 60
def verify_monstra_signature(raw_body: bytes, header: str, secret: str, now=None) -> bool:
"""raw_body: the request body exactly as received. secret: the whole "mk_whsec_..." string."""
parts = {}
for piece in (header or "").split(","):
key, sep, value = piece.partition("=")
if sep:
parts[key.strip()] = value.strip()
t, v1 = parts.get("t", ""), parts.get("v1", "")
if not re.fullmatch(r"[0-9]+", t) or not re.fullmatch(r"[0-9a-f]{64}", v1):
return False
if abs((time.time() if now is None else now) - int(t)) > TOLERANCE_SECONDS:
return False
expected = hmac.new(secret.encode(), t.encode() + b"." + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, v1)
app = Flask(__name__)
@app.post("/monstra/webhook")
def monstra_webhook():
raw = request.get_data() # the bytes as sent, before any JSON parsing
if not verify_monstra_signature(raw, request.headers.get("Monstra-Signature", ""), os.environ["MONSTRA_WEBHOOK_SECRET"]):
return "", 400
event = json.loads(raw)
# Answer 2xx quickly; de-duplicate on event["id"] (= Monstra-Delivery) and do the work afterwards.
print(event["event"], event["id"])
return "", 204Delivery and retries
- Any 2xx answer is a delivery. Answer 2xx as soon as the request arrives and do the work afterwards. No answer within 10 seconds counts as a failure.
- A 3xx is not followed and counts as a failure (the signed body must not go anywhere else).
- After a failure it is sent again after 1 minute → 5 minutes → 30 minutes → 2 hours → 8 hours (6 tries including the first, about 10.5 hours). Then the notification ends
failed. - Order is not guaranteed. Sort by
created_atandid, and read the current state with GET. - The receiving address must be a public https address on the default port (443) — no number such as
:8443or:80after the host. Private or internal addresses cannot be saved. - Turning the webhook off or deleting it cancels waiting notifications. Beyond 1000 notifications waiting, the oldest are cancelled.
- The "API keys & webhook" screen shows the recent notifications and why any failed.
6.Idempotency keys
To send a request again safely when its response was lost, add an Idempotency-Key header to the POST. Sent again with the same key, it answers the first response.
- Works on every v1 POST except file uploads. PUT and DELETE give the same result however often they are sent, so the header there is refused with 400.
- Value: 1–128 characters of
A–Z a–z 0–9 _ . : -. Scoped to the account, so it carries over when you change API keys; kept for 24 hours. - A replayed response carries
Idempotency-Replayed: true. It replays the first response, so states in it (a generation'sstatus) are as they were then — read the current state with GET. - The same key with a different request (another path or body) is 409
idempotency_key_reused; while the first request is still running it is 409idempotency_in_progress(try again shortly). - Only answers about the request itself are stored and replayed: successes, and 4xx such as validation errors, not found,
external_id_takenand finished work (generation_finished,bulk_finished). - Answers that depend on the moment are not stored, so the same key sent again really runs: every 429 and 5xx, plus
too_many_active·quota_exceeded·insufficient_credit·busy·rate_limited·storage_limit_reached·product_limit_reached·too_many_image_imports·upload_in_progress·generation_in_progress·image_import_in_progress·store_push_in_progress·store_job_in_progress·bulk_in_progress·idempotency_in_progress·source_page_required·base_page_not_ready·store_needs_reauth·store_not_connected·store_unavailable·engine_unavailable·bulk_unavailable·writer_unavailable. - Send the same body again, byte for byte. A trailing
/in the path is ignored. Replays count toward the per-minute limit. - Signed photo URLs in a replayed body may have expired (they last about an hour). GET the resource again for fresh ones.
curl -si "$MONSTRA_BASE/products/$PRODUCT_ID/compose" \
-H "Authorization: Bearer $MONSTRA_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: ali-1005001-compose-1" \
-d '{"languages": ["EN", "KO"]}' | grep -i '^idempotency-replayed'
# Idempotency-Replayed: true <- the first answer, replayed; no second generation7.Your own ids (external_id)
Attach your system's id (product number, SKU …) to a product and you need not store Monstra's product id yourself.
external_idonPOST /productsandPUT /products/{id}: 1–128 characters after trimming, no control characters, case-sensitive. Unique within the account.- A value already in use answers 409
external_id_takenwith that product'sproduct_id— carry on with that product. - Find a product:
GET /products?external_id=…(exact match, 0 or 1 result). Combines with the other filters. PUTreplaces the whole product, exceptexternal_id: left out, it is kept;nullclears it (languagesis also kept when left out).- Generation, store job and photo import notifications carry the product's
external_id.
curl -s "$MONSTRA_BASE/products?external_id=ali-1005001" \
-H "Authorization: Bearer $MONSTRA_KEY" | jq '.products[0].id'8.Bulk jobs and stores
- Bulk generation: see the estimate with
POST /bulk/generate/estimate, thenPOST /bulk/generate. Bulk delete:POST /bulk/delete. StatusGET /bulk/jobs/{id}, cancelPOST /bulk/jobs/{id}/cancel. - Up to 100 products per request and one running bulk job per account (409
bulk_in_progress+bulk_id). When it ends you getbulk.completedorbulk.cancelled. - A bulk job generates its products one after another. To run several at once, send
composefor each product yourself (within the concurrent generation limit). - Stores are connected on the web only. Once connected,
GET /stores,POST /stores/{id}/import,GET /products/{id}/store/preview,POST /products/{id}/store/pushandrestore, andPOST /bulk/pushwork through the API, ending withstore_job.completedorfailed. - Where store integration is off, the store routes answer 404
not_found.
9.Limits
| What | Limit | Beyond it |
|---|---|---|
| Requests per key | 120 per minute | 429 rate_limited + Retry-After |
| Requests per account | 360 per minute (all keys plus v1 calls with a login token) | 429 rate_limited + Retry-After |
| Failures with an unknown key | 30 per minute per IP | 429 rate_limited |
| Active keys per account | 10 | 409 api_key_limit_reached |
| Generations running at once | 2 per account (an admin can change it; quota.max_active of /me) | 429 too_many_active |
| Pages generated per day | 1,000 by default (an admin can change it per account, or remove it; quota.daily_limit of /me, null = no daily limit) | 429 quota_exceeded |
| Credit | The same balance as the web; a running generation holds its estimate | 429 insufficient_credit |
| Products / storage | 500 / 2 GiB | 409 product_limit_reached / storage_limit_reached |
| Photos | 50 originals per product, 10 MiB each, 20000 px per side and 64 megapixels | 400 too_many_images · 413 file_too_large · 400 image_dimensions_too_large |
| Photos from links | 20 per request, 2048-character links, one running per product, 5 products at once per account | 400 validation_failed · 409 image_import_in_progress · 409 too_many_image_imports |
| Bulk jobs | 100 products per request, one running per account | 409 bulk_in_progress |
| JSON body | 1 MiB | 413 payload_too_large |
| Signed photo URLs | About an hour — download and keep them | 401 unauthorized after expiry |
| Webhooks | Answer within 10 seconds, 6 tries, log kept 30 days | — |
| Webhook settings (web screen) | Save 10 per minute, test notification 5 per minute | 429 rate_limited |
| Undelivered webhook notifications | Up to 1000 waiting | The oldest are cancelled beyond that |
| Idempotency keys | Kept 24 hours | 409 idempotency_key_reused · idempotency_in_progress |
10.Error codes
The codes you are most likely to meet. The responses of each route are in the OpenAPI spec.
| HTTP | code | Meaning |
|---|---|---|
| 400 | validation_failed · invalid_json | The input or the JSON is not valid. error names the field. |
| 400 | images_required · languages_required | Generating with no photos, or with no language to make |
| 400 | no_files · invalid_upload · too_many_images · unsupported_image · image_dimensions_too_large · invalid_image_order | Photo upload or order errors |
| 400 | image_url_invalid (+url) | A photo link that cannot be used (format, private or internal address) |
| 400 | writer_unavailable | Something went wrong, so pages cannot be made right now — try again shortly |
| 401 | unauthorized | No authentication, or an expired signed URL |
| 401 | invalid_api_key | A wrong or revoked key, or a key used outside v1 |
| 403 | browser_not_allowed | A key used from a browser (Origin header) |
| 404 | not_found · product_not_found · image_not_found · page_not_found · generation_not_found · image_import_not_found · bulk_not_found · store_not_found · store_job_not_found | Missing or not yours (another account's is 404 too) |
| 409 | generation_in_progress | The product is already being generated |
| 409 | source_page_required | Translating needs a generation (compose) first |
| 409 | image_import_in_progress (+import_id) | Photos are being added from links |
| 409 | too_many_image_imports | Five photo imports are already running across the account |
| 409 | external_id_taken (+product_id) | The external_id is already in use |
| 409 | idempotency_key_reused · idempotency_in_progress | Idempotency key conflict |
| 409 | product_limit_reached · storage_limit_reached | Product count or storage limit |
| 409 | bulk_in_progress (+bulk_id) · store_job_in_progress (+job_id) | A bulk or store job is already running |
| 413 | file_too_large · payload_too_large | A photo over 10 MiB, a JSON body over 1 MiB |
| 429 | rate_limited | Too many requests per minute (key, account, or an IP with many unknown-key failures) — try again after Retry-After seconds |
| 429 | too_many_active · quota_exceeded · insufficient_credit | Concurrent generations, daily limit or credit |
| 429 | upload_in_progress | Another upload of the account is running |
| 500 | internal_error | An unexpected error — try again shortly |
| 502 · 503 | engine_rejected · engine_error · engine_unavailable · busy | Generation is not available for a moment — try again shortly |
| 400 · 404 · 409 | webhook_url_invalid · webhook_not_found · api_key_not_found · api_key_limit_reached | Web screens only (key and webhook settings) — never from /api/v1 |
11.OpenAPI spec
Every route and the shape of every request and response are in the OpenAPI 3.1 spec, ready for code generators or Postman. Response schemas say additionalProperties: false, but build clients that ignore new fields.
Open openapi.jsonhttps://<api-host>/api/v1/openapi.json
# Account and catalog
GET /me
GET /me/ledger?cursor=&limit=
GET /languages
GET /personas
GET /layouts?lang=
# Products
GET /products?limit=&offset=&q=&sort=&source=&state=&lang=&lang_state=&external_id=
POST /products
GET /products/{id}
PUT /products/{id}
DELETE /products/{id}
PUT /products/{id}/layout
PUT /products/{id}/image-selection
PUT /products/{id}/photo-set
PUT /products/{id}/hero-image
# Photos
POST /products/{id}/images (multipart "files")
POST /products/{id}/images/from-urls
GET /products/{id}/image-imports/{importId}
PUT /products/{id}/images/order
DELETE /products/{id}/images/{imageId}
# Generation and pages
POST /products/{id}/compose
POST /products/{id}/translate
GET /products/{id}/generations?limit=
GET /generations/{id}
POST /generations/{id}/cancel
GET /products/{id}/pages/{language}?format=json|html
GET /products/{id}/pages/{language}/history
GET /products/{id}/source
# Bulk
POST /bulk/delete
POST /bulk/generate/estimate
POST /bulk/generate
GET /bulk/jobs?active=&limit=
GET /bulk/jobs/{id}
POST /bulk/jobs/{id}/cancel
POST /bulk/push/plan
POST /bulk/push
# Stores (connected on the web first)
GET /stores
GET /stores/jobs/{jobId}
GET /stores/{id}/products?cursor=&q=
POST /stores/{id}/import
GET /products/{id}/store/preview
POST /products/{id}/store/push
POST /products/{id}/store/restore
# Docs
GET /openapi.json (public)12.Versioning
- v1 only ever adds fields and routes. Clients must ignore response fields they do not know.
- Renaming, removing, or changing the type or meaning of anything comes as v2.
- An unknown field in a request is 400
validation_failed. - Paths under
/api/…but not/api/v1belong to the web screens and change without notice. Do not use them from programs. - The
errorsentences are Korean and may change. Branch oncode.