openapi: 3.0.1
info:
  title: Clearance API
  description: "This documentation describes the functionality of the Clearance API. It is responsible for managing clearance operations, including handling clearance jobs, requests, responses, and attachments. The API also supports downloading the payloads of both requests and responses.\n\nThe `Clearance Service` sends documents to designated clearance authorities via Pagero Online. It automatically determines when a document requires clearance and initiates a `clearance request` to the appropriate authority based on the sender’s country.\nOnce a `clearance response` is received, it is delivered to the sender through Pagero Online.\n\n\n# Resources\n\n## Clearance Job\n\nFor each document that is uniquely identified, a clearance job is created. A clearance job can contain\nmultiple clearance requests. For each of these requests there are corresponding responses.\n\n## Clearance Request\n\nFor every request sent to the clearance authority for document clearance, there is a clearance request in the clearance service.\n\n## Clearance Response\n\nA clearance response is generated for each response received back from the clearance authority.\n\n## Attachment\n\nThis can be either attachments sent with the business document or an attachment provided back with the response from the clearance authority. \n\n## Clearance Export\n\nAn CSV or Excel file containing a list of clearance jobs which meets the parameters requested in the query.\n\n# Concepts\n\n## Clearance Authority\n\nThe clearance authority is the mandated entity for a specific country, responsible for processing clearance requests.\nIt returns a clearance response indicating the clearance status:\n\n* Approved - The request is approved.\n\n* Rejected - The request is denied with a reason. The corresponding business document enters a \"AwaitingInteraction,Error\" status .\nThe user must address the rejection reason before resubmitting the document in order to receive an Approval status\n\n* ApprovedWithWarnings - The clearance request is accepted, but the clearance authority has identified minor issues or currently non-critical inconsistencies which may result in rejection at a later date.\n\n\n## Clearance Type\n\nThere are four clearance modes:\n\n* Pre-Clearance - Document must be cleared by a clearance authority before they are sent to the recipient.\n\n* Reporting - The document is reported, but no formal acceptance is required by the clearance authority before distribution occurs.\n\n* Centralized - A regulatory hub validates and facilitates transactions between parties, acting as both a validator and an exchange mechanism.\n\n\n## Clearance Statuses\n\n### Job\n\n* New - Document received, job created and ready for processing.\n\n* RequestProcessed - Only used in Certification mode after the clearance request is fully processed but stopped before distribution to the clearance authority occurs.\n\n* Delivered - Request sent to the clearance authority.\n\n* Approved/Rejected/ApprovedWithWarnings - Final job status based on the clearance response.\n \n\n### Request\n\n* New - Request created.\n\n* Processing - Request being processed.\n\n* RequestProcessed - Only used in Certified mode after the clearance request is fully processed but stopped before distribution to the clearance authority occurs.\n\n* Delivered - Request sent to authority.\n\n\n### Response\n\n* Processing - Response processing.\n\n* Approved  - The clearance request has been fully accepted by the clearance authority.\n\n* Rejected - Clearance authority has refused to accept the submitted document due to critical issues that prevent it from being processed or approved.\n\n* ApprovedWithWarnings - The clearance request is accepted, but the clearance authority has identified minor issues or currently non-critical inconsistencies which may result in rejection at a later date.\n\n\n# Changelog\n\n## 2.0.0\n\n * Default `createTimeFrom` is changed to 90 days from current date.\n \n * `searchTerm` can only be Receiver name or Sender name.\n \n * Default `limit' is changed to 10.\n \n * Max `limit' except for jobexport end point is changed to 1000.\n \n * New parameter `documentTypes` added to the `Get clearance jobs`, `Get clearance requests`, `Get clearance responses` end point requests.\n \n * `documents` array is removed from `Get clearance job` response.\n \n * New attributes `documentType`, `documentSubType`, `totalAmount`, `dueDate`, `referencedDocumentIdentifier` and `referencedDocumentType` are added to ClearanceRequest.\n \n * Removed the document API calls.\n \n * SendMode changed from `Prod`, `Test`, `Cert` to `Production`, `Test`, `Certification`'\n"
  contact:
    name: support
    email: support@pageroab.zendesk.com
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 2.0.0
servers:
- url: https://virtserver.swaggerhub.com/pagero-api/clearance-api/2.0.0
  description: SwaggerHub API Auto Mocking
