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

# Get Workflow

Retrieve a workflow by ID or name, including full node configuration, edges, and version details. By default, the latest version is returned.

## Behavior Notes

* Use `version` to retrieve a specific version number.
* Use `label` to retrieve the version currently assigned to a release label.
* `version` and `label` are mutually exclusive.

## Related

* [Create Workflow](/reference/create-workflow)
* [Update Workflow](/reference/patch-workflow)
* [Workflows](/why-promptlayer/workflows)


## OpenAPI

````yaml GET /workflows/{workflow_id_or_name}
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security:
  - ApiKeyAuth: []
paths:
  /workflows/{workflow_id_or_name}:
    get:
      tags:
        - workflow
      summary: Get Agent
      operationId: getWorkflow
      parameters:
        - name: workflow_id_or_name
          in: path
          required: true
          schema:
            type: string
          description: The agent ID or name.
          example: my-workflow
        - name: version
          in: query
          required: false
          schema:
            type: integer
            exclusiveMinimum: 0
          description: >-
            Specific version number to retrieve. Mutually exclusive with
            `label`.
          example: 3
        - name: label
          in: query
          required: false
          schema:
            type: string
          description: >-
            Release label name to retrieve (e.g. 'prod', 'staging'). Mutually
            exclusive with `version`.
          example: production
      responses:
        '200':
          description: Agent retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  workflow_id:
                    type: integer
                    description: Unique identifier for the agent
                  workflow_name:
                    type: string
                    description: Name of the agent
                  version:
                    type: integer
                    description: Version number
                  workflow_version_id:
                    type: integer
                    description: Unique identifier for this version
                  commit_message:
                    type: string
                    nullable: true
                    description: Commit message for this version
                  required_input_variables:
                    type: object
                    nullable: true
                    description: Input variable names mapped to their types
                    additionalProperties:
                      type: string
                  release_labels:
                    type: array
                    items:
                      type: string
                    description: Release labels attached to this version
                  created_at:
                    type: string
                    nullable: true
                    description: ISO 8601 timestamp of when this version was created
                  nodes:
                    type: array
                    description: >-
                      Full node definitions including configuration and
                      dependencies
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: UUID of the node
                        workflow_version_id:
                          type: integer
                          description: Version ID this node belongs to
                        name:
                          type: string
                          description: Node name (unique within a version)
                        node_type:
                          type: string
                          description: >-
                            Type of node (e.g. PROMPT_TEMPLATE, CODE_EXECUTION,
                            VARIABLE)
                        is_output_node:
                          type: boolean
                          description: Whether this node is an output node
                        configuration:
                          type: object
                          description: >-
                            Full node configuration (structure depends on
                            node_type)
                        dependencies:
                          type: array
                          items:
                            type: string
                          description: Names of nodes this node depends on
                      required:
                        - id
                        - name
                        - node_type
                        - is_output_node
                        - configuration
                        - dependencies
                  edges:
                    type: array
                    description: Connections between nodes with optional conditionals
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: UUID of the edge
                        source_node_name:
                          type: string
                          description: Name of the source node
                        target_node_name:
                          type: string
                          description: Name of the target node
                        is_and:
                          type: boolean
                          description: >-
                            Whether all conditionals must be true (AND) or any
                            (OR)
                        conditionals:
                          type: array
                          description: Conditional rules for this edge
                          items:
                            type: object
                      required:
                        - id
                        - source_node_name
                        - target_node_name
                        - is_and
                required:
                  - success
                  - workflow_id
                  - workflow_name
                  - version
                  - workflow_version_id
                  - nodes
                  - edges
              examples:
                latest:
                  summary: Workflow
                  value:
                    success: true
                    workflow_id: 123
                    workflow_name: my-workflow
                    version_number: 3
                    release_labels:
                      - production
                    nodes:
                      - name: greeting
                        node_type: VARIABLE
                        is_output_node: true
                        configuration:
                          value:
                            type: string
                            value: Hello, World!
                        dependencies: []
                    edges: []
                    required_input_variables:
                      user_message: string
                    external_ids: []
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  responses:
    UnauthorizedError:
      description: Unauthorized - missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFoundError:
      description: Not found - requested resource does not exist or is not accessible.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ValidationError:
      description: Validation error - request parameters or body are invalid.
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/HTTPValidationError'
              - $ref: '#/components/schemas/ErrorResponse'
  schemas:
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          default: false
          description: Indicates that the request failed.
        message:
          type: string
          description: Human-readable error message.
        error:
          type: string
          description: Machine-readable or fallback error message.
      additionalProperties: true
      description: >-
        Standard error response. Some legacy endpoints may return either message
        or error.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````