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

# Update file export status

> Update the export status of a file from an integrated system.

This endpoint is designed for **pull-based integrations** where integrated systems need to report back:
- Whether a file was successfully exported to the integrated system
- Any error messages or status information from the integrated system

The export status and messages will be visible in the file list UI, helping users track the integration status of their documents.

**Use Cases:**
- Report successful export: Set status to `completed` with success message
- Report export failure: Set status to `error` with error details
- Report in-progress: Set status to `exporting` with queue information
- Clear status: Set status to `empty` to reset

This endpoint enables **pull-based integrations** to report the export status of files back to fileAI.

## Use Cases

<CardGroup cols={2}>
  <Card title="ERP Integration" icon="building">
    Report when documents have been successfully imported into your ERP system
  </Card>

  <Card title="Accounting Software" icon="calculator">
    Confirm invoices have been processed in your accounting platform
  </Card>

  <Card title="Custom Workflows" icon="gears">
    Track document processing status in your custom integrations
  </Card>

  <Card title="Error Handling" icon="triangle-exclamation">
    Report validation errors or processing failures back to users
  </Card>
</CardGroup>

## Status Values

| Status      | Description       | When to Use                                              |
| ----------- | ----------------- | -------------------------------------------------------- |
| `completed` | Export successful | Document was successfully processed by integrated system |
| `error`     | Export failed     | Validation error, processing failure, or other issues    |
| `exporting` | In progress       | Document is queued or being processed                    |
| `empty`     | No status         | Reset/clear the export status                            |

## Integration Flow

<Steps>
  <Step title="Fetch Files">
    Use `GET /files` with `updatedAfter` to get files that need processing
  </Step>

  <Step title="Process Files">
    Download and process files in your integrated system
  </Step>

  <Step title="Report Status">
    Call this endpoint to report the export status back to fileAI
  </Step>

  <Step title="User Visibility">
    Users see the status in the fileAI UI, enabling them to track integration progress
  </Step>
</Steps>

## Example: Reporting Success

```bash theme={null}
curl -X PATCH "https://api.orion.file.ai/prod/v1/files/53d6a0b1-2a8d-4ed9-9e6a-ceaef7ca3908" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "integrationExportStatus": "completed",
    "integrationExportMessages": ["Successfully imported to SAP"]
  }'
```

## Example: Reporting Error

```bash theme={null}
curl -X PATCH "https://api.orion.file.ai/prod/v1/files/53d6a0b1-2a8d-4ed9-9e6a-ceaef7ca3908" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "integrationExportStatus": "error",
    "integrationExportMessages": [
      "Validation failed: Invoice number format invalid",
      "Expected format: INV-YYYY-NNNN"
    ]
  }'
```

<Note>
  The export status and messages are visible in the fileAI file list UI, helping users understand the integration status of their documents.
</Note>


## OpenAPI

