{
  "openapi": "3.1.0",
  "info": {
    "description": "API for customers to export their data",
    "title": "Customer Export API",
    "version": "2026.16"
  },
  "servers": [
    {
      "url": "https://portal.dotypay.com",
      "description": "Generated server url"
    }
  ],
  "paths": {
    "/api/batches": {
      "get": {
        "description": "Export batches. Date filter must always be specified (either using `date` or `startDate`+`endDate`).",
        "parameters": [
          {
            "description": "Batch date in ISO format (YYYY-MM-DD). Incompatible with other date/time parameters.",
            "example": "2023-06-18",
            "in": "query",
            "name": "date",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "description": "Start of date range, inclusive, in ISO format. Must be used in conjunction with `endDate`.",
            "example": "2023-06-18T01:30:00.000+02:00",
            "in": "query",
            "name": "startDate",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "description": "End of date range, exclusive, in ISO format. Must be used in conjunction with `startDate`.",
            "example": "2023-06-18T01:30:00.000+02:00",
            "in": "query",
            "name": "endDate",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "description": "List of TIDs (terminal IDs). If both `tids` and `bids` are specified, the resulting filter is applied as a logical (inclusive) disjunction (OR).",
            "in": "query",
            "name": "tids",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "description": "List of BIDs (branch IDs). If both `tids` and `bids` are specified, the resulting filter is applied as a logical (inclusive) disjunction (OR).",
            "in": "query",
            "name": "bids",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/x-ndjson": {
                "schema": {
                  "$ref": "#/components/schemas/BatchExportDto"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "JWT": []
          },
          {
            "Person_apiKey": []
          }
        ],
        "summary": "Export batches",
        "tags": [
          "Batches export API"
        ]
      }
    },
    "/api/transactions": {
      "get": {
        "description": "Export transactions in various formats. The requested media type determines which parameters are supported. See the description of individual parameters for details. Date filter must always be specified (using `date`, `processedDate`, or `startDate`+`endDate`).",
        "parameters": [
          {
            "description": "Transaction date in ISO format (YYYY-MM-DD). Supported for XML and JSON export. Incompatible with other date/time parameters.",
            "example": "2023-06-18",
            "in": "query",
            "name": "date",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "description": "Transaction processed date in ISO format (YYYY-MM-DD). Supported for XML and JSON export. Incompatible with other date/time parameters.",
            "example": "2023-06-18",
            "in": "query",
            "name": "processedDate",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "description": "Start of date range, inclusive, in ISO format. Supported for XLSX, PDF and JSON export. Must be used in conjunction with `endDate`.",
            "example": "2023-06-18T01:30:00.000+02:00",
            "in": "query",
            "name": "startDate",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "description": "End of date range, exclusive, in ISO format. Supported for XLSX, PDF and JSON export. Must be used in conjunction with `startDate`.",
            "example": "2023-06-18T01:30:00.000+02:00",
            "in": "query",
            "name": "endDate",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "description": "List of TIDs (terminal IDs). Supported for XLSX, PDF and JSON export. If both `tids` and `bids` are specified, the resulting filter is applied as a logical (inclusive) disjunction (OR).",
            "in": "query",
            "name": "tids",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "description": "List of BIDs (branch IDs). Supported for XLSX, PDF and JSON export. If both `tids` and `bids` are specified, the resulting filter is applied as a logical (inclusive) disjunction (OR).",
            "in": "query",
            "name": "bids",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "description": "If `true`, only approved transactions will be included in the export. Supported for XLSX and PDF export.",
            "in": "query",
            "name": "approvedOnly",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "description": "Filter transactions based on their pairing status. Supported for XLSX and PDF export.",
            "in": "query",
            "name": "unpairedNexi",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "description": "If `true`, transactions will be grouped by their reporting group. Supported for PDF export.",
            "in": "query",
            "name": "grouped",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/x-ndjson": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionsJsonExportDto"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionsXmlExportResponseXsd"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "JWT": []
          },
          {
            "Person_apiKey": []
          }
        ],
        "summary": "Export transactions",
        "tags": [
          "Transactions export API"
        ]
      }
    },
    "/api/transactions/query": {
      "post": {
        "description": "Export transactions in XLSX or PDF. If both `bids` and `tids` are specified in the request body, the resulting filter is applied as a logical (inclusive) disjunction (OR). The requested media type determines which request body schema is supported. See the descriptions of request body for details.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/TransactionsExportRequestDto",
                    "description": "Supported for XLSX export"
                  },
                  {
                    "$ref": "#/components/schemas/TransactionsPdfExportRequestDto",
                    "description": "Supported for PDF export"
                  }
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": "OK"
          }
        },
        "security": [
          {
            "JWT": []
          },
          {
            "Person_apiKey": []
          }
        ],
        "summary": "Export transactions",
        "tags": [
          "Transactions export API"
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "BatchExportDto": {
        "properties": {
          "amount": {
            "type": [
              "number",
              "null"
            ],
            "example": 100
          },
          "amountOfCredits": {
            "type": [
              "number",
              "null"
            ],
            "example": 110
          },
          "amountOfDebits": {
            "type": [
              "number",
              "null"
            ],
            "example": 10
          },
          "batchId": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "example": 1234
          },
          "closedTime": {
            "type": "string",
            "format": "date-time",
            "example": "2024-11-06T05:01:37Z"
          },
          "currency": {
            "type": "string",
            "example": "CZK"
          },
          "id": {
            "type": "string",
            "example": "76632587c15h72e8741beb651a1547j8vf87401a"
          },
          "mid": {
            "type": [
              "string",
              "null"
            ],
            "example": "12345678"
          },
          "numberOfCredits": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "example": 15
          },
          "numberOfDebits": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "example": 1
          },
          "openedDate": {
            "type": "string",
            "format": "date-time",
            "example": "2024-11-06T05:01:37Z"
          },
          "returnsCount": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "example": 1
          },
          "returnsTotal": {
            "type": [
              "number",
              "null"
            ],
            "example": 5
          },
          "salesCount": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "example": 10
          },
          "salesTotal": {
            "type": [
              "number",
              "null"
            ],
            "example": 10
          },
          "tid": {
            "type": [
              "string",
              "null"
            ],
            "example": "AG123456"
          },
          "totalTipAmount": {
            "type": [
              "number",
              "null"
            ],
            "example": 15.45
          },
          "transactionCount": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "example": 10
          },
          "voidsCount": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "example": 2
          },
          "voidsTotal": {
            "type": [
              "number",
              "null"
            ],
            "example": 8
          }
        }
      },
      "TransactionsExportRequestDto": {
        "properties": {
          "approvedOnly": {
            "type": "boolean"
          },
          "bids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "endDate": {
            "type": "string",
            "format": "date-time"
          },
          "startDate": {
            "type": "string",
            "format": "date-time"
          },
          "tids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "unpairedNexi": {
            "type": "boolean"
          }
        },
        "required": [
          "endDate",
          "startDate"
        ]
      },
      "TransactionsExportSpdhResponseCode": {
        "type": "integer",
        "format": "int32",
        "description": "| Code | Explanation |\n|---|---|\n| 10 | Partial approval |\n| 50 | Rejected by bank |\n| 51 | Expired card |\n| 52 | Number of PIN entry attempts exceeded |\n| 55 | Card not supported |\n| 56 | Operation not allowed |\n| 57 | Lost or stolen card |\n| 58 | Invalid card |\n| 59 | Restricted card |\n| 60 | Closed account |\n| 64 | Bad track 2 |\n| 67 | Invalid transaction date |\n| 69 | Re-try transaction |\n| 73 | Invalid route service (destination) |\n| 74 | Unable to authorize |\n| 76 | Low funds |\n| 82 | Card limit exceeded |\n| 87 | Maximum number of refund credit by retailer |\n| 88 | Place call |\n| 89 | CAF status inactive or closed |\n| 96 | PIN required |\n| 97 | Mod 10 check failure |\n| 100 | Invalid PIN key |\n| 107 | Card limit exceeded |\n| 122 | Unable to validate PIN |\n| 150 | Merchant not on file |\n| 201 | Incorrect PIN |\n| 204 | Card limit exceeded |\n| 205 | Invalid amount |\n| 206 | Invalid card |\n| 349 | Server error |\n| 505 | Blocked account |\n| 551 | Unsupported type in this service |\n| 553 | Requested entity not exist |\n| 554 | Invalid card |\n| 555 | Missing mandatory value |\n| 800 | Bad format |\n| 811 | Transaction system error |\n| 903 | Blocked card |\n| 909 | Blocked card |"
      },
      "TransactionsJsonExportDto": {
        "properties": {
          "acquirerFee": {
            "type": [
              "number",
              "null"
            ],
            "example": 0.1
          },
          "amount": {
            "type": "number",
            "example": 10
          },
          "cardType": {
            "type": [
              "string",
              "null"
            ],
            "example": "Visa"
          },
          "currency": {
            "type": "string",
            "example": "EUR"
          },
          "customIdentifier": {
            "type": [
              "string",
              "null"
            ],
            "example": "g6hdf84YA8K8FYSsr5hs"
          },
          "feeCurrency": {
            "type": [
              "string",
              "null"
            ],
            "example": "EUR"
          },
          "feeTotal": {
            "type": [
              "number",
              "null"
            ],
            "example": 0.3
          },
          "id": {
            "type": "string",
            "example": "76632587c15h72e8741beb651a1547j8vf87401a"
          },
          "interchangeFee": {
            "type": [
              "number",
              "null"
            ],
            "example": 0.1
          },
          "ip": {
            "type": [
              "string",
              "null"
            ],
            "example": "192.0.2.1"
          },
          "maskedPan": {
            "type": [
              "string",
              "null"
            ],
            "example": "123456xxxxxx6789"
          },
          "netAmount": {
            "type": [
              "number",
              "null"
            ],
            "example": 10.7
          },
          "netAmountCurrency": {
            "type": [
              "string",
              "null"
            ],
            "example": "EUR"
          },
          "par": {
            "type": [
              "string",
              "null"
            ],
            "example": "Q8VS4TBU86OGMUI4864UIOPJ8G4MX"
          },
          "schemeFee": {
            "type": [
              "number",
              "null"
            ],
            "example": 0.1
          },
          "spdhApprovalCode": {
            "type": [
              "string",
              "null"
            ],
            "example": "562014"
          },
          "spdhResponseCode": {
            "$ref": "#/components/schemas/TransactionsExportSpdhResponseCode"
          },
          "state": {
            "type": "string",
            "example": "PAID"
          },
          "tid": {
            "type": [
              "string",
              "null"
            ],
            "example": "AG123456"
          },
          "tip": {
            "type": [
              "number",
              "null"
            ],
            "example": 1
          },
          "transactionTime": {
            "type": "string",
            "format": "date-time",
            "example": "2024-11-06T05:01:37Z"
          },
          "transactionType": {
            "type": "string",
            "example": "PAYMENT"
          },
          "transferId": {
            "type": [
              "string",
              "null"
            ],
            "example": "12345678"
          },
          "variableSymbol": {
            "type": [
              "string",
              "null"
            ],
            "example": "1234567890"
          }
        }
      },
      "TransactionsPdfExportRequestDto": {
        "properties": {
          "approvedOnly": {
            "type": "boolean"
          },
          "bids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "endDate": {
            "type": "string",
            "format": "date-time"
          },
          "grouped": {
            "type": "boolean"
          },
          "startDate": {
            "type": "string",
            "format": "date-time"
          },
          "tids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "unpairedNexi": {
            "type": "boolean"
          }
        },
        "required": [
          "endDate",
          "startDate"
        ]
      },
      "TransactionsXmlExportResponseXsd": {
        "externalDocs": {
          "url": "https://portal.dotypay.com/xds/transactions.xsd"
        }
      }
    },
    "securitySchemes": {
      "JWT": {
        "bearerFormat": "JWT",
        "description": "JWT",
        "scheme": "bearer",
        "type": "http"
      },
      "Person_apiKey": {
        "description": "Example: 'ApiKey uihdrtghb9843ui5dfgbdwjk'",
        "in": "header",
        "name": "Authorization",
        "type": "apiKey"
      }
    }
  }
}