{"openapi":"3.1.0","info":{"title":"Automatica API","version":"v1","description":"Generate images and videos with AI models, read your library and run templates, with the same abilities the Automatica MCP server offers. Generations are paid for in tokens and run asynchronously: start one, then poll it until it has finished.","x-rate-limits":{"requests_per_minute":120,"generations_per_minute":10,"uploads_per_minute":20},"x-pagination":{"default_per_page":15,"max_per_page":50,"description":"List endpoints take page and per_page and answer {data, meta}; meta.last_page says when you have everything."},"x-idempotency":{"field":"idempotency_key","description":"Send a UUID of your own when starting a generation. Retrying with the same key returns the generation it started (200) instead of starting another (201)."}},"servers":[{"url":"https:\/\/automaticaapp.com\/api\/v1"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Account","description":"Your plan, token balance and profile picture."},{"name":"Models","description":"The models you can generate with, their settings and prices."},{"name":"Generations","description":"Start generations and follow them to the end."},{"name":"Artifacts","description":"The images and videos in your library."},{"name":"Templates","description":"Prompt templates in your library and on Explore."},{"name":"Uploads","description":"Reference images and videos for generations."}],"paths":{"\/openapi.json":{"get":{"operationId":"getOpenApiDocument","tags":["Account"],"summary":"This document","security":[],"responses":{"200":{"description":"The OpenAPI 3.1 document.","content":{"application\/json":{"schema":{"type":"object"}}}}}}},"\/account":{"get":{"operationId":"getAccount","tags":["Account"],"summary":"Your plan and token balance","description":"balance is what you hold, reserved is held by generations still in progress, and available is what a new generation can spend.","x-required-scope":"api:read","responses":{"200":{"description":"Your account.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Account"},"example":{"username":"ada","plan":"Creator","credits":{"balance":1200,"reserved":8,"available":1192},"profile_picture":{"set":true,"shown":true}}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/account\/profile-picture":{"put":{"operationId":"setProfilePicture","tags":["Account"],"summary":"Make one of your images your profile picture","description":"Send artifact_id for an image you generated (not one you saved from someone else), or upload_id for an image in your uploads. Your profile picture shows beside your name on everything you publish, so this also turns it on. The image itself is left as it is: the picture is a copy, scaled down. Setting the same image again changes nothing.","x-required-scope":"api:write","requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SetProfilePictureRequest"},"example":{"artifact_id":"9d2f7a8e-5a0b-4c7e-9a2c-0f1d4e6b8c21"}}}},"responses":{"200":{"description":"Your account, with the picture set and shown.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Account"},"example":{"username":"ada","plan":"Creator","credits":{"balance":1200,"reserved":8,"available":1192},"profile_picture":{"set":true,"shown":true}}}}},"403":{"description":"You did not generate this image, or the token lacks the scope.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Not in your library or uploads.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"errors.artifact_id or errors.upload_id: neither or both sent, not a UUID, or not an image.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/models":{"get":{"operationId":"listModels","tags":["Models"],"summary":"List the models you can generate with","description":"price is in tokens: per is the unit one rate buys and from\/to are the cheapest and dearest rates the settings can select. A model that takes media may name an edit_model or image_to_video_model to use when you attach an image or video.","x-required-scope":"api:read","parameters":[{"name":"type","in":"query","required":false,"description":"Only models that produce this kind of media.","schema":{"type":"string","enum":["image","video"]}}],"responses":{"200":{"description":"The models, unpaginated.","content":{"application\/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/ModelSummary"}}}}}}},"422":{"description":"type is not image or video.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/models\/{model}":{"get":{"operationId":"getModel","tags":["Models"],"summary":"A model with its settings and prices","description":"settings lists each setting by field name with its options or range and default. pricing.options pairs each combination of the settings that affect price with its rate in tokens; the total also multiplies by the number of outputs.","x-required-scope":"api:read","parameters":[{"name":"model","in":"path","required":true,"description":"A model key from the list, including an edit_model or image_to_video_model key.","schema":{"type":"string"}}],"responses":{"200":{"description":"The model.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ModelDetail"}}}},"404":{"description":"No such model, or it has no active price.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/generations\/estimate":{"post":{"operationId":"estimateGeneration","tags":["Generations"],"summary":"Price a generation before starting it","description":"Nothing is generated or charged. For a model that edits an input video, give artifact_id or upload_id so the price uses that video's duration.","x-required-scope":"api:read","requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/EstimateRequest"},"example":{"model":"fal-veo-3.1","settings":{"duration":"4s","resolution":"720p","generate_audio":false}}}}},"responses":{"200":{"description":"The price against your token balance.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Estimate"},"example":{"credits":40,"outputs":1,"duration_seconds":4,"available_credits":1192,"affordable":true}}}},"422":{"description":"Unknown model (errors.model), unknown or unpriced settings (errors.settings), or an unusable input video.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/generations":{"post":{"operationId":"createGeneration","tags":["Generations"],"summary":"Start a generation","description":"Spends tokens when it succeeds. The answer has status processing: poll GET \/generations\/{generation} for the outcome rather than calling this again. Images usually finish within a minute and videos within a few. Up to 10 generations may be started a minute.","x-required-scope":"api:write","requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/CreateGenerationRequest"},"example":{"model":"fal-flux-pro","prompt":"A copper kettle on a slate worktop, morning light","settings":{"num_images":2},"idempotency_key":"6f9619ff-8b86-4d01-b42d-00cf4fc964ff"}}}},"responses":{"201":{"description":"The generation started.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Generation"},"example":{"id":"4c1b7e52-2a9f-4d3b-8e6a-1f2c3d4e5f60","status":"processing","model":"fal-flux-pro","prompt":"A copper kettle on a slate worktop, morning light","settings":{"num_images":2},"outputs":2,"cost":8,"created_at":"2026-10-10T09:12:44+00:00"}}}},"200":{"description":"The idempotency key was seen before: the generation it started.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Generation"},"example":{"id":"4c1b7e52-2a9f-4d3b-8e6a-1f2c3d4e5f60","status":"processing","model":"fal-flux-pro","prompt":"A copper kettle on a slate worktop, morning light","settings":{"num_images":2},"outputs":2,"cost":8,"created_at":"2026-10-10T09:12:44+00:00"}}}},"402":{"description":"Not enough tokens.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/InsufficientCredits"},"example":{"message":"Insufficient balance. You have 8 tokens reserved for queued generations. Please wait or top up.","required":16,"available":10,"pending_costs":8,"shortfall":6}}}},"422":{"description":"Validation failed: errors.model, errors.settings, errors.media_inputs or errors.idempotency_key say why.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Too many generations started this minute, or too many requests. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/generations\/{generation}":{"get":{"operationId":"getGeneration","tags":["Generations"],"summary":"Check on a generation","description":"status is processing until it is over; then succeeded with its artifacts, failed or moderated with error saying why, or cancelled. Only a generation that succeeded is charged. Poll every 10 to 20 seconds.","x-required-scope":"api:read","parameters":[{"name":"generation","in":"path","required":true,"description":"The generation id.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The generation.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Generation"},"example":{"id":"4c1b7e52-2a9f-4d3b-8e6a-1f2c3d4e5f60","status":"succeeded","model":"fal-flux-pro","prompt":"A copper kettle on a slate worktop, morning light","settings":{"num_images":2},"outputs":2,"cost":8,"created_at":"2026-10-10T09:12:44+00:00","finished_at":"2026-10-10T09:13:20+00:00","artifacts":[{"id":"9d2f7a8e-5a0b-4c7e-9a2c-0f1d4e6b8c21","type":"image","model":"fal-flux-pro","prompt":"A copper kettle on a slate worktop, morning light","creator":"ada","width":1024,"height":768,"created_at":"2026-10-10T09:12:44+00:00","app_url":"https:\/\/automatica.example\/artifacts?artifact=9d2f7a8e-5a0b-4c7e-9a2c-0f1d4e6b8c21"}]}}}},"404":{"description":"Not one of your generations.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/artifacts":{"get":{"operationId":"listArtifacts","tags":["Artifacts"],"summary":"List or search your library","description":"Everything you generated plus anything you saved from other people. search matches by meaning and keyword and ranks by relevance; without it, results are newest first. prompt is cut short here and missing for artifacts made from someone else's template.","x-required-scope":"api:read","parameters":[{"name":"search","in":"query","required":false,"description":"What the artifact shows, in plain words.","schema":{"type":"string","maxLength":255}},{"name":"type","in":"query","required":false,"description":"Only this kind of media.","schema":{"type":"string","enum":["image","video"]}},{"name":"model","in":"query","required":false,"description":"Only artifacts generated with this model key.","schema":{"type":"string"}},{"name":"ownership","in":"query","required":false,"description":"mine for what you generated, imported for what you saved from others.","schema":{"type":"string","enum":["mine","imported"]}},{"name":"liked","in":"query","required":false,"description":"Only artifacts you liked.","schema":{"type":"boolean"}},{"name":"sort","in":"query","required":false,"description":"Ignored when searching.","schema":{"type":"string","enum":["newest","oldest"],"default":"newest"}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"per_page","in":"query","required":false,"description":"Results per page.","schema":{"type":"integer","minimum":1,"maximum":50,"default":15}}],"responses":{"200":{"description":"A page of artifacts.","content":{"application\/json":{"schema":{"type":"object","description":"A page of artifacts.","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/ArtifactSummary"}},"meta":{"$ref":"#\/components\/schemas\/Pagination"}}},"example":{"data":[{"id":"9d2f7a8e-5a0b-4c7e-9a2c-0f1d4e6b8c21","type":"image","model":"fal-flux-pro","prompt":"A copper kettle on a slate worktop, morning light","creator":"ada","width":1024,"height":768,"created_at":"2026-10-10T09:12:44+00:00","app_url":"https:\/\/automatica.example\/artifacts?artifact=9d2f7a8e-5a0b-4c7e-9a2c-0f1d4e6b8c21"}],"meta":{"page":1,"per_page":15,"total":1,"last_page":1}}}}},"422":{"description":"A filter or page parameter is invalid.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/artifacts\/{artifact}":{"get":{"operationId":"getArtifact","tags":["Artifacts"],"summary":"One artifact with its prompt and settings","description":"cost is the tokens this output cost. prompt is missing when the artifact came from someone else's template; template names it and template_variables holds what was filled in.","x-required-scope":"api:read","parameters":[{"name":"artifact","in":"path","required":true,"description":"The artifact id.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The artifact.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ArtifactDetail"},"example":{"id":"9d2f7a8e-5a0b-4c7e-9a2c-0f1d4e6b8c21","type":"image","model":"fal-flux-pro","prompt":"A copper kettle on a slate worktop, morning light","creator":"ada","width":1024,"height":768,"created_at":"2026-10-10T09:12:44+00:00","app_url":"https:\/\/automatica.example\/artifacts?artifact=9d2f7a8e-5a0b-4c7e-9a2c-0f1d4e6b8c21","settings":{"num_images":2},"mime_type":"image\/png","cost":4,"can_create_template":true}}}},"404":{"description":"Not in your library.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}},"delete":{"operationId":"deleteArtifact","tags":["Artifacts"],"summary":"Remove an artifact from your library","description":"An artifact you generated also comes off Explore; one you saved from someone else leaves their copy alone. The artifact itself is deleted once nobody holds it. There is no undo.","x-required-scope":"api:write","parameters":[{"name":"artifact","in":"path","required":true,"description":"The artifact id.","schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Removed."},"404":{"description":"Not in your library.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/artifacts\/{artifact}\/publish":{"post":{"operationId":"publishArtifact","tags":["Artifacts"],"summary":"Put an artifact on Explore","description":"Works for artifacts you generated, not ones you saved from someone else. An output of a generation that made several joins that group's Explore entry and becomes its cover. Its prompt and any reference media become visible with it. Publishing again changes nothing.","x-required-scope":"api:write","parameters":[{"name":"artifact","in":"path","required":true,"description":"The artifact id.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The artifact, with published_at.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ArtifactDetail"},"example":{"id":"9d2f7a8e-5a0b-4c7e-9a2c-0f1d4e6b8c21","type":"image","model":"fal-flux-pro","prompt":"A copper kettle on a slate worktop, morning light","creator":"ada","width":1024,"height":768,"created_at":"2026-10-10T09:12:44+00:00","app_url":"https:\/\/automatica.example\/artifacts?artifact=9d2f7a8e-5a0b-4c7e-9a2c-0f1d4e6b8c21","published_at":"2026-10-10T09:15:02+00:00","settings":{"num_images":2},"mime_type":"image\/png","cost":4,"can_create_template":true}}}},"403":{"description":"You did not generate this artifact, or the token lacks the scope.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Not in your library.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/artifacts\/{artifact}\/unpublish":{"post":{"operationId":"unpublishArtifact","tags":["Artifacts"],"summary":"Take an artifact off Explore","description":"It stays in your library and in the libraries of anyone who saved it. Unpublishing again changes nothing.","x-required-scope":"api:write","parameters":[{"name":"artifact","in":"path","required":true,"description":"The artifact id.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The artifact, without published_at.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ArtifactDetail"}}}},"403":{"description":"You did not generate this artifact, or the token lacks the scope.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Not in your library.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/artifacts\/{artifact}\/media":{"get":{"operationId":"getArtifactMedia","tags":["Artifacts"],"summary":"Temporary links to the file and its preview","description":"download_url serves the original with a download disposition and preview_url a small image (a video's first frame). Both expire at expires_at: use them straight away and call again for new ones. preview_url is null until the preview has been made.","x-required-scope":"api:read","parameters":[{"name":"artifact","in":"path","required":true,"description":"The artifact id.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The links.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MediaLinks"},"example":{"id":"9d2f7a8e-5a0b-4c7e-9a2c-0f1d4e6b8c21","type":"image","mime_type":"image\/png","bytes":482133,"width":1024,"height":768,"duration_ms":null,"download_url":"https:\/\/storage.example\/artifacts\/9d2f7a8e.png?X-Amz-Signature=...","preview_url":"https:\/\/storage.example\/thumbnails\/9d2f7a8e.webp?X-Amz-Signature=...","expires_at":"2026-10-10T09:43:20+00:00"}}}},"404":{"description":"Not in your library.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/artifacts\/{artifact}\/download":{"get":{"operationId":"downloadArtifact","tags":["Artifacts"],"summary":"Download the file","description":"Redirects to a temporary link for the original, so `curl -L -o out.png` saves it in one call.","x-required-scope":"api:read","parameters":[{"name":"artifact","in":"path","required":true,"description":"The artifact id.","schema":{"type":"string","format":"uuid"}}],"responses":{"302":{"description":"Redirect to the file.","headers":{"Location":{"description":"The temporary file URL.","schema":{"type":"string","format":"uri"}}}},"404":{"description":"Not in your library.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/templates":{"get":{"operationId":"listTemplates","tags":["Templates"],"summary":"List or search templates","description":"scope library (the default) is your own templates, drafts included, plus those you saved; scope explore is everything published to Explore. runnable is false for an unfinished draft.","x-required-scope":"api:read","parameters":[{"name":"scope","in":"query","required":false,"description":"Which templates.","schema":{"type":"string","enum":["library","explore"],"default":"library"}},{"name":"search","in":"query","required":false,"description":"What the template is for, in plain words.","schema":{"type":"string","maxLength":255}},{"name":"model","in":"query","required":false,"description":"Only templates built on this model key.","schema":{"type":"string"}},{"name":"ownership","in":"query","required":false,"description":"Library only: mine for templates you created, imported for ones you saved.","schema":{"type":"string","enum":["mine","imported"]}},{"name":"status","in":"query","required":false,"description":"Library only: published for templates on Explore, unpublished for the rest.","schema":{"type":"string","enum":["published","unpublished"]}},{"name":"view","in":"query","required":false,"description":"Explore only: the order when not searching.","schema":{"type":"string","enum":["top","rising","recent"],"default":"top"}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"per_page","in":"query","required":false,"description":"Results per page.","schema":{"type":"integer","minimum":1,"maximum":50,"default":15}}],"responses":{"200":{"description":"A page of templates.","content":{"application\/json":{"schema":{"type":"object","description":"A page of templates.","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/TemplateSummary"}},"meta":{"$ref":"#\/components\/schemas\/Pagination"}}}}}},"422":{"description":"A filter or page parameter is invalid.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}},"post":{"operationId":"createTemplate","tags":["Templates"],"summary":"Save a template to your library","description":"Base it on one of your own generations with artifact_id, which copies that generation's model, settings, prompt and attached media, or describe it from scratch with model, settings and prompt. Mark each blank in the prompt as {{id}} and declare it in variables under the same id. The template stays private until you publish it on the site. Nothing is generated or charged.","x-required-scope":"api:write","requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/CreateTemplateRequest"},"example":{"title":"Kettle shots","model":"fal-nano-banana-edit","settings":{"num_images":2},"prompt":"A {{subject}} on a {{surface}}, studio lit","variables":[{"id":"subject","label":"Subject","placeholder":"copper kettle"},{"id":"surface","label":"Surface"}],"media_inputs":[{"slot":"reference_images","label":"Your product"}]}}}},"responses":{"201":{"description":"The template.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/TemplateDetail"}}}},"403":{"description":"The generation was made with someone else's prompt.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"Validation failed: errors.variables, errors.model, errors.settings, errors.media_inputs or errors.artifact_id say why.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/templates\/{template}":{"get":{"operationId":"getTemplate","tags":["Templates"],"summary":"What a template asks you to fill in","description":"variables are its text blanks and media_inputs the images or videos it asks for; keep their ids, a run is keyed by them. prompt and settings are returned only to the template's creator. cost is the tokens one run spends; it is missing when the price depends on the input video.","x-required-scope":"api:read","parameters":[{"name":"template","in":"path","required":true,"description":"The template id.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The template.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/TemplateDetail"},"example":{"id":"2b7e1f4a-9c3d-4e5f-8a6b-7c8d9e0f1a2b","title":"Studio product shot","model":"fal-nano-banana-edit","creator":"grace","is_owner":false,"in_library":false,"runnable":true,"app_url":"https:\/\/automatica.example\/explore\/templates?template=2b7e1f4a-9c3d-4e5f-8a6b-7c8d9e0f1a2b","variables":[{"id":"subject","label":"Subject","placeholder":"A teapot"}],"media_inputs":[{"id":"7f3a2b1c-4d5e-4f60-8a1b-2c3d4e5f6a7b","slot":"reference_images","label":"Your product","description":null}],"cost":6}}}},"404":{"description":"Not in your library and not published.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}},"delete":{"operationId":"deleteTemplate","tags":["Templates"],"summary":"Remove a template from your library","description":"Works for templates in your library, drafts included, not for ones merely published to Explore. One you saved from someone else leaves their copy alone. The template itself is deleted, and taken off Explore, once nobody holds it; generations made from it stay. There is no undo.","x-required-scope":"api:write","parameters":[{"name":"template","in":"path","required":true,"description":"The template id.","schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Removed."},"404":{"description":"Not in your library.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/templates\/{template}\/publish":{"post":{"operationId":"publishTemplate","tags":["Templates"],"summary":"Put a template on Explore","description":"Only the creator of a complete template can publish it. artifact_ids publishes some of your results from this template alongside it as examples, and thumbnail_artifact_id makes one of them, or a result already published, its cover. A template already on Explore is updated in place. Others only ever see the fields to fill in, never the prompt.","x-required-scope":"api:write","parameters":[{"name":"template","in":"path","required":true,"description":"The template id.","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/PublishTemplateRequest"},"example":{"artifact_ids":["9d2f7a8e-5a0b-4c7e-9a2c-0f1d4e6b8c21"],"thumbnail_artifact_id":"9d2f7a8e-5a0b-4c7e-9a2c-0f1d4e6b8c21"}}}},"responses":{"200":{"description":"The template, with published_at.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/TemplateDetail"}}}},"403":{"description":"You did not create this template, or the token lacks the scope.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Not in your library.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"409":{"description":"The template is still a draft.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"errors.artifact_ids or errors.thumbnail_artifact_id name a result not made with this template, or a thumbnail that is not being published.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/templates\/{template}\/unpublish":{"post":{"operationId":"unpublishTemplate","tags":["Templates"],"summary":"Take a template off Explore","description":"It stays in your library and in the libraries of anyone who saved it. Example results published with it stay on Explore until each is unpublished. Unpublishing again changes nothing.","x-required-scope":"api:write","parameters":[{"name":"template","in":"path","required":true,"description":"The template id.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The template, without published_at.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/TemplateDetail"}}}},"403":{"description":"You did not create this template, or the token lacks the scope.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"404":{"description":"Not in your library.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/templates\/{template}\/runs":{"post":{"operationId":"runTemplate","tags":["Templates"],"summary":"Run a template","description":"Spends the tokens GET \/templates\/{template} reports as cost. variables takes a value for every variable keyed by id; media takes an artifact_id or upload_id for every media input keyed by its id. The prompt is filled in on the server, so a template can be run without seeing it. Poll GET \/generations\/{generation} for the outcome.","x-required-scope":"api:write","parameters":[{"name":"template","in":"path","required":true,"description":"The template id.","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":false,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/RunTemplateRequest"},"example":{"variables":{"subject":"a copper kettle"},"media":{"7f3a2b1c-4d5e-4f60-8a1b-2c3d4e5f6a7b":{"artifact_id":"9d2f7a8e-5a0b-4c7e-9a2c-0f1d4e6b8c21"}},"idempotency_key":"6f9619ff-8b86-4d01-b42d-00cf4fc964ff"}}}},"responses":{"201":{"description":"The generation started.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Generation"}}}},"200":{"description":"The idempotency key was seen before: the generation it started.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Generation"}}}},"402":{"description":"Not enough tokens.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/InsufficientCredits"}}}},"404":{"description":"Not in your library and not published.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"409":{"description":"The template is still a draft.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"Validation failed: errors.variables or errors.media say what is missing or unknown.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Too many generations started this minute, or too many requests.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/uploads":{"get":{"operationId":"listUploads","tags":["Uploads"],"summary":"List your uploads","x-required-scope":"api:read","parameters":[{"name":"type","in":"query","required":false,"description":"Only this kind of media.","schema":{"type":"string","enum":["image","video"]}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer","minimum":1,"default":1}},{"name":"per_page","in":"query","required":false,"description":"Results per page.","schema":{"type":"integer","minimum":1,"maximum":50,"default":15}}],"responses":{"200":{"description":"A page of uploads.","content":{"application\/json":{"schema":{"type":"object","description":"A page of uploads.","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Upload"}},"meta":{"$ref":"#\/components\/schemas\/Pagination"}}}}}},"422":{"description":"A filter or page parameter is invalid.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}},"post":{"operationId":"createUpload","tags":["Uploads"],"summary":"Upload a reference image or video","description":"multipart\/form-data with one file field. Images (jpeg, png, webp) up to 10 MB and videos (mp4, mov, webm, avi) up to 200 MB. Use the returned id as upload_id in a generation's media_inputs or a template run's media. The upload appears on My Uploads and stays until you delete it. Up to 20 uploads a minute.","x-required-scope":"api:write","requestBody":{"required":true,"content":{"multipart\/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"The image or video."}}}}}},"responses":{"201":{"description":"The upload.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Upload"},"example":{"id":"c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f","type":"image","mime_type":"image\/png","bytes":204800,"width":1024,"height":1024,"created_at":"2026-10-10T09:12:44+00:00"}}}},"200":{"description":"The same bytes were uploaded before: the existing upload.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Upload"}}}},"422":{"description":"The file is missing, too large or not a supported type.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"Too many uploads this minute, or too many requests.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}},"\/uploads\/{upload}":{"get":{"operationId":"getUpload","tags":["Uploads"],"summary":"One upload","x-required-scope":"api:read","parameters":[{"name":"upload","in":"path","required":true,"description":"The upload id.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The upload.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Upload"}}}},"404":{"description":"Not one of your uploads.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}},"delete":{"operationId":"deleteUpload","tags":["Uploads"],"summary":"Delete an upload","description":"Refused while the upload sits in the web generation form's tray.","x-required-scope":"api:write","parameters":[{"name":"upload","in":"path","required":true,"description":"The upload id.","schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Deleted."},"404":{"description":"Not one of your uploads.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"422":{"description":"The upload is in use in the web generation form.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"401":{"description":"No valid token was sent.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"403":{"description":"The token lacks the scope this call needs, or the email address is unverified.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"429":{"description":"The per-minute request cap was reached. Retry-After says when to try again.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}}}}}},"webhooks":{"generation.succeeded":{"post":{"operationId":"webhookGenerationSucceeded","tags":["Generations"],"summary":"A generation finished with its artifacts","description":"Posted to each endpoint registered under Settings, Webhooks and subscribed to this event. The body is JSON; X-Automatica-Signature carries t=<unix time>,v1=<hex> where v1 is HMAC-SHA256 of \"<t>.<raw body>\" with the endpoint secret; recompute it over the exact bytes received and reject a t more than 300 seconds old. Answer 2xx within 5 seconds; anything else is retried with backoff up to 5 times, and an endpoint that keeps failing is switched off. Deliveries can repeat: event_id identifies the event.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/WebhookEvent"},"example":{"event_id":"0f8fad5b-d9cb-469f-a165-70867728950e","event":"generation.succeeded","api_version":"v1","created_at":"2026-10-10T09:13:20+00:00","data":{"generation":{"id":"4c1b7e52-2a9f-4d3b-8e6a-1f2c3d4e5f60","status":"succeeded","model":"fal-flux-pro","prompt":"A copper kettle on a slate worktop, morning light","settings":{"num_images":2},"outputs":2,"cost":8,"created_at":"2026-10-10T09:12:44+00:00","finished_at":"2026-10-10T09:13:20+00:00","artifacts":[{"id":"9d2f7a8e-5a0b-4c7e-9a2c-0f1d4e6b8c21","type":"image","model":"fal-flux-pro","prompt":"A copper kettle on a slate worktop, morning light","creator":"ada","width":1024,"height":768,"created_at":"2026-10-10T09:12:44+00:00","app_url":"https:\/\/automatica.example\/artifacts?artifact=9d2f7a8e-5a0b-4c7e-9a2c-0f1d4e6b8c21","download_url":"https:\/\/storage.example\/artifacts\/9d2f7a8e.png?X-Amz-Signature=...","preview_url":"https:\/\/storage.example\/thumbnails\/9d2f7a8e.webp?X-Amz-Signature=...","links_expire_at":"2026-10-10T10:13:20+00:00"}]}}}}}},"responses":{"2XX":{"description":"Received. Any other status is retried."}}}},"generation.failed":{"post":{"operationId":"webhookGenerationFailed","tags":["Generations"],"summary":"A generation failed","description":"Posted to each endpoint registered under Settings, Webhooks and subscribed to this event. The body is JSON; X-Automatica-Signature carries t=<unix time>,v1=<hex> where v1 is HMAC-SHA256 of \"<t>.<raw body>\" with the endpoint secret; recompute it over the exact bytes received and reject a t more than 300 seconds old. Answer 2xx within 5 seconds; anything else is retried with backoff up to 5 times, and an endpoint that keeps failing is switched off. Deliveries can repeat: event_id identifies the event.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/WebhookEvent"},"example":{"event_id":"0f8fad5b-d9cb-469f-a165-70867728950e","event":"generation.failed","api_version":"v1","created_at":"2026-10-10T09:13:20+00:00","data":{"generation":{"id":"4c1b7e52-2a9f-4d3b-8e6a-1f2c3d4e5f60","status":"failed","model":"fal-flux-pro","prompt":"A copper kettle on a slate worktop, morning light","settings":{"num_images":2},"outputs":2,"cost":8,"created_at":"2026-10-10T09:12:44+00:00","finished_at":"2026-10-10T09:13:20+00:00","error":"The provider is busy or unavailable right now. Try again in a few minutes."}}}}}},"responses":{"2XX":{"description":"Received. Any other status is retried."}}}},"generation.moderated":{"post":{"operationId":"webhookGenerationModerated","tags":["Generations"],"summary":"A generation was stopped by content moderation","description":"Posted to each endpoint registered under Settings, Webhooks and subscribed to this event. The body is JSON; X-Automatica-Signature carries t=<unix time>,v1=<hex> where v1 is HMAC-SHA256 of \"<t>.<raw body>\" with the endpoint secret; recompute it over the exact bytes received and reject a t more than 300 seconds old. Answer 2xx within 5 seconds; anything else is retried with backoff up to 5 times, and an endpoint that keeps failing is switched off. Deliveries can repeat: event_id identifies the event.","requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/WebhookEvent"},"example":{"event_id":"0f8fad5b-d9cb-469f-a165-70867728950e","event":"generation.moderated","api_version":"v1","created_at":"2026-10-10T09:13:20+00:00","data":{"generation":{"id":"4c1b7e52-2a9f-4d3b-8e6a-1f2c3d4e5f60","status":"moderated","model":"fal-flux-pro","prompt":"A copper kettle on a slate worktop, morning light","settings":{"num_images":2},"outputs":2,"cost":8,"created_at":"2026-10-10T09:12:44+00:00","finished_at":"2026-10-10T09:13:20+00:00","error":"The provider is busy or unavailable right now. Try again in a few minutes."}}}}}},"responses":{"2XX":{"description":"Received. Any other status is retried."}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"A personal access token from Settings, API tokens, sent as Authorization: Bearer <token>. Its abilities are the scopes api:read and api:write; each operation names the one it needs."}},"schemas":{"Error":{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"errors":{"type":"object","description":"On 422 only: field name to the messages for it.","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"InsufficientCredits":{"type":"object","required":["message","required","available","pending_costs","shortfall"],"properties":{"message":{"type":"string"},"required":{"type":"integer","description":"Tokens the run needs, counting generations still in progress."},"available":{"type":"integer","description":"Tokens you hold."},"pending_costs":{"type":"integer","description":"Tokens reserved by generations still in progress."},"shortfall":{"type":"integer"}}},"Pagination":{"type":"object","required":["page","per_page","total","last_page"],"properties":{"page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"},"last_page":{"type":"integer"}}},"Account":{"type":"object","required":["username","plan","credits","profile_picture"],"properties":{"username":{"type":"string"},"plan":{"type":["string","null"]},"credits":{"type":"object","description":"Your token balance.","required":["balance","reserved","available"],"properties":{"balance":{"type":"integer"},"reserved":{"type":"integer","description":"Held by generations still in progress."},"available":{"type":"integer","description":"What a new generation can spend."}}},"profile_picture":{"type":"object","description":"The picture beside your name on what you publish. Its file is not returned.","required":["set","shown"],"properties":{"set":{"type":"boolean","description":"Whether you have a profile picture."},"shown":{"type":"boolean","description":"Whether it shows on what you publish. Without one, your initials show."}}}}},"PriceRange":{"type":"object","required":["per","from","to"],"properties":{"per":{"type":"string","enum":["image","video","second"],"description":"The unit one rate buys."},"from":{"type":"integer"},"to":{"type":"integer"}}},"ModelSummary":{"type":"object","required":["key","name","type","price"],"properties":{"key":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["image","video"]},"description":{"type":"string"},"capabilities":{"type":"array","items":{"type":"string"}},"recommended":{"type":"boolean","description":"Present, and true, for the models we suggest first."},"media_inputs":{"type":"array","items":{"type":"string","enum":["video","end_frame","edit_video","start_frame","reference_video","reference_images"]},"description":"The media slots the model takes. Absent when it takes none."},"edit_model":{"type":"string","description":"The model key to use when attaching reference images."},"image_to_video_model":{"type":"string","description":"The model key to use when attaching a start frame."},"price":{"$ref":"#\/components\/schemas\/PriceRange"}}},"ModelDetail":{"type":"object","required":["key","name","type","media_inputs","settings","pricing"],"properties":{"key":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["image","video"]},"description":{"type":"string"},"capabilities":{"type":"array","items":{"type":"string"}},"recommended":{"type":"boolean"},"edit_model":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}}},"image_to_video_model":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}}},"media_inputs":{"type":"object","description":"For each slot the model takes, how many it needs and allows.","additionalProperties":{"type":"object","properties":{"min_count":{"type":"integer"},"max_count":{"type":"integer"},"max_duration":{"type":["integer","null"]}}}},"settings":{"type":"array","items":{"type":"object","required":["field","type"],"properties":{"field":{"type":"string"},"type":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"min":{"type":"number"},"max":{"type":"number"},"default":{"description":"The value used when the setting is left out."}}}},"pricing":{"type":"object","required":["per","options"],"properties":{"per":{"type":"string","enum":["image","video","second"]},"options":{"type":"array","items":{"type":"object","required":["settings","credits"],"properties":{"settings":{"type":"object","additionalProperties":true},"credits":{"type":"integer"}}}},"per_extra_reference":{"type":"integer","description":"Credits each reference image after the first adds, once per generation. Only on models that price their references."}}}}},"EstimateRequest":{"type":"object","required":["model"],"properties":{"model":{"type":"string","description":"A model key from GET \/models."},"settings":{"type":"object","additionalProperties":true,"description":"Setting values keyed by the field names GET \/models\/{model} returns."},"artifact_id":{"type":"string","format":"uuid","description":"An input video from your library, for video edits."},"upload_id":{"type":"string","format":"uuid","description":"An input video from your uploads, instead of artifact_id."},"reference_count":{"type":"integer","minimum":0,"maximum":16,"description":"How many reference images the generation will send. A model whose pricing has per_extra_reference charges that for each reference after the first."}}},"Estimate":{"type":"object","required":["credits","outputs","duration_seconds","available_credits","affordable"],"properties":{"credits":{"type":"integer","description":"The total in tokens for every output."},"outputs":{"type":"integer"},"duration_seconds":{"type":["integer","null"]},"available_credits":{"type":"integer","description":"Tokens you can spend now."},"affordable":{"type":"boolean"}}},"MediaReference":{"type":"object","description":"One image or video to generate from: artifact_id from your library or Explore, or upload_id from your uploads.","properties":{"slot":{"type":"string","enum":["video","end_frame","edit_video","start_frame","reference_video","reference_images"],"description":"How the model uses it. GET \/models\/{model} names the slots."},"artifact_id":{"type":"string","format":"uuid"},"upload_id":{"type":"string","format":"uuid"}}},"CreateGenerationRequest":{"type":"object","required":["model","prompt"],"properties":{"model":{"type":"string","description":"A model key from GET \/models, or an edit_model \/ image_to_video_model key when attaching media."},"prompt":{"type":"string"},"settings":{"type":"object","additionalProperties":true,"description":"Setting values keyed by field name; anything left out uses the default."},"media_inputs":{"type":"array","maxItems":30,"items":{"$ref":"#\/components\/schemas\/MediaReference"},"description":"Each with a slot."},"idempotency_key":{"type":"string","format":"uuid"}}},"Generation":{"type":"object","required":["id","status","model","outputs","cost","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["processing","succeeded","failed","moderated","cancelled"]},"model":{"type":"string"},"prompt":{"type":"string","description":"Missing when the generation came from someone else's template."},"template":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"}}},"settings":{"type":"object","additionalProperties":true},"outputs":{"type":"integer"},"cost":{"type":"integer","description":"Tokens, charged only when the generation succeeds."},"created_at":{"type":"string","format":"date-time"},"finished_at":{"type":"string","format":"date-time"},"error":{"type":"string","description":"Why a failed or moderated generation stopped."},"artifacts":{"type":"array","items":{"$ref":"#\/components\/schemas\/ArtifactSummary"},"description":"Present once the generation succeeded."}}},"ArtifactSummary":{"type":"object","required":["id","type","created_at","app_url"],"properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["image","video"]},"model":{"type":"string"},"prompt":{"type":"string","description":"Cut to 300 characters in lists. Missing when private to a template creator."},"template":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"}}},"creator":{"type":"string","description":"Username."},"width":{"type":"integer"},"height":{"type":"integer"},"duration_ms":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"published_at":{"type":"string","format":"date-time","description":"Present while the artifact is on Explore."},"app_url":{"type":"string","format":"uri","description":"The artifact's page on the site; it does not expire."}}},"ArtifactDetail":{"type":"object","required":["id","type","created_at","app_url"],"properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["image","video"]},"model":{"type":"string"},"prompt":{"type":"string"},"template":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"}}},"creator":{"type":"string"},"width":{"type":"integer"},"height":{"type":"integer"},"duration_ms":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"published_at":{"type":"string","format":"date-time","description":"Present while the artifact is on Explore."},"app_url":{"type":"string","format":"uri"},"settings":{"type":"object","additionalProperties":true},"template_variables":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"value":{"type":"string"}}}},"mime_type":{"type":"string"},"cost":{"type":"number","description":"Tokens for this output."},"can_create_template":{"type":"boolean"}}},"MediaLinks":{"type":"object","required":["id","type","mime_type","bytes","download_url","preview_url","expires_at"],"properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["image","video"]},"mime_type":{"type":"string"},"bytes":{"type":"integer"},"width":{"type":["integer","null"]},"height":{"type":["integer","null"]},"duration_ms":{"type":["integer","null"]},"download_url":{"type":"string","format":"uri"},"preview_url":{"type":["string","null"],"format":"uri"},"expires_at":{"type":"string","format":"date-time"}}},"TemplateSummary":{"type":"object","required":["id","title","is_owner","in_library","runnable","app_url"],"properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string"},"model":{"type":"string"},"creator":{"type":"string","description":"Username."},"is_owner":{"type":"boolean"},"in_library":{"type":"boolean"},"runnable":{"type":"boolean","description":"False for an unfinished draft."},"published_at":{"type":"string","format":"date-time"},"likes_count":{"type":"integer"},"app_url":{"type":"string","format":"uri"}}},"TemplateDetail":{"type":"object","required":["id","title","is_owner","in_library","runnable","app_url","variables","media_inputs"],"properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string"},"model":{"type":"string"},"creator":{"type":"string"},"is_owner":{"type":"boolean"},"in_library":{"type":"boolean"},"runnable":{"type":"boolean"},"published_at":{"type":"string","format":"date-time"},"likes_count":{"type":"integer"},"app_url":{"type":"string","format":"uri"},"variables":{"type":"array","items":{"type":"object","required":["id","label"],"properties":{"id":{"type":"string"},"label":{"type":"string"},"placeholder":{"type":"string"},"description":{"type":"string"}}}},"media_inputs":{"type":"array","items":{"type":"object","required":["id","slot"],"properties":{"id":{"type":"string","format":"uuid"},"slot":{"type":"string","enum":["video","end_frame","edit_video","start_frame","reference_video","reference_images"]},"label":{"type":["string","null"]},"description":{"type":["string","null"]}}}},"prompt":{"type":"string","description":"Creator only."},"settings":{"type":"object","additionalProperties":true,"description":"Creator only."},"cost":{"type":"integer","description":"Tokens one run spends."}}},"CreateTemplateRequest":{"type":"object","required":["title"],"properties":{"title":{"type":"string","maxLength":50},"description":{"type":"string","maxLength":120},"artifact_id":{"type":"string","format":"uuid","description":"One of your own generations to base the template on."},"model":{"type":"string","description":"Required unless artifact_id is given."},"settings":{"type":"object","additionalProperties":true},"prompt":{"type":"string","description":"With each blank written as {{id}}. Required unless artifact_id is given."},"variables":{"type":"array","maxItems":20,"items":{"type":"object","required":["id","label"],"properties":{"id":{"type":"string","maxLength":50,"description":"Letters, digits, - and _."},"label":{"type":"string","maxLength":100},"placeholder":{"type":"string","maxLength":100},"description":{"type":"string","maxLength":100}}}},"media_inputs":{"type":"array","maxItems":25,"items":{"type":"object","required":["slot"],"properties":{"slot":{"type":"string","enum":["video","end_frame","edit_video","start_frame","reference_video","reference_images"]},"label":{"type":"string","maxLength":100},"description":{"type":"string","maxLength":250}}}}}},"SetProfilePictureRequest":{"type":"object","description":"Send one of artifact_id or upload_id.","oneOf":[{"required":["artifact_id"]},{"required":["upload_id"]}],"properties":{"artifact_id":{"type":"string","format":"uuid","description":"An image you generated, from your library."},"upload_id":{"type":"string","format":"uuid","description":"An image from your uploads."}}},"PublishTemplateRequest":{"type":"object","properties":{"artifact_ids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Your results from this template to show on Explore as examples."},"thumbnail_artifact_id":{"type":"string","format":"uuid","description":"One of artifact_ids, or a result already published, to use as the cover."}}},"RunTemplateRequest":{"type":"object","properties":{"variables":{"type":"object","additionalProperties":{"type":"string","maxLength":4000},"description":"A value for each variable, keyed by its id."},"media":{"type":"object","maxProperties":30,"additionalProperties":{"$ref":"#\/components\/schemas\/MediaReference"},"description":"For each media input id, an artifact_id or upload_id."},"idempotency_key":{"type":"string","format":"uuid"}}},"WebhookEvent":{"type":"object","required":["event_id","event","api_version","created_at","data"],"properties":{"event_id":{"type":"string","format":"uuid","description":"The same for every endpoint and retry of one event."},"event":{"type":"string","enum":["generation.succeeded","generation.failed","generation.moderated"]},"api_version":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"data":{"type":"object","required":["generation"],"properties":{"generation":{"description":"The generation as GET \/generations\/{generation} returns it; each artifact also carries download_url, preview_url and links_expire_at.","allOf":[{"$ref":"#\/components\/schemas\/Generation"}]}}}}},"Upload":{"type":"object","required":["id","type","mime_type","bytes","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["image","video"]},"mime_type":{"type":"string"},"bytes":{"type":"integer"},"width":{"type":"integer"},"height":{"type":"integer"},"duration_ms":{"type":"integer"},"created_at":{"type":"string","format":"date-time"}}}}}}