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

# Batch Export Results

> Export results from multiple sessions in a single file.

## Authentication & Scope

Requires the `sessions-read` ability.

## Request

```http theme={null}
POST /extractions/templates/550e8400-e29b-41d4-a716-446655440000/sessions/batch/export/excel HTTP/1.1
Host: api.raydocs.com
Authorization: Bearer <token>
Content-Type: application/json

{
  "session_ids": [
    "770e8400-e29b-41d4-a716-446655440001",
    "770e8400-e29b-41d4-a716-446655440002",
    "770e8400-e29b-41d4-a716-446655440003"
  ]
}
```

### Path Parameters

| Parameter    | Type   | Required | Description                      |
| ------------ | ------ | -------- | -------------------------------- |
| `templateId` | uuid   | Yes      | The template ID                  |
| `format`     | string | Yes      | Export format: `json` or `excel` |

### Body Parameters

| Parameter     | Type  | Required | Description                    |
| ------------- | ----- | -------- | ------------------------------ |
| `session_ids` | array | Yes      | Array of session IDs to export |

## Response

### JSON Format

`200 OK` – JSON array of results.

```json theme={null}
[
  {
    "session_id": "770e8400-e29b-41d4-a716-446655440001",
    "session_name": "Invoice Batch 1",
    "data": {
      "invoice_details": {
        "invoice_number": "INV-001",
        "total_amount": 1500.00
      }
    }
  }
]
```

### Excel Format

`200 OK` – Excel file download with `Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`.

<Tip>
  Excel exports include audit data with reasoning and source references in additional sheets.
</Tip>


## OpenAPI

````yaml post /extractions/templates/{templateId}/sessions/batch/export
openapi: 3.0.1
info:
  title: Raydocs API
  description: REST API for document extraction with AI-powered data parsing
  version: 1.0.0
servers:
  - url: https://api.raydocs.com
security:
  - bearerAuth: []
tags:
  - name: Workspaces
    description: Create and manage workspaces.
  - name: Workspace Users
    description: Manage users within a workspace.
  - name: Extraction Templates
    description: Define extraction schemas and settings.
  - name: Extraction Sessions
    description: Manage extraction jobs and documents.
  - name: Batch Operations
    description: Bulk operations on sessions.
  - name: Documents
    description: Upload and manage source documents.
  - name: Workflows
    description: Discover workflow runs and read their public outputs.
  - name: Results
    description: Access extraction results.
paths:
  /extractions/templates/{templateId}/sessions/batch/export:
    post:
      tags:
        - Batch Operations
      summary: Batch Export
      description: Export results from multiple sessions. Requires `sessions-read`.
      operationId: batchExport
      parameters:
        - name: templateId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - session_ids
              properties:
                session_ids:
                  type: array
                  items:
                    type: string
                    format: uuid
                format:
                  type: string
                  enum:
                    - json
                    - csv
                    - excel
                  default: json
      responses:
        '200':
          description: Export data
        '403':
          description: Forbidden
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Personal Access Token created from the Raydocs dashboard.

        Include in the Authorization header: `Bearer <your_token>`

        See [API Keys](/api-reference/api-keys) for token creation and
        management.

````