> ## Documentation Index
> Fetch the complete documentation index at: https://docs.infery.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve a workflow

> GET /v1/workflows/{id}

The latest version by default; pass `version=` for a specific one.

Returns the `definition` and the declared `inputs`, which is what you need to know what to send when you run it.


## OpenAPI

````yaml openapi.json GET /v1/workflows/{id}
openapi: 3.0.0
info:
  title: Infery Gateway
  description: >-
    Infery Inference Gateway — OpenAI-compatible API for LLMs, embeddings,
    images, audio, and video
  version: '1.0'
  contact: {}
servers:
  - url: https://api.infery.ai
    description: Production
  - url: http://localhost:3001
    description: Local
security: []
tags: []
paths:
  /v1/workflows/{id}:
    get:
      tags:
        - Workflows
      summary: Get workflow (latest or specific version)
      description: >-
        Returns the workflow row plus ONE version's definition — the `version`
        query parameter when given, otherwise `latestVersion`. The definition
        comes back exactly as stored: it is not re-parsed on this path, so
        schema defaults are NOT filled in and a row written before a schema
        change is returned unchanged. A workflow this caller may not see is
        reported as 404, never 403 — a 403 would confirm it exists.
      operationId: PipelinesController_getById[0]
      parameters:
        - name: id
          required: true
          in: path
          description: Workflow UUID.
          schema:
            example: b0e9f2a4-2b1a-4c7d-9a3e-1f5c8d2e4b60
            type: string
        - name: version
          required: false
          in: query
          description: >-
            Version to return. Integer; defaults to the workflow's
            `latestVersion`. A version that does not exist is a 404
            (`pipeline_version_not_found`).
          schema:
            example: 2
      responses:
        '200':
          description: The workflow and the requested version's definition.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipelineDetailDto'
        '401':
          description: Unauthorized — invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '404':
          description: >-
            No such workflow in this workspace, it is soft-deleted, it is not
            visible to this caller, or the requested version does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
      security:
        - ApiKey: []
