{"openapi":"3.1.0","info":{"title":"FlowAPI API","version":"1.0.0","description":"Image and video generation with one flat USD price per image or second of video. Failed, timed-out and cancelled jobs are refunded in full. Keys: `flow_sk_live_…` (charged) and `flow_sk_test_…` ($0, sample results). Docs: https://useflowapi.com/docs"},"servers":[{"url":"https://useflowapi.com"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Generation"},{"name":"Catalog"},{"name":"Account"},{"name":"Files"}],"paths":{"/v1/generations":{"post":{"operationId":"createGeneration","tags":["Generation"],"summary":"Submit an image or video generation job","description":"Charges the flat price when the job is accepted; a failed, timed-out or cancelled job is refunded. Rate limit: 120 writes per minute per key. Running jobs per account: 20 image, 5 video. Body ≤ 256 KB.","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","maxLength":255},"description":"Required. Retrying with the same key and body returns the original job (header `idempotent-replayed: true`); the same key with a different body returns 409."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationRequest"}}}},"responses":{"202":{"description":"Job accepted (or replayed)","headers":{"idempotent-replayed":{"schema":{"type":"string","const":"true"},"description":"Present when this is a replay"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"FLOW_INVALID_REQUEST","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"FLOW_UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"FLOW_INSUFFICIENT_BALANCE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"FLOW_SPEND_LIMIT_EXCEEDED, FLOW_ACCOUNT_RESTRICTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"FLOW_MODEL_NOT_FOUND, FLOW_JOB_NOT_FOUND, FLOW_FILE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"FLOW_IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"FLOW_CONTENT_REJECTED, FLOW_UNSUPPORTED_PARAMETER","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"FLOW_RATE_LIMITED, FLOW_TOO_MANY_RUNNING_JOBS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"FLOW_MODEL_UNAVAILABLE, FLOW_TEMPORARILY_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/quotes":{"post":{"operationId":"createQuote","tags":["Generation"],"summary":"Price a request without creating a job (never charges)","description":"Rate limit: 600 quotes per minute per key.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationRequest"}}}},"responses":{"200":{"description":"Quote","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Quote"}}}},"400":{"description":"FLOW_INVALID_REQUEST","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"FLOW_UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"FLOW_MODEL_NOT_FOUND, FLOW_JOB_NOT_FOUND, FLOW_FILE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"FLOW_CONTENT_REJECTED, FLOW_UNSUPPORTED_PARAMETER","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"FLOW_RATE_LIMITED, FLOW_TOO_MANY_RUNNING_JOBS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"FLOW_MODEL_UNAVAILABLE, FLOW_TEMPORARILY_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/models":{"get":{"operationId":"listModels","tags":["Catalog"],"summary":"List models and their flat prices","description":"Public: no API key needed. Rate-limited per IP.","security":[],"responses":{"200":{"description":"Model list","content":{"application/json":{"schema":{"type":"object","required":["object","data"],"properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Model"}}}}}}},"429":{"description":"FLOW_RATE_LIMITED, FLOW_TOO_MANY_RUNNING_JOBS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"FLOW_MODEL_UNAVAILABLE, FLOW_TEMPORARILY_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/balance":{"get":{"operationId":"getBalance","tags":["Account"],"summary":"Available balance and trial credit","responses":{"200":{"description":"Balance","content":{"application/json":{"schema":{"type":"object","required":["object","available","trial"],"properties":{"object":{"type":"string","const":"balance"},"available":{"type":"object","required":["amount","currency"],"properties":{"amount":{"type":"string","description":"Decimal USD, up to 6 decimals","examples":["0.027"]},"currency":{"type":"string","const":"USD"}},"description":"Everything you can spend, trial included"},"trial":{"type":"object","required":["amount","currency"],"properties":{"amount":{"type":"string","description":"Decimal USD, up to 6 decimals","examples":["0.027"]},"currency":{"type":"string","const":"USD"}},"description":"The part of `available` that is trial credit"}}}}}},"401":{"description":"FLOW_UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"FLOW_RATE_LIMITED, FLOW_TOO_MANY_RUNNING_JOBS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"FLOW_MODEL_UNAVAILABLE, FLOW_TEMPORARILY_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/files":{"post":{"operationId":"uploadFile","tags":["Files"],"summary":"Upload a reference file for a later job","description":"Up to 20 MB; kept 24 hours. Pass the returned id as `input.references[].file_id`.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"One of: image/png, image/jpeg, image/webp, video/mp4, audio/mpeg, audio/wav"}}}}}},"responses":{"201":{"description":"Stored","content":{"application/json":{"schema":{"$ref":"#/components/schemas/File"}}}},"400":{"description":"FLOW_INVALID_REQUEST","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"FLOW_UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"FLOW_RATE_LIMITED, FLOW_TOO_MANY_RUNNING_JOBS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"FLOW_MODEL_UNAVAILABLE, FLOW_TEMPORARILY_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/jobs/{id}":{"get":{"operationId":"getJob","tags":["Generation"],"summary":"Get a job: status, result files or error","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Job id (`job_…`)"}],"responses":{"200":{"description":"Job","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"401":{"description":"FLOW_UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"FLOW_MODEL_NOT_FOUND, FLOW_JOB_NOT_FOUND, FLOW_FILE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"FLOW_RATE_LIMITED, FLOW_TOO_MANY_RUNNING_JOBS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"FLOW_MODEL_UNAVAILABLE, FLOW_TEMPORARILY_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/jobs/{id}/cancel":{"post":{"operationId":"cancelJob","tags":["Generation"],"summary":"Cancel a queued or running job (refunded in full)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Job id (`job_…`)"}],"responses":{"200":{"description":"Job after cancel","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"401":{"description":"FLOW_UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"FLOW_MODEL_NOT_FOUND, FLOW_JOB_NOT_FOUND, FLOW_FILE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"FLOW_RATE_LIMITED, FLOW_TOO_MANY_RUNNING_JOBS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"FLOW_MODEL_UNAVAILABLE, FLOW_TEMPORARILY_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/jobs":{"get":{"operationId":"listJobs","tags":["Generation"],"summary":"List your jobs of the key's mode, newest first (cursor pagination)","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"cursor","in":"query","schema":{"type":"string"},"description":"`next_cursor` from the previous page"},{"name":"status","in":"query","schema":{"type":"string","enum":["queued","running","succeeded","failed","cancelled"]}},{"name":"model","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"One page of jobs","content":{"application/json":{"schema":{"type":"object","required":["object","data","has_more","next_cursor"],"properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Job"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}}}}},"400":{"description":"FLOW_INVALID_REQUEST","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"FLOW_UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"FLOW_RATE_LIMITED, FLOW_TOO_MANY_RUNNING_JOBS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"FLOW_MODEL_UNAVAILABLE, FLOW_TEMPORARILY_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/jobs/{id}/status":{"get":{"operationId":"waitJob","tags":["Generation"],"summary":"Long-poll a job until it finishes or `wait` seconds pass","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Job id (`job_…`)"},{"name":"wait","in":"query","schema":{"type":"number","minimum":0,"maximum":30,"default":0},"description":"Seconds to hold the request while the job is still running"}],"responses":{"200":{"description":"Job","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"FLOW_INVALID_REQUEST","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"FLOW_UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"FLOW_MODEL_NOT_FOUND, FLOW_JOB_NOT_FOUND, FLOW_FILE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"FLOW_RATE_LIMITED, FLOW_TOO_MANY_RUNNING_JOBS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"FLOW_MODEL_UNAVAILABLE, FLOW_TEMPORARILY_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/models/{vendor}/{model}":{"get":{"operationId":"getModel","tags":["Catalog"],"summary":"One model and its flat prices","description":"Public: no API key needed. Rate-limited per IP.","security":[],"parameters":[{"name":"vendor","in":"path","required":true,"schema":{"type":"string"}},{"name":"model","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Model","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Model"}}}},"404":{"description":"FLOW_MODEL_NOT_FOUND, FLOW_JOB_NOT_FOUND, FLOW_FILE_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"FLOW_RATE_LIMITED, FLOW_TOO_MANY_RUNNING_JOBS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"FLOW_MODEL_UNAVAILABLE, FLOW_TEMPORARILY_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/usage":{"get":{"operationId":"getUsage","tags":["Account"],"summary":"Spend and job counts by day, model and key (the key's live/test mode)","parameters":[{"name":"days","in":"query","schema":{"type":"integer","minimum":1,"maximum":90,"default":30}}],"responses":{"200":{"description":"Usage (UTC days; refunded jobs add no spend)","content":{"application/json":{"schema":{"type":"object","required":["object","from","to","totals","by_day","by_model","by_key"],"properties":{"object":{"type":"string","const":"usage"},"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"totals":{"$ref":"#/components/schemas/UsageCounts"},"by_day":{"type":"array","items":{"$ref":"#/components/schemas/UsageCounts"}},"by_model":{"type":"array","items":{"$ref":"#/components/schemas/UsageCounts"}},"by_key":{"type":"array","items":{"$ref":"#/components/schemas/UsageCounts"}}}}}}},"400":{"description":"FLOW_INVALID_REQUEST","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"FLOW_UNAUTHORIZED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"FLOW_RATE_LIMITED, FLOW_TOO_MANY_RUNNING_JOBS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"FLOW_MODEL_UNAVAILABLE, FLOW_TEMPORARILY_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key: `flow_sk_live_…` or `flow_sk_test_…`"}},"schemas":{"UsageCounts":{"type":"object","required":["jobs","succeeded","failed","spend"],"properties":{"date":{"type":"string","format":"date"},"model":{"type":"string"},"api_key_id":{"type":["string","null"]},"jobs":{"type":"integer"},"succeeded":{"type":"integer"},"failed":{"type":"integer"},"spend":{"type":"object","required":["amount","currency"],"properties":{"amount":{"type":"string","description":"Decimal USD, up to 6 decimals","examples":["0.027"]},"currency":{"type":"string","const":"USD"}}}}},"Money":{"type":"object","required":["amount","currency"],"properties":{"amount":{"type":"string","description":"Decimal USD, up to 6 decimals","examples":["0.027"]},"currency":{"type":"string","const":"USD"}}},"GenerationRequest":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string","maxLength":200,"description":"Model id from GET /v1/models, e.g. `google/nano-banana-pro`"},"input":{"type":"object","properties":{"type":{"type":"string","enum":["text","image","reference"],"description":"`text`: prompt only. `image`: image-to-image / image-to-video with references. `reference`: video only, reference-driven."},"prompt":{"type":"string"},"references":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["reference_image","first_frame","last_frame","reference_video","reference_audio"]},"url":{"type":"string","format":"uri"},"file_id":{"type":"string","description":"Id from POST /v1/files (your own upload)"}}}}}},"parameters":{"type":"object","additionalProperties":true,"description":"Model parameters (e.g. `resolution`, `aspect_ratio`). Images: `n` 1–4. Video: `duration` integer seconds 1–60, required."},"webhook_url":{"type":"string","format":"uri","maxLength":2048,"description":"https only. Stored with the job."}}},"Quote":{"type":"object","properties":{"object":{"type":"string","const":"quote"},"model":{"type":"string"},"type":{"type":"string","enum":["image","video"]},"spec":{"type":"string"},"unit":{"type":"string","enum":["image","second"]},"units":{"type":"integer"},"unit_price":{"$ref":"#/components/schemas/Money"},"price":{"$ref":"#/components/schemas/Money"},"trial_eligible":{"type":"boolean"},"parameters":{"type":"object","additionalProperties":true}}},"Model":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"model"},"type":{"type":"string","enum":["image","video"]},"vendor":{"type":"string"},"display_name":{"type":"string"},"defaults":{"type":"object","additionalProperties":true},"prices":{"type":"array","items":{"type":"object","properties":{"spec":{"type":"string"},"unit":{"type":"string","enum":["image","second"]},"amount":{"type":"string"},"currency":{"type":"string","const":"USD"},"match":{"type":"object","additionalProperties":true}}}}}},"Job":{"type":"object","required":["id","object","status","model","price","refunded"],"properties":{"id":{"type":"string"},"object":{"type":"string","const":"job"},"status":{"type":"string","enum":["queued","running","succeeded","failed","cancelled"]},"model":{"type":"string"},"mode":{"type":"string","enum":["live","test"]},"price":{"$ref":"#/components/schemas/Money"},"refunded":{"type":"boolean"},"created_at":{"type":["integer","null"],"description":"Unix seconds"},"completed_at":{"type":["integer","null"],"description":"Unix seconds"},"urls":{"type":"object","properties":{"get":{"type":"string"},"cancel":{"type":"string"}}},"result":{"oneOf":[{"type":"null"},{"type":"object","properties":{"files":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"media_type":{"type":"string"},"width":{"type":["integer","null"]},"height":{"type":["integer","null"]},"duration":{"type":["number","null"],"description":"Seconds"},"expires_at":{"type":["integer","null"]}}}}}}]},"error":{"oneOf":[{"type":"null"},{"type":"object","properties":{"code":{"type":"string","enum":["FLOW_INVALID_REQUEST","FLOW_UNAUTHORIZED","FLOW_INSUFFICIENT_BALANCE","FLOW_SPEND_LIMIT_EXCEEDED","FLOW_ACCOUNT_RESTRICTED","FLOW_MODEL_NOT_FOUND","FLOW_JOB_NOT_FOUND","FLOW_FILE_NOT_FOUND","FLOW_IDEMPOTENCY_CONFLICT","FLOW_CONTENT_REJECTED","FLOW_UNSUPPORTED_PARAMETER","FLOW_RATE_LIMITED","FLOW_TOO_MANY_RUNNING_JOBS","FLOW_MODEL_UNAVAILABLE","FLOW_TEMPORARILY_UNAVAILABLE","FLOW_GENERATION_FAILED"]},"message":{"type":"string"},"action":{"type":"string"},"retryable":{"type":"boolean"}}}]}}},"File":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"file"},"filename":{"type":["string","null"]},"media_type":{"type":"string"},"bytes":{"type":"integer"},"expires_at":{"type":["integer","null"]}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message","action","retryable","request_id"],"properties":{"code":{"type":"string","enum":["FLOW_INVALID_REQUEST","FLOW_UNAUTHORIZED","FLOW_INSUFFICIENT_BALANCE","FLOW_SPEND_LIMIT_EXCEEDED","FLOW_ACCOUNT_RESTRICTED","FLOW_MODEL_NOT_FOUND","FLOW_JOB_NOT_FOUND","FLOW_FILE_NOT_FOUND","FLOW_IDEMPOTENCY_CONFLICT","FLOW_CONTENT_REJECTED","FLOW_UNSUPPORTED_PARAMETER","FLOW_RATE_LIMITED","FLOW_TOO_MANY_RUNNING_JOBS","FLOW_MODEL_UNAVAILABLE","FLOW_TEMPORARILY_UNAVAILABLE","FLOW_GENERATION_FAILED"]},"message":{"type":"string"},"action":{"type":"string","enum":["fix_request","add_funds","modify_input","retry_later","contact_support"]},"retryable":{"type":"boolean"},"request_id":{"type":"string"},"job_id":{"type":"string","description":"Set when a job was created and refunded"},"refunded":{"type":"boolean"}}}}}}}}