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

# Extract OCR and NLP data

> Retrieve OCR or NLP data generated for a fax.

Provide the required `job_id`, `direction`, and `type` fields. Set `direction` to `inbound` or `outbound`. The `type` value is case-sensitive and accepts `OCR` or `NLP`. Authenticate with a Bearer access token.

<Note>
  The `200` response has separate shortened OCR and NLP examples. OCR returns an array of detected blocks in `data.json_text`; NLP returns a structured object. See [OCR and NLP response formats](/guides/ocr-nlp-response-formats).
</Note>


## OpenAPI

````yaml POST /v1/ai/extract
openapi: 3.1.0
info:
  title: Amplify Customer API
  version: 1.0.0
  description: |-
    Canonical contract for the Amplify customer-facing API. This YAML file is
    the source of truth for Postman and Mintlify. Operations marked with
    x-amplify-validation-status: pending were migrated from the legacy Postman
    collection and must be validated before their contract is considered final.
servers:
  - url: https://api.amplify.xyz
    description: Production
  - url: https://dev-api.amplify.xyz
    description: Development
security: []
tags:
  - name: Authentication
  - name: Fax
  - name: Send Faxes
  - name: Receive Faxes
  - name: Manage Faxes
  - name: Workspace
  - name: Numbers
  - name: Contacts
  - name: Documents
  - name: Templates
paths:
  /v1/ai/extract:
    post:
      tags:
        - Fax
      summary: Extract OCR and NLP data
      description: >-
        Returns previously generated OCR or NLP data for a fax. The response
        data shape depends on the requested processing type.
      operationId: postv1AiExtract
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - job_id
                - direction
                - type
              properties:
                job_id:
                  type: string
                  description: >-
                    Unique identifier of the fax whose extracted data is
                    returned.
                direction:
                  type: string
                  description: Direction of the fax whose extracted data is returned.
                  enum:
                    - inbound
                    - outbound
                type:
                  type: string
                  description: Case-sensitive extraction type.
                  enum:
                    - OCR
                    - NLP
            example:
              job_id: 01KKXJMQMDZ6JAFVHCEG9TZ65M
              direction: outbound
              type: NLP
      responses:
        '200':
          description: >-
            The requested OCR or NLP data was retrieved successfully. This
            example shows an NLP response; OCR returns a different `json_text`
            shape.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - message
                  - data
                properties:
                  status:
                    type: integer
                  message:
                    type: string
                  data:
                    type: object
                    required:
                      - json_text
                    properties:
                      json_text:
                        description: >-
                          Extracted data whose structure depends on whether
                          `type` is `OCR` or `NLP`.
                        oneOf:
                          - type: object
                            description: NLP result object.
                            additionalProperties: true
                          - type: array
                            description: OCR blocks detected in the fax document.
                            items:
                              type: object
                              additionalProperties: true
              examples:
                nlp:
                  summary: Shortened NLP response
                  value:
                    status: 1
                    message: JSON NLP data retrieved successfully.
                    data:
                      json_text:
                        task_id: 8cd23e57-ed34-49fd-a81c-ca068a263076
                        action: combined
                        status: success
                        DPI: '200'
                        result_type: object
                        result:
                          document_type:
                            overall:
                              class: Other
                              confidence: 0
                              index: -1
                        errors: []
                ocr:
                  summary: Shortened OCR response
                  value:
                    status: 1
                    message: JSON OCR data retrieved successfully.
                    data:
                      json_text:
                        - BlockType: PAGE
                          Id: 0faea376-249c-4c4f-bb6f-a70241af2d65
                          Page: 1
                          Geometry:
                            BoundingBox:
                              Width: 1
                              Height: 1
                              Left: 0
                              Top: 0
                        - BlockType: LINE
                          Confidence: 100
                          Text: FAX
                          Id: 27f2be95-f9d5-494b-80bd-643d75d10bc3
                          Page: 1
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````