components:
  schemas:
    PipelineDetailDto:
      type: object
      properties:
        id:
          type: string
          description: Workflow UUID.
          example: b0e9f2a4-2b1a-4c7d-9a3e-1f5c8d2e4b60
        workspaceId:
          type: string
          description: Owning workspace UUID — always the workspace the API key belongs to.
          example: 7d1c0a55-9f2b-4a13-8c6e-30b4e9a1c7f2
        name:
          type: string
          description: Author-supplied name. Max 120 characters.
          example: Weekly report
        description:
          type: string
          nullable: true
          description: >-
            Author-supplied description. Max 2000 characters. Null when never
            set.
          example: Summarise the week and render a PDF
        latestVersion:
          type: number
          description: >-
            Highest version number that exists for this workflow. `PUT`
            increments it only when the request carried a `definition`; a
            name/description-only update leaves it unchanged.
          example: 3
        isActive:
          type: boolean
          description: >-
            Column default. No code path in this repo ever writes it, so it is
            `true` on every row; do not read it as an enable/disable switch.
          example: true
        createdAt:
          type: string
          description: ISO-8601 creation timestamp.
          example: '2026-05-04T09:15:22.113Z'
        updatedAt:
          type: string
          description: >-
            ISO-8601 timestamp of the last `PUT` (name, description or
            definition).
          example: '2026-05-06T11:02:47.900Z'
        deletedAt:
          type: string
          nullable: true
          description: >-
            Soft-delete timestamp. Always null on these responses: both reads
            filter on `deletedAt: null`, so a deleted workflow is a 404 rather
            than a row with a value here.
          example: null
        createdByUserId:
          type: string
          nullable: true
          description: >-
            User the workflow was created by, when the creating API key could be
            attributed to a workspace member. Null for a key whose creator was
            deleted or has left the workspace — such a key creates
            `workspace`-scoped workflows instead.
          example: 4e5a1b8c-77d3-4c21-a0fe-9b6d2c3a5e11
        sharingScope:
          type: string
          enum:
            - private
            - workspace
            - users
          description: >-
            Who may see this workflow, before per-user grants. `private` = its
            creator (plus workspace owners/admins); `workspace` = every member;
            `users` = the members it was explicitly shared with. New workflows
            land on `private` unless the API key had no attributable creator.
          example: private
        sharePermission:
          type: string
          enum:
            - read
            - write
          description: >-
            What the sharing grant permits. Consulted only for the `workspace`
            and `users` scopes. `read` allows running the workflow — it means
            "you cannot change it", not "you cannot use it".
          example: read
        definition:
          type: object
          additionalProperties: true
          description: >-
            The stored workflow definition for `version`, exactly as it was
            written. Unmodelled here: its shape is the Zod schema in
            `schemas/pipeline-definition.schema.ts` (`steps[]`, `output`,
            `retry`, `failure_mode`, `inputs[]`, `ui`), which this document does
            not publish. It is returned as stored — the schema `.default()`
            values are NOT filled in on this read.
        version:
          type: number
          description: >-
            The version this `definition` came from: the `version` query
            parameter when one was given, otherwise `latestVersion`.
          example: 3
        inputs:
          description: >-
            The declared run inputs read out of `definition.inputs`. `[]` for a
            legacy definition that predates the input contract, and also `[]` —
            never an error — when a hand-edited row carries a non-array
            `inputs`.
          type: array
          items:
            $ref: '#/components/schemas/InputDeclarationDto'
      required:
        - id
        - workspaceId
        - name
        - description
        - latestVersion
        - isActive
        - createdAt
        - updatedAt
        - deletedAt
        - createdByUserId
        - sharingScope
        - sharePermission
        - definition
        - version
        - inputs
    ErrorResponseDto:
      type: object
      properties:
        error:
          description: >-
            The error envelope. Every non-2xx response from this API has this
            shape, so a client can parse failures without branching on the
            endpoint.
          allOf:
            - $ref: '#/components/schemas/ErrorDetailDto'
      required:
        - error
    InputDeclarationDto:
      type: object
      properties:
        name:
          type: string
          description: Input name. Referenced inside the definition as `${input.<name>}`.
          example: topic
        type:
          type: string
          enum:
            - text
            - number
            - boolean
            - json
            - image
            - video
            - audio
            - file
          description: >-
            Declared value type. `image`, `video`, `audio` and `file` are plain
            strings carrying either a URL or a workspace-scoped file id.
          example: text
        required:
          type: boolean
          description: >-
            Whether a run must supply this input. ABSENT MEANS REQUIRED — the
            validator treats a missing `required` as `true`, it does not default
            to optional.
          example: true
        default:
          description: >-
            The value a run receives when it OMITS this input
            (`applyInputDefaults`). Part of the run contract: a caller that
            sends nothing gets this.
          oneOf:
            - type: string
            - type: number
            - type: boolean
            - type: object
              additionalProperties: true
            - type: array
              items: {}
        savedValue:
          description: >-
            The value the EDITOR last saved for this input, so a workflow
            reopens showing what its author typed. NOT a default — nothing on
            the run path reads it, and a `required` input may carry one.
          oneOf:
            - type: string
            - type: number
            - type: boolean
            - type: object
              additionalProperties: true
            - type: array
              items: {}
        label:
          type: string
          description: Display label for editors. Not read by the engine.
          example: Topic
        description:
          type: string
          description: Display help text for editors. Not read by the engine.
      required:
        - name
        - type
    ErrorDetailDto:
      type: object
      properties:
        message:
          type: string
          example: Model not found
          description: Human-readable error message
        type:
          type: string
          example: invalid_request_error
          description: Error category
          enum:
            - invalid_request_error
            - authentication_error
            - permission_error
            - quota_exceeded
            - rate_limit_error
            - server_error
        code:
          type: string
          example: model_not_found
          nullable: true
          description: >-
            Stable machine-readable error code. Branch on this rather than on
            `message`, which is prose and may be reworded.
        param:
          type: string
          example: model
          nullable: true
          description: >-
            Name of the request parameter that triggered the error. `null` when
            the error is not attributable to one field.
        job_id:
          type: string
          example: job_1hR9xTPZqK4mVLc2nJ7fY5wB
          description: >-
            Handle to work that is ALREADY RUNNING AND ALREADY BILLED, present
            on the few errors that carry one. When it is here, this is not a
            failure to retry — retrying pays twice. Collect the result from `GET
            /v1/images/jobs/{job_id}`, which serves every durable media job
            regardless of modality.


            Two situations produce it. A media generation that outruns the
            gateway's wait answers `504` with `code: "job_timeout"` and keeps
            working. And `POST /v1/audio/speech` answers **500** with `code:
            "artifact_unreadable"` when the speech was generated and settled but
            could not be read back from storage — the audio exists and is paid
            for; only this response failed.


            Declared here rather than per-endpoint because the rule is about the
            FIELD, not the status: if this is present, there is a paid-for
            result to collect. It was undeclared until now, so a client
            generated from this document could not see the one field that
            recovers money already spent.
      required:
        - message
        - type
        - code
        - param
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: Authorization
      description: 'API key in format: Bearer inf_***'

````