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

# Trigger an export

> Enqueues an asynchronous export job and returns immediately with `202 Accepted` and `status: pending`. Poll `GET /exports/{exportId}` until `status` is `completed` (then `download_url` is set) or `failed`.



## OpenAPI

````yaml /api-reference/reporting-openapi.yaml post /exports
openapi: 3.0.0
info:
  title: OpenFiskal reporting API
  description: |-
    Country-specific fiscal export endpoints for compliance reporting.

    Exports are asynchronous: create a job, poll until ready, then download
    the artifact before the retention deadline.
  version: 1.1.0
  contact: {}
  license:
    name: Proprietary
servers:
  - url: https://api.openfiskal.com/v1
    description: Production
  - url: https://sandbox.api.openfiskal.com/v1
    description: Sandbox
security: []
tags:
  - name: Exports
    description: Create and inspect asynchronous fiscal export jobs.
paths:
  /exports:
    post:
      tags:
        - Exports
      summary: Trigger an export
      description: >-
        Enqueues an asynchronous export job and returns immediately with `202
        Accepted` and `status: pending`. Poll `GET /exports/{exportId}` until
        `status` is `completed` (then `download_url` is set) or `failed`.
      operationId: ExportsController_create
      parameters:
        - name: X-OpenFiskal-Merchant
          in: header
          description: Merchant identifier returned by the merchants resource.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateExportDto'
      responses:
        '202':
          description: Export job enqueued
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Export'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
              examples:
                default:
                  summary: invalid_request
                  value:
                    code: invalid_request
                    message: The request body is malformed.
                    retryable: false
        '401':
          description: Authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
              examples:
                default:
                  summary: unauthorized
                  value:
                    code: unauthorized
                    message: Authentication failed.
                    retryable: false
        '403':
          description: >-
            Authenticated caller is not allowed to access the requested tenant,
            country, or merchant.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
              examples:
                default:
                  summary: forbidden
                  value:
                    code: forbidden
                    message: The authenticated caller cannot access this resource.
                    retryable: false
        '404':
          description: Register not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
              examples:
                default:
                  summary: not_found
                  value:
                    code: not_found
                    message: The requested resource does not exist.
                    retryable: false
        '422':
          description: Domain validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
              examples:
                default:
                  summary: regime_validation_failed
                  value:
                    code: regime_validation_failed
                    message: The payload violates regime-specific validation rules.
                    retryable: false
      security:
        - BearerAuth: []
components:
  schemas:
    CreateExportDto:
      type: object
      properties:
        type:
          example: dsfinvk
          description: Country-specific fiscal export type.
          allOf:
            - $ref: '#/components/schemas/ExportType'
        register_id:
          type: string
          example: reg_01HABC
          description: >-
            Optional register to scope the export to. When omitted, the export
            covers all eligible registers for the merchant under the matching
            fiscal regime.
        from:
          type: string
          format: date-time
          example: '2026-03-01T00:00:00.000Z'
        to:
          type: string
          format: date-time
          example: '2026-03-31T23:59:59.000Z'
      required:
        - type
        - from
        - to
    Export:
      type: object
      properties:
        id:
          type: string
        type:
          allOf:
            - $ref: '#/components/schemas/ExportType'
        status:
          type: string
          enum:
            - pending
            - completed
            - failed
        register_id:
          type: string
          nullable: true
        from:
          type: string
          format: date-time
        to:
          type: string
          format: date-time
        download_url:
          type: string
          nullable: true
          description: >-
            Signed URL to download the export artifact. Present only when status
            is `completed`.
        error:
          nullable: true
          description: Failure information. Present only when status is `failed`.
          allOf:
            - $ref: '#/components/schemas/ExportError'
        created_at:
          type: string
          format: date-time
        completed_at:
          type: string
          format: date-time
          nullable: true
      required:
        - id
        - type
        - status
        - from
        - to
        - created_at
    ErrorDto:
      type: object
      properties:
        code:
          type: string
          description: Stable machine-readable error code.
          example: invalid_request
        message:
          type: string
          description: Human-readable explanation of the error.
        retryable:
          type: boolean
          description: Whether retrying the request is safe.
        details:
          type: object
          description: Additional structured context for the error.
          additionalProperties: true
      required:
        - code
        - message
        - retryable
    ExportType:
      type: string
      enum:
        - dsfinvk
      description: Country-specific fiscal export type.
    ExportError:
      type: object
      properties:
        message:
          type: string
          description: Human-readable failure description.
        details:
          type: object
          nullable: true
          description: >-
            Structured error payload (e.g. provider error response). Shape
            varies by export type.
      required:
        - message
  securitySchemes:
    BearerAuth:
      scheme: bearer
      bearerFormat: API key
      type: http

````