API reference
Run the extraction pipeline from your own code: upload a sheet, crop it, export it and download the ZIP. Version 1 of the API is available on Pro.
Overview
The API is the same pipeline the web app uses, so a sheet uploaded through the API counts against your monthly sheets, follows your plan's limits and shows up in History. All v1 paths start with /api/v1.
https://openasset-backend.anands.dev/api/v1Requests and responses are JSON, except the upload (multipart/form-data) and the download (a ZIP). Call the API from your servers, scripts and CI, never from a web page: a key in a page can be read by everyone who opens it.
Authentication
Every request carries an API key in the Authorization header. Create one in Settings, API keys.
Authorization: Bearer oa_live_…- Only API keys work here. Cookies and web session tokens are refused, and an API key does not work on the web app's own API.
- The full key is shown once, when you create it. OpenAssets stores only a hash of it and the first characters, so a lost key cannot be recovered: revoke it and create another.
- You can hold up to 5 active keys. Name each after what uses it, and use one key per integration so you can revoke one without touching the rest.
- Revoking a key takes effect at once. Keys keep working when you sign out or change your password, so revoke a key you think has leaked.
- If your Pro period ends, your keys stay listed but every request answers
403 PLAN_REQUIREDuntil you are on Pro again.
To check a key, ask who it belongs to:
export OPENASSETS_API=https://openasset-backend.anands.dev
export OPENASSETS_KEY=oa_live_…
curl "$OPENASSETS_API/api/v1/me" \
-H "Authorization: Bearer $OPENASSETS_KEY"Quickstart
Upload a sheet, wait for detection, crop, export, then download. Each step that starts work answers at once and the job moves on in the background, so you poll the job between steps.
- Upload the sheet. The response holds the job id.
- Poll the job until its status is
detected. - Crop. Poll until the status is
cropped. - Export. Poll until the status is
ready. - Download the ZIP.
# 1. Upload
curl -X POST "$OPENASSETS_API/api/v1/jobs" \
-H "Authorization: Bearer $OPENASSETS_KEY" \
-F image=@rpg_pack_v1.png
# → { "data": { "jobId": "7c1e9d52-…", "status": "queued", … } }
JOB=7c1e9d52-…
# 2. Poll until "status" is "detected" (every few seconds)
curl "$OPENASSETS_API/api/v1/jobs/$JOB" \
-H "Authorization: Bearer $OPENASSETS_KEY"
# 3. Crop the detected boxes, then poll until "status" is "cropped"
curl -X POST "$OPENASSETS_API/api/v1/jobs/$JOB/crop" \
-H "Authorization: Bearer $OPENASSETS_KEY"
# 4. Export at 2x, then poll until "status" is "ready"
curl -X POST "$OPENASSETS_API/api/v1/jobs/$JOB/export" \
-H "Authorization: Bearer $OPENASSETS_KEY" \
-H "Content-Type: application/json" \
-d '{ "scale": 2 }'
# 5. Download the ZIP
curl -o assets.zip "$OPENASSETS_API/api/v1/jobs/$JOB/download" \
-H "Authorization: Bearer $OPENASSETS_KEY"Responses
Every JSON response has the same envelope.
{
"success": true,
"message": "Job",
"data": { … }
}{
"success": false,
"message": "Job not found.",
"code": "JOB_NOT_FOUND",
"details": { … }
}- Branch on
codeand the HTTP status, never onmessage, which is for people and can be reworded.detailsis present only when there is more to say. See Errors. - Server errors (5xx) have a
messageand nocode. Retry them after a short wait. - Times are ISO 8601 in UTC. Sizes and positions are in pixels of the original sheet.
- Fields may be added to responses at any time, so ignore fields you do not know. Fields are not renamed or removed within v1. Unknown fields in request bodies are ignored.
Job lifecycle
A job moves through these statuses. Poll GET /jobs/{jobId} every two to five seconds.
| Status | Meaning | What to do |
|---|---|---|
| uploaded, queued | The sheet is stored and waiting for detection. | Wait. |
| detecting | Detection is finding the assets. | Wait. |
| detected | Boxes are ready. | Review boxes, then call crop. |
| removing_bg, cropping, naming | The crop is running: background removal, cutting and AI naming. | Wait. |
| cropped | The assets are cut out and named. | Read assets, then call export. |
| finalizing | The export is running (upscaling). | Wait. |
| ready | The ZIP can be downloaded. | Call download. |
| failed | Something went wrong. error says what. | Upload the sheet again. |
A job is removed about 24 hours after its last change. After that it answers 404 JOB_NOT_FOUND and no longer appears in the job list.
GET /me
GET/api/v1/me
The key you called with, the plan behind it, this month's sheets and the limits that apply. Use it to check a key.
Response
{
"success": true,
"message": "Account",
"data": {
"key": { "id": "66f0…", "name": "CI export", "prefix": "oa_live_a1b2" },
"plan": "pro",
"sheets": {
"used": 3,
"limit": null,
"remaining": null,
"period": "2026-10",
"resetAt": "2026-11-01T00:00:00.000Z"
},
"maxUpscale": 4,
"rateLimits": {
"requestsPerMinute": 120,
"startsPer15Minutes": 60,
"failedAuthPer15Minutes": 100
}
}
}sheets.limit is null when the plan has no limit.
POST /jobs
POST/api/v1/jobs
Upload a sheet and start detection. Send multipart/form-data with the file in the image field. The upload uses one of your monthly sheets, and the sheet is given back if the upload fails.
| Field | Rule |
|---|---|
image | PNG, JPEG or WebP, up to 20 MB, 64 to 12,000 pixels on each side. Required. |
Request
curl -X POST "$OPENASSETS_API/api/v1/jobs" \
-H "Authorization: Bearer $OPENASSETS_KEY" \
-F image=@rpg_pack_v1.pngResponse: 201
{
"success": true,
"message": "Sheet uploaded. Detection has started.",
"data": {
"jobId": "7c1e9d52-4b0e-4c53-9d6f-2a8f0f1c6a10",
"status": "queued",
"imageUrl": "https://…/7c1e9d52-….png"
}
}Errors: 400 IMAGE_REQUIRED, 400 INVALID_IMAGE, 413 FILE_TOO_LARGE, 415 UNSUPPORTED_FILE_TYPE, 403 SHEET_LIMIT.
GET /jobs
GET/api/v1/jobs
Your recent jobs, newest first, a page at a time. These are the jobs still kept (about 24 hours).
| Parameter | Meaning |
|---|---|
limit | Jobs per page, 1 to 100. Default 50. |
cursor | The nextCursor of the previous page. Omit it for the first page. |
Request
curl "$OPENASSETS_API/api/v1/jobs?limit=2" \
-H "Authorization: Bearer $OPENASSETS_KEY"Response
{
"success": true,
"message": "Jobs",
"data": {
"jobs": [
{
"jobId": "7c1e9d52-…",
"status": "cropped",
"fileName": "rpg_pack_v1.png",
"assetCount": 12,
"createdAt": "2026-10-30T09:14:02.511Z",
"imageUrl": "https://…",
"error": null
}
],
"nextCursor": "MTc2MTgxMjQ0MjUxMXw3YzFlOWQ1Mi0…"
}
}nextCursor is null on the last page. assetCount is the number of detected boxes until the crop has produced assets.
GET /jobs/{jobId}
GET/api/v1/jobs/{jobId}
A job's status, the boxes detection found and, once it is cropped, the assets with their names. A job that does not exist and a job that belongs to someone else both answer 404 JOB_NOT_FOUND.
Request
curl "$OPENASSETS_API/api/v1/jobs/$JOB" \
-H "Authorization: Bearer $OPENASSETS_KEY"Response
{
"success": true,
"message": "Job",
"data": {
"jobId": "7c1e9d52-…",
"status": "cropped",
"fileName": "rpg_pack_v1.png",
"createdAt": "2026-10-30T09:14:02.511Z",
"image": { "url": "https://…", "width": 2048, "height": 2048 },
"detection": { "mode": "dark-background", "confidence": 0.93, "warning": null },
"background": { "kind": "flat", "color": "#f7f6f2" },
"backgroundRemoval": { "mode": "auto", "method": "server", "reason": null },
"boxes": [
{ "id": "box_1", "x": 32, "y": 40, "width": 180, "height": 210, "label": "asset_001" }
],
"assets": [
{
"id": "box_1",
"name": "fire_sword",
"url": "https://…/fire_sword.png",
"upscaledUrl": null,
"fileName": null
}
],
"export": { "scale": null, "namingPattern": null, "ready": false },
"error": null
}
}| Field | Meaning |
|---|---|
boxes | What detection found, in pixels. label is its placeholder name. |
background | What the sheet's background is: kind is transparent, flat (white, black, a plain colour), chroma (magenta, green) or complex (gradient, texture), and color is the #rrggbb value for flat and chroma. null for sheets detected before this existed. |
backgroundRemoval | null until the crop has run. Then mode (what was asked), method (server: removed on our server, free; ai: AI removal; none: kept) and reason when the background was kept. |
assets | Empty until the crop finishes. id is the id of the box it was cut from; name is the file name used in the ZIP. |
assets[].upscaledUrl | Set per asset once the export has upscaled it. |
assets[].fileName | The file name (with .png) the export gave the asset. null until the export has started. |
export.namingPattern | The naming pattern the export follows, once it has started. |
export.scale | The upscale factor of the export once it has started: 2 or 4, or 1 when it skipped upscaling. |
export.ready | true when the ZIP can be downloaded. |
error | Why the job failed, when its status is failed. |
POST /jobs/{jobId}/crop
POST/api/v1/jobs/{jobId}/crop
Cut the assets out and name them. This removes backgrounds and asks an AI model for names, and like the web app it leaves a private draft collection in My collections. The job must be detected. Send boxes to correct what detection found, or nothing to crop the detected boxes as they are.
| Field | Meaning |
|---|---|
boxes | Optional. 1 to 1,000 objects { id, x, y, width, height, label? } in pixels of the original sheet. id is a string you choose. It replaces the detected boxes. |
removeEnclosedBackground | Optional boolean, default false. true also removes background inside an asset, such as the hole of a ring or a letter. It applies whenever the server removes the background itself (see backgroundRemoval), on any storage provider, and it removes every pocket that matches the background colour. The AI cut-out ignores it. Other values answer 400 VALIDATION_ERROR. |
backgroundRemoval | Optional, default "auto". "auto" removes a flat or chroma-key background on the server for free and uses AI removal only for a gradient or texture. "flat" removes a flat background on the server and keeps the background of any other sheet. "ai" always uses AI removal (not available on local storage, where the background is kept). "none" keeps the background. A transparent sheet needs nothing in any mode. Any other value answers 400 VALIDATION_ERROR. The job reports background (kind transparent, flat, chroma or complex, and color) after detection, and backgroundRemoval.method (server, ai or none) with a reason when the background was kept, after the crop. |
Request
curl -X POST "$OPENASSETS_API/api/v1/jobs/$JOB/crop" \
-H "Authorization: Bearer $OPENASSETS_KEY" \
-H "Content-Type: application/json" \
-d '{ "boxes": [ { "id": "box_1", "x": 32, "y": 40, "width": 180, "height": 210 } ] }'Response: 201
{ "success": true, "message": "Crop started", "data": { "jobId": "7c1e9d52-…" } }Errors: 404 JOB_NOT_FOUND, 409 INVALID_JOB_STATE (the job is not detected; the status is in details), 400 VALIDATION_ERROR.
POST /jobs/{jobId}/export
POST/api/v1/jobs/{jobId}/export
Start the export: choose assets, rename them, and upscale. The job must be cropped. With no body it exports every asset at 2×.
| Field | Meaning |
|---|---|
selectedIds | Optional. Asset ids to export. Default: all. Ids that match no asset are ignored. |
names | Optional. Rename assets for this export: { "box_1": "big_sword" }. Names are used as file names in the ZIP. |
scale | 2 or 4. Default 2. The factor is checked against your plan's upscale limit. |
upscale | false exports the crops as they are, with no AI upscaling. Default true. |
namingPattern | How the files are named, for example {sheet}_{index:03}_{name}. Default: the pattern saved in Settings, Export, otherwise {name}. See Naming patterns. |
Request
curl -X POST "$OPENASSETS_API/api/v1/jobs/$JOB/export" \
-H "Authorization: Bearer $OPENASSETS_KEY" \
-H "Content-Type: application/json" \
-d '{ "selectedIds": ["box_1"], "names": { "box_1": "big_sword" }, "scale": 4, "namingPattern": "{name}@{scale}x" }'Response: 201
{
"success": true,
"message": "Export started",
"data": {
"jobId": "7c1e9d52-…",
"namingPattern": "{name}@{scale}x",
"scale": 4,
"files": [
{ "id": "box_1", "name": "big_sword", "fileName": "big_sword@4x.png" }
]
}
}files lists the file names the export will use, one per selected asset: nameis the asset's name and fileName what it is called in the ZIP. scale is the upscale factor (1 when upscale is false). The same names appear as assets[].fileName on the job once the export is under way.
Errors: 404 JOB_NOT_FOUND, 409 INVALID_JOB_STATE (the job is not cropped), 400 VALIDATION_ERROR, 400 INVALID_PATTERN (the naming pattern is not valid), 400 BAD_REQUEST (no selected id matches an asset), 403 PLAN_LIMIT(the scale is above your plan's limit).
Naming patterns
A naming pattern is literal text with tokens in braces. It sets the name of each file in the export. The default, {name}, is the asset's name.
| Token | Is | Example |
|---|---|---|
{name} | The asset name | fire_sword |
{index} | Position in this export, from 1 | 1 |
{index:03} | The same, zero-padded to 1 to 8 digits | 001 |
{sheet} | The uploaded file name without its extension | rpg_pack_v1 |
{w} {h} | Width and height in pixels of the exported image, after upscaling | 128, 96 |
{scale} | The upscale factor: 1 when not upscaled, else 2 or 4 | 2 |
{date} | The export date in UTC | 2026-10-30 |
- 1 to 100 characters, and it must contain
{name}or{index}so names differ. Unknown tokens, unmatched braces and slashes are errors (400 INVALID_PATTERN, withdetails.issues). - Names are cleaned for use as files: letters, digits,
-,_,.and@are kept and anything else becomes_. Names that still collide get_2,_3. - Custom patterns are part of Pro, like the API itself. Without a
namingPatternin the request, the default saved in Settings, Export applies.
{name} fire_sword.png
{sheet}_{index:03}_{name} rpg_pack_v1_001_fire_sword.png
{name}@{scale}x fire_sword@2x.png
icon-{index}-{w}x{h} icon-1-128x96.pngGET /jobs/{jobId}/download
GET/api/v1/jobs/{jobId}/download
The ZIP of the exported PNGs, built when you ask for it, with a metadata.jsonnext to the images. It holds the assets you selected, upscaled if you asked for that, each named as the export's naming pattern says (assets[].fileName). The job must be ready.
Request
curl -o assets.zip "$OPENASSETS_API/api/v1/jobs/$JOB/download" \
-H "Authorization: Bearer $OPENASSETS_KEY"The response is 200 with Content-Type: application/zip. Errors: 404 JOB_NOT_FOUND, 409 JOB_NOT_READY, 502 EXPORT_FETCH_FAILED (the stored images could not be fetched: try again).
Rate limits
| Limit | Applies to | Window |
|---|---|---|
| 120 | Every request, per API key | 1 minute |
| 60 | Requests that start work (POST /jobs, /crop, /export), per API key. These count whether or not they succeed. | 15 minutes |
| 100 | Requests answered 401 because of a bad key, per IP address | 15 minutes |
- Limits follow the key, not the address: two keys on one server are counted separately.
- Responses carry
RateLimit-Limit,RateLimit-RemainingandRateLimit-Reset(seconds until the minute limit resets). - Past a limit you get
429 RATE_LIMITEDwith aRetry-Afterheader in seconds. Wait that long, then retry. Counts are kept by each API server, so treat the numbers as ceilings.
HTTP/1.1 429 Too Many Requests
Retry-After: 23
{
"success": false,
"message": "Rate limit reached: 120 requests a minute per API key. Retry after the time in Retry-After.",
"code": "RATE_LIMITED",
"details": { "retryAfterSeconds": 23 }
}Errors
| Status | Code | Meaning |
|---|---|---|
| 401 | API_KEY_MISSING | No Authorization header, or not a Bearer one. |
| 401 | API_KEY_INVALID | Not a key we issued. A web session token is not one. |
| 401 | API_KEY_REVOKED | The key was revoked in Settings. Create a new one. |
| 403 | PLAN_REQUIRED | The account is no longer on Pro. Keys work again when it is. |
| 403 | PLAN_LIMIT | A plan limit would be exceeded, for example scale 4 above the plan's upscale limit. details has the limit. |
| 403 | SHEET_LIMIT | The monthly sheet allowance is used up. details.resetAt says when it resets. Pro has no sheet limit. |
| 404 | JOB_NOT_FOUND | No such job, it belongs to someone else, or it expired. |
| 404 | NOT_FOUND | No such endpoint. |
| 409 | INVALID_JOB_STATE | The job is not in the state this call needs. details has the current and the expected status. |
| 409 | JOB_NOT_READY | The export has not finished. details.status has the current status. |
| 400 | VALIDATION_ERROR | The body failed validation. details.issues lists what was wrong. |
| 400 | IMAGE_REQUIRED | No file in the image field. |
| 400 | INVALID_IMAGE | The image is not PNG, JPEG or WebP, or is outside 64 to 12,000 pixels. |
| 400 | INVALID_PATTERN | The naming pattern is not valid. details.issues lists the problems. |
| 400 | INVALID_JSON | The body is not valid JSON. |
| 400 | INVALID_UPLOAD | The multipart request is malformed or sends the file in the wrong field. |
| 400 | BAD_REQUEST | Anything else wrong with the request, such as a bad query parameter. |
| 413 | FILE_TOO_LARGE | The image is over 20 MB. |
| 413 | PAYLOAD_TOO_LARGE | The JSON body is over 100 KB. |
| 415 | UNSUPPORTED_FILE_TYPE | The file is not an image. |
| 429 | RATE_LIMITED | Too many requests. See Rate limits. |
| 502 | EXPORT_FETCH_FAILED | The stored images could not be fetched to build the ZIP. Try again. |
Plan limits
| Limit | Free | Pro |
|---|---|---|
| API access | None | Up to 5 keys |
| Sheets per month | 5 | Unlimited |
| Export upscale (scale) | Up to 2× | Up to 4× |
- Free accounts cannot create API keys: creating one answers
403 PLAN_REQUIRED. A sixth active key on Pro answers403 PLAN_LIMIT; revoke one to make room. - Each upload counts as a sheet, the same count the web app uses, shown in
sheetsonGET /me. - Other limits: 20 MB per image, 64 to 12,000 pixels per side, 100 KB per JSON body, 1,000 boxes per crop.
- If your Pro period ends, requests with your keys answer
403 PLAN_REQUIRED. Jobs you already started are not lost, but you cannot reach them through the API until you are on Pro again.
See Pricing for the plans.