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}/inputs

Requires 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

FieldMeaning
version_idthe version a run would execute now. Pass it back on the run to pin this exact contract
schema_hashchanges when any input changes. The one field to compare against your cache
credits_estimatecredits a run of this workflow has been costing on average
duration_seconds_estimatehow long it has been taking on average, end to end

Each input

FieldMeaning
keythe name to use in the run's inputs object
acceptsvalue send the value itself · url send a public HTTPS link · option send one of options[].id
typestring, number, boolean, image, video, audio or document
requiredmust be present, unless default_value is set
allow_multiplewhen true, the value may be an array; when false, an array is refused
allowed_valuesfor accepts: value: the only accepted strings, unless allow_custom is true
allow_customwhen false, values outside allowed_values or options are refused
minimum, maximuminclusive bounds, for type: number
default_valuewhat the run uses when the input is omitted
url_content_typesfor accepts: url: the content types the link may serve
max_bytesfor accepts: url: the largest file accepted for this input
optionsfor accepts: option: { "id", "label" } entries. Send the id back exactly as given; it is not a URL
title, descriptionwritten 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.

On this page