````yaml patch /prod/v1/files/{fileId}
openapi: 3.0.0
info:
  title: Public API
  description: >-

    ### Welcome to fileAI’s Public API Documentation.

    This API allows users to check the health of the system, upload and manage
    files, and manage AI Schemas.

    Should you have any questions, please reach out to fileAI via the “Contact a
    Developer” link below.



    [Contact a Developer](mailto:support@file.ai)



    ### Prerequisites


    Before using our API, please ensure you complete the following prerequisites

    - You must have a fileAI account. Sign up or login
    [here](https://orion.file.ai/en/sign-up)

    - You must have an API Key. After creating your fileAI account, you can
    generate your API Key. Refer to the Authentication section below for more
    details.



    ### Authentication

    All API requests require an API key for authentication.

    - To obtain your API key, please log in to your fileAI account and navigate
    to Project Settings in your dashboard

    - Keep your API key secure and do not share it publicly.


    ![Authentication](https://fileai-static-assets.s3.us-west-2.amazonaws.com/public-api-service/authentication.png)


    ### How to Use Your API Key

    Once you have your API key:

    - Click the Authorize button on the top-right of this page

    - Enter your API Key under Value

    - Click Authorize to start making authenticated requests directly from the
    documentation


    ![How to Use Your API
    Key](https://fileai-static-assets.s3.us-west-2.amazonaws.com/public-api-service/how-to-use-api-keys.png)
        
  version: '1.0'
  contact: {}
servers:
  - url: https://api.orion.file.ai
security: []
tags:
  - name: Public API V1
paths:
  /prod/v1/files/{fileId}:
    patch:
      tags:
        - Public API V1
      summary: Update file export status
      description: >-
        Update the export status of a file from an integrated system.


        This endpoint is designed for **pull-based integrations** where
        integrated systems need to report back:

        - Whether a file was successfully exported to the integrated system

        - Any error messages or status information from the integrated system


        The export status and messages will be visible in the file list UI,
        helping users track the integration status of their documents.


        **Use Cases:**

        - Report successful export: Set status to `completed` with success
        message

        - Report export failure: Set status to `error` with error details

        - Report in-progress: Set status to `exporting` with queue information

        - Clear status: Set status to `empty` to reset
      operationId: PublicAPIController_updateFileExportStatus
      parameters:
        - name: fileId
          required: true
          in: path
          description: The unique identifier of the file (document ID)
          schema:
            type: string
            example: 53d6a0b1-2a8d-4ed9-9e6a-ceaef7ca3908
      requestBody:
        required: true
        description: Export status update payload
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateFileExportStatusForPAInput'
            examples:
              completed:
                summary: Successful export
                value:
                  integrationExportStatus: completed
                  integrationExportMessages:
                    - Successfully synced to ERP system
              error:
                summary: Failed export
                value:
                  integrationExportStatus: error
                  integrationExportMessages:
                    - 'Validation error: Missing required field ''invoice_number'''
                    - Please check the document and retry
              exporting:
                summary: Export in progress
                value:
                  integrationExportStatus: exporting
                  integrationExportMessages:
                    - Queued for processing
      responses:
        '200':
          description: Export status updated successfully
          content:
            application/json:
              example:
                fileId: 53d6a0b1-2a8d-4ed9-9e6a-ceaef7ca3908
                exportInfo:
                  integrationExportStatus: completed
                  integrationExportMessages:
                    - Successfully synced to ERP system
                  integrationExportUpdatedAt: '2025-01-26T14:30:00.000Z'
              schema:
                $ref: '#/components/schemas/UpdateFileExportStatusForPAOutput'
        '401':
          description: Invalid API key | API key is missing
          content:
            application/json:
              example:
                message: Invalid API key | API key is missing
                error: Unauthorized
                statusCode: 401
        '403':
          description: Access denied. You are in readonly mode.
          content:
            application/json:
              example:
                message: Access denied. You are in readonly mode.
                error: Forbidden
                statusCode: 403
        '404':
          description: File not found
          content:
            application/json:
              example:
                message: File with id 53d6a0b1-2a8d-4ed9-9e6a-ceaef7ca3908 not found
                error: Not Found
                statusCode: 404
        '422':
          description: Validation error
          content:
            application/json:
              example:
                message: >-
                  integrationExportStatus must be one of: error, completed,
                  exporting, empty
                statusCode: 422
        '429':
          description: Too Many Requests
          content:
            application/json:
              example:
                statusCode: 429
                message: Too Many Requests
      security:
        - x-api-key: []
components:
  schemas:
    UpdateFileExportStatusForPAInput:
      type: object
      properties:
        integrationExportStatus:
          type: string
          enum:
            - error
            - completed
            - exporting
            - empty
          description: Export status from integrated system
          example: completed
        integrationExportMessages:
          type: array
          items:
            type: string
          description: Export messages describing the result from integrated system
          example:
            - Successfully synced to ERP system
      required:
        - integrationExportStatus
    UpdateFileExportStatusForPAOutput:
      type: object
      properties:
        fileId:
          type: string
          description: The file ID (document ID)
        exportInfo:
          $ref: '#/components/schemas/IntegrationExportInfoForPAOutput'
          description: Export info object containing integration export status fields
      required:
        - fileId
        - exportInfo
    IntegrationExportInfoForPAOutput:
      type: object
      properties:
        integrationExportStatus:
          type: string
          enum:
            - error
            - completed
            - exporting
            - empty
          description: Export status from integrated system
        integrationExportMessages:
          type: array
          items:
            type: string
          description: Export messages from integrated system
          nullable: true
        integrationExportUpdatedAt:
          type: string
          format: date-time
          description: Timestamp when the export status was last updated
      required:
        - integrationExportStatus
        - integrationExportUpdatedAt
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication

````