> ## 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 Splits

> List splits.

Returns a paginated list of splits for the authenticated environment, newest first by
default. Filter by `filename` prefix (case-insensitive) and by a `created_at` window
using `from_date`/`to_date` (`YYYY-MM-DD`). Page through results with `before`/`after`,
`limit`, and `order`.

List persisted splits for your organization, with id-based pagination.

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

  client = Retab()

  splits = client.splits.list(limit=20, order="desc")
  for s in splits.data:
      print(f"{s.id}: {s.file.filename}")
  ```

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

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

  const splits = await client.splits.list({ limit: 20, order: "desc" });
  for (const s of splits.data) {
    console.log(`${s.id}: ${s.file.filename}`);
  }
  ```

  ```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)
  	}

  	splits, err := client.Splits.List(ctx, &retab.SplitsListParams{
  		PaginationParams: retab.PaginationParams{Limit: ptr(20), Order: ptr("desc")},
  	})
  	if err != nil {
  		log.Fatal(err)
  	}
  	for _, s := range splits.Data {
  		fmt.Printf("%s: %s\n", s.ID, s.File.Filename)
  	}
  }
  ```

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

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

  splits = client.splits.list(limit: 20, order: 'desc')
  splits.data.each do |s|
    puts "#{s.id}: #{s.file.filename}"
  end
  ```

  ```rust Rust theme={null}
  use retab::enums::SplitsOrder;
  use retab::resources::splits::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 splits = client
          .splits()
          .list(ListParams {
              limit: Some(20),
              order: Some(SplitsOrder::Desc),
              ..Default::default()
          })
          .await?;
      for s in &splits.data {
          println!("{}: {}", s.id, s.file.filename);
      }
      Ok(())
  }
  ```

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

  use Retab\Client;

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

  $result = $client->splits()->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.Splits.ListAsync(new SplitsListOptions());
  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.splits().list(null, null, 10L, null, "invoice.pdf", null, null, null);
      System.out.println(result);
    }
  }
  ```

  ```curl cURL theme={null}
  curl -X GET \
    'https://api.retab.com/v1/splits?limit=20&order=desc' \
    -H "Authorization: Bearer $RETAB_API_KEY"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "data": [
      {
        "id": "split_01G34H8J2K",
        "file": {
          "id": "file_6dd6eb00688ad8d1",
          "filename": "invoice_batch.pdf",
          "mime_type": "application/pdf"
        },
        "model": "retab-small",
        "subdocuments": [
          {
            "name": "invoice",
            "description": "Invoice documents",
            "allow_multiple_instances": true
          }
        ],
        "n_consensus": 1,
        "instructions": null,
        "output": [{ "name": "invoice", "pages": [1, 2, 3] }],
        "consensus": null,
        "usage": {
          "credits": 1.0
        },
        "created_at": "2024-03-15T10:30:00Z"
      }
    ],
    "list_metadata": {
      "before": null,
      "after": "split_01G34H8J2K",
      "total_count": 12
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /v1/splits
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.retab.com
security: []
paths:
  /v1/splits:
    get:
      tags:
        - Splits
      summary: List Splits
      description: >-
        List splits.


        Returns a paginated list of splits for the authenticated environment,
        newest first by

        default. Filter by `filename` prefix (case-insensitive) and by a
        `created_at` window

        using `from_date`/`to_date` (`YYYY-MM-DD`). Page through results with
        `before`/`after`,

        `limit`, and `order`.
      operationId: list_splits
      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
            default: 10
            title: Limit
          required: false
        - in: query
          name: order
          schema:
            enum:
              - asc
              - desc
            type: string
            default: desc
            title: Order
          required: false
        - in: query
          name: filename
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Filename
          required: false
        - in: query
          name: status
          schema:
            anyOf:
              - enum:
                  - pending
                  - queued
                  - in_progress
                  - completed
                  - failed
                  - cancelled
                type: string
              - type: 'null'
            title: Status
          required: false
        - in: query
          name: from_date
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: From Date
          required: false
        - in: query
          name: to_date
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: To Date
          required: false
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SplitList'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    SplitList:
      description: >-
        A page of `Split` 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/Split'
          type: array
          title: Data
        list_metadata:
          $ref: '#/components/schemas/ListMetadata'
      type: object
      required:
        - data
        - list_metadata
      title: SplitList
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
          default: []
      type: object
      title: HTTPValidationError
    Split:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier of the split result
        file:
          $ref: '#/components/schemas/FileRef'
          description: Information about the split file
        model:
          type: string
          title: Model
          description: Model used for the split operation
        subdocuments:
          items:
            $ref: '#/components/schemas/Subdocument'
          type: array
          title: Subdocuments
          description: Subdocuments used for the split operation
        n_consensus:
          type: integer
          title: N Consensus
          description: Number of consensus votes used
          default: 1
        instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: Instructions
          description: Free-form instructions supplied with the split request.
        output:
          items:
            $ref: '#/components/schemas/SplitResult'
          type: array
          title: Output
          description: >-
            The list of document splits with their assigned pages. Empty []
            until status == 'completed'.
          default: []
        status:
          type: string
          enum:
            - pending
            - queued
            - in_progress
            - completed
            - failed
            - cancelled
          title: Status
          description: >-
            Lifecycle status. The synchronous path returns 'completed'.
            Background runs progress pending -> queued -> in_progress ->
            completed | failed | cancelled.
          default: pending
        error:
          anyOf:
            - $ref: '#/components/schemas/PrimitiveError'
            - type: 'null'
          description: >-
            Error details when a background run fails; null otherwise. Always
            present so consumers can read it without an existence check.
        consensus:
          anyOf:
            - $ref: '#/components/schemas/SplitConsensus'
            - type: 'null'
          description: Consensus metadata for multi-vote split runs
        usage:
          anyOf:
            - $ref: '#/components/schemas/RetabUsage'
            - type: 'null'
          description: Usage information for the split operation
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
      type: object
      required:
        - file
        - id
        - model
        - subdocuments
      title: Split
      description: 'A split result: a document divided into its constituent `subdocuments`.'
    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
    FileRef:
      properties:
        id:
          type: string
          title: Id
          description: ID of the file
        filename:
          type: string
          title: Filename
          description: Filename of the file
        mime_type:
          type: string
          title: Mime Type
          description: MIME type of the file
      type: object
      required:
        - filename
        - id
        - mime_type
      title: FileRef
      description: Public/shared file reference used across SDK and customer-facing APIs.
    Subdocument:
      properties:
        name:
          type: string
          title: Name
          description: The name of the subdocument
        description:
          type: string
          title: Description
          description: The description of the subdocument
          default: ''
        allow_multiple_instances:
          type: boolean
          title: Allow Multiple Instances
          description: >-
            When true, this subdocument type can appear more than once in the
            document — the split will identify each distinct instance (runs an
            extra vision-based refinement pass).
          default: false
      type: object
      required:
        - name
      title: Subdocument
    SplitResult:
      properties:
        name:
          type: string
          title: Name
          description: The name of the subdocument
        pages:
          items:
            type: integer
          type: array
          title: Pages
          description: The pages of the subdocument (1-indexed)
        regions:
          items:
            $ref: '#/components/schemas/SheetRegion'
          type: array
          title: Regions
          default: []
      type: object
      required:
        - name
        - pages
      title: SplitResult
    PrimitiveError:
      properties:
        code:
          type: string
          title: Code
          description: Machine-readable error code.
        message:
          type: string
          title: Message
          description: Human-readable error message.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: Optional structured error context.
      type: object
      required:
        - code
        - message
      title: PrimitiveError
    SplitConsensus:
      properties:
        likelihoods:
          items:
            $ref: '#/components/schemas/SplitSubdocumentLikelihood'
          type: array
          title: Likelihoods
          description: Consensus likelihood tree mirroring the split output
          default: []
        choices:
          items:
            items:
              $ref: '#/components/schemas/SplitResult'
            type: array
          type: array
          title: Choices
          description: Alternative split vote outputs used to build the consolidated result
          default: []
      type: object
      title: SplitConsensus
    RetabUsage:
      properties:
        credits:
          type: number
          title: Credits
          description: Credits consumed for processing
      type: object
      required:
        - credits
      title: RetabUsage
      description: Usage information for document processing.
    SheetRegion:
      properties:
        col_end:
          anyOf:
            - type: integer
            - type: 'null'
          title: Col End
        col_start:
          anyOf:
            - type: integer
            - type: 'null'
          title: Col Start
        header_rows:
          items:
            type: integer
          type: array
          title: Header Rows
          default: []
        row_end:
          type: integer
          title: Row End
        row_start:
          type: integer
          title: Row Start
        sheet_index:
          type: integer
          title: Sheet Index
        sheet_name:
          type: string
          title: Sheet Name
      type: object
      required:
        - row_end
        - row_start
        - sheet_index
        - sheet_name
      title: SheetRegion
    SplitSubdocumentLikelihood:
      properties:
        name:
          anyOf:
            - type: number
            - type: 'null'
          title: Name
          description: Confidence that this split label is correct
        pages:
          items:
            type: number
          type: array
          title: Pages
          description: Confidence for each page in the corresponding split.pages array
          default: []
      type: object
      title: SplitSubdocumentLikelihood
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````