Get a workflow's inputs
Read the inputs a workflow takes before you start a run.
A workflow's inputs are authored in Studio and change when its authors change them. Read the contract rather than hard-coding it.
GET {base_url}/workflows/{workflow_id}/inputsRequires workflows:read.
Response
{
"workflow": {
"id": "0192f3c3-9d21-7c44-b8e1-5a7f2c9d4e10",
"name": "Story visuals",
"version_id": "0192f3c4-1a02-7bb3-9f40-2c6e8d1a5b77",
"schema_hash": "9fdf032d5b1c4e88",
"credits_estimate": 1840,
"duration_seconds_estimate": 420
},
"inputs": [
{
"key": "story_document",
"accepts": "url",
"type": "document",
"required": true,
"allow_multiple": false,
"url_content_types": ["application/pdf", "text/plain", "text/markdown"],
"max_bytes": 104857600,
"title": "Story document",
"description": "The finished story to adapt"
},
{
"key": "tone",
"accepts": "value",
"type": "string",
"required": true,
"allow_multiple": false,
"allowed_values": ["thriller", "romance", "mythology"],
"allow_custom": false,
"default_value": "thriller",
"title": "Tone"
}
]
}The workflow object
| Field | Meaning |
|---|---|
version_id | the version a run would execute now. Pass it back on the run to pin this exact contract |
schema_hash | changes when any input changes. The one field to compare against your cache |
credits_estimate | credits a run of this workflow has been costing on average |
duration_seconds_estimate | how long it has been taking on average, end to end |
Each input
| Field | Meaning |
|---|---|
key | the name to use in the run's inputs object |
accepts | value send the value itself · url send a public HTTPS link · option send one of options[].id |
type | string, number, boolean, image, video, audio or document |
required | must be present, unless default_value is set |
allow_multiple | when true, the value may be an array; when false, an array is refused |
allowed_values | for accepts: value: the only accepted strings, unless allow_custom is true |
allow_custom | when false, values outside allowed_values or options are refused |
minimum, maximum | inclusive bounds, for type: number |
default_value | what the run uses when the input is omitted |
url_content_types | for accepts: url: the content types the link may serve |
max_bytes | for accepts: url: the largest file accepted for this input |
options | for accepts: option: { "id", "label" } entries. Send the id back exactly as given; it is not a URL |
title, description | written for people, safe to show in your own UI |
Cache the contract against schema_hash, and re-read it when a run is refused with invalid_request. A workflow's authors can add a required input between two of your runs.