openapi: 3.0.0
info:
  title: Pagero Online Download Export API
  description: |+
    This documentation describes the Download-Export API functionality. The Download-Export API is used to track your exports and allow you to download them. Exports are created through other API's.

  contact:
    name: Pagero Support
    email: support@pagero.com
  version: 1.0.0
servers:
- url: https://api.pageroonline.com/download-exports/v1/
  description: Production environment
paths:
  /exports:
    get:
      tags:
      - exports
      summary: "Returns a list of all pending, failed & completed exports belonging to the user."
      description: Get `Exports`.
      parameters:
      - name: exportReference
        in: query
        description: "Allows filtering of the exports based on their 'exportReference' value. Every export will be created with a reference, in most cases this will be the name of the service that created the export. For example all exports created through the clearance API will have the export reference 'clearance'. See other API's for what export references your exorts will have."
        required: false
        style: form
        explode: true
        schema:
          type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  exports:
                    type: array
                    items:
                      $ref: '#/components/schemas/Export'
              example:
                exports:
                - id: 37ef2d1b-35da-47cf-9a09-00d4243e0d95
                  name: MyExport.csv
                  requestedAt: 2024-10-02T10:45:02Z
                  status: Pending
                - id: 22febf3c-e91f-4a28-887f-5c56e3f85a40
                  name: MyOtherExport.xlsx
                  errorMessage: An error message
                  requestedAt: 2024-10-02T11:45:02Z
                  stoppedAt: 2024-10-02T11:45:02Z
                  status: Failed
                - id: 37ef2d1b-35da-47cf-9a09-00d4243e0d95
                  name: YourExport.xlsx
                  status: Completed
                  requestedAt: 2024-10-02 10:45:02.974
                  stoppedAt: 2024-10-02T11:45:02Z
                  expiresAt: 2024-10-04T10:45:02Z
        "401":
          $ref: '#/components/responses/Unauthorized'
        "403":
          $ref: '#/components/responses/Forbidden'
        "500":
          $ref: '#/components/responses/InternalServerError'
  /exports/{id}/payload:
    get:
      tags:
      - exports
      summary: Returns the payload of an export.
      description: Get export payload.
      parameters:
      - name: id
        in: path
        description: Export id
        required: true
        style: simple
        explode: false
        schema:
          type: string
      responses:
        "200":
          $ref: '#/components/responses/ExportPayloadResponse'
        "401":
          $ref: '#/components/responses/Unauthorized'
        "403":
          $ref: '#/components/responses/Forbidden'
        "500":
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    Export:
      required:
      - id
      - name
      - requestedAt
      - status
      type: object
      properties:
        id:
          type: string
          description: The id of the Export.
          example: 37ef2d1b-35da-47cf-9a09-00d4243e0d95
        name:
          type: string
          description: The name of the export.
          example: YourExport.xlsx
        status:
          type: string
          description: The status of the export
          enum:
          - Pending
          - Failed
          - Completed
        requestedAt:
          type: string
          description: "The time, expressed in ISO 8601 format of when the export was created/requested."
          example: 2024-10-02T10:45:02Z
        stoppedAt:
          type: string
          description: "The time, expressed in ISO 8601 format of when the export was marked as Completed or Failed."
          example: 2024-10-02T11:45:02Z
        expiresAt:
          type: string
          description: "The export expire time, expressed in ISO 8601 format."
          example: 2024-10-04T10:45:02Z
        errorMessage:
          type: string
          description: An Error Message. Only exists on exports with a status of 'Failed'.
          example: There was an error.
      description: Completed/Failed/Pending Exports
  responses:
    ExportPayloadResponse:
      description: |
        Returns the export in binary format. Format will depend on how the export was created.
      content:
        application/excel: {}
        text/csv: {}
        application/octet-stream: {}
    Unauthorized:
      description: Unauthorized
    Forbidden:
      description: The client is not allowed to access the requested resource.
    InternalServerError:
      description: Internal Server Error
