{
  "openapi": "3.1.0",
  "info": {
    "title": "Felloh API",
    "description": "The Felloh API enables travel companies to manage bookings, collect payments, process refunds, and handle trust account operations. All requests require Bearer token authentication obtained via the /token endpoint.",
    "version": "1.0.0",
    "contact": {
      "name": "Felloh Support",
      "url": "https://felloh.com",
      "email": "support@felloh.com"
    },
    "termsOfService": "https://felloh.com/terms"
  },
  "servers": [
    {
      "url": "https://api.felloh.com",
      "description": "Production"
    },
    {
      "url": "https://sandbox.felloh.com",
      "description": "Sandbox"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "JWT token obtained from POST /token using your public and private API keys."
      }
    },
    "schemas": {
      "Meta": {
        "type": "object",
        "properties": {
          "code": { "type": "integer", "example": 200 },
          "reason": { "type": "string", "example": "OK" },
          "message": { "type": "string", "example": "The request was successful" },
          "request_id": { "type": "string", "format": "uuid" },
          "count": { "type": "integer" }
        }
      },
      "Pagination": {
        "type": "object",
        "properties": {
          "organisation": { "type": "string", "description": "Organisation ID" },
          "skip": { "type": "integer", "description": "Number of records to skip", "default": 0 },
          "take": { "type": "integer", "description": "Number of records to return", "default": 20 }
        },
        "required": ["organisation"]
      },
      "Booking": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "booking_reference": { "type": "string" },
          "customer_name": { "type": "string" },
          "email": { "type": "string", "format": "email" },
          "gross": { "type": "integer", "description": "Gross amount in minor currency units" },
          "currency": { "type": "string", "enum": ["GBX", "USX", "EUX"] },
          "departure_date": { "type": "string", "format": "date" },
          "return_date": { "type": "string", "format": "date" },
          "package_type": { "type": "string" },
          "atol_receipt_number": { "type": "string" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" }
        }
      },
      "Transaction": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "amount": { "type": "integer" },
          "currency": { "type": "string" },
          "status": { "type": "string", "enum": ["COMPLETE", "PENDING", "FAILED", "REVERSED"] },
          "type": { "type": "string" },
          "booking_reference": { "type": "string" },
          "card_brand": { "type": "string" },
          "card_last_four": { "type": "string" },
          "card_type": { "type": "string" },
          "cardholder_name": { "type": "string" },
          "issuing_country": { "type": "string" },
          "bin_type": { "type": "string" },
          "surcharge": { "type": "integer" },
          "ip_address": { "type": "string" },
          "fingerprint": { "type": "string" },
          "ai_analysed": { "type": "boolean" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" }
        }
      },
      "PaymentLink": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "customer_name": { "type": "string" },
          "email": { "type": "string", "format": "email" },
          "amount": { "type": "integer" },
          "currency": { "type": "string" },
          "description": { "type": "string" },
          "status": { "type": "string" },
          "type": { "type": "string" },
          "open_banking_enabled": { "type": "boolean" },
          "card_enabled": { "type": "boolean" },
          "expires_at": { "type": "string", "format": "date-time" },
          "booking_id": { "type": "string", "format": "uuid" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" }
        }
      },
      "Ecommerce": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "customer_name": { "type": "string" },
          "email": { "type": "string", "format": "email" },
          "amount": { "type": "integer" },
          "currency": { "type": "string" },
          "status": { "type": "string" },
          "open_banking_enabled": { "type": "boolean" },
          "card_enabled": { "type": "boolean" },
          "booking_id": { "type": "string", "format": "uuid" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" }
        }
      },
      "Customer": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "customer_name": { "type": "string" },
          "email": { "type": "string", "format": "email" },
          "address_1": { "type": "string" },
          "address_2": { "type": "string" },
          "city": { "type": "string" },
          "county": { "type": "string" },
          "country": { "type": "string" },
          "post_code": { "type": "string" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" }
        }
      },
      "Supplier": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "supplier_name": { "type": "string" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" }
        }
      },
      "Refund": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "amount": { "type": "integer" },
          "currency": { "type": "string" },
          "status": { "type": "string", "enum": ["PENDING_AUTHORISATION", "AUTHORISED", "DECLINED", "COMPLETE"] },
          "authorization_code": { "type": "string" },
          "transaction_id": { "type": "string", "format": "uuid" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" }
        }
      },
      "Chargeback": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "amount": { "type": "integer" },
          "currency": { "type": "string" },
          "reason": { "type": "string" },
          "status": { "type": "string" },
          "received_date": { "type": "string", "format": "date" },
          "due_date": { "type": "string", "format": "date" },
          "posting_date": { "type": "string", "format": "date" },
          "transaction_id": { "type": "string", "format": "uuid" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" }
        }
      },
      "Charge": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "amount": { "type": "integer" },
          "currency": { "type": "string" },
          "card_brand": { "type": "string" },
          "card_type": { "type": "string" },
          "bin_type": { "type": "string" },
          "issuing_country": { "type": "string" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" }
        }
      },
      "CreditNote": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "amount": { "type": "integer" },
          "currency": { "type": "string" },
          "status": { "type": "string" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" }
        }
      },
      "ScheduledPayment": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "amount": { "type": "integer" },
          "currency": { "type": "string" },
          "status": { "type": "string" },
          "execution_date": { "type": "string", "format": "date" },
          "booking_id": { "type": "string", "format": "uuid" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" }
        }
      },
      "Organisation": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "name": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" }
        }
      },
      "Disbursement": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "amount": { "type": "integer" },
          "currency": { "type": "string" },
          "beneficiary": { "type": "object" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" }
        }
      },
      "Beneficiary": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "account_name": { "type": "string" },
          "account_number": { "type": "string" },
          "sort_code": { "type": "string" },
          "status": { "type": "string" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" }
        }
      },
      "LedgerEntry": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "amount": { "type": "integer" },
          "currency": { "type": "string" },
          "type": { "type": "string" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" }
        }
      },
      "AISPAccount": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "account_name": { "type": "string" },
          "iban": { "type": "string" },
          "balance": { "type": "integer" },
          "currency": { "type": "string" },
          "organisation": { "type": "string" }
        }
      },
      "AISPTransaction": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "amount": { "type": "integer" },
          "currency": { "type": "string" },
          "type": { "type": "string", "enum": ["credit", "debit"] },
          "description": { "type": "string" },
          "counterparty_name": { "type": "string" },
          "posted_date": { "type": "string", "format": "date" },
          "account_iban": { "type": "string" }
        }
      },
      "APIKey": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "name": { "type": "string" },
          "public_key": { "type": "string" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" }
        }
      },
      "AuditEntry": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "action": { "type": "string" },
          "entity_type": { "type": "string" },
          "entity_id": { "type": "string", "format": "uuid" },
          "user": { "type": "string" },
          "organisation": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" }
        }
      },
      "BookingComponent": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "supplier": { "type": "string", "format": "uuid" },
          "amount": { "type": "integer" },
          "currency": { "type": "string" },
          "booking_reference": { "type": "string" },
          "destination_air": { "type": "string" },
          "type": { "type": "string" }
        }
      },
      "TokenisedCard": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "cardholder_name": { "type": "string" },
          "bin": { "type": "string" },
          "card_brand": { "type": "string" },
          "organisation": { "type": "string" }
        }
      }
    }
  },
  "paths": {
    "/token": {
      "post": {
        "summary": "Generate authentication token",
        "description": "Exchange your API public and private keys for a JWT bearer token.",
        "tags": ["Authentication"],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["public_key", "private_key"],
                "properties": {
                  "public_key": { "type": "string", "description": "Your API public key" },
                  "private_key": { "type": "string", "description": "Your API private key" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Token generated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "token": { "type": "string" },
                        "expiry_time": { "type": "integer" },
                        "type": { "type": "string", "example": "BEARER" }
                      }
                    },
                    "meta": { "$ref": "#/components/schemas/Meta" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agent/bookings": {
      "post": {
        "summary": "List bookings",
        "description": "Fetch bookings with pagination, search, and date filtering.",
        "tags": ["Bookings"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["organisation"],
                "properties": {
                  "organisation": { "type": "string" },
                  "keyword": { "type": "string", "description": "Search by customer name, email, or booking reference" },
                  "skip": { "type": "integer", "default": 0 },
                  "take": { "type": "integer", "default": 20 },
                  "date_from": { "type": "string", "format": "date" },
                  "date_to": { "type": "string", "format": "date" },
                  "booking_reference": { "type": "string" },
                  "show-child-organisations": { "type": "boolean" },
                  "type": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "List of bookings",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": { "type": "array", "items": { "$ref": "#/components/schemas/Booking" } },
                    "meta": { "$ref": "#/components/schemas/Meta" }
                  }
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Create a booking",
        "description": "Create a new booking with customer and trip details.",
        "tags": ["Bookings"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["organisation", "booking_reference", "customer_name", "email", "currency"],
                "properties": {
                  "organisation": { "type": "string" },
                  "booking_reference": { "type": "string" },
                  "customer_name": { "type": "string" },
                  "email": { "type": "string", "format": "email" },
                  "currency": { "type": "string", "enum": ["GBX", "USX", "EUX"] },
                  "gross_amount": { "type": "integer", "description": "Amount in minor currency units" },
                  "departure_date": { "type": "string", "format": "date" },
                  "return_date": { "type": "string", "format": "date" },
                  "package_type": { "type": "string" },
                  "atol_receipt_number": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Booking created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" } } },
                    "meta": { "$ref": "#/components/schemas/Meta" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agent/bookings/{booking_id}": {
      "get": {
        "summary": "Get a booking",
        "description": "Fetch a single booking by ID.",
        "tags": ["Bookings"],
        "parameters": [{ "name": "booking_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": { "200": { "description": "Booking details", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/Booking" }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      },
      "post": {
        "summary": "Update a booking",
        "description": "Update an existing booking's details.",
        "tags": ["Bookings"],
        "parameters": [{ "name": "booking_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "gross_value": { "type": "integer" }, "departure_date": { "type": "string", "format": "date" }, "return_date": { "type": "string", "format": "date" }, "customer_name": { "type": "string" }, "email": { "type": "string" }, "package_type": { "type": "string" }, "atol_receipt_number": { "type": "string" } } } } } },
        "responses": { "200": { "description": "Booking updated" } }
      },
      "delete": {
        "summary": "Delete a booking",
        "description": "Delete a booking by ID.",
        "tags": ["Bookings"],
        "parameters": [{ "name": "booking_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": { "200": { "description": "Booking deleted" } }
      }
    },
    "/agent/bookings/{booking_id}/update-reference": {
      "post": {
        "summary": "Update booking reference",
        "tags": ["Bookings"],
        "parameters": [{ "name": "booking_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["booking_reference"], "properties": { "booking_reference": { "type": "string" } } } } } },
        "responses": { "200": { "description": "Reference updated" } }
      }
    },
    "/agent/transactions": {
      "post": {
        "summary": "List transactions",
        "description": "Fetch transactions with pagination and date filtering.",
        "tags": ["Transactions"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "keyword": { "type": "string" }, "skip": { "type": "integer" }, "take": { "type": "integer" }, "date_from": { "type": "string", "format": "date" }, "date_to": { "type": "string", "format": "date" }, "statuses": { "type": "array", "items": { "type": "string" } }, "show-child-organisations": { "type": "boolean" } } } } } },
        "responses": { "200": { "description": "List of transactions", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Transaction" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/agent/transactions/{transaction_id}/refund": {
      "post": {
        "summary": "Refund a transaction",
        "description": "Initiate a full or partial refund on a transaction.",
        "tags": ["Transactions"],
        "parameters": [{ "name": "transaction_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["amount"], "properties": { "amount": { "type": "integer", "description": "Refund amount in minor currency units" } } } } } },
        "responses": { "200": { "description": "Refund initiated" } }
      }
    },
    "/agent/transactions/{transaction_id}/complete": {
      "get": {
        "summary": "Complete a pre-authorised transaction",
        "tags": ["Transactions"],
        "parameters": [{ "name": "transaction_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": { "200": { "description": "Transaction completed" } }
      }
    },
    "/agent/transactions/{transaction_id}/reverse": {
      "get": {
        "summary": "Reverse a pre-authorised transaction",
        "tags": ["Transactions"],
        "parameters": [{ "name": "transaction_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": { "200": { "description": "Transaction reversed" } }
      }
    },
    "/agent/transactions/{transaction_id}/re-assign": {
      "post": {
        "summary": "Reassign a transaction",
        "description": "Reassign a transaction to a different booking.",
        "tags": ["Transactions"],
        "parameters": [{ "name": "transaction_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["booking_id"], "properties": { "booking_id": { "type": "string", "format": "uuid" } } } } } },
        "responses": { "200": { "description": "Transaction reassigned" } }
      }
    },
    "/agent/payment-links": {
      "post": {
        "summary": "List payment links",
        "tags": ["Payment Links"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "keyword": { "type": "string" }, "skip": { "type": "integer" }, "take": { "type": "integer" }, "date_from": { "type": "string", "format": "date" }, "date_to": { "type": "string", "format": "date" }, "filter_booking_exists": { "type": "boolean" }, "show-child-organisations": { "type": "boolean" } } } } } },
        "responses": { "200": { "description": "List of payment links", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/PaymentLink" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      },
      "put": {
        "summary": "Create a payment link",
        "tags": ["Payment Links"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["customer_name", "email", "organisation", "amount", "type"], "properties": { "customer_name": { "type": "string" }, "email": { "type": "string", "format": "email" }, "organisation": { "type": "string" }, "amount": { "type": "integer" }, "type": { "type": "string" }, "booking_id": { "type": "string", "format": "uuid" }, "customer_id": { "type": "string", "format": "uuid" }, "open_banking_enabled": { "type": "boolean" }, "card_enabled": { "type": "boolean" }, "description": { "type": "string" }, "expires_at": { "type": "string", "format": "date-time" }, "currency": { "type": "string" }, "authorisation_only": { "type": "boolean" }, "surcharging_enabled": { "type": "boolean" }, "dcc_enabled": { "type": "boolean" }, "excluded_card_types": { "type": "array", "items": { "type": "string" } }, "excluded_card_regions": { "type": "array", "items": { "type": "string" } }, "hide_store_card": { "type": "boolean" }, "store_card_forced": { "type": "boolean" } } } } } },
        "responses": { "200": { "description": "Payment link created", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" } } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/agent/payment-links/{payment_link_id}": {
      "get": {
        "summary": "Get a payment link",
        "tags": ["Payment Links"],
        "parameters": [{ "name": "payment_link_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": { "200": { "description": "Payment link details", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/PaymentLink" }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      },
      "delete": {
        "summary": "Delete a payment link",
        "tags": ["Payment Links"],
        "parameters": [{ "name": "payment_link_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": { "200": { "description": "Payment link deleted" } }
      }
    },
    "/agent/payment-links/{payment_link_id}/assign": {
      "post": {
        "summary": "Assign payment link to a booking",
        "tags": ["Payment Links"],
        "parameters": [{ "name": "payment_link_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["booking_id"], "properties": { "booking_id": { "type": "string", "format": "uuid" } } } } } },
        "responses": { "200": { "description": "Payment link assigned" } }
      }
    },
    "/agent/ecommerce": {
      "post": {
        "summary": "List ecommerce sessions",
        "tags": ["Ecommerce"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "keyword": { "type": "string" }, "skip": { "type": "integer" }, "take": { "type": "integer" }, "date_from": { "type": "string", "format": "date" }, "date_to": { "type": "string", "format": "date" }, "show-child-organisations": { "type": "boolean" } } } } } },
        "responses": { "200": { "description": "List of ecommerce sessions", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Ecommerce" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      },
      "put": {
        "summary": "Create an ecommerce session",
        "tags": ["Ecommerce"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["customer_name", "email", "organisation", "amount"], "properties": { "customer_name": { "type": "string" }, "email": { "type": "string", "format": "email" }, "organisation": { "type": "string" }, "amount": { "type": "integer" }, "booking_id": { "type": "string", "format": "uuid" }, "customer_id": { "type": "string", "format": "uuid" }, "open_banking_enabled": { "type": "boolean" }, "card_enabled": { "type": "boolean" }, "expires_at": { "type": "string", "format": "date-time" }, "currency": { "type": "string" }, "authorisation_only": { "type": "boolean" }, "surcharging_enabled": { "type": "boolean" }, "dcc_enabled": { "type": "boolean" }, "excluded_card_types": { "type": "array", "items": { "type": "string" } }, "excluded_card_regions": { "type": "array", "items": { "type": "string" } }, "hide_store_card": { "type": "boolean" }, "store_card_forced": { "type": "boolean" } } } } } },
        "responses": { "200": { "description": "Ecommerce session created", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string" } } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/agent/ecommerce/{ecommerce_id}": {
      "get": {
        "summary": "Get an ecommerce session",
        "tags": ["Ecommerce"],
        "parameters": [{ "name": "ecommerce_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": { "200": { "description": "Ecommerce session details", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/Ecommerce" }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      },
      "delete": {
        "summary": "Delete an ecommerce session",
        "tags": ["Ecommerce"],
        "parameters": [{ "name": "ecommerce_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": { "200": { "description": "Ecommerce session deleted" } }
      }
    },
    "/agent/ecommerce/{ecommerce_id}/assign": {
      "post": {
        "summary": "Assign ecommerce session to a booking",
        "tags": ["Ecommerce"],
        "parameters": [{ "name": "ecommerce_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["booking_id"], "properties": { "booking_id": { "type": "string", "format": "uuid" } } } } } },
        "responses": { "200": { "description": "Ecommerce session assigned" } }
      }
    },
    "/agent/customers": {
      "post": {
        "summary": "List customers",
        "tags": ["Customers"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "keyword": { "type": "string" }, "skip": { "type": "integer" }, "take": { "type": "integer" }, "show-child-organisations": { "type": "boolean" } } } } } },
        "responses": { "200": { "description": "List of customers", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Customer" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      },
      "put": {
        "summary": "Create a customer",
        "tags": ["Customers"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "customer_name": { "type": "string" }, "email": { "type": "string", "format": "email" }, "address_1": { "type": "string" }, "address_2": { "type": "string" }, "city": { "type": "string" }, "county": { "type": "string" }, "country": { "type": "string" }, "post_code": { "type": "string" } } } } } },
        "responses": { "200": { "description": "Customer created", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" } } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/agent/suppliers": {
      "post": {
        "summary": "List suppliers",
        "tags": ["Suppliers"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "keyword": { "type": "string" }, "skip": { "type": "integer" }, "take": { "type": "integer" } } } } } },
        "responses": { "200": { "description": "List of suppliers", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Supplier" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      },
      "put": {
        "summary": "Create a supplier",
        "tags": ["Suppliers"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation", "supplier_name"], "properties": { "organisation": { "type": "string" }, "supplier_name": { "type": "string" } } } } } },
        "responses": { "200": { "description": "Supplier created" } }
      }
    },
    "/agent/refunds": {
      "post": {
        "summary": "List refunds",
        "tags": ["Refunds"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "skip": { "type": "integer" }, "take": { "type": "integer" } } } } } },
        "responses": { "200": { "description": "List of refunds", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Refund" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/agent/refunds/{authorization_code}/authorise": {
      "get": {
        "summary": "Authorise a refund",
        "tags": ["Refunds"],
        "parameters": [{ "name": "authorization_code", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": { "200": { "description": "Refund authorised" } }
      }
    },
    "/agent/refunds/{authorization_code}/decline": {
      "get": {
        "summary": "Decline a refund",
        "tags": ["Refunds"],
        "parameters": [{ "name": "authorization_code", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": { "200": { "description": "Refund declined" } }
      }
    },
    "/agent/chargebacks": {
      "post": {
        "summary": "List chargebacks",
        "tags": ["Chargebacks"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "skip": { "type": "integer" }, "take": { "type": "integer" }, "show-child-organisations": { "type": "boolean" }, "type": { "type": "string" } } } } } },
        "responses": { "200": { "description": "List of chargebacks", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Chargeback" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/agent/charges": {
      "post": {
        "summary": "List charges",
        "tags": ["Charges"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "date_from": { "type": "string", "format": "date" }, "date_to": { "type": "string", "format": "date" }, "skip": { "type": "integer" }, "take": { "type": "integer" } } } } } },
        "responses": { "200": { "description": "List of charges", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Charge" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/agent/credit-notes": {
      "post": {
        "summary": "List credit notes",
        "tags": ["Credit Notes"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "skip": { "type": "integer" }, "take": { "type": "integer" } } } } } },
        "responses": { "200": { "description": "List of credit notes", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/CreditNote" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/agent/credit-notes/{credit_note_id}": {
      "get": {
        "summary": "Get a credit note",
        "tags": ["Credit Notes"],
        "parameters": [{ "name": "credit_note_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": { "200": { "description": "Credit note details", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/CreditNote" }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/payment/scheduled-payment": {
      "post": {
        "summary": "List scheduled payments",
        "tags": ["Scheduled Payments"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "keyword": { "type": "string" }, "skip": { "type": "integer" }, "take": { "type": "integer" }, "show-child-organisations": { "type": "boolean" } } } } } },
        "responses": { "200": { "description": "List of scheduled payments", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/ScheduledPayment" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/payment/booking/{booking_id}/available-tokens": {
      "get": {
        "summary": "Get available tokenised cards",
        "description": "Retrieve tokenised cards available on a booking for scheduled payments.",
        "tags": ["Scheduled Payments"],
        "parameters": [{ "name": "booking_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": { "200": { "description": "Available tokens", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/TokenisedCard" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/payment/booking/{booking_id}/payment": {
      "post": {
        "summary": "Create a scheduled payment",
        "description": "Create a payment using a tokenised card.",
        "tags": ["Scheduled Payments"],
        "parameters": [{ "name": "booking_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["token", "amount"], "properties": { "token": { "type": "string", "format": "uuid", "description": "Tokenised card ID" }, "amount": { "type": "integer", "description": "Amount in minor currency units" }, "date": { "type": "string", "format": "date", "description": "Execution date (YYYY-MM-DD)" } } } } } },
        "responses": { "200": { "description": "Scheduled payment created" } }
      }
    },
    "/agent/bookings/{booking_id}/approval-link": {
      "post": {
        "summary": "Generate an approval link",
        "description": "Generate a payment approval link for a booking.",
        "tags": ["Scheduled Payments"],
        "parameters": [{ "name": "booking_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": { "200": { "description": "Approval link generated" } }
      }
    },
    "/payment/scheduled-payment/{payment_id}": {
      "delete": {
        "summary": "Cancel a scheduled payment",
        "tags": ["Scheduled Payments"],
        "parameters": [{ "name": "payment_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": { "200": { "description": "Scheduled payment cancelled" } }
      }
    },
    "/user/organisations": {
      "get": {
        "summary": "List organisations",
        "description": "Fetch all organisations accessible to the authenticated user.",
        "tags": ["Organisations"],
        "responses": { "200": { "description": "List of organisations", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Organisation" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/ledger/disbursements": {
      "post": {
        "summary": "List disbursements",
        "tags": ["Disbursements"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "skip": { "type": "integer" }, "take": { "type": "integer" }, "date_from": { "type": "string", "format": "date" }, "date_to": { "type": "string", "format": "date" }, "keyword": { "type": "string" }, "show-child-organisations": { "type": "boolean" } } } } } },
        "responses": { "200": { "description": "List of disbursements", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Disbursement" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/ledger/disbursements/{disbursement_id}": {
      "get": {
        "summary": "Get a disbursement",
        "tags": ["Disbursements"],
        "parameters": [{ "name": "disbursement_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": { "200": { "description": "Disbursement details", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/Disbursement" }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/ledger/beneficiaries": {
      "post": {
        "summary": "List beneficiaries",
        "tags": ["Beneficiaries"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "skip": { "type": "integer" }, "take": { "type": "integer" }, "show-child-organisations": { "type": "boolean" } } } } } },
        "responses": { "200": { "description": "List of beneficiaries", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Beneficiary" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      },
      "put": {
        "summary": "Create a beneficiary",
        "tags": ["Beneficiaries"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation", "account_name", "account_number", "sort_code"], "properties": { "organisation": { "type": "string" }, "account_name": { "type": "string" }, "account_number": { "type": "string" }, "sort_code": { "type": "string" } } } } } },
        "responses": { "200": { "description": "Beneficiary created", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" } } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/ledger/beneficiaries/{beneficiary_id}/activate": {
      "put": {
        "summary": "Activate a beneficiary",
        "tags": ["Beneficiaries"],
        "parameters": [{ "name": "beneficiary_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": { "200": { "description": "Beneficiary activated" } }
      }
    },
    "/ledger": {
      "post": {
        "summary": "List ledger entries",
        "tags": ["Ledger"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "keyword": { "type": "string" }, "skip": { "type": "integer" }, "take": { "type": "integer" }, "type": { "type": "string" } } } } } },
        "responses": { "200": { "description": "List of ledger entries", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/LedgerEntry" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/aisp/accounts": {
      "get": {
        "summary": "List AISP accounts",
        "description": "Fetch connected bank accounts via Open Banking.",
        "tags": ["AISP"],
        "parameters": [{ "name": "organisation", "in": "query", "required": true, "schema": { "type": "string" } }],
        "responses": { "200": { "description": "List of connected accounts", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/AISPAccount" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/aisp/transactions": {
      "post": {
        "summary": "List AISP transactions",
        "description": "Fetch bank transactions from connected accounts.",
        "tags": ["AISP"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "skip": { "type": "integer" }, "take": { "type": "integer" }, "date_from": { "type": "string", "format": "date" }, "date_to": { "type": "string", "format": "date" }, "type": { "type": "string", "enum": ["credit", "debit"] }, "account_iban": { "type": "string" } } } } } },
        "responses": { "200": { "description": "List of bank transactions", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/AISPTransaction" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/aisp/statistics": {
      "get": {
        "summary": "Get AISP account statistics",
        "tags": ["AISP"],
        "parameters": [{ "name": "organisation", "in": "query", "required": true, "schema": { "type": "string" } }],
        "responses": { "200": { "description": "Account statistics" } }
      }
    },
    "/token/keys": {
      "post": {
        "summary": "List API keys",
        "tags": ["API Keys"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" } } } } } },
        "responses": { "200": { "description": "List of API keys", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/APIKey" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/token/key": {
      "put": {
        "summary": "Create an API key",
        "tags": ["API Keys"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation", "name"], "properties": { "organisation": { "type": "string" }, "name": { "type": "string" } } } } } },
        "responses": { "200": { "description": "API key created", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "name": { "type": "string" }, "public_key": { "type": "string" }, "secret_key": { "type": "string" } } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/token/key/{key_id}": {
      "delete": {
        "summary": "Delete an API key",
        "tags": ["API Keys"],
        "parameters": [{ "name": "key_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "responses": { "200": { "description": "API key deleted" } }
      }
    },
    "/audit": {
      "post": {
        "summary": "List audit entries",
        "tags": ["Audit"],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["organisation"], "properties": { "organisation": { "type": "string" }, "skip": { "type": "integer" }, "take": { "type": "integer" } } } } } },
        "responses": { "200": { "description": "List of audit entries", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/AuditEntry" } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/agent/booking/{booking_id}/component": {
      "put": {
        "summary": "Create a booking component",
        "description": "Add a flight, package, or transfer component to a booking.",
        "tags": ["Booking Components"],
        "parameters": [{ "name": "booking_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["supplier", "amount", "currency", "booking_reference"], "properties": { "supplier": { "type": "string", "format": "uuid" }, "amount": { "type": "integer" }, "currency": { "type": "string" }, "booking_reference": { "type": "string" }, "destination_air": { "type": "string" }, "type": { "type": "string" } } } } } },
        "responses": { "200": { "description": "Component created", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string" } } }, "meta": { "$ref": "#/components/schemas/Meta" } } } } } } }
      }
    },
    "/agent/bookings/{booking_id}/component/{component_id}": {
      "delete": {
        "summary": "Delete a booking component",
        "tags": ["Booking Components"],
        "parameters": [
          { "name": "booking_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } },
          { "name": "component_id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }
        ],
        "responses": { "200": { "description": "Component deleted" } }
      }
    }
  },
  "tags": [
    { "name": "Authentication", "description": "Generate JWT tokens for API access" },
    { "name": "Bookings", "description": "Manage travel bookings" },
    { "name": "Transactions", "description": "View and manage payment transactions" },
    { "name": "Payment Links", "description": "Create and manage shareable payment links" },
    { "name": "Ecommerce", "description": "Create and manage SDK-based payment sessions" },
    { "name": "Customers", "description": "Manage customer records" },
    { "name": "Suppliers", "description": "Manage travel suppliers" },
    { "name": "Refunds", "description": "Process and manage refunds" },
    { "name": "Chargebacks", "description": "Track chargebacks" },
    { "name": "Charges", "description": "View acquirer settlement charges" },
    { "name": "Credit Notes", "description": "View credit notes" },
    { "name": "Scheduled Payments", "description": "Manage scheduled and tokenised card payments" },
    { "name": "Organisations", "description": "View accessible organisations" },
    { "name": "Disbursements", "description": "View trust account disbursements" },
    { "name": "Beneficiaries", "description": "Manage disbursement beneficiaries" },
    { "name": "Ledger", "description": "View trust account ledger entries" },
    { "name": "AISP", "description": "Open Banking account information" },
    { "name": "API Keys", "description": "Manage API keys" },
    { "name": "Audit", "description": "View audit trail" },
    { "name": "Booking Components", "description": "Manage booking components (flights, packages, transfers)" }
  ]
}
