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

# Extract Information Asynchronously

> Extract structured information from documents asynchronously

<Note>
  This API requires authentication. See our [Authentication Guide](/common/authentication) for details.
</Note>

### Features

* Supports PDF and image files (jpg, jpeg, png)
* Accepts URLs or base64-encoded file content
* Maximum file size: 10MB
* Supports both direct schema and template-based extraction
* Returns immediately with a task\_id for status tracking
* Optional callback URL for webhook notification when processing completes

### Request Body

<ParamField body="document" type="object">
  Document to process (either URL or file content)
</ParamField>

<ParamField body="document.url" type="string">
  URL of the document to process
</ParamField>

<ParamField body="document.file_content" type="string">
  Base64 encoded file content
</ParamField>

<ParamField body="extraction_schema" type="object">
  Extraction schema definition
</ParamField>

<ParamField body="template_id" type="string">
  ID of a saved extraction template
</ParamField>

<ParamField body="callback_url" type="string">
  Optional URL for webhook notification when processing completes
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.appliedai.club/api/extractor/v1/extract-async \
    -H "Authorization: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "document": {
        "url": "https://example.com/invoice.pdf"
      },
      "extraction_schema": {
        "fields": [
          {"name": "invoice_number", "type": "string", "description": "Invoice number from the document"},
          {"name": "total_amount", "type": "number", "description": "Total amount from the invoice"}
        ],
        "document_description": "Invoice document"
      },
      "callback_url": "https://your-server.com/webhook"
    }'
  ```

  ```python Python theme={null}
  import requests
  import json

  url = "https://api.appliedai.club/api/extractor/v1/extract-async"
  headers = {
      "Authorization": "YOUR_API_KEY",
      "Content-Type": "application/json"
  }
  payload = {
      "document": {
          "url": "https://example.com/invoice.pdf"
      },
      "extraction_schema": {
          "fields": [
              {"name": "invoice_number", "type": "string", "description": "Invoice number from the document"},
              {"name": "total_amount", "type": "number", "description": "Total amount from the invoice"}
          ],
          "document_description": "Invoice document"
      },
      "callback_url": "https://your-server.com/webhook"
  }

  response = requests.post(url, headers=headers, json=payload)
  result = response.json()
  print(result)
  ```
</RequestExample>


## OpenAPI

````yaml POST /api/extractor/v1/extract-async
openapi: 3.1.0
info:
  title: Image Extraction API
  description: Extract structured data from images and PDFs
  version: 1.0.0
servers: []
security:
  - APIKeyHeader: []
paths:
  /api/extractor/v1/extract-async:
    post:
      tags:
        - extractor
      summary: Extract Information from Document Asynchronously
      description: >-
        Extract structured information from documents (PDF or images)
        asynchronously.
            
            **Features:**
            * Supports PDF and image files (jpg, jpeg, png)
            * Accepts URLs or base64-encoded file content
            * Maximum file size: 10MB
            * Supports both direct schema and template-based extraction
            * Returns immediately with a task_id for status tracking
            * Optional callback URL for webhook notification when processing completes
            
            **Input Options:**
            1. Document URL
            2. Base64 encoded file content
            3. Direct extraction schema or template ID
      operationId: extract_text_async_api_extractor_v1_extract_async_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AsyncExtractionRequest'
            example:
              extraction_schema:
                fields:
                  - name: invoice_number
                    type: string
                    description: Invoice number from the document
                  - name: total_amount
                    type: number
                    description: Total amount from the invoice
                document_description: Invoice document
              provider: openai
              document:
                url: https://example.com/invoice.pdf
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncExtractionResponse'
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
        '401':
          description: Authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
        '422':
          description: Validation error in request body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
      security:
        - APIKeyHeader: []
components:
  schemas:
    AsyncExtractionRequest:
      properties:
        document_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Url
        file_content:
          anyOf:
            - type: string
            - type: 'null'
          title: File Content
        extraction_schema:
          anyOf:
            - type: object
            - type: 'null'
          title: Extraction Schema
        template_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Template Id
        provider:
          anyOf:
            - $ref: '#/components/schemas/LLMProvider'
            - type: 'null'
        document_description:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Description
        callback_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Callback Url
      type: object
      title: AsyncExtractionRequest
      description: Request model for asynchronous extraction
    AsyncExtractionResponse:
      properties:
        task_id:
          type: string
          title: Task Id
        status:
          $ref: '#/components/schemas/BatchProcessingStatus'
        message:
          type: string
          title: Message
      type: object
      required:
        - task_id
        - status
        - message
      title: AsyncExtractionResponse
      description: Response model for asynchronous extraction request
    ErrorDetail:
      properties:
        detail:
          type: string
          title: Detail
      type: object
      required:
        - detail
      title: ErrorDetail
      description: Standard error response schema
    AuthError:
      properties:
        detail:
          type: string
          title: Detail
        error_code:
          type: string
          title: Error Code
          default: unauthorized
      type: object
      required:
        - detail
      title: AuthError
      description: Authentication error response schema
    ValidationError:
      properties:
        detail:
          items:
            type: object
          type: array
          title: Detail
      type: object
      required:
        - detail
      title: ValidationError
      description: Validation error response schema
    RateLimitError:
      properties:
        detail:
          type: string
          title: Detail
        retry_after:
          anyOf:
            - type: integer
            - type: 'null'
          title: Retry After
      type: object
      required:
        - detail
      title: RateLimitError
      description: Rate limit error response schema
    LLMProvider:
      type: string
      enum:
        - openai
        - anthropic
        - gemini
      title: LLMProvider
    BatchProcessingStatus:
      type: string
      enum:
        - processing
        - retrying
        - completed
        - failed
      title: BatchProcessingStatus
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization
      description: Enter your API key

````