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

# Create Entry Correction

> Create or update a correction for an entry.

Supports two correction modes:
1. **Full replacement**: Provide the complete corrected object in the `data` field.
2. **Path-based patches**: Provide a list of field-level patches, each with a JSON Pointer `path` and the new `value`.

You can also include `notes` to describe the reason for the correction.



## OpenAPI

````yaml /api-reference/openapi.json post /v3/entries/{entry_id}/correction
openapi: 3.1.0
info:
  title: matil API
  description: Structured data extraction for documents
  version: 3.0.0
servers:
  - url: https://api.matil.ai
security:
  - ApiKeyAuth: []
paths:
  /v3/entries/{entry_id}/correction:
    post:
      tags:
        - Entries
      summary: Create Entry Correction
      description: >-
        Create or update a correction for an entry.


        Supports two correction modes:

        1. **Full replacement**: Provide the complete corrected object in the
        `data` field.

        2. **Path-based patches**: Provide a list of field-level patches, each
        with a JSON Pointer `path` and the new `value`.


        You can also include `notes` to describe the reason for the correction.
      operationId: create_entry_correction_v3_entries__entry_id__correction_post
      parameters:
        - name: entry_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Entry Id
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
        - name: X-Tenant-ID
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Tenant-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CorrectionCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CorrectionCreateResponse'
        '401':
          description: >-
            Authentication required. Provide a valid `x-api-key` or
            `Authorization: Bearer` token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: AUTHENTICATION_REQUIRED
                message: Authentication required. Provide a valid x-api-key header.
                details: null
        '404':
          description: Entry not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: ENTRY_NOT_FOUND
                message: Entry not found.
                details: null
        '422':
          description: Validation error. Check request body and document format.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: VALIDATION_ERROR
                message: >-
                  Provide either data or patches (at least one must be
                  non-empty).
                details: null
components:
  schemas:
    CorrectionCreate:
      properties:
        data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Data
          description: Full corrected JSON object (complete replacement mode)
        patches:
          anyOf:
            - items:
                $ref: '#/components/schemas/FieldPatch'
              type: array
            - type: 'null'
          title: Patches
          description: >-
            List of path-based field patches using JSON Pointer syntax (partial
            update mode)
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
          description: Notes or reason for the correction
      type: object
      title: CorrectionCreate
      description: >-
        Schema for creating a correction.


        Supports two correction modes:

        1. Full replacement: Provide complete corrected object in `data`

        2. Path-based patches: Provide list of field patches in `patches`


        Both can be used together: `data` provides the base, `patches` applies
        updates on top.
      examples:
        - title: Full replacement
          value:
            data:
              invoice_number: INV-002
              items:
                - desc: Item 1
                  price: 100
              total: 100
            notes: Fixed invoice number
        - title: Path-based patches
          value:
            notes: Fixed typos
            patches:
              - path: /invoice_number
                value: INV-002
              - path: /items/0/price
                value: 150
    CorrectionCreateResponse:
      properties:
        entry_id:
          type: string
          format: uuid
          title: Entry Id
          description: Entry ID that was corrected
        patches_applied:
          type: integer
          title: Patches Applied
          description: Number of patches applied
      type: object
      required:
        - entry_id
        - patches_applied
      title: CorrectionCreateResponse
      description: Response for correction creation.
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Machine-readable error code.
        message:
          type: string
          description: Human-readable description.
        details:
          type: object
          nullable: true
          description: Additional context when available.
      required:
        - error
        - message
    FieldPatch:
      properties:
        path:
          type: string
          title: Path
          description: JSON Pointer path to the field (RFC 6901 format)
          examples:
            - /items/0/price
            - /invoice_number
            - /customer/name
        value:
          title: Value
          description: New value to set at the specified path
      type: object
      required:
        - path
        - value
      title: FieldPatch
      description: A single JSON path-based field patch.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````