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

# Upload a document for extraction

> Upload a PDF document for extraction.

Accepts a PDF document and queues it for extraction processing. The document
is stored in immutable storage with the specified retention period for
SEC 17a-4 compliance.

Optionally provide a document_type hint to skip auto-classification.
Supported types: capital_call, distribution, k1, nav_statement, audited_financial,
invoice, trade_confirmation, wire_confirmation, subscription_agreement, insurance,
investor_letter.

Configure webhooks via `POST /v1/webhooks` to receive notifications when
processing completes.

Returns:
    IngestResponse with document_id, job_id, and status.

Raises:
    HTTPException 400: Invalid file type (only PDFs supported)
    HTTPException 413: File exceeds maximum size limit
    HTTPException 429: Rate limit exceeded



## OpenAPI

````yaml openapi.json post /v1/documents
openapi: 3.1.0
info:
  title: DocIntell API
  description: >-

    # DocIntell API


    **Turn Documents into Data. Keep the Source Safe.**


    Financial document intelligence platform that turns PDFs into queryable data
    while keeping source files secure and compliant.


    ## Features


    - **Document Ingestion**: Upload PDFs with SEC 17a-4 compliant immutable
    storage

    - **Schema Projection**: Query extracted data with custom schemas (not data
    dumps!)

    - **Multi-Schema Support**: Same document, multiple query patterns

    - **Webhook Delivery**: Async notifications on job completion

    - **Row-Level Security**: Multi-tenant isolation built-in


    ## Authentication


    All API endpoints (except `/health`, `/`, `/docs`, and `/redoc`) require API
    key authentication.


    Include your API key in the `Authorization` header:


    ```

    Authorization: Bearer dk_live_<your_key>

    ```


    Test keys start with `dk_test_`, production keys with `dk_live_`.


    ## Rate Limiting


    Per-tenant rate limits:

    - **Document ingestion**: 100 documents/hour

    - **Projection queries**: 1,000 requests/hour

    - **Schema operations**: 10 creates/hour


    Rate limit info is returned in response headers:

    - `X-RateLimit-Limit`: Maximum requests allowed

    - `X-RateLimit-Remaining`: Remaining requests in window

    - `X-RateLimit-Reset`: Unix timestamp when limit resets


    ## Error Handling


    All errors follow RFC 7807 Problem Details format:


    ```json

    {
      "error": "error_code",
      "message": "Human-readable description",
      "details": {}
    }

    ```


    Common error codes:

    - `unauthorized` (401): Missing or invalid API key

    - `rate_limit_exceeded` (429): Too many requests

    - `invalid_file_type` (400): Only PDFs supported

    - `file_too_large` (413): File exceeds size limit (default 100MB,
    configurable via MAX_UPLOAD_SIZE_MB)

    - `job_not_found` (404): Job ID doesn't exist or doesn't belong to tenant


    ## Getting Started


    1. Obtain API key from dashboard

    2. Upload PDF: `POST /v1/documents`

    3. Poll status: `GET /v1/documents/{document_id}/status`

    4. Query results: `POST /v1/documents/{document_id}/project`


    Full documentation: [https://docs.docintel.com](https://docs.docintel.com)
        
  contact:
    name: DocIntell Support
    url: https://docintel.com/support
    email: support@docintel.com
  license:
    name: Proprietary
    url: https://docintel.com/terms
  version: 0.1.0
servers:
  - url: http://localhost:8000
    description: Local development
  - url: https://api.docintell.com
    description: Production API
  - url: https://api-staging.docintell.com
    description: Staging environment
security:
  - bearerAuth: []
tags:
  - name: health
    description: Health check operations. Verify service and dependency connectivity.
    x-mint-tag-group: System
  - name: api_keys
    description: API key management operations. Create, list, and revoke API keys.
    x-mint-tag-group: Management
  - name: documents
    description: Document ingestion operations. Upload PDFs for extraction.
    x-mint-tag-group: Core
  - name: jobs
    description: >-
      Job status and query operations. Check extraction status and query
      results.
    x-mint-tag-group: Core
  - name: document-types
    description: >-
      Document type schemas. List and retrieve extraction schema definitions for
      financial document types.
  - name: webhooks
    description: >-
      Webhook configuration management. Create, update, and manage webhook
      endpoints for job completion notifications.
    x-mint-tag-group: Integrations
  - name: stats
    description: Analytics and metrics endpoints. Get document, job, and schema statistics.
  - name: views
    description: >-
      View management for consumption layer. Define field subsets for querying
      extraction data.
paths:
  /v1/documents:
    post:
      tags:
        - documents
      summary: Upload a document for extraction
      description: >-
        Upload a PDF document for extraction.


        Accepts a PDF document and queues it for extraction processing. The
        document

        is stored in immutable storage with the specified retention period for

        SEC 17a-4 compliance.


        Optionally provide a document_type hint to skip auto-classification.

        Supported types: capital_call, distribution, k1, nav_statement,
        audited_financial,

        invoice, trade_confirmation, wire_confirmation, subscription_agreement,
        insurance,

        investor_letter.


        Configure webhooks via `POST /v1/webhooks` to receive notifications when

        processing completes.


        Returns:
            IngestResponse with document_id, job_id, and status.

        Raises:
            HTTPException 400: Invalid file type (only PDFs supported)
            HTTPException 413: File exceeds maximum size limit
            HTTPException 429: Rate limit exceeded
      operationId: ingest_document_v1_documents_post
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_ingest_document_v1_documents_post'
      responses:
        '202':
          description: Document accepted for processing
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IngestResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: python
          label: Python
          source: |-
            import requests

            response = requests.post(
                "https://api.docintell.com/v1/documents",
                headers={"Authorization": "Bearer dk_live_YOUR_API_KEY"},
                files={"file": open("invoice.pdf", "rb")},
                data={"retention_years": 7}
            )
            print(response.json())
        - lang: typescript
          label: TypeScript
          source: >-
            const formData = new FormData();

            formData.append("file", fs.createReadStream("invoice.pdf"));

            formData.append("retention_years", "7");


            const response = await
            fetch("https://api.docintell.com/v1/documents", {
              method: "POST",
              headers: { Authorization: "Bearer dk_live_YOUR_API_KEY" },
              body: formData,
            });

            console.log(await response.json());
        - lang: bash
          label: cURL
          source: |-
            curl -X POST https://api.docintell.com/v1/documents \
              -H "Authorization: Bearer dk_live_YOUR_API_KEY" \
              -F "file=@invoice.pdf" \
              -F "retention_years=7"
components:
  schemas:
    Body_ingest_document_v1_documents_post:
      properties:
        file:
          type: string
          format: binary
          title: File
          description: PDF document to ingest
        retention_years:
          type: integer
          maximum: 10
          minimum: 1
          title: Retention Years
          description: Retention period in years (1-10)
          default: 7
        document_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Type
          description: >-
            Optional document type hint (e.g., 'capital_call', 'invoice', 'k1').
            If not provided, the system will auto-classify the document.
      type: object
      required:
        - file
      title: Body_ingest_document_v1_documents_post
    IngestResponse:
      properties:
        document_id:
          type: string
          format: uuid
          title: Document Id
          description: >-
            Stable identifier for the document asset (use this for status checks
            and projections)
        job_id:
          type: string
          format: uuid
          title: Job Id
          description: Unique identifier for the extraction job
        status:
          type: string
          enum:
            - pending
            - processing
          title: Status
          description: >-
            Current job status ('pending' for new jobs, 'processing' if
            returning existing in-progress job)
        vault_uri:
          type: string
          title: Vault Uri
          description: GCS path to the uploaded document in Cold Vault
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Job creation timestamp (ISO 8601)
      type: object
      required:
        - document_id
        - job_id
        - status
        - vault_uri
        - created_at
      title: IngestResponse
      description: |-
        Response for document ingestion (POST /v1/documents).

        Returns 202 Accepted with job tracking information.
        Webhooks are configured separately via POST /v1/webhooks.
      examples:
        - created_at: '2025-11-22T18:30:00Z'
          document_id: 6789def0-abcd-4567-ef01-23456789abcd
          job_id: 550e8400-e29b-41d4-a716-446655440000
          status: pending
          vault_uri: gs://docintel-vault-prod/tenant-123/2025/550e8400.pdf
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'API Key authentication. Format: dk_test_<key> or dk_live_<key>'

````