- url: https://api.pageroonline.com/clearance/v2
  description: Production Url
tags:
- name: job
  description: Operations on jobs
- name: request
  description: Operations on requests
- name: response
  description: Operations on responses
- name: attachment
  description: Operations on attachments
- name: export
  description: Operations on clearance exports
paths:
  /jobs:
    get:
      tags:
      - job
      summary: Get clearance jobs.
      description: |
        Get `Clearance Jobs`.

        The results are sorted by createTime in descending order.
      parameters:
      - name: companyId
        in: query
        description: "Id of the company to get jobs for. If not provided, jobs for all companies the user has access to are returned."
        required: false
        schema:
          type: string
        example: 123456
      - name: authorities
        in: query
        description: Comma-separated clearance authority names of the clearance jobs to filter on.
        required: false
        schema:
          type: string
        example: TicketBAI
      - name: sendModes
        in: query
        description: Comma-separated send modes of the clearance jobs to filter on.<br>  **Production** - Production mode. <br> **Test** - Test mode. Documents will be delivered to the clearance authority but will be delivered in test mode if the clearance authority supports it. Please note that not all clearance authorities support test mode.<br> **Certification** - Certification mode. Documents will be processed by Pagero Online but will not be delivered to the clearance authorities. This can be useful during testing.
        required: false
        schema:
          type: string
          enum:
          - Production
          - Test
          - Certification
        example: Production
      - name: clearanceTypes
        in: query
        description: |
          Comma-separated clearance types of the clearance jobs to filter on.
          Clearance type
           * **PreClearance** - Document must be cleared by a clearance authority before they are sent to the recipient.

           * **ClearanceOnDelivery** -  The Clearance Request is sent directly with the document to the service provider, who is also the service provider or Authority.

           * **Reporting** - The document is reported, but no formal acceptance is required by the clearance authority before distribution occurs.

           * **Centralized** - A regulatory hub validates and facilitates transactions between parties, acting as both a validator and an exchange mechanism.
        required: false
        schema:
          type: string
          enum:
          - PreClearance
          - ClearanceOnDelivery
          - Reporting
          - Centralized
        example: PreClearance
      - name: statuses
        in: query
        description: Comma-separated statuses of the clearance jobs to filter on.
        required: false
        schema:
          type: string
          enum:
          - Approved
          - Rejected
          - New
          - Delivered
          - ApprovedWithWarnings
          - RequestProcessed
        example: Approved
      - name: createTimeFrom
        in: query
        description: Exclude jobs created earlier than this date and time. Date and time should be expressed in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ). This is defaulted to (currentdate - 90 days) if not provided.
        required: false
        schema:
          type: string
        example: 2025-03-25T04:38:10Z
      - name: createTimeTo
        in: query
        description: Exclude jobs created later than this date and time. Date and time should be expressed in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
        required: false
        schema:
          type: string
        example: 2025-03-25T04:38:10Z
      - name: searchTerm
        in: query
        description: The search term. Can be sender name or receiver name.
        required: false
        schema:
          type: string
        example: ReceiverName
      - name: documentIdentifiers
        in: query
        description: Comma-separated document identifiers of the clearance jobs to filter on.
        required: false
        schema:
          type: string
        example: "12345, 34567"
      - name: clearanceIds
        in: query
        description: Comma-separated clearance ids of the clearance jobs to filter on.
        required: false
        schema:
          type: string
        example: "6789, 1234"
      - name: fileId
        in: query
        description: Sender reference. The `File` id is returned when posting a `File` in the File API.
        required: false
        schema:
          type: string
      - name: documentTypes
        in: query
        description: |
          Comma separated document types of the clearance jobs to filter on.
          Available document types are listed [here](https://pagero.github.io/partners/apis/document-types). Available values are subjected to change.
        required: false
        schema:
          type: string
        example: Invoice
      - name: expand
        in: query
        description: |
          When the value for this parameter is `Request`, Jobs are returned with corresponding clearance requests.
        required: false
        schema:
          type: string
        example: Requests
      - name: offset
        in: query
        description: The number of items to skip before starting to collect the result set.
        required: false
        schema:
          minimum: 0
          type: integer
          format: int32
          default: 0
      - name: limit
        in: query
        description: The maximum number of items in the collection resource response.
        required: false
        schema:
          maximum: 1000
          minimum: 0
          type: integer
          format: int32
          default: 10
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClearanceJobs"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /jobs/{id}:
    get:
      tags:
      - job
      summary: Get a clearance job.
      description: Get a `Clearance Job`.
      parameters:
      - name: id
        in: path
        description: Id of the `Clearance Job`.
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                allOf:
                - $ref: "#/components/schemas/ClearanceJob"
                - type: object
                  properties:
                    requests:
                      type: array
                      items:
                        allOf:
                        - $ref: "#/components/schemas/ClearanceRequest"
                        - type: object
                          properties:
                            responses:
                              type: array
                              items:
                                $ref: "#/components/schemas/ClearanceResponse"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /requests:
    get:
      tags:
      - request
      summary: Get clearance requests.
      description: |-
        Get `Clearance Requests`.

        The results are sorted by requestDate in descending order.
      parameters:
      - name: jobIds
        in: query
        description: Comma-separated clearance job ids to get requests for.
        required: false
        schema:
          type: string
        example: "1234, 5678"
      - name: statuses
        in: query
        description: Comma-separated statuses of the clearance requests to filter on.
        required: false
        schema:
          type: string
          enum:
          - New
          - Processing
          - RequestProcessed
          - Delivered
        example: Delivered
      - name: sendModes
        in: query
        description: Comma-separated send modes of the clearance requests to filter on.<br>  **Production** - Production mode. <br> **Test** - Test mode. Documents will be delivered to the clearance authorities but will be delivered in test mode if the clearance authority support it. Please note that not all clearance authorities support test mode.<br> **Certification** - Certification mode. Documents will be processed by Pagero Online but will not be delivered to the clearance authorities. This can be useful during testing.
        required: false
        schema:
          type: string
          enum:
          - Production
          - Test
          - Certification
        example: Production
      - name: documentTypes
        in: query
        description: |
          Comma separated document types of the clearance requests to filter on.
          Available document types are listed [here](https://pagero.github.io/partners/apis/document-types).
        required: false
        schema:
          type: string
        example: Invoice
      - name: createTimeFrom
        in: query
        description: Exclude requests created earlier than this date and time. Date and time should be expressed in ISO 8601 format (YYYY-MM-DD hh:mm:ss). This is defaulted to (currentdate - 90 days) if not provided.
        required: false
        schema:
          type: string
        example: 2025-03-25T04:38:10Z
      - name: createTimeTo
        in: query
        description: Exclude requests created later than this date and time. Date and time should be expressed in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
        required: false
        schema:
          type: string
        example: 2025-03-25T04:38:10Z
      - name: offset
        in: query
        description: The number of items to skip before starting to collect the result set.
        required: false
        schema:
          minimum: 0
          type: integer
          format: int32
          default: 0
      - name: limit
        in: query
        description: The maximum number of items in the collection resource response.
        required: false
        schema:
          maximum: 1000
          minimum: 0
          type: integer
          format: int32
          default: 10
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClearanceRequests"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /requests/{id}:
    get:
      tags:
      - request
      summary: Get a clearance request.
      description: Get `Clearance Request`.
      parameters:
      - name: id
        in: path
        description: Id of the `Clearance Request`.
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                allOf:
                - $ref: "#/components/schemas/ClearanceRequest"
                - type: object
                  properties:
                    attachments:
                      type: array
                      items:
                        $ref: "#/components/schemas/Attachment"
                    job:
                      allOf:
                      - $ref: "#/components/schemas/ClearanceJob"
                      - type: object
                    responses:
                      type: array
                      items:
                        $ref: "#/components/schemas/ClearanceResponse"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /requests/{id}/target:
    get:
      tags:
      - request
      summary: Get a request target.
      description: Get target document for a `Request`.
      parameters:
      - name: id
        in: path
        description: Id of the `Clearance Request`.
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/octet-stream:
              schema:
                type: string
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /responses:
    get:
      tags:
      - response
      summary: Get clearance responses.
      description: |-
        Get `Clearance Responses`.

        The results are sorted by receiveTime in descending order.
      parameters:
      - name: requestIds
        in: query
        description: Comma-separated clearance request ids to get responses for.
        required: false
        schema:
          type: string
        example: "1234, 3456"
      - name: statuses
        in: query
        description: Comma-separated statuses of the clearance responses to filter on.
        required: false
        schema:
          type: string
          enum:
          - Processing
          - Approved
          - Rejected
          - ApprovedWithWarnings
        example: Approved
      - name: sendModes
        in: query
        description: Comma-separated send modes of the clearance responses to filter on.<br>  **Production** - Production mode. <br> **Test** - Test mode. Documents will be delivered to the clearance authorities but will be delivered in test mode if the clearance authority supports it. Please note that not all clearance authorities support test mode.<br> **Certification** - Certification mode. Documents will be processed by Pagero Online but will not be delivered to the clearance authorities. This can be useful during testing.
        required: false
        schema:
          type: string
          enum:
          - Production
          - Test
          - Certification
        example: Production
      - name: clearanceId
        in: query
        description: The unique identifier given by the clearance authority for the document that clearance response references.
        required: false
        schema:
          type: string
      - name: responseNumber
        in: query
        description: The identifier of the clearance response.
        required: false
        schema:
          type: string
      - name: documentTypes
        in: query
        description: |
          Comma separated filter of document types the clearance responses are in reference to. Available document types are listed [here](https://pagero.github.io/partners/apis/document-types).
        required: false
        schema:
          type: string
        example: Invoice
      - name: receiveTimeFrom
        in: query
        description: Exclude responses received earlier than this date and time. Date and time should be expressed in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
        required: false
        schema:
          type: string
        example: 2025-03-25T04:38:10Z
      - name: receiveTimeTo
        in: query
        description: Exclude responses received later than this date and time. Date and time should be expressed in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
        required: false
        schema:
          type: string
        example: 2025-03-25T04:38:10Z
      - name: fileId
        in: query
        description: Sender reference. The `File` id is returned when posting a `File` in the File API.
        required: false
        schema:
          type: string
      - name: offset
        in: query
        description: The number of items to skip before starting to collect the result set.
        required: false
        schema:
          minimum: 0
          type: integer
          format: int32
          default: 0
      - name: limit
        in: query
        description: The maximum number of items in the collection resource response.
        required: false
        schema:
          maximum: 1000
          minimum: 0
          type: integer
          format: int32
          default: 10
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClearanceResponses"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /responses/{id}:
    get:
      tags:
      - response
      summary: Get a clearance response.
      description: Get `Clearance Response`.
      parameters:
      - name: id
        in: path
        description: Id of the `Clearance Response`.
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                allOf:
                - $ref: "#/components/schemas/ClearanceResponse"
                - type: object
                  properties:
                    attachments:
                      type: array
                      items:
                        $ref: "#/components/schemas/Attachment"
                    request:
                      allOf:
                      - $ref: "#/components/schemas/ClearanceRequest"
                      - type: object
                        properties:
                          job:
                            allOf:
                            - $ref: "#/components/schemas/ClearanceJob"
                            - type: object
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /requests/{id}/presentation:
    get:
      tags:
      - request
      summary: Get request presentation.
      description: Get presentation for a `Request`.
      parameters:
      - name: id
        in: path
        description: Id of the `Request`.
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/octet-stream:
              schema:
                type: string
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /attachments/{id}:
    get:
      tags:
      - attachment
      summary: Get an attachment.
      description: Get an `attachment`.
      parameters:
      - name: id
        in: path
        description: Id of the `Attachment`.
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/octet-stream:
              schema:
                type: string
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /jobexport:
    post:
      tags:
      - export
      summary: Export clearance jobs.
      description: "Export `Clearance Jobs`. \n\nThis endpoint is a start endpoint to create export files. To get the created export list and to download the \nexport files, please refer the export API documentation. \nNote: Use \"clearance\" as the exportReference field.\n\nExport API documentation - https://app.swaggerhub.com/apis/pagero-api/download-export-api/1.1.0\n"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/JobExport"
      responses:
        "200":
          description: OK
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "500":
          $ref: "#/components/responses/InternalServerError"
components:
  schemas:
    ClearanceJobs:
      required:
      - items
      - meta
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/CollectionMetadata"
        items:
          type: array
          items:
            allOf:
            - $ref: "#/components/schemas/ClearanceJob"
            - type: object
              properties:
                requests:
                  type: array
                  description: Only available if the `Requests` are expanded.
                  items:
                    $ref: "#/components/schemas/ClearanceRequest"
    ClearanceRequests:
      required:
      - items
      - meta
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/CollectionMetadata"
        items:
          type: array
          items:
            allOf:
            - $ref: "#/components/schemas/ClearanceRequest"
            - type: object
              properties:
                job:
                  allOf:
                  - $ref: "#/components/schemas/ClearanceJob"
    ClearanceResponses:
      required:
      - items
      - meta
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/CollectionMetadata"
        items:
          type: array
          items:
            allOf:
            - $ref: "#/components/schemas/ClearanceResponse"
            - type: object
              properties:
                request:
                  allOf:
                  - $ref: "#/components/schemas/ClearanceRequest"
                  - type: object
                    properties:
                      job:
                        allOf:
                        - $ref: "#/components/schemas/ClearanceJob"
                        - type: object
    ClearanceJob:
      required:
      - clearanceType
      - companyId
      - createTime
      - documentIdentifier
      - fiscalYear
      - id
      - sendMode
      - senderCountry
      - senderName
      - status
      - statusText
      type: object
      properties:
        id:
          type: string
          description: Id of the clearance job.
          example: "123456"
        status:
          type: string
          description: Clearance job status.
          enum:
          - New
          - RequestProcessed
          - Delivered
          - Approved
          - Rejected
          - ApprovedWithWarnings
        statusText:
          type: string
          description: Description of the status.
          example: Newly created
        sendMode:
          $ref: "#/components/schemas/SendModeEnum"
        clearanceType:
          $ref: "#/components/schemas/ClearanceTypeEnum"
        documentIdentifier:
          type: string
          description: "Document identifier for the document. For example Invoice number. This is unique for the Clearance job, the given sender, and the fiscal year if the document is sent on Production mode."
          example: "12345"
        companyId:
          type: string
          description: Id of the company which owns the document.
          example: companyId
        senderCountry:
          type: string
          description: "Country of the document sender, expressed in in ISO 3166 alpha-2 two-letter format."
          example: IN
        senderName:
          type: string
          description: Name of the document sender.
          example: senderName
        receiverName:
          type: string
          description: Name of the document receiver.
          example: receiverName
        clearanceAuthorityName:
          type: string
          description: Name of the Clearance authority which is responsible for the clearance of the document.
          example: IRPIndia
        fiscalYear:
          type: string
          description: "The fiscal year, which the document belongs to in YYYY format. In the fiscal year the documentIdentifier will be unique for the sender in production send mode."
          example: "2025"
        createTime:
          type: string
          description: "Creation time of the job in the system, expressed in ISO 8601 format (yyyy-mm-ddThh:mm:ssZ)."
          example: 2025-03-25T04:38:10Z
        clearanceId:
          type: string
          description: The unique identifier given by the clearance authority for the document.
          example: clearanceId
        selfBilled:
          type: boolean
          description: Indicates whether the document is self-billed or not.
      description: Clearance Job
    ClearanceRequest:
      required:
      - fiscalYear
      - id
      - requestDate
      - status
      - statusText
      type: object
      properties:
        id:
          type: string
          description: Id of the clearance request.
          example: "6789"
        status:
          type: string
          description: Clearance request status.
          example: New
          enum:
          - New
          - Processing
          - RequestProcessed
          - Delivered
        statusText:
          type: string
          description: Description of the status.
          example: Newly created
        requestDate:
          type: string
          description: "Creation time of the clearance request in the system, expressed in ISO 8601 format (yyyy-mm-ddThh:mm:ssZ)."
          example: 2025-03-25T04:38:10Z
        retentionDate:
          type: string
          description: "Retention date of the clearance request in the system, expressed in ISO 8601 format (yyyy-mm-ddThh:mm:ssZ)."
          example: 2025-03-25T04:38:10Z
        fiscalYear:
          type: string
          description: Fiscal year of the clearance request in YYYY format.
          example: "2025"
        userId:
          type: string
          description: Id of the user who sends the request.
          example: userId
        fileId:
          type: string
          description: Sender reference. The `File` id is returned when posting a `File` in the File API.
          example: fileId
        fileStatus:
          type: string
          description: File status.
          example: New
        fileStatusText:
          type: string
          description: Description of the file status.
          example: Newly created
        documentType:
          type: string
          description: Document type of the request.
          example: Invoice
        documentSubType:
          type: string
          description: Document sub type of the request.
          example: Debit
        totalAmount:
          type: string
          description: Total amount of the document
          example: 7000$
        dueDate:
          type: string
          description: "Due date of the document, expressed in ISO 8601 format (yyyy-mm-ddThh:mm:ssZ)."
          example: 2025-03-25T04:38:10Z
        referencedDocumentIdentifier:
          type: string
          description: "Identifier of the document referenced by this document. For example if the current document is a ApplicationResponse, this is the identifier of the related Invoice."
        referencedDocumentType:
          type: string
          description: Document type of the document referenced by this document.
      description: Clearance Request
    ClearanceResponse:
      required:
      - id
      - processStatus
      - processStatusText
      - receiveTime
      - sendMode
      type: object
      properties:
        id:
          type: string
          description: Id of the clearance response.
          example: "12345"
        sendMode:
          $ref: "#/components/schemas/SendModeEnum"
        receiveTime:
          type: string
          description: "Received time of the clearance response in the system, expressed in ISO 8601 format (yyyy-mm-ddThh:mm:ssZ)."
          example: 2025-03-25T04:38:10Z
        clearanceId:
          type: string
          description: The unique identifier given by the clearance authority for the document that clearance response references.
          example: clearanceId
        responseNumber:
          type: string
          description: The identifier of the clearance response sent by the clearance Authority.
          example: "12345678"
        processStatus:
          type: string
          description: Clearance response process status.
          example: Approved
          enum:
          - Processing
          - Approved
          - Rejected
          - ApprovedWithWarnings
        processStatusText:
          type: string
          description: Description of the process status.
          example: Approved by the authority
        status:
          type: string
          description: Final status of the clearance response. This is returned after the processing is finished.
          example: Approved
          enum:
          - Approved
          - Rejected
          - ApprovedWithWarnings
        statusText:
          type: string
          description: Description of the clearance response final status.
          example: Approved by the authority
        clearanceAuthorityName:
          type: string
          description: Name of the clearance authority who sends the clearance response.
          example: IRPIndia
      description: Clearance response
    Attachment:
      type: object
      properties:
        id:
          type: string
          description: Id of the attachment.
          example: "12345"
        mimeType:
          type: string
          description: Attachment mime type.
          example: application/pdf
        filename:
          type: string
          description: Attachment file name.
          example: test.pdf
        attachmentType:
          type: string
          description: Type of the attachment.
          example: PP
      description: Attachment
    JobExport:
      required:
      - fileFormat
      - filename
      type: object
      properties:
        companyId:
          type: string
          description: "Id of the company to export jobs for. If not provided, jobs for all companies the user has access to are exported."
          example: "12345"
        authorities:
          type: string
          description: Comma-separated clearance authorities of the clearance jobs to be exported.
          example: IRPIndia
        sendModes:
          type: string
          description: Comma-separated send modes of the clearance jobs to be exported.<br>  **Production** - Production mode. <br> **Test** - Test mode. Documents will be delivered to the recipients but will be delivered in test mode if the recipients support it. Please note that not all recipients support test mode.<br> **Certification** - Certification mode. Documents will be processed by Pagero Online but will not be delivered to the recipients. This can be useful during testing.
          example: Production
          enum:
          - Production
          - Test
          - Certification
        statuses:
          type: string
          description: Comma-separated statuses of the clearance jobs to be exported.
          example: Approved
          enum:
          - Approved
          - Rejected
          - New
          - Delivered
          - ApprovedWithWarnings
          - RequestProcessed
        createTimeFrom:
          type: string
          description: Exclude jobs created earlier than this date and time. Date and time should be expressed in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
          example: 2025-03-25T04:38:10Z
        createTimeTo:
          type: string
          description: Exclude jobs created later than this date and time. Date and time should be expressed in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
          example: 2025-03-25T04:38:10Z
        searchTerm:
          type: string
          description: The search term. Can be sender name or receiver name.
          example: Sender Name
        documentIdentifiers:
          type: string
          description: Comma-separated document identifiers of the clearance jobs to be exported.
          example: "12345"
        clearanceIds:
          type: string
          description: Comma-separated clearance ids of the clearance jobs to be exported.
          example: clearanceIds
        fileFormat:
          type: string
          description: |
            The file format to be exported.
            Available values are :
             * **application/vnd.openxmlformats-officedocument.spreadsheetml.sheet**
             * **text/csv**
          example: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
        filename:
          type: string
          description: The export filename.
          example: filename
        fileId:
          type: string
          description: Sender reference. The `File` id is returned when posting a `File` in the File API.
          example: fileId
    CollectionMetadata:
      required:
      - limit
      - offset
      - total
      type: object
      properties:
        offset:
          type: number
          description: The number of items to skip before starting to collect the result set.
        limit:
          type: number
          description: The maximum number of items in the collection resource response. Please note that there is always an upper bound to this property which may vary between different APIs and resources.
          example: 10
        total:
          type: number
          description: The total number of items in the collection.
          example: 1
    SendModeEnum:
      title: SendModeEnum
      type: string
      description: |
        Send mode.

        * **Production** - Production mode

        * **Test** - Test mode. Documents will be delivered to the recipients
        but will be delivered in test mode if the recipients support it.
        Please note that not all recipients support test mode.

        * **Certification** - Certification mode. Documents will be processed
        by Pagero Online but will not be delivered to the recipients. This can
        be useful during testing.
      enum:
      - Production
      - Test
      - Certification
    ClearanceTypeEnum:
      title: ClearanceTypes
      type: string
      description: |
        Clearance type
        * **PreClearance** - Document must be cleared by a clearance authority before they are sent to the recipient.

        * **ClearanceOnDelivery** -  The Clearance Request is sent directly with the document to the service provider, who is also the service provider or Authority.

        * **Reporting** - The document is reported, but no formal acceptance is required by the clearance authority before distribution occurs.

        * **Centralized** - A regulatory hub validates and facilitates transactions between parties, acting as both a validator and an exchange mechanism.
      example: PreClearance
    BadRequestErrorResponse:
      type: object
      properties:
        errorCode:
          type: string
          description: |
            Error code. Possible values:
             BAD_REQUEST : Error while mapping the request : Missing required fields
          example: "400"
        description:
          type: string
          description: Description of the returning error
          example: BAD_REQUEST. Error while mapping the given request. Missing required fields
    UnAuthorizedErrorResponse:
      type: object
      properties:
        errorCode:
          type: string
          description: |
            Error code. Possible values:
             UNAUTHORIZED: The supplied authentication is invalid or is missing
          example: "401"
        description:
          type: string
          description: Description of the returning error
          example: UNAUTHORIZED. The supplied authentication is invalid or is missing
    ForbiddenErrorResponse:
      type: object
      properties:
        errorCode:
          type: string
          description: |
            Error code. Possible values:
             FORBIDDEN: User does not have the required permissions for this API request
          example: "403"
        description:
          type: string
          description: Description of the returning error
          example: FORBIDDEN. User does not have the required permissions for this API request.
    NotFoundErrorResponse:
      type: object
      properties:
        errorCode:
          type: string
          description: |
            Error code. Possible values:
             NOT_FOUND: The object can not be found
          example: "404"
        description:
          type: string
          description: Description of the returning error
          example: NOT_FOUND. The object can not be found
    InternalServerErrorResponse:
      type: object
      properties:
        errorCode:
          type: string
          description: |
            Error code. Possible values:
             INTERNAL_SERVER_ERROR: Unknown error
          example: "500"
        description:
          type: string
          description: Description of the returning error
          example: INTERNAL_SERVER_ERROR. Unknown error
  responses:
    BadRequest:
      description: Bad request. This occurs if a mandatory paramater is missing or the value given for a parameter is invalid.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/BadRequestErrorResponse"
    Unauthorized:
      description: Unauthorized. This occurs if authentication details is not provided or invalid.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/UnAuthorizedErrorResponse"
    Forbidden:
      description: Forbidden. This occurs if the user does not have the required permissions for this API request.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ForbiddenErrorResponse"
    NotFound:
      description: Not Found. This occurs if the requested resource is not found.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/NotFoundErrorResponse"
    InternalServerError:
      description: Internal Server Error. This occurs if undefined or unknown error happens.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/InternalServerErrorResponse"
  parameters:
    offset:
      name: offset
      in: query
      description: The number of items to skip before starting to collect the result set.
      required: false
      schema:
        minimum: 0
        type: integer
        format: int32
        default: 0
    limit:
      name: limit
      in: query
      description: The maximum number of items in the collection resource response.
      required: false
      schema:
        maximum: 1000
        minimum: 0
        type: integer
        format: int32
        default: 10
