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

# List Workflows

> List workflows with pagination and optional filtering.

List workflows with id pagination. Use `before` or `after` to page through results.

<RequestExample>
  ```python Python theme={null}
  from retab import Retab

  client = Retab()

  workflows = client.workflows.list(
      limit=10,
      order="desc",
      sort_by="updated_at",
  )

  next_page = client.workflows.list(
      after=workflows.list_metadata.after,
      limit=5,
  )

  print(workflows.list_metadata.after)
  print(next_page.data[0].name)
  ```

  ```typescript TypeScript theme={null}
  import { Retab } from "@retab/node";

  const client = new Retab({ apiKey: process.env.RETAB_API_KEY });

  const workflows = await client.workflows.list({
    limit: 10,
    order: "desc",
    sortBy: "updated_at",
  });

  const nextPage = await client.workflows.list({
    after: workflows.list_metadata.after ?? undefined,
    limit: 5,
  });

  console.log(workflows.list_metadata.after);
  console.log(nextPage.data[0]?.name);
  ```

  ```go Go theme={null}
  package main

  import (
  	"context"
  	"fmt"
  	"log"

  	retab "github.com/retab-dev/retab/clients/go"
  )

  func ptr[T any](v T) *T { return &v }

  func main() {
  	ctx := context.Background()

  	client, err := retab.NewClient("")
  	if err != nil {
  		log.Fatal(err)
  	}

  	workflows, err := client.Workflows.List(ctx, &retab.WorkflowsListParams{
  		PaginationParams: retab.PaginationParams{Limit: ptr(10), Order: ptr("desc")},
  		SortBy:           ptr("updated_at"),
  	})
  	if err != nil {
  		log.Fatal(err)
  	}

  	filtered, err := client.Workflows.List(ctx, &retab.WorkflowsListParams{
  		PaginationParams: retab.PaginationParams{
  			After: ptr("workflow_abc123xyz"),
  			Limit: ptr(5),
  		},
  	})
  	if err != nil {
  		log.Fatal(err)
  	}

  	fmt.Println(workflows.ListMetadata.After)
  	fmt.Println(filtered.Data[0].Name)
  }
  ```

  ```ruby Ruby theme={null}
  require 'retab'

  client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])

  workflows = client.workflows.list(
    limit: 10,
    order: 'desc',
    sort_by: 'updated_at',
  )

  filtered = client.workflows.list(
    after: 'workflow_abc123xyz',
    limit: 5,
    fields: 'id,name,updated_at',
  )

  puts workflows.list_metadata.after
  puts filtered.data[0].name
  ```

  ```rust Rust theme={null}
  use retab::enums::WorkflowsOrder;
  use retab::resources::workflows::ListParams;
  use retab::Retab;

  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error>> {
      let client = Retab::new(std::env::var("RETAB_API_KEY")?);

      let workflows = client
          .workflows()
          .list(ListParams {
              limit: Some(10),
              order: Some(WorkflowsOrder::Desc),
              sort_by: Some("updated_at".into()),
              ..Default::default()
          })
          .await?;

      let filtered = client
          .workflows()
          .list(ListParams {
              after: Some("workflow_abc123xyz".into()),
              limit: Some(5),
              ..Default::default()
          })
          .await?;

      println!("{:?}", workflows.list_metadata.after);
      if let Some(first) = filtered.data.first() {
          println!("{}", first.name.as_deref().unwrap_or(""));
      }
      Ok(())
  }
  ```

  ```php PHP theme={null}
  <?php
  require 'vendor/autoload.php';

  use Retab\Client;

  $client = new Client(apiKey: getenv('RETAB_API_KEY'));

  $result = $client->workflows()->list();
  print_r($result);
  ```

  ```csharp C# theme={null}
  using Retab;
  using RetabClient = Retab.Retab;

  var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
  var client = new RetabClient(apiKey);

  var result = await client.Workflows.ListAsync(new WorkflowsListOptions());
  Console.WriteLine(result);
  ```

  ```java Java theme={null}
  import com.retab.RetabClient;

  public final class Example {
    public static void main(String[] args) throws Exception {
      RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY"));

      var result = client.workflows().list(null, null, 10L, null, "created_at", null);
      System.out.println(result);
    }
  }
  ```

  ```curl cURL theme={null}
  curl -X 'GET' \
    'https://api.retab.com/v1/workflows?limit=10&order=desc&sort_by=updated_at' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer <your-api-key>'

  curl -X 'GET' \
    'https://api.retab.com/v1/workflows?after=workflow_abc123xyz&limit=5&fields=id%2Cname%2Cupdated_at' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer <your-api-key>'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "data": [
      {
        "id": "workflow_def456xyz",
        "name": "Invoice Processing",
        "description": "Extract invoice fields and route for review",
        "published": {
          "version_id": "ver_8zJfV7T9qK2mP4xN6bR1cD3eF5gH7iJ9",
          "published_at": "2026-03-12T09:45:00Z"
        },
        "created_at": "2026-03-10T12:00:00Z",
        "updated_at": "2026-03-12T09:45:00Z"
      },
      {
        "id": "workflow_abc123xyz",
        "name": "Receipt Classification",
        "description": "",
        "published": null,
        "created_at": "2026-03-09T15:30:00Z",
        "updated_at": "2026-03-11T18:20:00Z"
      }
    ],
    "list_metadata": {
      "before": null,
      "after": "workflow_abc123xyz"
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /v1/workflows
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.retab.com
security: []
paths:
  /v1/workflows:
    get:
      tags:
        - Workflows
      summary: List Workflows
      description: List workflows with pagination and optional filtering.
      operationId: list_workflows
      parameters:
        - in: query
          name: before
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Before
          required: false
        - in: query
          name: after
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: After
          required: false
        - in: query
          name: limit
          schema:
            type: integer
            maximum: 100
            minimum: 1
            description: Items per page
            default: 10
            title: Limit
          required: false
          description: Items per page
        - in: query
          name: order
          schema:
            enum:
              - asc
              - desc
            type: string
            default: desc
            title: Order
          required: false
        - in: query
          name: sort_by
          schema:
            type: string
            default: updated_at
            title: Sort By
          required: false
        - in: query
          name: project_id
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Only return workflows belonging to this project. Use the shared
              project's id to list the organization's shared workflows.
            title: Project Id
          required: false
          description: >-
            Only return workflows belonging to this project. Use the shared
            project's id to list the organization's shared workflows.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowList'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    WorkflowList:
      description: >-
        A page of `Workflow` resources. `data` holds the items and
        `list_metadata` carries the `before`/`after` cursors; pass `after` to
        fetch the next page.
      properties:
        data:
          items:
            $ref: '#/components/schemas/Workflow'
          type: array
          title: Data
        list_metadata:
          $ref: '#/components/schemas/ListMetadata'
      type: object
      required:
        - data
        - list_metadata
      title: WorkflowList
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
          default: []
      type: object
      title: HTTPValidationError
    Workflow:
      properties:
        id:
          type: string
          title: Id
          description: Unique ID for this workflow
        name:
          type: string
          title: Name
          description: The name of the workflow
          default: Untitled Workflow
        description:
          type: string
          title: Description
          description: Description of the workflow
          default: ''
        project_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Project Id
          description: >-
            Project that owns this workflow. Null only on legacy rows that
            predate the project backfill.
        published:
          anyOf:
            - $ref: '#/components/schemas/WorkflowPublished'
            - type: 'null'
          description: Published workflow metadata when a published version exists
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - created_at
        - id
        - updated_at
      title: Workflow
      description: A workflow and its current configuration.
    ListMetadata:
      properties:
        before:
          anyOf:
            - type: string
            - type: 'null'
          title: Before
        after:
          anyOf:
            - type: string
            - type: 'null'
          title: After
      type: object
      required:
        - after
        - before
      title: ListMetadata
      description: Boundary resource IDs for page navigation.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
          default: null
        ctx:
          type: object
          title: Context
          default: {}
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    WorkflowPublished:
      properties:
        version_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Version Id
          description: Published content-addressed workflow version ID
        published_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Published At
          description: When the workflow was last published
        description:
          type: string
          title: Description
          description: >-
            Release note attached to the currently published version. Echoes the
            `description` body passed to `POST /v1/workflows/{id}/publish` so
            the caller can confirm it was stored without a separate fetch.
          default: ''
      type: object
      title: WorkflowPublished
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````