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

# Update Template

> Update an extraction template's name, description, schema, or settings.

## Authentication & Scope

Requires the `templates-write` ability.

## Request

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

{
  "name": "Updated Invoice Template",
  "schema_json": {
    "config": {
      "reasoning_enabled": true
    },
    "groups": {
      "invoice_details": {
        "search_query": "invoice number, date, total",
        "fields": {
          "invoice_number": { "type": "string" },
          "date": { "type": "string" },
          "total_amount": { "type": "number" }
        }
      }
    }
  }
}
```

### Path Parameters

| Parameter    | Type | Required | Description     |
| ------------ | ---- | -------- | --------------- |
| `templateId` | uuid | Yes      | The template ID |

### Body Parameters

| Parameter     | Type   | Required | Description               |
| ------------- | ------ | -------- | ------------------------- |
| `name`        | string | No       | Updated name              |
| `description` | string | No       | Updated description       |
| `schema_json` | object | No       | Updated extraction schema |
| `settings`    | object | No       | Updated parsing settings  |

## Response

`200 OK` – The updated template.

```json theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Updated Invoice Template",
  "schema_json": { ... },
  "settings": { ... },
  "workspace_id": 1,
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-16T09:00:00Z"
}
```

<Note>
  Template changes are versioned. You can view version history in the dashboard.
</Note>


## OpenAPI

````yaml put /extractions/templates/{templateId}
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}:
    put:
      tags:
        - Extraction Templates
      summary: Update Template
      description: Update an extraction template. Requires `templates-write`.
      operationId: updateTemplate
      parameters:
        - name: templateId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                description:
                  type: string
                schema_json:
                  $ref: '#/components/schemas/ExtractionSchema'
                settings:
                  type: object
      responses:
        '200':
          description: Updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExtractionTemplate'
        '403':
          description: Forbidden
components:
  schemas:
    ExtractionSchema:
      type: object
      description: JSON schema defining extraction fields and groups
      properties:
        config:
          type: object
          properties:
            reasoning_enabled:
              type: boolean
            system_message:
              type: string
        definitions:
          type: object
          additionalProperties: true
        groups:
          type: object
          additionalProperties:
            type: object
            properties:
              search_query:
                type: string
              extraction_prompt:
                type: string
              fields:
                type: object
                additionalProperties: true
    ExtractionTemplate:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
        description:
          type: string
        schema_json:
          $ref: '#/components/schemas/ExtractionSchema'
        settings:
          type: object
          properties:
            parsing:
              type: object
              properties:
                contextual_embedding:
                  type: boolean
        workspace_id:
          type: integer
        created_at:
          type: string
          format: date-time
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
  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.

````