{"openapi":"3.1.0","info":{"title":"SciFig API","version":"1.0.0","description":"Create scientific figures, data charts and flowcharts. Documentation: https://scifig.ai/docs/api"},"servers":[{"url":"https://scifig.ai/api/v1"}],"components":{"headers":{"XRequestId":{"description":"Unique id of this request. Quote it when contacting support.","schema":{"type":"string","format":"uuid"}},"XRateLimitLimit":{"description":"Requests allowed in the current one-minute window (the tightest window that applies).","schema":{"type":"integer"}},"XRateLimitRemaining":{"description":"Requests left in that window.","schema":{"type":"integer"}},"XRateLimitReset":{"description":"When that window resets, in Unix seconds.","schema":{"type":"integer"}},"RetryAfter":{"description":"Seconds to wait before the next attempt. Retry a create request with the same Idempotency-Key.","schema":{"type":"integer","minimum":1}},"Location":{"description":"The job to poll, e.g. /api/v1/jobs/{id}.","schema":{"type":"string","format":"uri-reference"}}},"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"API key (sk_live_…) or OAuth access token (sf_at_…)."}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":1,"maxLength":255}},"Prefer":{"name":"Prefer","in":"header","required":false,"description":"wait=N (1–30): hold the response until the job finishes or N seconds pass.","schema":{"type":"string"}}},"schemas":{"Job":{"type":"object","required":["id","kind","status","created_at","credits","outputs","error"],"properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["image_generation","image_edit","image_upscale","image_conversion","chart","flowchart"]},"status":{"type":"string","enum":["queued","processing","succeeded","failed","canceled"]},"created_at":{"type":"string","format":"date-time"},"credits":{"type":"object","properties":{"reserved":{"type":"integer"},"charged":{"type":"integer"},"refunded":{"type":"integer"}}},"outputs":{"type":"array","items":{"type":"object","properties":{"file_id":{"type":"string","format":"uuid"},"format":{"type":"string"},"download_url":{"type":"string","format":"uri"},"expires_at":{"type":"string","format":"date-time"},"width":{"type":"integer","minimum":1,"description":"Pixel width, when the output is a raster image."},"height":{"type":"integer","minimum":1,"description":"Pixel height, when the output is a raster image."},"editor_url":{"type":"string","format":"uri","description":"Charts and flowcharts: opens the conversation in the SciFig web editor (the signed-in owner only)."}}}},"error":{"oneOf":[{"type":"null"},{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object"}}}]},"late_delivery_until":{"type":"string","format":"date-time"}}},"TextDetection":{"type":"object","required":["id","object","width","height","texts"],"properties":{"id":{"type":"string","format":"uuid"},"object":{"const":"text_detection"},"width":{"type":"integer"},"height":{"type":"integer"},"texts":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"text":{"type":"string"},"corners":{"type":"array","items":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}}}}}}}}},"Error":{"type":"object","properties":{"error":{"type":"object","required":["code","message","request_id"],"properties":{"code":{"type":"string","enum":["UNAUTHORIZED","ACCOUNT_UNAVAILABLE","SCOPE_DENIED","INVALID_REQUEST","IDEMPOTENCY_KEY_REQUIRED","IDEMPOTENCY_CONFLICT","IDEMPOTENCY_IN_PROGRESS","NOT_FOUND","REVISION_CONFLICT","PAYLOAD_TOO_LARGE","INSUFFICIENT_CREDITS","CONTENT_REJECTED","PLAN_REQUIRED","RATE_LIMITED","CONCURRENCY_LIMITED","SERVICE_UNAVAILABLE","TASK_FAILED","INTERNAL_ERROR"]},"message":{"type":"string"},"request_id":{"type":"string"},"details":{"type":"object","properties":{"reason":{"type":"string","description":"Finer cause for some codes. New values may be added.","examples":["VALIDATION_FAILED","DAILY_CONVERSION_LIMIT","HOURLY_LIMIT_REACHED","FILE_TOO_LARGE"]},"top_up_url":{"type":"string","format":"uri"},"max_bytes":{"type":"integer"}}}}}}}},"responses":{"Error":{"description":"Error. Branch on error.code; never parse message. 503 responses carry Retry-After.","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"INVALID_REQUEST","message":"The request is invalid.","request_id":"c0a8012e-5f3b-4a91-8d2c-6e7f9b1a3d45","details":{"reason":"VALIDATION_FAILED"}}}}}},"PayloadTooLarge":{"description":"The request body or an uploaded file is over the limit (details.max_bytes).","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"PAYLOAD_TOO_LARGE","message":"The request body is too large.","request_id":"c0a8012e-5f3b-4a91-8d2c-6e7f9b1a3d45","details":{"max_bytes":1048576}}}}}},"InsufficientCredits":{"description":"Not enough credits. No job is created; top up or upgrade, then send a new request with a new Idempotency-Key.","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"INSUFFICIENT_CREDITS","message":"Not enough credits.","request_id":"c0a8012e-5f3b-4a91-8d2c-6e7f9b1a3d45","details":{"top_up_url":"https://scifig.ai/pricing?utm_source=api"}}}}}},"RateLimited":{"description":"RATE_LIMITED (per-minute window, or a daily limit named in details.reason, e.g. DAILY_CONVERSION_LIMIT) or CONCURRENCY_LIMITED (too many running tasks). Wait Retry-After seconds and retry with the same Idempotency-Key.","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"perMinute":{"value":{"error":{"code":"RATE_LIMITED","message":"Too many requests.","request_id":"c0a8012e-5f3b-4a91-8d2c-6e7f9b1a3d45"}}},"dailyConversions":{"value":{"error":{"code":"RATE_LIMITED","message":"Too many requests.","request_id":"c0a8012e-5f3b-4a91-8d2c-6e7f9b1a3d45","details":{"reason":"DAILY_CONVERSION_LIMIT","limit":200}}}},"concurrency":{"value":{"error":{"code":"CONCURRENCY_LIMITED","message":"Too many tasks are running for this account.","request_id":"c0a8012e-5f3b-4a91-8d2c-6e7f9b1a3d45"}}}}}}}}},"paths":{"/images/generations":{"post":{"summary":"Generate a scientific illustration","security":[{"bearer":["figures:generate"]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Prefer"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"prompt":{"type":"string","minLength":3,"maxLength":20000},"aspect_ratio":{"default":"1:1","type":"string","enum":["1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9","21:9"]},"quality":{"default":"standard","type":"string","enum":["standard","advanced","premium"]},"style":{"type":"string","enum":["flat","2-5d","line-art","hand-drawn","scientific","line","3d","editorial","sketch","watercolor","auto"]},"palette":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"minItems":1,"maxItems":4,"type":"array","items":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"}}]},"reference_file_ids":{"minItems":1,"maxItems":3,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["prompt"],"additionalProperties":false}}}},"responses":{"200":{"description":"Finished job","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"succeeded","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":50,"refunded":0},"outputs":[{"file_id":"0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60","format":"png","download_url":"https://scifig.ai/api/v1/files/0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60?exp=1760432400&sig=…","expires_at":"2026-10-14T09:00:00.000Z","width":2048,"height":1536}],"error":null}}}},"202":{"description":"Job accepted and still running. Poll the Location URL after Retry-After seconds.","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"},"Location":{"$ref":"#/components/headers/Location"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"processing","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":0,"refunded":0},"outputs":[],"error":null}}}},"402":{"$ref":"#/components/responses/InsufficientCredits"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"default":{"$ref":"#/components/responses/Error"}}}},"/images/edits":{"post":{"summary":"Edit an image","security":[{"bearer":["figures:generate"]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Prefer"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","anyOf":[{"type":"object","properties":{"operation":{"default":"instruct","type":"string","const":"instruct"},"image":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"instruction":{"type":"string","minLength":1,"maxLength":2000},"mask":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"quality":{"default":"standard","type":"string","enum":["standard","advanced","premium"]}},"required":["image","instruction"],"additionalProperties":false},{"type":"object","properties":{"operation":{"type":"string","const":"white_background"},"image":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"quality":{"default":"standard","type":"string","enum":["standard","advanced","premium"]}},"required":["operation","image"],"additionalProperties":false},{"type":"object","properties":{"operation":{"type":"string","const":"aspect_ratio"},"image":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"aspect_ratio":{"type":"string","enum":["1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9","21:9"]},"quality":{"default":"standard","type":"string","enum":["standard","advanced","premium"]}},"required":["operation","image","aspect_ratio"],"additionalProperties":false},{"type":"object","properties":{"operation":{"type":"string","const":"recolor"},"image":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"palette":{"minItems":1,"maxItems":8,"type":"array","items":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"}},"quality":{"default":"standard","type":"string","enum":["standard","advanced","premium"]}},"required":["operation","image"],"additionalProperties":false},{"type":"object","properties":{"operation":{"type":"string","const":"replace_text"},"image":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"text_detection":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"replacements":{"minItems":1,"maxItems":256,"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0,"maximum":255},"text":{"type":"string","minLength":1,"maxLength":500}},"required":["index","text"],"additionalProperties":false}}},"required":["operation","image","text_detection","replacements"],"additionalProperties":false}]}}}},"responses":{"200":{"description":"Finished job","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"succeeded","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":50,"refunded":0},"outputs":[{"file_id":"0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60","format":"png","download_url":"https://scifig.ai/api/v1/files/0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60?exp=1760432400&sig=…","expires_at":"2026-10-14T09:00:00.000Z","width":2048,"height":1536}],"error":null}}}},"202":{"description":"Job accepted and still running. Poll the Location URL after Retry-After seconds.","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"},"Location":{"$ref":"#/components/headers/Location"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"processing","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":0,"refunded":0},"outputs":[],"error":null}}}},"402":{"$ref":"#/components/responses/InsufficientCredits"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"default":{"$ref":"#/components/responses/Error"}}}},"/images/text-detections":{"post":{"summary":"Detect the text in an image (free; use with the replace_text edit)","security":[{"bearer":["figures:generate"]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"image":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["image"],"additionalProperties":false}}}},"responses":{"200":{"description":"Detected text, in reading order","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TextDetection"},"example":{"id":"5e2d7c91-3b48-4f0a-a6d1-9c8e2f4b7a30","object":"text_detection","width":2048,"height":1536,"texts":[{"index":0,"text":"Nucleus","corners":[{"x":812,"y":404},{"x":1010,"y":404},{"x":1010,"y":452},{"x":812,"y":452}]}]}}}},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"default":{"$ref":"#/components/responses/Error"}}}},"/images/upscales":{"post":{"summary":"Upscale an image","security":[{"bearer":["figures:generate"]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Prefer"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"image":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"scale":{"type":"string","enum":["2k","4k","8k"]}},"required":["image","scale"],"additionalProperties":false}}}},"responses":{"200":{"description":"Finished job","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"succeeded","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":50,"refunded":0},"outputs":[{"file_id":"0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60","format":"png","download_url":"https://scifig.ai/api/v1/files/0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60?exp=1760432400&sig=…","expires_at":"2026-10-14T09:00:00.000Z","width":2048,"height":1536}],"error":null}}}},"202":{"description":"Job accepted and still running. Poll the Location URL after Retry-After seconds.","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"},"Location":{"$ref":"#/components/headers/Location"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"processing","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":0,"refunded":0},"outputs":[],"error":null}}}},"402":{"$ref":"#/components/responses/InsufficientCredits"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"default":{"$ref":"#/components/responses/Error"}}}},"/images/conversions":{"post":{"summary":"Convert an image","security":[{"bearer":["figures:generate"]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Prefer"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"image":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"format":{"type":"string","enum":["svg","png","pdf","tiff","pptx"]},"vector_mode":{"type":"string","enum":["editable_text","full_vector"]},"dpi":{"anyOf":[{"type":"number","const":300},{"type":"number","const":600},{"type":"number","const":1000}]},"width":{"type":"integer","minimum":256,"maximum":4096}},"required":["image","format"],"additionalProperties":false}}}},"responses":{"200":{"description":"Finished job","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"succeeded","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":50,"refunded":0},"outputs":[{"file_id":"0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60","format":"png","download_url":"https://scifig.ai/api/v1/files/0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60?exp=1760432400&sig=…","expires_at":"2026-10-14T09:00:00.000Z","width":2048,"height":1536}],"error":null}}}},"202":{"description":"Job accepted and still running. Poll the Location URL after Retry-After seconds.","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"},"Location":{"$ref":"#/components/headers/Location"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"processing","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":0,"refunded":0},"outputs":[],"error":null}}}},"402":{"$ref":"#/components/responses/InsufficientCredits"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"default":{"$ref":"#/components/responses/Error"}}}},"/charts/generations":{"post":{"summary":"Plot a chart from data","security":[{"bearer":["figures:generate"]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Prefer"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"data":{"type":"string","format":"binary","description":"CSV, TSV, XLSX or XLS, up to 8 MB."},"request":{"type":"string","minLength":1,"maxLength":16000},"chart_types":{"type":"string","description":"Comma-separated chart types."},"journal_style":{"default":"default","type":"string","enum":["default","nature","science","cell","plos","acs"]},"figure_width":{"default":"double","type":"string","enum":["single","onehalf","double"]},"color_palette":{"default":"okabe_ito","type":"string","enum":["okabe_ito","wong","tol_bright","tol_muted","nature","science","nejm","lancet","jama"]},"sheet_name":{"type":"string","minLength":1,"maxLength":255}},"required":["data","request"],"additionalProperties":false}}}},"responses":{"200":{"description":"Finished job","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"succeeded","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":50,"refunded":0},"outputs":[{"file_id":"0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60","format":"png","download_url":"https://scifig.ai/api/v1/files/0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60?exp=1760432400&sig=…","expires_at":"2026-10-14T09:00:00.000Z","width":2048,"height":1536}],"error":null}}}},"202":{"description":"Job accepted and still running. Poll the Location URL after Retry-After seconds.","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"},"Location":{"$ref":"#/components/headers/Location"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"processing","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":0,"refunded":0},"outputs":[],"error":null}}}},"402":{"$ref":"#/components/responses/InsufficientCredits"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"default":{"$ref":"#/components/responses/Error"}}}},"/charts/edits":{"post":{"summary":"Edit the latest version of a chart","security":[{"bearer":["figures:generate"]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Prefer"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"job":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"instruction":{"type":"string","minLength":1,"maxLength":16000}},"required":["job","instruction"],"additionalProperties":false}}}},"responses":{"200":{"description":"Finished job","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"succeeded","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":50,"refunded":0},"outputs":[{"file_id":"0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60","format":"png","download_url":"https://scifig.ai/api/v1/files/0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60?exp=1760432400&sig=…","expires_at":"2026-10-14T09:00:00.000Z","width":2048,"height":1536}],"error":null}}}},"202":{"description":"Job accepted and still running. Poll the Location URL after Retry-After seconds.","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"},"Location":{"$ref":"#/components/headers/Location"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"processing","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":0,"refunded":0},"outputs":[],"error":null}}}},"402":{"$ref":"#/components/responses/InsufficientCredits"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"default":{"$ref":"#/components/responses/Error"}}}},"/flowcharts/generations":{"post":{"summary":"Draw a flowchart","security":[{"bearer":["figures:generate"]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Prefer"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"prompt":{"type":"string","minLength":1,"maxLength":8000},"aspect_ratio":{"default":"auto","type":"string","enum":["auto","16:9","1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","21:9"]},"attachment_file_ids":{"default":[],"maxItems":8,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["prompt"],"additionalProperties":false}}}},"responses":{"200":{"description":"Finished job","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"succeeded","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":50,"refunded":0},"outputs":[{"file_id":"0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60","format":"png","download_url":"https://scifig.ai/api/v1/files/0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60?exp=1760432400&sig=…","expires_at":"2026-10-14T09:00:00.000Z","width":2048,"height":1536}],"error":null}}}},"202":{"description":"Job accepted and still running. Poll the Location URL after Retry-After seconds.","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"},"Location":{"$ref":"#/components/headers/Location"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"processing","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":0,"refunded":0},"outputs":[],"error":null}}}},"402":{"$ref":"#/components/responses/InsufficientCredits"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"default":{"$ref":"#/components/responses/Error"}}}},"/flowcharts/edits":{"post":{"summary":"Edit the latest version of a flowchart","security":[{"bearer":["figures:generate"]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Prefer"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"job":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"instruction":{"type":"string","minLength":1,"maxLength":8000}},"required":["job","instruction"],"additionalProperties":false}}}},"responses":{"200":{"description":"Finished job","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"succeeded","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":50,"refunded":0},"outputs":[{"file_id":"0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60","format":"png","download_url":"https://scifig.ai/api/v1/files/0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60?exp=1760432400&sig=…","expires_at":"2026-10-14T09:00:00.000Z","width":2048,"height":1536}],"error":null}}}},"202":{"description":"Job accepted and still running. Poll the Location URL after Retry-After seconds.","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"},"Location":{"$ref":"#/components/headers/Location"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"processing","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":0,"refunded":0},"outputs":[],"error":null}}}},"402":{"$ref":"#/components/responses/InsufficientCredits"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"default":{"$ref":"#/components/responses/Error"}}}},"/files":{"post":{"summary":"Upload a file","security":[{"bearer":["figures:generate"]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"},"purpose":{"type":"string","enum":["image","mask","flowchart_attachment"],"default":"image"}}}}}},"responses":{"201":{"description":"Uploaded","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","required":["file_id","purpose","content_type","size_bytes","expires_at","created_at"],"properties":{"file_id":{"type":"string","format":"uuid"},"purpose":{"type":"string"},"content_type":{"type":"string"},"size_bytes":{"type":"integer"},"expires_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"}}},"example":{"file_id":"3f6a2d81-9c4b-4e7a-b0d5-1a8e6c2f9b47","purpose":"image","content_type":"image/png","size_bytes":482113,"expires_at":"2026-10-21T08:00:00.000Z","created_at":"2026-10-14T08:00:00.000Z"}}}},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimited"},"default":{"$ref":"#/components/responses/Error"}}}},"/files/{file_id}":{"get":{"summary":"Download a file","security":[{"bearer":["figures:read"]},{}],"parameters":[{"name":"file_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sig","in":"query","required":false,"schema":{"type":"string"}},{"name":"exp","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"}},"content":{"application/json":{"schema":{"type":"string","format":"binary"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"default":{"$ref":"#/components/responses/Error"}}}},"/jobs/{id}":{"get":{"summary":"Get a job","security":[{"bearer":["figures:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"succeeded","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":50,"refunded":0},"outputs":[{"file_id":"0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60","format":"png","download_url":"https://scifig.ai/api/v1/files/0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60?exp=1760432400&sig=…","expires_at":"2026-10-14T09:00:00.000Z","width":2048,"height":1536}],"error":null}}}},"429":{"$ref":"#/components/responses/RateLimited"},"default":{"$ref":"#/components/responses/Error"}}}},"/jobs":{"get":{"summary":"List recent jobs","security":[{"bearer":["figures:read"]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":20,"default":10}},{"name":"cursor","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Job"}},"next_cursor":{"type":["string","null"]}}},"example":{"data":[{"id":"7b3f9a52-1c4e-4d8a-9f61-2e5b8c0d4a17","kind":"image_generation","status":"succeeded","created_at":"2026-10-14T08:00:00.000Z","credits":{"reserved":50,"charged":50,"refunded":0},"outputs":[{"file_id":"0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60","format":"png","download_url":"https://scifig.ai/api/v1/files/0d9c4b8e-6a2f-4f17-b3e5-8c1a7d2e9f60?exp=1760432400&sig=…","expires_at":"2026-10-14T09:00:00.000Z","width":2048,"height":1536}],"error":null}],"next_cursor":null}}}},"429":{"$ref":"#/components/responses/RateLimited"},"default":{"$ref":"#/components/responses/Error"}}}},"/credits":{"get":{"summary":"Credit balance, plan and limits","security":[{"bearer":["figures:read"]}],"parameters":[],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"},"X-RateLimit-Limit":{"$ref":"#/components/headers/XRateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/XRateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/XRateLimitReset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"balance":{"type":"integer"},"reserved":{"type":"integer"},"plan":{"type":"string"},"plan_level":{"type":"integer"},"limits":{"type":"object","properties":{"concurrent_tasks":{"type":"integer"},"tasks_per_hour":{"type":"integer"}}},"top_up_url":{"type":"string","format":"uri"}}},"example":{"balance":1950,"reserved":50,"plan":"starter","plan_level":1,"limits":{"concurrent_tasks":5,"tasks_per_hour":200},"top_up_url":"https://scifig.ai/pricing?utm_source=api"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"default":{"$ref":"#/components/responses/Error"}}}},"/pricing":{"get":{"summary":"Credit prices","security":[],"responses":{"200":{"description":"OK","headers":{"X-Request-Id":{"$ref":"#/components/headers/XRequestId"}}}}}},"/openapi.yaml":{"get":{"summary":"This document as YAML","security":[],"responses":{"200":{"description":"OK"}}}},"/openapi.json":{"get":{"summary":"This document","security":[],"responses":{"200":{"description":"OK"}}}}}}