{
  "openapi": "3.1.0",
  "info": {
    "title": "Matamba Gateway",
    "version": "1",
    "contact": {
      "name": "Matamba Gateway partner support",
      "email": "partners@matambaintelligence.com",
      "url": "https://docs.matambaintelligence.com/support"
    },
    "description": "Open brokerage accounts for your customers, fund them from your wallet, place and track orders, and read each account's records at the broker. Amounts are integers in kobo. A field ending in `_kobo_decimal` is a decimal string of kobo, exact: digits, a point and at most 12 places, with a leading minus where an account can owe, and never an exponent. A whole-kobo figure beside one is it rounded in the direction its description says. Every error includes a `code` you can use in your logic. A list of values, such as an order state or an error `code`, can gain values: if you generate a client, have it accept values it doesn't know (in OpenAPI Generator, `enumUnknownDefaultCase`)."
  },
  "servers": [
    {
      "url": "https://gateway-sandbox.matambaintelligence.com",
      "description": "Sandbox"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "Accounts",
      "description": "The accounts you can trade for, and the broker's records for each one."
    },
    {
      "name": "Orders",
      "description": "Estimate, place, retrieve and cancel orders. We store each order before we send it to the exchange, and we send it only once."
    },
    {
      "name": "Events",
      "description": "Each change to your orders, applications and allocations creates an event. We send the same event bodies to your webhook endpoint. See [Webhooks](/webhooks) for how to verify them."
    },
    {
      "name": "Applications",
      "description": "Open a brokerage account for your customer."
    },
    {
      "name": "Reference",
      "description": "Code lists from the broker that you use in account applications."
    },
    {
      "name": "Wallet",
      "description": "Your wallet, its ledger, and the allocations you make from it to your customers' accounts."
    },
    {
      "name": "Limits",
      "description": "What you may send: the limits on your requests and your day, and how much of each you've used."
    },
    {
      "name": "Keys",
      "description": "Revoke a key that has leaked, yourself, at any hour."
    }
  ],
  "paths": {
    "/v1/accounts": {
      "get": {
        "operationId": "listAccounts",
        "summary": "List your accounts",
        "description": "Returns the accounts this API key can trade for, in order of account code, a page at a time. Call this first to check your setup. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Accounts"],
        "parameters": [
          {
            "$ref": "#/components/parameters/LimitParameter"
          },
          {
            "$ref": "#/components/parameters/CursorParameter"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/AccountListResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request",
            "description": "`invalid_request`: the request includes a parameter other than `limit` and `cursor`, a parameter sent twice, an empty parameter, or a cursor we didn't issue."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.service_unavailable",
            "description": "`service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/accounts/{account}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AccountParameter"
        }
      ],
      "get": {
        "operationId": "getAccount",
        "summary": "Retrieve an account",
        "description": "Returns one of your accounts from our records, without asking the broker. Takes no query parameters. For what the broker holds in it, read its balance and positions. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Accounts"],
        "responses": {
          "200": {
            "$ref": "#/components/responses/AccountResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request",
            "description": "`invalid_request`: this endpoint takes no query parameters."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "404": {
            "$ref": "#/components/responses/error.account_not_found",
            "description": "`account_not_found`: you have no account with this code. An account of someone else's returns the same."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.service_unavailable",
            "description": "`service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/orders": {
      "post": {
        "operationId": "placeOrder",
        "summary": "Place an order",
        "description": "Stores the order, then sends it to the exchange once. If an order ends in `uncertain`, we don't send it again. Retrieve it, or wait for its event, until it resolves. Requires the `trade` [scope](/keys-and-security#scopes).",
        "tags": ["Orders"],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKeyParameter"
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/OrderRequestBody"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/OrderResponse",
            "description": "This idempotency key was already used for this same order, so we didn't send anything new. The body shows the order's current state. It reads `sending` while the first request is in progress, or after it if its outcome was not recorded."
          },
          "201": {
            "$ref": "#/components/responses/OrderResponse",
            "description": "This request created the order. `state` is `pending` or `uncertain`."
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request.missing_required_field.unknown_account",
            "description": "`invalid_request`, `missing_required_field` (`param` names the field or header), `unknown_account`. We didn't store anything."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.account_blocked.account_trading_blocked.insufficient_scope.partner_closed.partner_suspended.partner_trading_paused.security_blocked.security_close_only",
            "description": "`insufficient_scope`: this key doesn't have the `trade` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed. `partner_trading_paused`: we've paused new trading for your account, and we didn't store or send anything. Cancels, estimates and reads still work. `account_trading_blocked`: we've blocked new orders on this one account; your other accounts aren't affected, and we didn't store or send anything. `account_blocked`: we've blocked this one account, and we didn't store or send anything. Cancels, estimates and reads still work. `security_close_only`: we've made this symbol close-only, so we refuse a buy; we didn't store or send anything. `security_blocked`: we've blocked new orders in this symbol; we didn't store or send anything."
          },
          "409": {
            "$ref": "#/components/responses/error.duplicate_order.similar_order_unresolved",
            "description": "`duplicate_order`: this idempotency key was already used for a different order, which `order` names. Retrieve that order instead of sending again. `similar_order_unresolved`: an identical order on this account, which `order` names, hasn't resolved yet. We didn't store anything."
          },
          "413": {
            "$ref": "#/components/responses/error.request_too_large",
            "description": "`request_too_large`"
          },
          "415": {
            "$ref": "#/components/responses/error.unsupported_media_type",
            "description": "`unsupported_media_type`: send `Content-Type: application/json`."
          },
          "422": {
            "$ref": "#/components/responses/error.limit_exceeded.order_rejected.unknown_symbol",
            "description": "`order_rejected`: the exchange rejected the order, and `reject_reason` says why. The order is stored as `rejected`, and you can't reuse the key. `unknown_symbol`, `limit_exceeded`: we didn't store anything, so you can reuse the key."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`: we didn't process the request. Retry it with the same key after `Retry-After` seconds."
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`: retry the request with the same key."
          },
          "502": {
            "$ref": "#/components/responses/error.exchange_error",
            "description": "`exchange_error`: nothing was stored. Sending the request again will not change the result, so [contact us](/support)."
          },
          "503": {
            "$ref": "#/components/responses/error.exchange_unavailable.order_not_sent.outcome_not_recorded.service_unavailable.trading_paused",
            "description": "`exchange_unavailable`: we didn't store or send anything. Retry with the same key. `order_not_sent`: the order is stored as `refused`, and you can't reuse the key. Retry with a new key. `outcome_not_recorded`: your request reached us, and its outcome wasn't recorded. The order `order` names reads `sending` until it resolves. Retrieve it until then, and don't send it again under a new key. `service_unavailable`: retry with the same key, not a new one. `trading_paused`: we've paused new orders, and we didn't store or send anything. Retry with the same key after the `Retry-After` seconds."
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["trade"]
          }
        ]
      },
      "get": {
        "operationId": "listOrders",
        "summary": "List your orders",
        "description": "Returns your orders, newest first. If you place an order while you paginate, it appears before the first page and doesn't shift the pages that follow. Filters narrow the list and can be combined. Keep the same filters for every page. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Orders"],
        "parameters": [
          {
            "$ref": "#/components/parameters/LimitParameter"
          },
          {
            "$ref": "#/components/parameters/CursorParameter"
          },
          {
            "name": "account",
            "in": "query",
            "required": false,
            "description": "Only orders for this account.",
            "schema": {
              "$ref": "#/components/schemas/AccountCode"
            },
            "example": "1000000001"
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Only orders in this state.",
            "schema": {
              "$ref": "#/components/schemas/OrderState"
            },
            "example": "filled"
          },
          {
            "name": "symbol",
            "in": "query",
            "required": false,
            "description": "Only orders for this symbol. Letter case doesn't matter.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9.-]{1,20}$"
            },
            "example": "DANGCEM"
          },
          {
            "$ref": "#/components/parameters/ClientReferenceParameter"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/OrderListResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request",
            "description": "`invalid_request`: the request includes a parameter this list doesn't take, a parameter sent twice, an empty parameter, a filter value that isn't valid, or a cursor we didn't issue. `param` names it."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.service_unavailable",
            "description": "`service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/orders/estimate": {
      "post": {
        "operationId": "estimateOrder",
        "summary": "Estimate an order",
        "description": "Returns the broker's estimate of an order's total: for a buy, what it would cost, and for a sell, what you'd receive. The estimate is indicative. Send the same body you'd use to place the order. This doesn't place or store an order, and you don't need an `Idempotency-Key`. Requires the `trade` [scope](/keys-and-security#scopes).",
        "tags": ["Orders"],
        "requestBody": {
          "$ref": "#/components/requestBodies/OrderRequestBody"
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/OrderEstimateResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request.missing_required_field.unknown_account",
            "description": "`invalid_request`, `missing_required_field`, `unknown_account`"
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended.security_blocked.security_close_only",
            "description": "`insufficient_scope`: this key doesn't have the `trade` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed. `security_close_only`: we've made this symbol close-only, so we refuse the estimate of a buy. `security_blocked`: we've blocked new orders in this symbol, so we refuse its estimate."
          },
          "413": {
            "$ref": "#/components/responses/error.request_too_large",
            "description": "`request_too_large`"
          },
          "415": {
            "$ref": "#/components/responses/error.unsupported_media_type",
            "description": "`unsupported_media_type`"
          },
          "422": {
            "$ref": "#/components/responses/error.order_rejected",
            "description": "`order_rejected`: the exchange would reject this order, and `reject_reason` says why. No order is created."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "502": {
            "$ref": "#/components/responses/error.exchange_error",
            "description": "`exchange_error`: the broker's estimate couldn't be read, or is too large to give exactly. Nothing was placed, and sending it again gets the same answer. [Contact us](/support)."
          },
          "503": {
            "$ref": "#/components/responses/error.exchange_unavailable.service_unavailable",
            "description": "`exchange_unavailable`: nothing was changed; send it again, backing off as [Handle errors](/handle-errors#4-back-off-between-retries) says. `service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["trade"]
          }
        ]
      }
    },
    "/v1/orders/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/OrderIdParameter"
        }
      ],
      "get": {
        "operationId": "getOrder",
        "summary": "Retrieve an order",
        "description": "Returns the order, including everything the exchange has reported about it. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Orders"],
        "responses": {
          "200": {
            "$ref": "#/components/responses/OrderResponse"
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "404": {
            "$ref": "#/components/responses/error.order_not_found",
            "description": "`order_not_found`"
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.service_unavailable",
            "description": "`service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      },
      "delete": {
        "operationId": "cancelOrder",
        "summary": "Cancel an order",
        "description": "Requests a cancel of a `pending` or `partially_filled` limit order. Only limit orders can be cancelled. A `202` means the broker accepted the request, not that the order is cancelled: the order then moves to `cancelled`, or to `filled` if it fills before the cancel takes effect. Wait for the event, or retrieve the order. Requires the `trade` [scope](/keys-and-security#scopes).",
        "tags": ["Orders"],
        "responses": {
          "202": {
            "$ref": "#/components/responses/OrderResponse",
            "description": "Cancel requested. The broker accepted the request, and the order isn't cancelled yet. The body is the order as it was before the cancel."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `trade` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "404": {
            "$ref": "#/components/responses/error.order_not_found",
            "description": "`order_not_found`"
          },
          "409": {
            "$ref": "#/components/responses/error.order_not_cancelable",
            "description": "`order_not_cancelable`: the order is already in a final state, isn't yet confirmed at the exchange, or is a market order, or the exchange refused the cancel. Retrieve the order to check its state."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.cancel_unconfirmed.exchange_unavailable.service_unavailable",
            "description": "`exchange_unavailable`: we didn't send the cancel. Retry it. `cancel_unconfirmed`: the cancel may have reached the exchange. It's safe to retry. `service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["trade"]
          }
        ]
      }
    },
    "/v1/events": {
      "get": {
        "operationId": "listEvents",
        "summary": "List your events",
        "description": "Returns every change to your orders, applications and allocations, oldest first, whether or not your webhook endpoint accepted it. We keep events for 30 days. Store the last `next_cursor` and pass it as `cursor` next time. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Events"],
        "parameters": [
          {
            "$ref": "#/components/parameters/LimitParameter"
          },
          {
            "$ref": "#/components/parameters/CursorParameter"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/EventListResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request",
            "description": "`invalid_request`: the request includes a parameter other than `limit` and `cursor`, a parameter sent twice, an empty parameter, or a cursor we didn't issue."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.service_unavailable",
            "description": "`service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/applications": {
      "post": {
        "operationId": "createApplication",
        "summary": "Apply for an account",
        "description": "Takes your customer's application. We hold the identity details sealed, never logged, until the account opens or the application ends. If we haven't asked the depository to open the account within 7 days of when you sent the application, or it becomes `uncertain` before we have, we erase them then. Then send its four documents with `PUT /v1/applications/{id}/documents/{type}`. After the fourth, we check the customer at the identity registries and their bank, open the account at the depository (CSCS) and add it to the broker. See [How we check an application](/applications#how-we-check-an-application). Requires the `apply` [scope](/keys-and-security#scopes).",
        "tags": ["Applications"],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKeyParameter"
          }
        ],
        "requestBody": {
          "description": "Your customer's details, for us to check and open their account.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplicationRequest"
              },
              "example": {
                "first_name": "Adaeze",
                "last_name": "Okafor",
                "gender": "F",
                "date_of_birth": "1990-05-01",
                "email": "adaeze@example.com",
                "phone": "08000000000",
                "mothers_maiden_name": "Example",
                "street": "1 Example Street",
                "city": "Ikeja",
                "state": "LA",
                "postcode": "100001",
                "state_of_origin": "LA",
                "lga_of_origin": "LA-IKJ",
                "next_of_kin_name": "Ben Example",
                "next_of_kin_phone": "08000000001",
                "bank": "058",
                "bank_account_name": "Adaeze Okafor",
                "bank_account_number": "0000000021",
                "bank_account_opened": "2015-06-01",
                "bvn": "00000000101"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/ApplicationResponse",
            "description": "This idempotency key was already used for this same application, so we didn't send anything new. `state` is the application's state now. It reads `sending` while the first request is in progress, or after it if its outcome was not recorded."
          },
          "201": {
            "$ref": "#/components/responses/ApplicationCreatedResponse",
            "description": "This request created the application. `state` is `documents_required`, and `reference` is `null` until we've added the account to the broker. Nothing has been checked or sent yet."
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request.missing_required_field",
            "description": "`invalid_request`, `missing_required_field`. `param` names the field when one is missing or breaks its rule. A field with the wrong JSON type, an unrecognised field, or a field sent twice has no `param`: the message names it. The response never includes the field's value."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.feature_not_enabled.insufficient_scope.partner_closed.partner_suspended.partner_trading_paused",
            "description": "`insufficient_scope`: this key doesn't have the `apply` scope. `feature_not_enabled`: account opening isn't enabled on this gateway. Nothing was stored or sent. [Contact us](/support). `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed. `partner_trading_paused`: we've paused new trading for your account, and we didn't store or send anything. Cancels, estimates and reads still work."
          },
          "409": {
            "$ref": "#/components/responses/error.duplicate_application",
            "description": "`duplicate_application`: this idempotency key was already used for a different application, which `application` names."
          },
          "413": {
            "$ref": "#/components/responses/error.request_too_large",
            "description": "`request_too_large`"
          },
          "415": {
            "$ref": "#/components/responses/error.unsupported_media_type",
            "description": "`unsupported_media_type`"
          },
          "422": {
            "$ref": "#/components/responses/error.application_rejected.limit_exceeded.too_many_applications_in_progress",
            "description": "`application_rejected`: a retry with this key, once its application has been rejected by our checks, the depository or the broker. `reject_reason` says why, and `param` names the field when one is at fault. You can't reuse the key. `too_many_applications_in_progress`: your company has the most applications in progress it may have at once. `limit_exceeded`: your company has sent the most applications it may send in a day. For either, we didn't store or send anything, so you can reuse the key. See [Limits](/limits)."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.application_not_sent.exchange_unavailable.outcome_not_recorded.service_unavailable.trading_paused",
            "description": "`exchange_unavailable`: we didn't store or send anything. Retry with the same key. `application_not_sent`: we couldn't take the application and sent nothing, and you can't reuse the key. Retry with a new key. `outcome_not_recorded`: your request reached us, and its outcome wasn't recorded. The application `application` names reads `sending` until it resolves. Retrieve it until then, and don't send it again under a new key. `service_unavailable`: retry with the same key, not a new one. `trading_paused`: we've paused new applications, and we didn't store or send anything. Retry with the same key after the `Retry-After` seconds."
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["apply"]
          }
        ]
      },
      "get": {
        "operationId": "listApplications",
        "summary": "List your applications",
        "description": "Returns your applications, newest first. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Applications"],
        "parameters": [
          {
            "$ref": "#/components/parameters/LimitParameter"
          },
          {
            "$ref": "#/components/parameters/CursorParameter"
          },
          {
            "$ref": "#/components/parameters/ClientReferenceParameter"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ApplicationListResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request",
            "description": "`invalid_request`"
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.service_unavailable",
            "description": "`service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/applications/{id}": {
      "get": {
        "operationId": "getApplication",
        "summary": "Retrieve an application",
        "description": "Returns the application's current state. Once it's `opened`, you can trade for the account in `account`. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Applications"],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApplicationIdParameter"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ApplicationResponse"
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "404": {
            "$ref": "#/components/responses/error.application_not_found",
            "description": "`application_not_found`"
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.service_unavailable",
            "description": "`service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/applications/{id}/documents/{type}": {
      "put": {
        "operationId": "sendDocument",
        "summary": "Send a document",
        "description": "Sends one of the application's four documents: the file itself as the body, a JPEG or PNG smaller than 1,000,000 bytes and at most 8,000 pixels wide and high. We check that the file is whole and hold it, sealed, until the depository has opened the account; then we send it to the broker, and erase our copy once the account opens. The same file sent again once we hold it isn't taken twice; one whose earlier answer was unconfirmed is taken again. A different file for a type we hold, or whose earlier file is unconfirmed, is refused. At most two of your documents are on their way to us at once. Send documents while the application is `documents_required` or `submitted`; the fourth makes it `submitted`. Requires the `apply` [scope](/keys-and-security#scopes).",
        "tags": ["Applications"],
        "parameters": [
          {
            "$ref": "#/components/parameters/ApplicationIdParameter"
          },
          {
            "$ref": "#/components/parameters/DocumentTypeParameter"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The file itself.",
          "content": {
            "image/jpeg": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/png": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/DocumentResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request",
            "description": "`invalid_request`: the file is empty, `type` isn't one of the four, or the body didn't arrive whole within 30 seconds."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.feature_not_enabled.insufficient_scope.partner_closed.partner_suspended.partner_trading_paused",
            "description": "`insufficient_scope`: this key doesn't have the `apply` scope. `feature_not_enabled`: account opening isn't enabled on this gateway. Nothing was sent. [Contact us](/support). `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed. `partner_trading_paused`: we've paused new trading for your account, and we didn't store or send anything. Cancels, estimates and reads still work."
          },
          "404": {
            "$ref": "#/components/responses/error.application_not_found",
            "description": "`application_not_found`"
          },
          "409": {
            "$ref": "#/components/responses/error.application_not_accepting_documents.document_already_delivered.document_in_flight.earlier_document_unconfirmed",
            "description": "`application_not_accepting_documents`, `document_already_delivered`, `document_in_flight` or `earlier_document_unconfirmed`"
          },
          "413": {
            "$ref": "#/components/responses/error.document_too_large",
            "description": "`document_too_large`"
          },
          "415": {
            "$ref": "#/components/responses/error.unsupported_media_type",
            "description": "`unsupported_media_type`: send `image/jpeg` or `image/png`."
          },
          "422": {
            "$ref": "#/components/responses/error.document_rejected.invalid_document.too_many_applications_in_progress",
            "description": "`invalid_document`, or `document_rejected`, answered only for an application sent before account opening changed. `too_many_applications_in_progress`: your company has the most applications in progress it may have at once ahead of this one, and we didn't store or send anything. Send the document again once one of them that is `sending`, `documents_required` or `submitted` moves to another state."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.document_unconfirmed.exchange_unavailable.service_unavailable.trading_paused",
            "description": "`document_unconfirmed`, `exchange_unavailable`, `service_unavailable` or `trading_paused`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["apply"]
          }
        ]
      }
    },
    "/v1/wallet": {
      "get": {
        "operationId": "getWallet",
        "summary": "Retrieve your wallet",
        "description": "Returns your wallet. Each figure is a ledger sum, all read at the same moment. Takes no parameters. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Wallet"],
        "responses": {
          "200": {
            "$ref": "#/components/responses/WalletResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request",
            "description": "`invalid_request`: this endpoint takes no parameters."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.service_unavailable",
            "description": "`service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/wallet/transfers": {
      "get": {
        "operationId": "listWalletTransfers",
        "summary": "List your wallet's ledger",
        "description": "Returns every entry in your wallet's ledger, newest first: credits from your payments, the reserve, booking or return of each allocation, and the hold, payment, release or return of each withdrawal. Entries are never changed or removed, so a page never shifts. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Wallet"],
        "parameters": [
          {
            "$ref": "#/components/parameters/LimitParameter"
          },
          {
            "$ref": "#/components/parameters/CursorParameter"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/WalletTransferListResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request",
            "description": "`invalid_request`: the request includes a parameter other than `limit` and `cursor`, a parameter sent twice, an empty parameter, or a cursor we didn't issue."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.service_unavailable",
            "description": "`service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/allocations": {
      "post": {
        "operationId": "createAllocation",
        "summary": "Allocate from your wallet",
        "description": "Moves money from your wallet to the balance of one of your accounts at the broker, and it's booked only once. We reserve the amount in the same step that checks your wallet. If an allocation ends in `uncertain`, the amount stays reserved and we don't send it again. Requires the `fund` [scope](/keys-and-security#scopes).",
        "tags": ["Wallet"],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKeyParameter"
          }
        ],
        "requestBody": {
          "description": "The account to fund, and the amount to move to it from your wallet.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AllocationRequest"
              },
              "example": {
                "account": "1000000001",
                "amount_kobo": 5000000
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/AllocationResponse",
            "description": "This idempotency key was already used for this same allocation, so we didn't send anything new. `state` is the allocation's state now. It reads `sending` while the first request is in progress, or after it if its outcome was not recorded."
          },
          "201": {
            "$ref": "#/components/responses/AllocationResponse",
            "description": "This request sent the allocation. `state` is `booked` or `uncertain`."
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request.missing_required_field.unknown_account",
            "description": "`invalid_request`, `missing_required_field`, `unknown_account`. We didn't store anything."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.account_blocked.account_money_blocked.feature_not_enabled.insufficient_scope.partner_closed.partner_money_paused.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `fund` scope. `feature_not_enabled`: deposits aren't enabled on this gateway. Nothing was sent, the amount is returned to your wallet, and the key now belongs to this refusal. [Contact us](/support). `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed. `partner_money_paused`: we've paused new allocations for your account, and we didn't store or send anything. `account_money_blocked`: we've blocked new allocations to this one account; your other accounts aren't affected, and we didn't store or send anything. `account_blocked`: we've blocked this one account, and we didn't store or send anything."
          },
          "409": {
            "$ref": "#/components/responses/error.duplicate_allocation.similar_allocation_unresolved",
            "description": "`duplicate_allocation`: this idempotency key was already used for a different allocation, which `allocation` names. `similar_allocation_unresolved`: an allocation to this account for this amount, which `allocation` names, hasn't resolved yet. We didn't store anything."
          },
          "413": {
            "$ref": "#/components/responses/error.request_too_large",
            "description": "`request_too_large`"
          },
          "415": {
            "$ref": "#/components/responses/error.unsupported_media_type",
            "description": "`unsupported_media_type`"
          },
          "422": {
            "$ref": "#/components/responses/error.allocation_rejected.limit_exceeded.wallet_too_low",
            "description": "`wallet_too_low`, `limit_exceeded`: we didn't store anything, so you can reuse the key. `allocation_rejected`: the broker rejected the allocation, `reject_reason` says why, and the amount is returned to your wallet."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.allocation_not_sent.exchange_unavailable.outcome_not_recorded.service_unavailable.trading_paused",
            "description": "`exchange_unavailable`: we didn't store or send anything. Retry with the same key. `allocation_not_sent`: the allocation didn't reach the broker, the amount is returned to your wallet, and you can't reuse the key. Retry with a new key. `outcome_not_recorded`: your request reached us, and its outcome wasn't recorded. The allocation `allocation` names reads `sending`, with its amount reserved, until it resolves. Retrieve it until then, and don't send it again under a new key. `service_unavailable`: retry with the same key, not a new one. `trading_paused`: we've paused new allocations, and we didn't store or send anything. Retry with the same key after the `Retry-After` seconds."
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["fund"]
          }
        ]
      },
      "get": {
        "operationId": "listAllocations",
        "summary": "List your allocations",
        "description": "Returns your allocations, newest first. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Wallet"],
        "parameters": [
          {
            "$ref": "#/components/parameters/LimitParameter"
          },
          {
            "$ref": "#/components/parameters/CursorParameter"
          },
          {
            "$ref": "#/components/parameters/ClientReferenceParameter"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/AllocationListResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request",
            "description": "`invalid_request`"
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.service_unavailable",
            "description": "`service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/allocations/{id}": {
      "get": {
        "operationId": "getAllocation",
        "summary": "Retrieve an allocation",
        "description": "Returns the allocation's current state. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Wallet"],
        "parameters": [
          {
            "$ref": "#/components/parameters/AllocationIdParameter"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/AllocationResponse"
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "404": {
            "$ref": "#/components/responses/error.allocation_not_found",
            "description": "`allocation_not_found`"
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.service_unavailable",
            "description": "`service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/reference/banks": {
      "get": {
        "operationId": "listBanks",
        "summary": "List banks",
        "description": "Returns the banks an application's `bank` can name: the broker's list, less any the depository (CSCS) doesn't open accounts with. Use one of these codes as an application's `bank`. Takes no parameters. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Reference"],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ChoiceListResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request",
            "description": "`invalid_request`: this endpoint takes no parameters."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "502": {
            "$ref": "#/components/responses/error.exchange_error",
            "description": "`exchange_error`: sending the request again will not change the result."
          },
          "503": {
            "$ref": "#/components/responses/error.exchange_unavailable.service_unavailable.settlement_lockout",
            "description": "`exchange_unavailable`: nothing was changed; send it again, backing off as [Handle errors](/handle-errors#4-back-off-between-retries) says. `settlement_lockout`: retry after `Retry-After` seconds. `service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/reference/states": {
      "get": {
        "operationId": "listStates",
        "summary": "List states",
        "description": "Returns the broker's list of states. Use these codes for an application's `state` and `state_of_origin`. Takes no parameters. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Reference"],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ChoiceListResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request",
            "description": "`invalid_request`: this endpoint takes no parameters."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "502": {
            "$ref": "#/components/responses/error.exchange_error",
            "description": "`exchange_error`: sending the request again will not change the result."
          },
          "503": {
            "$ref": "#/components/responses/error.exchange_unavailable.service_unavailable.settlement_lockout",
            "description": "`exchange_unavailable`: nothing was changed; send it again, backing off as [Handle errors](/handle-errors#4-back-off-between-retries) says. `settlement_lockout`: retry after `Retry-After` seconds. `service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/reference/states/{state}/lgas": {
      "get": {
        "operationId": "listLgas",
        "summary": "List a state's LGAs",
        "description": "Returns the broker's local government areas (LGAs) for one state. Use one of these codes as an application's `lga_of_origin`. Takes no query parameters. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Reference"],
        "parameters": [
          {
            "name": "state",
            "in": "path",
            "required": true,
            "description": "A state code from GET /v1/reference/states.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9-]{1,32}$"
            },
            "example": "LA"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ChoiceListResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request",
            "description": "`invalid_request`: the request includes a query parameter, or the state isn't formatted as a code (`param` is `state`)."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "502": {
            "$ref": "#/components/responses/error.exchange_error",
            "description": "`exchange_error`: sending the request again will not change the result."
          },
          "503": {
            "$ref": "#/components/responses/error.exchange_unavailable.service_unavailable.settlement_lockout",
            "description": "`exchange_unavailable`: nothing was changed; send it again, backing off as [Handle errors](/handle-errors#4-back-off-between-retries) says. `settlement_lockout`: retry after `Retry-After` seconds. `service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/accounts/{account}/balance": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AccountParameter"
        }
      ],
      "get": {
        "operationId": "getBalance",
        "summary": "Retrieve an account's balance",
        "description": "Returns the account's balance as the broker reports it. Takes no query parameters. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Accounts"],
        "responses": {
          "200": {
            "$ref": "#/components/responses/BalanceResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request.unknown_account",
            "description": "`invalid_request`: this endpoint takes no query parameters. `unknown_account`"
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "409": {
            "$ref": "#/components/responses/error.account_not_at_broker",
            "description": "`account_not_at_broker`: the account is registered to you with us, but the broker has no record of it. [Contact us](/support)."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "502": {
            "$ref": "#/components/responses/error.exchange_error",
            "description": "`exchange_error`: sending the request again will not change the result."
          },
          "503": {
            "$ref": "#/components/responses/error.exchange_unavailable.service_unavailable.settlement_lockout",
            "description": "`exchange_unavailable`: nothing was changed; send it again, backing off as [Handle errors](/handle-errors#4-back-off-between-retries) says. `settlement_lockout`: the broker is settling the day's trades. Retry after `Retry-After` seconds. `service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/limits": {
      "get": {
        "operationId": "getLimits",
        "summary": "Retrieve your limits",
        "description": "Returns each of your limits and how much of it you've used, counted the way the limit counts it. `remaining` is what a request can use at this moment. Takes no parameters. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Limits"],
        "responses": {
          "200": {
            "$ref": "#/components/responses/LimitsResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request",
            "description": "`invalid_request`: this endpoint takes no parameters."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.service_unavailable",
            "description": "`service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/keys/revoke": {
      "post": {
        "operationId": "revokeKey",
        "summary": "Revoke this key",
        "description": "Ends the key you send in the `Authorization` header, at once. Use it the moment a key leaks, at any hour. Any key can revoke itself, whatever its scopes, and from any address, including one a live key isn't registered for. The answer is `204` whether the key worked, was already revoked or was never issued, so it never confirms that a key is real. To check, send any request with the key from one of your servers: `401` means it no longer works. Your other keys keep working, and a request the key started before you revoked it still finishes. Takes no body.",
        "tags": ["Keys"],
        "responses": {
          "204": {
            "description": "The key no longer works on this host, if it ever did. No body."
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`: no key in the `Authorization` header, or a key for the other environment. Revoke that one at its own host. Nothing was revoked."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`: too many revocations from one address. Wait the `Retry-After` seconds, then send it again."
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "503": {
            "$ref": "#/components/responses/error.service_unavailable",
            "description": "`service_unavailable`: the key may still work. Send it again."
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        }
      }
    },
    "/v1/accounts/{account}/positions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AccountParameter"
        }
      ],
      "get": {
        "operationId": "listPositions",
        "summary": "List an account's positions",
        "description": "Returns the account's positions as the broker reports them. Takes no query parameters. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Accounts"],
        "responses": {
          "200": {
            "$ref": "#/components/responses/PositionListResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request.unknown_account",
            "description": "`invalid_request`: this endpoint takes no query parameters. `unknown_account`"
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "409": {
            "$ref": "#/components/responses/error.account_not_at_broker",
            "description": "`account_not_at_broker`: [contact us](/support)."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "502": {
            "$ref": "#/components/responses/error.exchange_error",
            "description": "`exchange_error`: sending the request again will not change the result."
          },
          "503": {
            "$ref": "#/components/responses/error.exchange_unavailable.service_unavailable.settlement_lockout",
            "description": "`exchange_unavailable`: nothing was changed; send it again, backing off as [Handle errors](/handle-errors#4-back-off-between-retries) says. `settlement_lockout`: retry after `Retry-After` seconds. `service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/accounts/{account}/trades": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AccountParameter"
        }
      ],
      "get": {
        "operationId": "listTrades",
        "summary": "List an account's trades",
        "description": "Returns buy and sell fills with a trade date from `from` to `to`, newest first. A range can include at most 1,000 records. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Accounts"],
        "parameters": [
          {
            "$ref": "#/components/parameters/FromParameter"
          },
          {
            "$ref": "#/components/parameters/ToParameter"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/TradeListResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request.unknown_account",
            "description": "`invalid_request`: an invalid or unknown parameter, or more than 1,000 records in the range (`param` is `from`). `unknown_account`"
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "409": {
            "$ref": "#/components/responses/error.account_not_at_broker",
            "description": "`account_not_at_broker`: [contact us](/support)."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "502": {
            "$ref": "#/components/responses/error.exchange_error",
            "description": "`exchange_error`: sending the request again will not change the result."
          },
          "503": {
            "$ref": "#/components/responses/error.exchange_unavailable.service_unavailable.settlement_lockout",
            "description": "`exchange_unavailable`: nothing was changed; send it again, backing off as [Handle errors](/handle-errors#4-back-off-between-retries) says. `settlement_lockout`: retry after `Retry-After` seconds. `service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    },
    "/v1/accounts/{account}/contract-notes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AccountParameter"
        }
      ],
      "get": {
        "operationId": "listContractNotes",
        "summary": "List an account's contract notes",
        "description": "Returns settled trades with their charges, for trades dated from `from` to `to`, newest first. A range can include at most 1,000 records. Requires the `read` [scope](/keys-and-security#scopes).",
        "tags": ["Accounts"],
        "parameters": [
          {
            "$ref": "#/components/parameters/FromParameter"
          },
          {
            "$ref": "#/components/parameters/ToParameter"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ContractNoteListResponse"
          },
          "400": {
            "$ref": "#/components/responses/error.invalid_request.unknown_account",
            "description": "`invalid_request`: an invalid or unknown parameter, or more than 1,000 records in the range (`param` is `from`). `unknown_account`"
          },
          "401": {
            "$ref": "#/components/responses/error.unauthorized",
            "description": "`unauthorized`"
          },
          "403": {
            "$ref": "#/components/responses/error.insufficient_scope.partner_closed.partner_suspended",
            "description": "`insufficient_scope`: this key doesn't have the `read` scope. `partner_suspended`: we've suspended your partner account, and we didn't read the request. `partner_closed`: your partner account is closed."
          },
          "409": {
            "$ref": "#/components/responses/error.account_not_at_broker",
            "description": "`account_not_at_broker`: [contact us](/support)."
          },
          "429": {
            "$ref": "#/components/responses/error.rate_limited",
            "description": "`rate_limited`"
          },
          "500": {
            "$ref": "#/components/responses/error.internal_error",
            "description": "`internal_error`"
          },
          "502": {
            "$ref": "#/components/responses/error.exchange_error",
            "description": "`exchange_error`: sending the request again will not change the result."
          },
          "503": {
            "$ref": "#/components/responses/error.exchange_unavailable.service_unavailable.settlement_lockout",
            "description": "`exchange_unavailable`: nothing was changed; send it again, backing off as [Handle errors](/handle-errors#4-back-off-between-retries) says. `settlement_lockout`: retry after `Retry-After` seconds. `service_unavailable`"
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "security": [
          {
            "bearer": ["read"]
          }
        ]
      }
    }
  },
  "webhooks": {
    "event": {
      "post": {
        "operationId": "receiveEvent",
        "summary": "Receive an event",
        "description": "What we send to your webhook endpoint when one of your orders, applications or allocations changes: the event exactly as `GET /v1/events` lists it. Check `webhook-signature` before you trust it, and answer with any 2xx. See [Webhooks](/webhooks) for how to verify it and when we send it again. The example is the test vector on that page: it verifies with the secret shown there.",
        "tags": ["Events"],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event's `id`. It's the same on every attempt, so use it to drop repeats.",
            "schema": {
              "type": "string",
              "pattern": "^msg_[0-9a-f]{24}$"
            },
            "example": "msg_5f0c2a9e7b1d4c3a8e6f0b12"
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When we sent this attempt, in seconds since 1970-01-01 UTC. Refuse one too far from your own clock: see [Webhooks](/webhooks).",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "example": "1790316785"
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` and the base64 HMAC-SHA256 of `webhook-id`, `webhook-timestamp` and the body, joined by full stops, keyed with your signing secret. More than one, separated by spaces, while a secret is being rotated.",
            "schema": {
              "type": "string"
            },
            "example": "v1,F77xehg2itrdq7wVGgmMAgoJhpOEHpNYcqI3er4ySoA="
          }
        ],
        "requestBody": {
          "description": "The event.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Event"
              },
              "example": {
                "object": "event",
                "id": "msg_5f0c2a9e7b1d4c3a8e6f0b12",
                "type": "order.filled",
                "timestamp": "2026-09-25T06:13:02Z",
                "version": 2,
                "data": {
                  "object": "order",
                  "id": "ord_62jxryztxctob7uopekg",
                  "state": "filled",
                  "account": "1000000001",
                  "symbol": "DANGCEM",
                  "side": "buy",
                  "quantity": 10,
                  "type": "market",
                  "time_in_force": "day",
                  "price_kobo": null,
                  "filled_quantity": 10,
                  "exchange_order_id": "1790316754123",
                  "reason": null,
                  "reject_reason": null,
                  "created_at": "2026-09-25T06:12:34Z",
                  "updated_at": "2026-09-25T06:13:02Z",
                  "filled_at": "2026-09-25T06:13:02Z",
                  "average_fill_price_kobo_decimal": "47500",
                  "client_reference": null
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx tells us you have the event. Anything else, or no answer in time, and we send it again later."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "`Authorization: Bearer <key>`. Sandbox keys start with `mgw_test_` and live keys start with `mgw_live_`. Each key works only in its own environment, and a live key works only from the IP addresses or ranges registered for it."
      }
    },
    "headers": {
      "RequestIdHeader": {
        "description": "A unique identifier for this request. Include it when you [contact us](/support#report-a-problem).",
        "schema": {
          "type": "string"
        },
        "example": "req_ih4pqm3vb3uruahh"
      },
      "CacheControlHeader": {
        "description": "Always `no-store`.",
        "schema": {
          "type": "string",
          "const": "no-store"
        },
        "example": "no-store"
      },
      "RetryAfterHeader": {
        "description": "The number of seconds to wait before you retry. Sent with `409 document_in_flight` (`1`), `429 rate_limited` (`1`), `503 settlement_lockout` (`60`) and `503 trading_paused` (`60`).",
        "schema": {
          "type": "integer"
        },
        "example": 1
      },
      "WWWAuthenticateHeader": {
        "description": "Sent with 401: `Bearer realm=\"Matamba Gateway\"`.",
        "schema": {
          "type": "string"
        },
        "example": "Bearer realm=\"Matamba Gateway\""
      },
      "AllowHeader": {
        "description": "Sent with 405. Lists the methods the path supports.",
        "schema": {
          "type": "string"
        },
        "example": "GET, POST"
      }
    },
    "parameters": {
      "DocumentTypeParameter": {
        "name": "type",
        "in": "path",
        "required": true,
        "description": "Which of the four documents.",
        "schema": {
          "$ref": "#/components/schemas/DocumentType"
        },
        "example": "government_id"
      },
      "ClientReferenceParameter": {
        "name": "client_reference",
        "in": "query",
        "required": false,
        "description": "Only the ones you sent with this `client_reference`, matched exactly.",
        "schema": {
          "$ref": "#/components/schemas/ClientReference"
        },
        "example": "ord-88213"
      },
      "IdempotencyKeyParameter": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "A key you choose to identify this request. Send the same key every time you retry the request. Once used, a key stays tied to that request permanently. It must be printable ASCII with no spaces, and we compare it byte for byte. Send the header only once.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255,
          "pattern": "^[!-~]+$"
        },
        "example": "order-0001"
      },
      "LimitParameter": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "The number of items to return.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 25
        },
        "example": 25
      },
      "CursorParameter": {
        "name": "cursor",
        "in": "query",
        "required": false,
        "description": "The `next_cursor` from the previous page, unchanged.",
        "schema": {
          "type": "string",
          "minLength": 1
        },
        "example": "b3JkXzR2cTd6azJtNXh3M3BuNnJ0ZDJh"
      },
      "FromParameter": {
        "name": "from",
        "in": "query",
        "required": false,
        "description": "The first trade date, in West Africa Time (WAT). Defaults to 30 days before `to`. Can't be after `to`.",
        "schema": {
          "type": "string",
          "format": "date"
        },
        "example": "2026-09-01"
      },
      "ToParameter": {
        "name": "to",
        "in": "query",
        "required": false,
        "description": "The last trade date, in West Africa Time (WAT). Defaults to today. Can't be after today.",
        "schema": {
          "type": "string",
          "format": "date"
        },
        "example": "2026-09-25"
      },
      "AccountParameter": {
        "name": "account",
        "in": "path",
        "required": true,
        "description": "One of your account codes, from GET /v1/accounts.",
        "schema": {
          "$ref": "#/components/schemas/AccountCode"
        },
        "example": "1000000001"
      },
      "OrderIdParameter": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "The order's `id`.",
        "schema": {
          "type": "string",
          "pattern": "^ord_[a-z2-7]{20}$"
        },
        "example": "ord_4vq7zk2m5xw3pn6rtd2a"
      },
      "ApplicationIdParameter": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "The application's `id`.",
        "schema": {
          "type": "string",
          "pattern": "^app_[a-z2-7]{20}$"
        },
        "example": "app_3rbw6yq2kd5mz7tcxf4n"
      },
      "AllocationIdParameter": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "The allocation's `id`.",
        "schema": {
          "type": "string",
          "pattern": "^alc_[a-z2-7]{20}$"
        },
        "example": "alc_4hn7vz2qe6wk3pma5rtd"
      }
    },
    "requestBodies": {
      "OrderRequestBody": {
        "description": "The order to place or estimate.",
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/OrderRequest"
            },
            "examples": {
              "limit": {
                "summary": "Limit buy of an ETF (an ETF takes limit orders only)",
                "value": {
                  "account": "1000000001",
                  "symbol": "STANBICETF30",
                  "side": "buy",
                  "quantity": 100,
                  "type": "limit",
                  "time_in_force": "day",
                  "price_kobo": 12050,
                  "client_reference": "ord-88213"
                }
              },
              "market": {
                "summary": "Market sell",
                "value": {
                  "account": "1000000001",
                  "symbol": "MTNN",
                  "side": "sell",
                  "quantity": 50,
                  "type": "market",
                  "time_in_force": "day"
                }
              }
            }
          }
        }
      }
    },
    "responses": {
      "DocumentResponse": {
        "description": "The document, as we hold it.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Document"
            },
            "example": {
              "object": "document",
              "application": "app_3rbw6yq2kd5mz7tcxf4n",
              "type": "government_id",
              "state": "delivered",
              "created_at": "2026-09-30T10:02:14Z",
              "updated_at": "2026-09-30T10:02:14Z"
            }
          }
        }
      },
      "ErrorResponse": {
        "description": "An error. Use `error.code` in your logic. A path that doesn't exist returns 404 `not_found`, and a method the path doesn't support returns 405 `method_not_allowed` with an `Allow` header.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfterHeader"
          },
          "WWW-Authenticate": {
            "$ref": "#/components/headers/WWWAuthenticateHeader"
          },
          "Allow": {
            "$ref": "#/components/headers/AllowHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "not_found": {
                "summary": "not_found",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "not_found",
                    "message": "No such path. Check the path against the API reference.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#not_found"
                  }
                }
              },
              "method_not_allowed": {
                "summary": "method_not_allowed",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "method_not_allowed",
                    "message": "This method is not allowed on this path.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#method_not_allowed"
                  }
                }
              }
            }
          }
        }
      },
      "AccountResponse": {
        "description": "One of your accounts.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Account"
            },
            "example": {
              "object": "account",
              "code": "1000000077",
              "application": "app_5n2c6xq4ld7kz3pw7vby",
              "created_at": "2026-09-25T07:41:30Z",
              "restrictions": {
                "trading_blocked": false,
                "money_blocked": true,
                "blocked": false,
                "since": "2026-10-04T21:00:00Z",
                "trading_blocked_at": null,
                "money_blocked_at": "2026-10-04T21:00:00Z",
                "blocked_at": null,
                "trading_blocked_reason": null,
                "money_blocked_reason": "Fraud review",
                "blocked_reason": null
              }
            }
          }
        }
      },
      "AccountListResponse": {
        "description": "Your accounts.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AccountList"
            },
            "example": {
              "object": "list",
              "has_more": false,
              "next_cursor": null,
              "data": [
                {
                  "object": "account",
                  "code": "1000000001",
                  "application": null,
                  "created_at": "2026-09-20T09:00:00Z",
                  "restrictions": {
                    "trading_blocked": false,
                    "money_blocked": false,
                    "blocked": false,
                    "since": null,
                    "trading_blocked_at": null,
                    "money_blocked_at": null,
                    "blocked_at": null,
                    "trading_blocked_reason": null,
                    "money_blocked_reason": null,
                    "blocked_reason": null
                  }
                },
                {
                  "object": "account",
                  "code": "1000000077",
                  "application": "app_5n2c6xq4ld7kz3pw7vby",
                  "created_at": "2026-09-25T07:41:30Z",
                  "restrictions": {
                    "trading_blocked": false,
                    "money_blocked": false,
                    "blocked": false,
                    "since": null,
                    "trading_blocked_at": null,
                    "money_blocked_at": null,
                    "blocked_at": null,
                    "trading_blocked_reason": null,
                    "money_blocked_reason": null,
                    "blocked_reason": null
                  }
                }
              ]
            }
          }
        }
      },
      "OrderResponse": {
        "description": "An order.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Order"
            },
            "examples": {
              "placed": {
                "summary": "A market buy, just placed",
                "value": {
                  "object": "order",
                  "id": "ord_62jxryztxctob7uopekg",
                  "state": "pending",
                  "account": "1000000001",
                  "symbol": "DANGCEM",
                  "side": "buy",
                  "quantity": 10,
                  "type": "market",
                  "time_in_force": "day",
                  "price_kobo": null,
                  "filled_quantity": 0,
                  "exchange_order_id": "1790316754123",
                  "reason": null,
                  "reject_reason": null,
                  "created_at": "2026-09-25T06:12:34Z",
                  "updated_at": "2026-09-25T06:12:34Z",
                  "filled_at": null,
                  "average_fill_price_kobo_decimal": null,
                  "client_reference": null
                }
              },
              "filled": {
                "summary": "The same order, filled",
                "value": {
                  "object": "order",
                  "id": "ord_62jxryztxctob7uopekg",
                  "state": "filled",
                  "account": "1000000001",
                  "symbol": "DANGCEM",
                  "side": "buy",
                  "quantity": 10,
                  "type": "market",
                  "time_in_force": "day",
                  "price_kobo": null,
                  "filled_quantity": 10,
                  "exchange_order_id": "1790316754123",
                  "reason": null,
                  "reject_reason": null,
                  "created_at": "2026-09-25T06:12:34Z",
                  "updated_at": "2026-09-25T06:13:02Z",
                  "filled_at": "2026-09-25T06:13:02Z",
                  "average_fill_price_kobo_decimal": "47500",
                  "client_reference": null
                }
              },
              "limit": {
                "summary": "A limit buy of an ETF, open (what a cancel returns)",
                "value": {
                  "object": "order",
                  "id": "ord_7kq2m4xw5pz3ncvha6de",
                  "state": "pending",
                  "account": "1000000001",
                  "symbol": "STANBICETF30",
                  "side": "buy",
                  "quantity": 50,
                  "type": "limit",
                  "time_in_force": "day",
                  "price_kobo": 12000,
                  "filled_quantity": 0,
                  "exchange_order_id": "1790316761507",
                  "reason": null,
                  "reject_reason": null,
                  "created_at": "2026-09-25T06:20:11Z",
                  "updated_at": "2026-09-25T06:20:11Z",
                  "filled_at": null,
                  "average_fill_price_kobo_decimal": null,
                  "client_reference": null
                }
              }
            }
          }
        }
      },
      "OrderListResponse": {
        "description": "A page of orders.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/OrderList"
            },
            "example": {
              "object": "list",
              "has_more": false,
              "next_cursor": null,
              "data": [
                {
                  "object": "order",
                  "id": "ord_7kq2m4xw5pz3ncvha6de",
                  "state": "pending",
                  "account": "1000000001",
                  "symbol": "STANBICETF30",
                  "side": "buy",
                  "quantity": 50,
                  "type": "limit",
                  "time_in_force": "day",
                  "price_kobo": 12000,
                  "filled_quantity": 0,
                  "exchange_order_id": "1790316761507",
                  "reason": null,
                  "reject_reason": null,
                  "created_at": "2026-09-25T06:20:11Z",
                  "updated_at": "2026-09-25T06:20:11Z",
                  "filled_at": null,
                  "average_fill_price_kobo_decimal": null,
                  "client_reference": null
                },
                {
                  "object": "order",
                  "id": "ord_62jxryztxctob7uopekg",
                  "state": "filled",
                  "account": "1000000001",
                  "symbol": "DANGCEM",
                  "side": "buy",
                  "quantity": 10,
                  "type": "market",
                  "time_in_force": "day",
                  "price_kobo": null,
                  "filled_quantity": 10,
                  "exchange_order_id": "1790316754123",
                  "reason": null,
                  "reject_reason": null,
                  "created_at": "2026-09-25T06:12:34Z",
                  "updated_at": "2026-09-25T06:13:02Z",
                  "filled_at": "2026-09-25T06:13:02Z",
                  "average_fill_price_kobo_decimal": "47500",
                  "client_reference": null
                }
              ]
            }
          }
        }
      },
      "OrderEstimateResponse": {
        "description": "The estimate.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/OrderEstimate"
            },
            "examples": {
              "buy": {
                "summary": "A market buy: 10 x 52250 at the upper limit, plus 1.5% in the sandbox",
                "value": {
                  "object": "order_estimate",
                  "account": "1000000001",
                  "symbol": "DANGCEM",
                  "side": "buy",
                  "quantity": 10,
                  "type": "market",
                  "time_in_force": "day",
                  "price_kobo": null,
                  "estimated_total_kobo": 530338,
                  "estimated_total_kobo_decimal": "530337.5"
                }
              },
              "sell": {
                "summary": "A market sell: 50 x 22500 at the lower limit, less 1.5% in the sandbox",
                "value": {
                  "object": "order_estimate",
                  "account": "1000000001",
                  "symbol": "MTNN",
                  "side": "sell",
                  "quantity": 50,
                  "type": "market",
                  "time_in_force": "day",
                  "price_kobo": null,
                  "estimated_total_kobo": 1108125,
                  "estimated_total_kobo_decimal": "1108125"
                }
              }
            }
          }
        }
      },
      "EventListResponse": {
        "description": "A page of events.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventList"
            },
            "example": {
              "object": "list",
              "has_more": false,
              "next_cursor": "ZXZ0XzM",
              "data": [
                {
                  "object": "event",
                  "id": "msg_1d9e4b7a0c2f6e8b3a5d7c90",
                  "type": "order.pending",
                  "timestamp": "2026-09-25T06:12:34Z",
                  "version": 1,
                  "data": {
                    "object": "order",
                    "id": "ord_62jxryztxctob7uopekg",
                    "state": "pending",
                    "account": "1000000001",
                    "symbol": "DANGCEM",
                    "side": "buy",
                    "quantity": 10,
                    "type": "market",
                    "time_in_force": "day",
                    "price_kobo": null,
                    "filled_quantity": 0,
                    "exchange_order_id": "1790316754123",
                    "reason": null,
                    "reject_reason": null,
                    "created_at": "2026-09-25T06:12:34Z",
                    "updated_at": "2026-09-25T06:12:34Z",
                    "filled_at": null,
                    "average_fill_price_kobo_decimal": null,
                    "client_reference": null
                  }
                },
                {
                  "object": "event",
                  "id": "msg_5f0c2a9e7b1d4c3a8e6f0b12",
                  "type": "order.filled",
                  "timestamp": "2026-09-25T06:13:02Z",
                  "version": 2,
                  "data": {
                    "object": "order",
                    "id": "ord_62jxryztxctob7uopekg",
                    "state": "filled",
                    "account": "1000000001",
                    "symbol": "DANGCEM",
                    "side": "buy",
                    "quantity": 10,
                    "type": "market",
                    "time_in_force": "day",
                    "price_kobo": null,
                    "filled_quantity": 10,
                    "exchange_order_id": "1790316754123",
                    "reason": null,
                    "reject_reason": null,
                    "created_at": "2026-09-25T06:12:34Z",
                    "updated_at": "2026-09-25T06:13:02Z",
                    "filled_at": "2026-09-25T06:13:02Z",
                    "average_fill_price_kobo_decimal": "47500",
                    "client_reference": null
                  }
                },
                {
                  "object": "event",
                  "id": "msg_8c41e0d2a7b95f3e1c6d0a47",
                  "type": "allocation.booked",
                  "timestamp": "2026-09-25T06:20:11Z",
                  "version": 3,
                  "data": {
                    "object": "allocation",
                    "id": "alc_3k7qmz2w7xv4tn6pb6cd",
                    "account": "1000000001",
                    "amount_kobo": 5000000,
                    "state": "booked",
                    "reason": null,
                    "reject_reason": null,
                    "created_at": "2026-09-25T06:20:11Z",
                    "updated_at": "2026-09-25T06:20:11Z",
                    "client_reference": null
                  }
                }
              ]
            }
          }
        }
      },
      "ApplicationResponse": {
        "description": "An application.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Application"
            },
            "examples": {
              "documents_required": {
                "summary": "Taken, waiting for its documents",
                "value": {
                  "object": "application",
                  "id": "app_3rbw6yq2kd5mz7tcxf4n",
                  "state": "documents_required",
                  "reference": null,
                  "account": null,
                  "reason": null,
                  "reject_reason": null,
                  "param": null,
                  "created_at": "2026-09-25T05:58:40Z",
                  "updated_at": "2026-09-25T05:58:40Z",
                  "client_reference": null
                }
              },
              "opened": {
                "summary": "Opened",
                "value": {
                  "object": "application",
                  "id": "app_3rbw6yq2kd5mz7tcxf4n",
                  "state": "opened",
                  "reference": "MGW3RBW6YQ2KD5MZ7TCXF4N",
                  "account": "1000000001",
                  "reason": null,
                  "reject_reason": null,
                  "param": null,
                  "created_at": "2026-09-25T05:58:40Z",
                  "updated_at": "2026-09-25T06:04:10Z",
                  "client_reference": null
                }
              }
            }
          }
        }
      },
      "ApplicationCreatedResponse": {
        "description": "The application, as this request created it.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Application"
            },
            "example": {
              "object": "application",
              "id": "app_3rbw6yq2kd5mz7tcxf4n",
              "state": "documents_required",
              "reference": null,
              "account": null,
              "reason": null,
              "reject_reason": null,
              "param": null,
              "created_at": "2026-09-25T05:58:40Z",
              "updated_at": "2026-09-25T05:58:40Z",
              "client_reference": null
            }
          }
        }
      },
      "ApplicationListResponse": {
        "description": "A page of applications.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApplicationList"
            },
            "example": {
              "object": "list",
              "has_more": false,
              "next_cursor": null,
              "data": [
                {
                  "object": "application",
                  "id": "app_3rbw6yq2kd5mz7tcxf4n",
                  "state": "opened",
                  "reference": "MGW3RBW6YQ2KD5MZ7TCXF4N",
                  "account": "1000000001",
                  "reason": null,
                  "reject_reason": null,
                  "param": null,
                  "created_at": "2026-09-25T05:58:40Z",
                  "updated_at": "2026-09-25T06:04:10Z",
                  "client_reference": null
                }
              ]
            }
          }
        }
      },
      "WalletTransferListResponse": {
        "description": "A page of your wallet's ledger, newest first.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/WalletTransferList"
            },
            "example": {
              "object": "list",
              "has_more": true,
              "next_cursor": "d3RyXzQ",
              "data": [
                {
                  "object": "wallet_transfer",
                  "id": "wtr_6",
                  "type": "withdrawal_held",
                  "amount_kobo": 2000000,
                  "available_change_kobo": -2000000,
                  "allocation": null,
                  "account": null,
                  "bank_reference": null,
                  "withdrawal": "wdr_7qk2m4xw6rtp3vn6bz5c",
                  "created_at": "2026-09-25T09:41:07Z"
                },
                {
                  "object": "wallet_transfer",
                  "id": "wtr_5",
                  "type": "post",
                  "amount_kobo": 5000000,
                  "available_change_kobo": 0,
                  "allocation": "alc_3k7qmz2w7xv4tn6pb6cd",
                  "account": "1000000001",
                  "bank_reference": null,
                  "withdrawal": null,
                  "created_at": "2026-09-25T06:20:11Z"
                },
                {
                  "object": "wallet_transfer",
                  "id": "wtr_4",
                  "type": "reserve",
                  "amount_kobo": 5000000,
                  "available_change_kobo": -5000000,
                  "allocation": "alc_3k7qmz2w7xv4tn6pb6cd",
                  "account": null,
                  "bank_reference": null,
                  "withdrawal": null,
                  "created_at": "2026-09-25T06:20:11Z"
                }
              ]
            }
          }
        }
      },
      "WalletResponse": {
        "description": "Your wallet.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Wallet"
            },
            "example": {
              "object": "wallet",
              "credited_kobo": 100000000,
              "allocated_kobo": 5000000,
              "reserved_kobo": 0,
              "withdrawing_kobo": 2000000,
              "withdrawn_kobo": 3000000,
              "available_kobo": 90000000
            }
          }
        }
      },
      "AllocationResponse": {
        "description": "An allocation.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Allocation"
            },
            "example": {
              "object": "allocation",
              "id": "alc_4hn7vz2qe6wk3pma5rtd",
              "account": "1000000001",
              "amount_kobo": 5000000,
              "state": "booked",
              "reason": null,
              "reject_reason": null,
              "created_at": "2026-09-25T06:07:15Z",
              "updated_at": "2026-09-25T06:07:15Z",
              "client_reference": null
            }
          }
        }
      },
      "AllocationListResponse": {
        "description": "A page of allocations.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AllocationList"
            },
            "example": {
              "object": "list",
              "has_more": false,
              "next_cursor": null,
              "data": [
                {
                  "object": "allocation",
                  "id": "alc_4hn7vz2qe6wk3pma5rtd",
                  "account": "1000000001",
                  "amount_kobo": 5000000,
                  "state": "booked",
                  "reason": null,
                  "reject_reason": null,
                  "created_at": "2026-09-25T06:07:15Z",
                  "updated_at": "2026-09-25T06:07:15Z",
                  "client_reference": null
                }
              ]
            }
          }
        }
      },
      "ChoiceListResponse": {
        "description": "The complete list.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ChoiceList"
            },
            "examples": {
              "banks": {
                "summary": "GET /v1/reference/banks",
                "value": {
                  "object": "list",
                  "has_more": false,
                  "next_cursor": null,
                  "data": [
                    {
                      "object": "bank",
                      "code": "044",
                      "name": "Access Bank"
                    },
                    {
                      "object": "bank",
                      "code": "058",
                      "name": "Guaranty Trust Bank"
                    }
                  ]
                }
              },
              "states": {
                "summary": "GET /v1/reference/states",
                "value": {
                  "object": "list",
                  "has_more": false,
                  "next_cursor": null,
                  "data": [
                    {
                      "object": "state",
                      "code": "FC",
                      "name": "Federal Capital Territory"
                    },
                    {
                      "object": "state",
                      "code": "LA",
                      "name": "Lagos"
                    }
                  ]
                }
              },
              "lgas": {
                "summary": "GET /v1/reference/states/LA/lgas",
                "value": {
                  "object": "list",
                  "has_more": false,
                  "next_cursor": null,
                  "data": [
                    {
                      "object": "lga",
                      "code": "LA-ETO",
                      "name": "Eti-Osa"
                    },
                    {
                      "object": "lga",
                      "code": "LA-IKJ",
                      "name": "Ikeja"
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "BalanceResponse": {
        "description": "The account's balance.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Balance"
            },
            "example": {
              "object": "balance",
              "account": "1000000001",
              "currency": "NGN",
              "opening_kobo": 104517875,
              "opening_kobo_decimal": "104517875",
              "pending_debits_kobo": 609000,
              "pending_debits_kobo_decimal": "609000",
              "available_kobo": 103908875,
              "available_kobo_decimal": "103908875"
            }
          }
        }
      },
      "LimitsResponse": {
        "description": "Your limits and what you've used of them.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Limits"
            },
            "example": {
              "object": "limits",
              "day": "2026-09-25",
              "requests_per_second": {
                "limit": 20,
                "burst": 40
              },
              "requests_under_way": {
                "limit": 5,
                "used": 0,
                "remaining": 5,
                "resets_at": null
              },
              "orders_kobo_per_day": {
                "limit": 1000000000,
                "used": 522500,
                "remaining": 999477500,
                "resets_at": "2026-09-25T23:00:00Z"
              },
              "allocations_kobo_per_day": {
                "limit": 5000000000,
                "used": 5000000,
                "remaining": 4995000000,
                "resets_at": "2026-09-25T23:00:00Z"
              },
              "per_request": {
                "order_quantity": 100000000,
                "allocation_kobo": 10000000000,
                "request_body_bytes": 16384
              }
            }
          }
        }
      },
      "PositionListResponse": {
        "description": "All of the account's positions.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PositionList"
            },
            "example": {
              "object": "list",
              "has_more": false,
              "next_cursor": null,
              "data": [
                {
                  "object": "position",
                  "symbol": "DANGCEM",
                  "name": "DANGCEM",
                  "asset_class": "Stock",
                  "sector": null,
                  "industry": null,
                  "quantity": 10,
                  "average_cost_kobo_decimal": "47500",
                  "market_price_kobo": 47500,
                  "market_value_kobo": 475000
                }
              ]
            }
          }
        }
      },
      "TradeListResponse": {
        "description": "All trades in the range.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/TradeList"
            },
            "example": {
              "object": "list",
              "has_more": false,
              "next_cursor": null,
              "data": [
                {
                  "object": "trade",
                  "ticket": "T1790316754123-1",
                  "order_id": "ord_62jxryztxctob7uopekg",
                  "exchange_order_id": "1790316754123",
                  "symbol": "DANGCEM",
                  "name": "DANGCEM",
                  "side": "buy",
                  "quantity": 10,
                  "price_kobo": 47500,
                  "trade_date": "2026-09-25"
                }
              ]
            }
          }
        }
      },
      "ContractNoteListResponse": {
        "description": "All contract notes in the range.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ContractNoteList"
            },
            "example": {
              "object": "list",
              "has_more": false,
              "next_cursor": null,
              "data": [
                {
                  "object": "contract_note",
                  "ticket": "T1790316769318-1",
                  "symbol": "MTNN",
                  "name": "",
                  "side": "buy",
                  "quantity": 20,
                  "price_kobo": 25000,
                  "amount_kobo": 507500,
                  "amount_kobo_decimal": "507500",
                  "commission_kobo": 3750,
                  "commission_kobo_decimal": "3750",
                  "statutory_fees_kobo": 3000,
                  "statutory_fees_kobo_decimal": "3000",
                  "other_fees_kobo": 750,
                  "other_fees_kobo_decimal": "750",
                  "consideration_kobo": 500000,
                  "consideration_kobo_decimal": "500000",
                  "trade_date": "2026-09-25",
                  "transaction_date": "2026-09-25"
                }
              ]
            }
          }
        }
      },
      "error.account_blocked.account_money_blocked.feature_not_enabled.insufficient_scope.partner_closed.partner_money_paused.partner_suspended": {
        "description": "An error: `account_blocked`, `account_money_blocked`, `feature_not_enabled`, `insufficient_scope`, `partner_closed`, `partner_money_paused`, `partner_suspended`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "account_blocked": {
                "summary": "account_blocked",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "account_blocked",
                    "message": "This account is blocked: no new order or allocation is taken for it. Nothing was written and nothing was sent. Cancels, estimates and reads still work.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#account_blocked"
                  }
                }
              },
              "account_money_blocked": {
                "summary": "account_money_blocked",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "account_money_blocked",
                    "message": "New allocations to this account are blocked. Nothing was written and nothing was sent.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#account_money_blocked"
                  }
                }
              },
              "feature_not_enabled": {
                "summary": "feature_not_enabled",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "feature_not_enabled",
                    "message": "This feature is not enabled on this gateway. Sending the request again will not change the result. Contact us.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#feature_not_enabled"
                  }
                }
              },
              "insufficient_scope": {
                "summary": "insufficient_scope",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "insufficient_scope",
                    "message": "This API key does not have the scope this request requires. Nothing was done.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#insufficient_scope"
                  }
                }
              },
              "partner_closed": {
                "summary": "partner_closed",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "partner_closed",
                    "message": "This partner is closed. This request was refused before it was read.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#partner_closed"
                  }
                }
              },
              "partner_money_paused": {
                "summary": "partner_money_paused",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "partner_money_paused",
                    "message": "New allocations are paused for this partner. Nothing was written and nothing was sent.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#partner_money_paused"
                  }
                }
              },
              "partner_suspended": {
                "summary": "partner_suspended",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "partner_suspended",
                    "message": "This partner is suspended. This request was refused before it was read.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#partner_suspended"
                  }
                }
              }
            }
          }
        }
      },
      "error.account_blocked.account_trading_blocked.insufficient_scope.partner_closed.partner_suspended.partner_trading_paused.security_blocked.security_close_only": {
        "description": "An error: `account_blocked`, `account_trading_blocked`, `insufficient_scope`, `partner_closed`, `partner_suspended`, `partner_trading_paused`, `security_blocked`, `security_close_only`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "account_blocked": {
                "summary": "account_blocked",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "account_blocked",
                    "message": "This account is blocked: no new order or allocation is taken for it. Nothing was written and nothing was sent. Cancels, estimates and reads still work.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#account_blocked"
                  }
                }
              },
              "account_trading_blocked": {
                "summary": "account_trading_blocked",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "account_trading_blocked",
                    "message": "New orders on this account are blocked. Nothing was written and nothing was sent. Cancels, estimates and reads still work.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#account_trading_blocked"
                  }
                }
              },
              "insufficient_scope": {
                "summary": "insufficient_scope",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "insufficient_scope",
                    "message": "This API key does not have the scope this request requires. Nothing was done.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#insufficient_scope"
                  }
                }
              },
              "partner_closed": {
                "summary": "partner_closed",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "partner_closed",
                    "message": "This partner is closed. This request was refused before it was read.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#partner_closed"
                  }
                }
              },
              "partner_suspended": {
                "summary": "partner_suspended",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "partner_suspended",
                    "message": "This partner is suspended. This request was refused before it was read.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#partner_suspended"
                  }
                }
              },
              "partner_trading_paused": {
                "summary": "partner_trading_paused",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "partner_trading_paused",
                    "message": "New orders, applications and documents are paused for this partner. Nothing was written and nothing was sent. Cancels, estimates and reads still work.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#partner_trading_paused"
                  }
                }
              },
              "security_blocked": {
                "summary": "security_blocked",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "security_blocked",
                    "message": "New orders in this symbol are blocked. Nothing was written and nothing was sent. Cancels and reads still work.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#security_blocked"
                  }
                }
              },
              "security_close_only": {
                "summary": "security_close_only",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "security_close_only",
                    "message": "This symbol is close-only: we take sells and refuse buys. Nothing was written and nothing was sent. Cancels and reads still work.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#security_close_only"
                  }
                }
              }
            }
          }
        }
      },
      "error.account_not_at_broker": {
        "description": "An error: `account_not_at_broker`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "account_not_at_broker": {
                "summary": "account_not_at_broker",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "account_not_at_broker",
                    "message": "The broker does not recognise this account. No change is needed on your side. Contact us to resolve it.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#account_not_at_broker"
                  }
                }
              }
            }
          }
        }
      },
      "error.account_not_found": {
        "description": "An error: `account_not_found`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "account_not_found": {
                "summary": "account_not_found",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "account_not_found",
                    "message": "No such account.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#account_not_found"
                  }
                }
              }
            }
          }
        }
      },
      "error.allocation_not_found": {
        "description": "An error: `allocation_not_found`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "allocation_not_found": {
                "summary": "allocation_not_found",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "allocation_not_found",
                    "message": "No such allocation.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#allocation_not_found"
                  }
                }
              }
            }
          }
        }
      },
      "error.allocation_not_sent.exchange_unavailable.outcome_not_recorded.service_unavailable.trading_paused": {
        "description": "An error: `allocation_not_sent`, `exchange_unavailable`, `outcome_not_recorded`, `service_unavailable`, `trading_paused`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfterHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "allocation_not_sent": {
                "summary": "allocation_not_sent",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "allocation_not_sent",
                    "message": "The allocation was recorded but could not be sent. It never reached the broker.",
                    "allocation": "alc_4hn7vz2qe6wk3pma5rtd",
                    "doc_url": "https://docs.matambaintelligence.com/errors#allocation_not_sent"
                  }
                }
              },
              "exchange_unavailable": {
                "summary": "exchange_unavailable",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "exchange_unavailable",
                    "message": "The broker cannot be reached. Nothing was written and nothing was sent. Send the request again, with the same Idempotency-Key if it has one.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#exchange_unavailable"
                  }
                }
              },
              "outcome_not_recorded": {
                "summary": "outcome_not_recorded",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "outcome_not_recorded",
                    "message": "Your request reached us, and its outcome was not recorded.",
                    "allocation": "alc_4hn7vz2qe6wk3pma5rtd",
                    "doc_url": "https://docs.matambaintelligence.com/errors#outcome_not_recorded"
                  }
                }
              },
              "service_unavailable": {
                "summary": "service_unavailable",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "service_unavailable",
                    "message": "The gateway is temporarily unable to process this request. Send the same request again, with the same Idempotency-Key if it has one.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#service_unavailable"
                  }
                }
              },
              "trading_paused": {
                "summary": "trading_paused",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "trading_paused",
                    "message": "New orders, applications, documents and allocations are paused. Nothing was written and nothing was sent. Cancels, estimates and reads still work. Send it again after the Retry-After interval.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#trading_paused"
                  }
                }
              }
            }
          }
        }
      },
      "error.allocation_rejected.limit_exceeded.wallet_too_low": {
        "description": "An error: `allocation_rejected`, `limit_exceeded`, `wallet_too_low`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "allocation_rejected": {
                "summary": "allocation_rejected",
                "value": {
                  "error": {
                    "type": "wallet_error",
                    "code": "allocation_rejected",
                    "message": "The broker rejected this allocation. Its amount has been returned to the wallet.",
                    "reject_reason": "invalid_amount",
                    "allocation": "alc_4hn7vz2qe6wk3pma5rtd",
                    "doc_url": "https://docs.matambaintelligence.com/errors#allocation_rejected"
                  }
                }
              },
              "limit_exceeded": {
                "summary": "limit_exceeded",
                "value": {
                  "error": {
                    "type": "limit_error",
                    "code": "limit_exceeded",
                    "message": "This request would exceed your daily limit. Nothing was written and nothing was sent.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#limit_exceeded"
                  }
                }
              },
              "wallet_too_low": {
                "summary": "wallet_too_low",
                "value": {
                  "error": {
                    "type": "wallet_error",
                    "code": "wallet_too_low",
                    "message": "The wallet's available balance is less than this amount. Nothing was written and nothing was sent.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#wallet_too_low"
                  }
                }
              }
            }
          }
        }
      },
      "error.application_not_accepting_documents.document_already_delivered.document_in_flight.earlier_document_unconfirmed": {
        "description": "An error: `application_not_accepting_documents`, `document_already_delivered`, `document_in_flight`, `earlier_document_unconfirmed`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfterHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "application_not_accepting_documents": {
                "summary": "application_not_accepting_documents",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "application_not_accepting_documents",
                    "message": "This application does not take documents in its state. Nothing was sent.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#application_not_accepting_documents"
                  }
                }
              },
              "document_already_delivered": {
                "summary": "document_already_delivered",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "document_already_delivered",
                    "message": "A different file of this type is already delivered for this application. Nothing was sent.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#document_already_delivered"
                  }
                }
              },
              "document_in_flight": {
                "summary": "document_in_flight",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "document_in_flight",
                    "message": "An earlier request with this document is still in progress. Send it again shortly.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#document_in_flight"
                  }
                }
              },
              "earlier_document_unconfirmed": {
                "summary": "earlier_document_unconfirmed",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "earlier_document_unconfirmed",
                    "message": "Receipt of an earlier file of this type was not confirmed. Nothing was sent. Send that earlier file again.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#earlier_document_unconfirmed"
                  }
                }
              }
            }
          }
        }
      },
      "error.application_not_found": {
        "description": "An error: `application_not_found`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "application_not_found": {
                "summary": "application_not_found",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "application_not_found",
                    "message": "No such application.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#application_not_found"
                  }
                }
              }
            }
          }
        }
      },
      "error.application_not_sent.exchange_unavailable.outcome_not_recorded.service_unavailable.trading_paused": {
        "description": "An error: `application_not_sent`, `exchange_unavailable`, `outcome_not_recorded`, `service_unavailable`, `trading_paused`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfterHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "application_not_sent": {
                "summary": "application_not_sent",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "application_not_sent",
                    "message": "We could not take this application, and sent nothing.",
                    "application": "app_3rbw6yq2kd5mz7tcxf4n",
                    "doc_url": "https://docs.matambaintelligence.com/errors#application_not_sent"
                  }
                }
              },
              "exchange_unavailable": {
                "summary": "exchange_unavailable",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "exchange_unavailable",
                    "message": "The broker cannot be reached. Nothing was written and nothing was sent. Send the request again, with the same Idempotency-Key if it has one.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#exchange_unavailable"
                  }
                }
              },
              "outcome_not_recorded": {
                "summary": "outcome_not_recorded",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "outcome_not_recorded",
                    "message": "Your request reached us, and its outcome was not recorded.",
                    "application": "app_3rbw6yq2kd5mz7tcxf4n",
                    "doc_url": "https://docs.matambaintelligence.com/errors#outcome_not_recorded"
                  }
                }
              },
              "service_unavailable": {
                "summary": "service_unavailable",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "service_unavailable",
                    "message": "The gateway is temporarily unable to process this request. Send the same request again, with the same Idempotency-Key if it has one.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#service_unavailable"
                  }
                }
              },
              "trading_paused": {
                "summary": "trading_paused",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "trading_paused",
                    "message": "New orders, applications, documents and allocations are paused. Nothing was written and nothing was sent. Cancels, estimates and reads still work. Send it again after the Retry-After interval.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#trading_paused"
                  }
                }
              }
            }
          }
        }
      },
      "error.application_rejected.limit_exceeded.too_many_applications_in_progress": {
        "description": "An error: `application_rejected`, `limit_exceeded`, `too_many_applications_in_progress`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "application_rejected": {
                "summary": "application_rejected",
                "value": {
                  "error": {
                    "type": "application_error",
                    "code": "application_rejected",
                    "message": "The broker rejected this application. It is recorded as app_3rbw6yq2kd5mz7tcxf4n, rejected.",
                    "reject_reason": "rejected_by_broker",
                    "application": "app_3rbw6yq2kd5mz7tcxf4n",
                    "doc_url": "https://docs.matambaintelligence.com/errors#application_rejected"
                  }
                }
              },
              "limit_exceeded": {
                "summary": "limit_exceeded",
                "value": {
                  "error": {
                    "type": "limit_error",
                    "code": "limit_exceeded",
                    "message": "This request would exceed your daily limit. Nothing was written and nothing was sent.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#limit_exceeded"
                  }
                }
              },
              "too_many_applications_in_progress": {
                "summary": "too_many_applications_in_progress",
                "value": {
                  "error": {
                    "type": "limit_error",
                    "code": "too_many_applications_in_progress",
                    "message": "Your company has 100 applications in progress, the most it may have at once. Nothing was written and nothing was sent.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#too_many_applications_in_progress"
                  }
                }
              }
            }
          }
        }
      },
      "error.cancel_unconfirmed.exchange_unavailable.service_unavailable": {
        "description": "An error: `cancel_unconfirmed`, `exchange_unavailable`, `service_unavailable`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "cancel_unconfirmed": {
                "summary": "cancel_unconfirmed",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "cancel_unconfirmed",
                    "message": "Cancel unconfirmed: the broker did not confirm receipt of the cancel request. Send it again. Repeating a cancel request is safe.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#cancel_unconfirmed"
                  }
                }
              },
              "exchange_unavailable": {
                "summary": "exchange_unavailable",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "exchange_unavailable",
                    "message": "The broker cannot be reached. Nothing was written and nothing was sent. Send the request again, with the same Idempotency-Key if it has one.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#exchange_unavailable"
                  }
                }
              },
              "service_unavailable": {
                "summary": "service_unavailable",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "service_unavailable",
                    "message": "The gateway is temporarily unable to process this request. Send the same request again, with the same Idempotency-Key if it has one.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#service_unavailable"
                  }
                }
              }
            }
          }
        }
      },
      "error.document_rejected.invalid_document.too_many_applications_in_progress": {
        "description": "An error: `document_rejected`, `invalid_document`, `too_many_applications_in_progress`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "document_rejected": {
                "summary": "document_rejected",
                "value": {
                  "error": {
                    "type": "application_error",
                    "code": "document_rejected",
                    "message": "The broker refused this document. Nothing was delivered. Contact us.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#document_rejected"
                  }
                }
              },
              "invalid_document": {
                "summary": "invalid_document",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "invalid_document",
                    "message": "The file is not the image its Content-Type says, or is too large to show. Nothing was sent.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#invalid_document"
                  }
                }
              },
              "too_many_applications_in_progress": {
                "summary": "too_many_applications_in_progress",
                "value": {
                  "error": {
                    "type": "limit_error",
                    "code": "too_many_applications_in_progress",
                    "message": "Your company has 100 applications in progress, the most it may have at once. Nothing was written and nothing was sent.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#too_many_applications_in_progress"
                  }
                }
              }
            }
          }
        }
      },
      "error.document_too_large": {
        "description": "An error: `document_too_large`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "document_too_large": {
                "summary": "document_too_large",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "document_too_large",
                    "message": "The document is 1,000,000 bytes or more. Nothing was sent.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#document_too_large"
                  }
                }
              }
            }
          }
        }
      },
      "error.document_unconfirmed.exchange_unavailable.service_unavailable.trading_paused": {
        "description": "An error: `document_unconfirmed`, `exchange_unavailable`, `service_unavailable`, `trading_paused`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfterHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "document_unconfirmed": {
                "summary": "document_unconfirmed",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "document_unconfirmed",
                    "message": "Document unconfirmed: we could not confirm receipt of the document. Send the same file again. Sending the same file again is safe.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#document_unconfirmed"
                  }
                }
              },
              "exchange_unavailable": {
                "summary": "exchange_unavailable",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "exchange_unavailable",
                    "message": "The broker cannot be reached. Nothing was written and nothing was sent. Send the request again, with the same Idempotency-Key if it has one.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#exchange_unavailable"
                  }
                }
              },
              "service_unavailable": {
                "summary": "service_unavailable",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "service_unavailable",
                    "message": "The gateway is temporarily unable to process this request. Send the same request again, with the same Idempotency-Key if it has one.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#service_unavailable"
                  }
                }
              },
              "trading_paused": {
                "summary": "trading_paused",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "trading_paused",
                    "message": "New orders, applications, documents and allocations are paused. Nothing was written and nothing was sent. Cancels, estimates and reads still work. Send it again after the Retry-After interval.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#trading_paused"
                  }
                }
              }
            }
          }
        }
      },
      "error.duplicate_allocation.similar_allocation_unresolved": {
        "description": "An error: `duplicate_allocation`, `similar_allocation_unresolved`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "duplicate_allocation": {
                "summary": "duplicate_allocation",
                "value": {
                  "error": {
                    "type": "idempotency_error",
                    "code": "duplicate_allocation",
                    "message": "This Idempotency-Key already belongs to a different allocation.",
                    "allocation": "alc_4hn7vz2qe6wk3pma5rtd",
                    "doc_url": "https://docs.matambaintelligence.com/errors#duplicate_allocation"
                  }
                }
              },
              "similar_allocation_unresolved": {
                "summary": "similar_allocation_unresolved",
                "value": {
                  "error": {
                    "type": "wallet_error",
                    "code": "similar_allocation_unresolved",
                    "message": "An allocation to this account for this amount is not yet resolved.",
                    "allocation": "alc_4hn7vz2qe6wk3pma5rtd",
                    "doc_url": "https://docs.matambaintelligence.com/errors#similar_allocation_unresolved"
                  }
                }
              }
            }
          }
        }
      },
      "error.duplicate_application": {
        "description": "An error: `duplicate_application`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "duplicate_application": {
                "summary": "duplicate_application",
                "value": {
                  "error": {
                    "type": "idempotency_error",
                    "code": "duplicate_application",
                    "message": "This Idempotency-Key already belongs to a different application.",
                    "application": "app_3rbw6yq2kd5mz7tcxf4n",
                    "doc_url": "https://docs.matambaintelligence.com/errors#duplicate_application"
                  }
                }
              }
            }
          }
        }
      },
      "error.duplicate_order.similar_order_unresolved": {
        "description": "An error: `duplicate_order`, `similar_order_unresolved`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "duplicate_order": {
                "summary": "duplicate_order",
                "value": {
                  "error": {
                    "type": "idempotency_error",
                    "code": "duplicate_order",
                    "message": "This Idempotency-Key already belongs to a different order.",
                    "order": "ord_4vq7zk2m5xw3pn6rtd2a",
                    "doc_url": "https://docs.matambaintelligence.com/errors#duplicate_order"
                  }
                }
              },
              "similar_order_unresolved": {
                "summary": "similar_order_unresolved",
                "value": {
                  "error": {
                    "type": "order_error",
                    "code": "similar_order_unresolved",
                    "message": "An identical order on this account is not yet resolved.",
                    "order": "ord_4vq7zk2m5xw3pn6rtd2a",
                    "doc_url": "https://docs.matambaintelligence.com/errors#similar_order_unresolved"
                  }
                }
              }
            }
          }
        }
      },
      "error.exchange_error": {
        "description": "An error: `exchange_error`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "exchange_error": {
                "summary": "exchange_error",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "exchange_error",
                    "message": "The exchange returned a response the gateway cannot process. Nothing was changed. Sending the request again will not change the result. Contact us.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#exchange_error"
                  }
                }
              }
            }
          }
        }
      },
      "error.exchange_unavailable.order_not_sent.outcome_not_recorded.service_unavailable.trading_paused": {
        "description": "An error: `exchange_unavailable`, `order_not_sent`, `outcome_not_recorded`, `service_unavailable`, `trading_paused`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfterHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "exchange_unavailable": {
                "summary": "exchange_unavailable",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "exchange_unavailable",
                    "message": "The broker cannot be reached. Nothing was written and nothing was sent. Send the request again, with the same Idempotency-Key if it has one.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#exchange_unavailable"
                  }
                }
              },
              "order_not_sent": {
                "summary": "order_not_sent",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "order_not_sent",
                    "message": "The order was recorded but could not be sent. It never reached the exchange.",
                    "order": "ord_4vq7zk2m5xw3pn6rtd2a",
                    "doc_url": "https://docs.matambaintelligence.com/errors#order_not_sent"
                  }
                }
              },
              "outcome_not_recorded": {
                "summary": "outcome_not_recorded",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "outcome_not_recorded",
                    "message": "Your request reached us, and its outcome was not recorded.",
                    "order": "ord_4vq7zk2m5xw3pn6rtd2a",
                    "doc_url": "https://docs.matambaintelligence.com/errors#outcome_not_recorded"
                  }
                }
              },
              "service_unavailable": {
                "summary": "service_unavailable",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "service_unavailable",
                    "message": "The gateway is temporarily unable to process this request. Send the same request again, with the same Idempotency-Key if it has one.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#service_unavailable"
                  }
                }
              },
              "trading_paused": {
                "summary": "trading_paused",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "trading_paused",
                    "message": "New orders, applications, documents and allocations are paused. Nothing was written and nothing was sent. Cancels, estimates and reads still work. Send it again after the Retry-After interval.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#trading_paused"
                  }
                }
              }
            }
          }
        }
      },
      "error.exchange_unavailable.service_unavailable": {
        "description": "An error: `exchange_unavailable`, `service_unavailable`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "exchange_unavailable": {
                "summary": "exchange_unavailable",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "exchange_unavailable",
                    "message": "The broker cannot be reached. Nothing was written and nothing was sent. Send the request again, with the same Idempotency-Key if it has one.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#exchange_unavailable"
                  }
                }
              },
              "service_unavailable": {
                "summary": "service_unavailable",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "service_unavailable",
                    "message": "The gateway is temporarily unable to process this request. Send the same request again, with the same Idempotency-Key if it has one.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#service_unavailable"
                  }
                }
              }
            }
          }
        }
      },
      "error.exchange_unavailable.service_unavailable.settlement_lockout": {
        "description": "An error: `exchange_unavailable`, `service_unavailable`, `settlement_lockout`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfterHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "exchange_unavailable": {
                "summary": "exchange_unavailable",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "exchange_unavailable",
                    "message": "The broker cannot be reached. Nothing was written and nothing was sent. Send the request again, with the same Idempotency-Key if it has one.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#exchange_unavailable"
                  }
                }
              },
              "service_unavailable": {
                "summary": "service_unavailable",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "service_unavailable",
                    "message": "The gateway is temporarily unable to process this request. Send the same request again, with the same Idempotency-Key if it has one.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#service_unavailable"
                  }
                }
              },
              "settlement_lockout": {
                "summary": "settlement_lockout",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "settlement_lockout",
                    "message": "Temporarily unavailable: the broker is settling the day's trades. Send the request again after the Retry-After interval.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#settlement_lockout"
                  }
                }
              }
            }
          }
        }
      },
      "error.feature_not_enabled.insufficient_scope.partner_closed.partner_suspended.partner_trading_paused": {
        "description": "An error: `feature_not_enabled`, `insufficient_scope`, `partner_closed`, `partner_suspended`, `partner_trading_paused`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "feature_not_enabled": {
                "summary": "feature_not_enabled",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "feature_not_enabled",
                    "message": "This feature is not enabled on this gateway. Sending the request again will not change the result. Contact us.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#feature_not_enabled"
                  }
                }
              },
              "insufficient_scope": {
                "summary": "insufficient_scope",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "insufficient_scope",
                    "message": "This API key does not have the scope this request requires. Nothing was done.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#insufficient_scope"
                  }
                }
              },
              "partner_closed": {
                "summary": "partner_closed",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "partner_closed",
                    "message": "This partner is closed. This request was refused before it was read.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#partner_closed"
                  }
                }
              },
              "partner_suspended": {
                "summary": "partner_suspended",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "partner_suspended",
                    "message": "This partner is suspended. This request was refused before it was read.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#partner_suspended"
                  }
                }
              },
              "partner_trading_paused": {
                "summary": "partner_trading_paused",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "partner_trading_paused",
                    "message": "New orders, applications and documents are paused for this partner. Nothing was written and nothing was sent. Cancels, estimates and reads still work.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#partner_trading_paused"
                  }
                }
              }
            }
          }
        }
      },
      "error.insufficient_scope.partner_closed.partner_suspended": {
        "description": "An error: `insufficient_scope`, `partner_closed`, `partner_suspended`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "insufficient_scope": {
                "summary": "insufficient_scope",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "insufficient_scope",
                    "message": "This API key does not have the scope this request requires. Nothing was done.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#insufficient_scope"
                  }
                }
              },
              "partner_closed": {
                "summary": "partner_closed",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "partner_closed",
                    "message": "This partner is closed. This request was refused before it was read.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#partner_closed"
                  }
                }
              },
              "partner_suspended": {
                "summary": "partner_suspended",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "partner_suspended",
                    "message": "This partner is suspended. This request was refused before it was read.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#partner_suspended"
                  }
                }
              }
            }
          }
        }
      },
      "error.insufficient_scope.partner_closed.partner_suspended.security_blocked.security_close_only": {
        "description": "An error: `insufficient_scope`, `partner_closed`, `partner_suspended`, `security_blocked`, `security_close_only`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "insufficient_scope": {
                "summary": "insufficient_scope",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "insufficient_scope",
                    "message": "This API key does not have the scope this request requires. Nothing was done.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#insufficient_scope"
                  }
                }
              },
              "partner_closed": {
                "summary": "partner_closed",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "partner_closed",
                    "message": "This partner is closed. This request was refused before it was read.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#partner_closed"
                  }
                }
              },
              "partner_suspended": {
                "summary": "partner_suspended",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "partner_suspended",
                    "message": "This partner is suspended. This request was refused before it was read.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#partner_suspended"
                  }
                }
              },
              "security_blocked": {
                "summary": "security_blocked",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "security_blocked",
                    "message": "New orders in this symbol are blocked. Nothing was written and nothing was sent. Cancels and reads still work.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#security_blocked"
                  }
                }
              },
              "security_close_only": {
                "summary": "security_close_only",
                "value": {
                  "error": {
                    "type": "permission_error",
                    "code": "security_close_only",
                    "message": "This symbol is close-only: we take sells and refuse buys. Nothing was written and nothing was sent. Cancels and reads still work.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#security_close_only"
                  }
                }
              }
            }
          }
        }
      },
      "error.internal_error": {
        "description": "An error: `internal_error`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "internal_error": {
                "summary": "internal_error",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "internal_error",
                    "message": "The gateway encountered an internal error. Send the same request again, exactly as you sent it.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#internal_error"
                  }
                }
              }
            }
          }
        }
      },
      "error.invalid_request": {
        "description": "An error: `invalid_request`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "invalid_request": {
                "summary": "invalid_request",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "invalid_request",
                    "message": "The request could not be read.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#invalid_request"
                  }
                }
              }
            }
          }
        }
      },
      "error.invalid_request.missing_required_field": {
        "description": "An error: `invalid_request`, `missing_required_field`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "invalid_request": {
                "summary": "invalid_request",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "invalid_request",
                    "message": "The request could not be read.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#invalid_request"
                  }
                }
              },
              "missing_required_field": {
                "summary": "missing_required_field",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "missing_required_field",
                    "message": "A required field is missing.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#missing_required_field"
                  }
                }
              }
            }
          }
        }
      },
      "error.invalid_request.missing_required_field.unknown_account": {
        "description": "An error: `invalid_request`, `missing_required_field`, `unknown_account`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "invalid_request": {
                "summary": "invalid_request",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "invalid_request",
                    "message": "The request could not be read.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#invalid_request"
                  }
                }
              },
              "missing_required_field": {
                "summary": "missing_required_field",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "missing_required_field",
                    "message": "A required field is missing.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#missing_required_field"
                  }
                }
              },
              "unknown_account": {
                "summary": "unknown_account",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "unknown_account",
                    "message": "The account is not registered to you.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#unknown_account"
                  }
                }
              }
            }
          }
        }
      },
      "error.invalid_request.unknown_account": {
        "description": "An error: `invalid_request`, `unknown_account`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "invalid_request": {
                "summary": "invalid_request",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "invalid_request",
                    "message": "The request could not be read.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#invalid_request"
                  }
                }
              },
              "unknown_account": {
                "summary": "unknown_account",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "unknown_account",
                    "message": "The account is not registered to you.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#unknown_account"
                  }
                }
              }
            }
          }
        }
      },
      "error.limit_exceeded.order_rejected.unknown_symbol": {
        "description": "An error: `limit_exceeded`, `order_rejected`, `unknown_symbol`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "limit_exceeded": {
                "summary": "limit_exceeded",
                "value": {
                  "error": {
                    "type": "limit_error",
                    "code": "limit_exceeded",
                    "message": "This request would exceed your daily limit. Nothing was written and nothing was sent.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#limit_exceeded"
                  }
                }
              },
              "order_rejected": {
                "summary": "order_rejected",
                "value": {
                  "error": {
                    "type": "order_error",
                    "code": "order_rejected",
                    "message": "The broker or the exchange rejected this order.",
                    "reject_reason": "insufficient_funds",
                    "order": "ord_4vq7zk2m5xw3pn6rtd2a",
                    "doc_url": "https://docs.matambaintelligence.com/errors#order_rejected"
                  }
                }
              },
              "unknown_symbol": {
                "summary": "unknown_symbol",
                "value": {
                  "error": {
                    "type": "order_error",
                    "code": "unknown_symbol",
                    "message": "The broker does not list this symbol. Nothing was written and nothing was sent.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#unknown_symbol"
                  }
                }
              }
            }
          }
        }
      },
      "error.order_not_cancelable": {
        "description": "An error: `order_not_cancelable`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "order_not_cancelable": {
                "summary": "order_not_cancelable",
                "value": {
                  "error": {
                    "type": "order_error",
                    "code": "order_not_cancelable",
                    "message": "This order cannot be cancelled.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#order_not_cancelable"
                  }
                }
              }
            }
          }
        }
      },
      "error.order_not_found": {
        "description": "An error: `order_not_found`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "order_not_found": {
                "summary": "order_not_found",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "order_not_found",
                    "message": "No such order.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#order_not_found"
                  }
                }
              }
            }
          }
        }
      },
      "error.order_rejected": {
        "description": "An error: `order_rejected`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "order_rejected": {
                "summary": "order_rejected",
                "value": {
                  "error": {
                    "type": "order_error",
                    "code": "order_rejected",
                    "message": "The broker or the exchange rejected this order.",
                    "reject_reason": "insufficient_funds",
                    "order": "ord_4vq7zk2m5xw3pn6rtd2a",
                    "doc_url": "https://docs.matambaintelligence.com/errors#order_rejected"
                  }
                }
              }
            }
          }
        }
      },
      "error.rate_limited": {
        "description": "An error: `rate_limited`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfterHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "rate_limited": {
                "summary": "rate_limited",
                "value": {
                  "error": {
                    "type": "rate_limit_error",
                    "code": "rate_limited",
                    "message": "Too many requests. Nothing was done. Send the same request again after the Retry-After interval.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#rate_limited"
                  }
                }
              }
            }
          }
        }
      },
      "error.request_too_large": {
        "description": "An error: `request_too_large`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "request_too_large": {
                "summary": "request_too_large",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "request_too_large",
                    "message": "The request body exceeds the size limit.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#request_too_large"
                  }
                }
              }
            }
          }
        }
      },
      "error.service_unavailable": {
        "description": "An error: `service_unavailable`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "service_unavailable": {
                "summary": "service_unavailable",
                "value": {
                  "error": {
                    "type": "api_error",
                    "code": "service_unavailable",
                    "message": "The gateway is temporarily unable to process this request. Send the same request again, with the same Idempotency-Key if it has one.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#service_unavailable"
                  }
                }
              }
            }
          }
        }
      },
      "error.unauthorized": {
        "description": "An error: `unauthorized`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          },
          "WWW-Authenticate": {
            "$ref": "#/components/headers/WWWAuthenticateHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "unauthorized": {
                "summary": "unauthorized",
                "value": {
                  "error": {
                    "type": "authentication_error",
                    "code": "unauthorized",
                    "message": "Invalid credentials.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#unauthorized"
                  }
                }
              }
            }
          }
        }
      },
      "error.unsupported_media_type": {
        "description": "An error: `unsupported_media_type`.",
        "headers": {
          "x-request-id": {
            "$ref": "#/components/headers/RequestIdHeader"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/CacheControlHeader"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "unsupported_media_type": {
                "summary": "unsupported_media_type",
                "value": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "unsupported_media_type",
                    "message": "Content-Type must be application/json.",
                    "doc_url": "https://docs.matambaintelligence.com/errors#unsupported_media_type"
                  }
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "Document": {
        "type": "object",
        "description": "One document of an application, as we hold it. We keep the file sealed until we've sent it to the broker, and erase it once the account opens or the application ends. If we haven't asked the depository to open the account within 7 days of when you sent the application, or it becomes `uncertain` before we have, we erase it then.",
        "required": ["object", "application", "type", "state", "created_at", "updated_at"],
        "properties": {
          "object": {
            "type": "string",
            "const": "document"
          },
          "application": {
            "type": "string",
            "description": "The application's `id`.",
            "example": "app_3rbw6yq2kd5mz7tcxf4n"
          },
          "type": {
            "$ref": "#/components/schemas/DocumentType"
          },
          "state": {
            "title": "DocumentState",
            "type": "string",
            "enum": ["delivered"],
            "description": "`delivered`: we hold the file. We send it to the broker once the depository has opened the account. It doesn't mean anyone has verified it. New values can be added: handle an unrecognised value with a safe default."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the document was first sent, in UTC."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When its state last changed, in UTC."
          }
        }
      },
      "DocumentType": {
        "title": "DocumentType",
        "type": "string",
        "enum": ["photo", "government_id", "utility_bill", "signature"],
        "description": "`photo`: a passport photograph. `government_id`: a government-issued ID. `utility_bill`: a utility bill, for the address. `signature`: a specimen of the customer's signature. New values can be added: handle an unrecognised value with a safe default."
      },
      "Error": {
        "type": "object",
        "description": "The body of an error response.",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "object",
            "required": ["type", "code", "message", "doc_url"],
            "properties": {
              "type": {
                "title": "ErrorType",
                "type": "string",
                "description": "The category of the error. New values can be added: handle an unrecognised value with a safe default.",
                "enum": [
                  "authentication_error",
                  "invalid_request_error",
                  "idempotency_error",
                  "order_error",
                  "application_error",
                  "wallet_error",
                  "limit_error",
                  "rate_limit_error",
                  "permission_error",
                  "api_error"
                ]
              },
              "code": {
                "title": "ErrorCode",
                "type": "string",
                "description": "The error code. Use it in your logic; it doesn't change. New values can be added: handle an unrecognised value with a safe default.",
                "enum": [
                  "unauthorized",
                  "not_found",
                  "method_not_allowed",
                  "unsupported_media_type",
                  "request_too_large",
                  "invalid_request",
                  "missing_required_field",
                  "unknown_account",
                  "duplicate_order",
                  "order_not_found",
                  "account_not_found",
                  "exchange_unavailable",
                  "order_not_sent",
                  "order_rejected",
                  "similar_order_unresolved",
                  "order_not_cancelable",
                  "cancel_unconfirmed",
                  "settlement_lockout",
                  "account_not_at_broker",
                  "exchange_error",
                  "feature_not_enabled",
                  "insufficient_scope",
                  "application_rejected",
                  "duplicate_application",
                  "application_not_found",
                  "application_not_sent",
                  "wallet_too_low",
                  "allocation_rejected",
                  "duplicate_allocation",
                  "allocation_not_found",
                  "allocation_not_sent",
                  "similar_allocation_unresolved",
                  "rate_limited",
                  "unknown_symbol",
                  "limit_exceeded",
                  "too_many_keys",
                  "too_many_applications_in_progress",
                  "service_unavailable",
                  "internal_error",
                  "trading_paused",
                  "partner_trading_paused",
                  "partner_money_paused",
                  "partner_suspended",
                  "partner_closed",
                  "account_trading_blocked",
                  "account_money_blocked",
                  "account_blocked",
                  "security_close_only",
                  "security_blocked",
                  "outcome_not_recorded",
                  "document_too_large",
                  "invalid_document",
                  "application_not_accepting_documents",
                  "document_already_delivered",
                  "document_in_flight",
                  "earlier_document_unconfirmed",
                  "document_unconfirmed",
                  "document_rejected"
                ]
              },
              "message": {
                "type": "string",
                "description": "A human-readable description of the error, for your logs. The wording can change."
              },
              "param": {
                "type": "string",
                "description": "The field, parameter or header that caused the error. Absent when the error isn't tied to a single field."
              },
              "reject_reason": {
                "type": "string",
                "description": "Why it was rejected. Included with `order_rejected`, `application_rejected` and `allocation_rejected`, and takes the same values as the `reject_reason` field on the order, application or allocation."
              },
              "order": {
                "type": "string",
                "description": "The order the error is about, when it names one: the order that owns the `Idempotency-Key` for `duplicate_order`, the unresolved order for `similar_order_unresolved`, the order recorded for `order_rejected` and `order_not_sent`, and the order your request made for `outcome_not_recorded`.",
                "pattern": "^ord_[a-z2-7]{20}$"
              },
              "application": {
                "type": "string",
                "description": "The application the error is about, when it names one: the one that owns the key for `duplicate_application`, the one recorded for `application_rejected` and `application_not_sent`, and the one your request made for `outcome_not_recorded`.",
                "pattern": "^app_[a-z2-7]{20}$"
              },
              "allocation": {
                "type": "string",
                "description": "The allocation the error is about, when it names one: the one that owns the key for `duplicate_allocation`, the unresolved one for `similar_allocation_unresolved`, the one recorded for `allocation_rejected`, `allocation_not_sent` and `feature_not_enabled`, and the one your request made for `outcome_not_recorded`.",
                "pattern": "^alc_[a-z2-7]{20}$"
              },
              "doc_url": {
                "type": "string",
                "format": "uri",
                "description": "A link to the documentation for this error code."
              }
            },
            "description": "What went wrong, and the code to act on."
          }
        }
      },
      "AccountCode": {
        "type": "string",
        "pattern": "^[A-Za-z0-9]{1,64}$",
        "description": "An account code. Case-insensitive on input, and returned in uppercase."
      },
      "Account": {
        "type": "object",
        "description": "One account this API key can trade for.",
        "required": ["object", "code", "application", "created_at", "restrictions"],
        "properties": {
          "object": {
            "type": "string",
            "const": "account"
          },
          "code": {
            "type": "string",
            "description": "The code to pass as `account` in an order or allocation."
          },
          "application": {
            "type": ["string", "null"],
            "description": "The application that opened the account, when you opened it through the API. Null when we added the account for you.",
            "pattern": "^app_[a-z2-7]{20}$"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the account became yours to trade for through the API."
          },
          "restrictions": {
            "$ref": "#/components/schemas/AccountControls"
          }
        }
      },
      "AccountControls": {
        "type": "object",
        "description": "The controls on the account as they stand now. The `account.restriction_changed` event tells you each time one changes.",
        "required": [
          "trading_blocked",
          "money_blocked",
          "blocked",
          "since",
          "trading_blocked_at",
          "money_blocked_at",
          "blocked_at",
          "trading_blocked_reason",
          "money_blocked_reason",
          "blocked_reason"
        ],
        "properties": {
          "trading_blocked": {
            "type": "boolean",
            "description": "New orders on this account are refused with `403 account_trading_blocked`."
          },
          "money_blocked": {
            "type": "boolean",
            "description": "New allocations to this account are refused with `403 account_money_blocked`."
          },
          "blocked": {
            "type": "boolean",
            "description": "New orders and allocations for this account are refused with `403 account_blocked`."
          },
          "since": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When the most severe control that's on was set: the block, or else the earlier of the other two. `null` while none is on."
          },
          "trading_blocked_at": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When we blocked new orders on this account; `null` while it's off."
          },
          "money_blocked_at": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When we blocked new allocations to this account; `null` while it's off."
          },
          "blocked_at": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When we blocked this account; `null` while it's off."
          },
          "trading_blocked_reason": {
            "type": ["string", "null"],
            "description": "Why we blocked new orders on this account, in our words, while it's on; `null` while it's off. Never a person's name."
          },
          "money_blocked_reason": {
            "type": ["string", "null"],
            "description": "Why we blocked new allocations to this account, in our words, while it's on; `null` while it's off. Never a person's name."
          },
          "blocked_reason": {
            "type": ["string", "null"],
            "description": "Why we blocked this account, in our words, while it's on; `null` while it's off. Never a person's name."
          }
        }
      },
      "AccountList": {
        "type": "object",
        "description": "A page of your accounts, in order of account code.",
        "required": ["object", "has_more", "next_cursor", "data"],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether more accounts follow this page."
          },
          "next_cursor": {
            "type": ["string", "null"],
            "description": "Pass this as `cursor` to get the next page. Null on the last page."
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Account"
            },
            "description": "The accounts on this page."
          }
        }
      },
      "OrderRequest": {
        "type": "object",
        "description": "Send numbers as JSON numbers, not quoted strings. We reject unknown fields and any field that appears twice, even with different letter case.",
        "required": ["account", "symbol", "side", "quantity", "type", "time_in_force"],
        "additionalProperties": false,
        "properties": {
          "account": {
            "$ref": "#/components/schemas/AccountCode"
          },
          "symbol": {
            "type": "string",
            "pattern": "^[A-Za-z0-9.-]{1,20}$",
            "description": "The exchange's symbol, treated as uppercase. The exchange decides whether the symbol exists."
          },
          "side": {
            "$ref": "#/components/schemas/OrderSide",
            "description": "`buy` or `sell`."
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 100000000,
            "description": "The number of shares, as a whole number. At least 1. The broker doesn't publish a minimum of its own. If the broker refuses a quantity, the order comes back `order_rejected` with `reject_reason` `rejected_by_exchange`."
          },
          "type": {
            "$ref": "#/components/schemas/OrderType",
            "description": "An ETF takes limit orders only. Shares take limit and market orders. The broker rejects a market order on an ETF with `reject_reason` set to `etf_limit_orders_only`. A market order is priced at the day's price limit: the upper limit for a buy, the lower limit for a sell."
          },
          "time_in_force": {
            "$ref": "#/components/schemas/TimeInForce",
            "description": "`day`: good for the current trading session only. `gtc`: good till cancelled. `ioc`: immediate or cancel. `fok`: fill or kill. We accept every `type` with every `time_in_force`. The broker decides which combinations it supports, and rejects the rest as `order_rejected` with a `reject_reason`. If it refuses an order with a reason it doesn't publish, the order is `uncertain` until our operations team reconciles it."
          },
          "price_kobo": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 1000000000,
            "description": "The limit price in kobo, so ₦475.00 is 47500. Required for a limit order. Omit it for a market order."
          },
          "client_reference": {
            "$ref": "#/components/schemas/ClientReference"
          }
        }
      },
      "ClientReference": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "pattern": "^[!-~]{1,64}$",
        "description": "Your own reference for this, such as your internal ID, so you can find it again. 1 to 64 printable ASCII characters, with no spaces, matched exactly. We store it and return it. It's part of the request an `Idempotency-Key` stands for, so a retry with a different `client_reference` returns `409`. Never put personal data in it: no names, phone numbers, email addresses, BVN, NIN or account numbers of your customers.",
        "example": "ord-88213"
      },
      "OrderState": {
        "type": "string",
        "description": "`sending`: stored, and the send is in progress. If it still reads `sending` after its request has ended, its outcome was not recorded: it resolves as an `uncertain` order does, and an identical order is refused with `409 similar_order_unresolved` until then. `pending`: the exchange has the order. `partially_filled`, `filled`: some or all of the order has traded. `uncertain`: the exchange did not confirm receipt. The gateway does not resubmit it, and our operations team reconciles it against the exchange's records. Until it resolves, an identical order on the same account is refused with `409 similar_order_unresolved`. `rejected`: the broker or the exchange rejected it; see `reject_reason`. `refused`: it never reached the exchange: we refused it before sending, or our operations team confirmed the exchange never received it. `cancelled`: the exchange confirmed the cancel. `expired`: its time in force ran out. New values can be added: handle an unrecognised value with a safe default.",
        "enum": [
          "sending",
          "pending",
          "partially_filled",
          "filled",
          "uncertain",
          "rejected",
          "refused",
          "cancelled",
          "expired"
        ]
      },
      "OrderSide": {
        "type": "string",
        "enum": ["buy", "sell"],
        "description": "The side of an order: `buy` or `sell`. New values can be added: handle an unrecognised value with a safe default."
      },
      "OrderType": {
        "type": "string",
        "enum": ["limit", "market"],
        "description": "The type of an order: `limit` or `market`. New values can be added: handle an unrecognised value with a safe default."
      },
      "TimeInForce": {
        "type": "string",
        "enum": ["day", "gtc", "ioc", "fok"],
        "description": "How long an order stays open. `day`: good for the current trading session only. `gtc`: good till cancelled. `ioc`: immediate or cancel. `fok`: fill or kill. New values can be added: handle an unrecognised value with a safe default."
      },
      "Order": {
        "type": "object",
        "required": [
          "object",
          "id",
          "state",
          "account",
          "symbol",
          "side",
          "quantity",
          "type",
          "time_in_force",
          "price_kobo",
          "filled_quantity",
          "exchange_order_id",
          "reason",
          "reject_reason",
          "created_at",
          "updated_at",
          "filled_at",
          "average_fill_price_kobo_decimal",
          "client_reference"
        ],
        "description": "Fees are not on the order. The broker fixes them only on the contract note, so see `GET /v1/accounts/{account}/contract-notes` for what an order cost.",
        "properties": {
          "object": {
            "type": "string",
            "const": "order"
          },
          "id": {
            "type": "string",
            "description": "Unique identifier for the order. Starts with `ord_`.",
            "pattern": "^ord_[a-z2-7]{20}$"
          },
          "state": {
            "$ref": "#/components/schemas/OrderState"
          },
          "account": {
            "type": "string",
            "description": "The account code, in uppercase."
          },
          "symbol": {
            "type": "string",
            "description": "The symbol, in uppercase."
          },
          "side": {
            "$ref": "#/components/schemas/OrderSide",
            "description": "`buy` or `sell`. New values can be added: handle an unrecognised value with a safe default."
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "The number of shares ordered."
          },
          "type": {
            "$ref": "#/components/schemas/OrderType",
            "description": "`limit` or `market`. New values can be added: handle an unrecognised value with a safe default."
          },
          "time_in_force": {
            "$ref": "#/components/schemas/TimeInForce",
            "description": "How long the order stays open, as sent. New values can be added: handle an unrecognised value with a safe default."
          },
          "price_kobo": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "The limit price in kobo. Null for a market order."
          },
          "filled_quantity": {
            "type": "integer",
            "format": "int64",
            "description": "The total number of shares traded so far."
          },
          "exchange_order_id": {
            "type": ["string", "null"],
            "description": "The exchange's identifier for the order, once it has one."
          },
          "reason": {
            "type": ["string", "null"],
            "description": "A sentence explaining the order's current state. It's for people to read, so don't use it in your logic."
          },
          "reject_reason": {
            "title": "OrderRejectReason",
            "type": ["string", "null"],
            "description": "Why the broker or the exchange rejected the order. Set only when `state` is `rejected`. New values can be added: handle an unrecognised value with a safe default.",
            "enum": [
              "insufficient_funds",
              "market_closed",
              "settlement_lockout",
              "etf_limit_orders_only",
              "limit_orders_etf_only",
              "unknown_symbol",
              "symbol_not_tradable",
              "account_not_at_broker",
              "rejected_by_exchange",
              null
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "In UTC, to the second."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "In UTC, to the second."
          },
          "filled_at": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When we recorded the order as `filled`, in UTC, to the second. We check the broker about every 30 seconds, so this can be later than the fill at the exchange. The exchange's own times are on trades. Null until the order is filled."
          },
          "average_fill_price_kobo_decimal": {
            "type": ["string", "null"],
            "pattern": "^[0-9]+(\\.[0-9]{1,12})?$",
            "description": "The average price the filled shares traded at, in kobo, as a decimal string, before charges. It's exact when it has 12 decimal places or fewer, and otherwise rounded to 12. Null until a share has traded, or when we don't have the exchange's prices for the fills.",
            "example": "47512.5"
          },
          "client_reference": {
            "type": ["string", "null"],
            "description": "Your own reference, as you sent it. Null if you didn't send one."
          }
        }
      },
      "OrderList": {
        "type": "object",
        "description": "A page of your orders.",
        "required": ["object", "has_more", "next_cursor", "data"],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether more orders follow this page."
          },
          "next_cursor": {
            "type": ["string", "null"],
            "description": "Pass this as `cursor` to get the next page. Null on the last page."
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Order"
            },
            "description": "The orders on this page."
          }
        }
      },
      "OrderEstimate": {
        "type": "object",
        "description": "The broker's estimate for an order. An estimate doesn't place or store anything.",
        "required": [
          "object",
          "account",
          "symbol",
          "side",
          "quantity",
          "type",
          "time_in_force",
          "price_kobo",
          "estimated_total_kobo",
          "estimated_total_kobo_decimal"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "order_estimate"
          },
          "account": {
            "type": "string",
            "description": "The account code, in uppercase."
          },
          "symbol": {
            "type": "string",
            "description": "The symbol, in uppercase."
          },
          "side": {
            "$ref": "#/components/schemas/OrderSide",
            "description": "`buy` or `sell`, as sent. New values can be added: handle an unrecognised value with a safe default."
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "The number of shares, as sent."
          },
          "type": {
            "$ref": "#/components/schemas/OrderType",
            "description": "`limit` or `market`, as sent. New values can be added: handle an unrecognised value with a safe default."
          },
          "time_in_force": {
            "$ref": "#/components/schemas/TimeInForce",
            "description": "As sent. New values can be added: handle an unrecognised value with a safe default."
          },
          "price_kobo": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "The limit price in kobo. Null for a market order."
          },
          "estimated_total_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "The broker's estimate of the order's total, rounded to the whole kobo against the customer. For a buy, what the order would cost, rounded up. For a sell, what you'd receive, rounded down. In the sandbox, a buy includes 1.5% charges and a sell is net of them. The estimate is indicative, not a quote."
          },
          "estimated_total_kobo_decimal": {
            "type": "string",
            "description": "The broker's estimate of the order's total, in kobo, as an exact decimal string, because the broker's charges can include fractions of a kobo. `estimated_total_kobo` is this figure rounded up for a buy and down for a sell.",
            "example": "59831.63125"
          }
        }
      },
      "Event": {
        "type": "object",
        "description": "One change to one of your orders, applications or allocations, or to your accounts' or your partner account's controls. A webhook carries the same body.",
        "required": ["object", "id", "type", "timestamp", "version", "data"],
        "properties": {
          "object": {
            "type": "string",
            "const": "event"
          },
          "id": {
            "type": "string",
            "description": "Unique identifier for the event. Starts with `msg_`. Matches the `webhook-id` header the event was sent with.",
            "pattern": "^msg_[0-9a-f]{24}$"
          },
          "type": {
            "title": "EventType",
            "type": "string",
            "description": "What changed, followed by the state the change moved it to. New types can appear: ignore any you don't handle.",
            "enum": [
              "account.restriction_changed",
              "allocation.booked",
              "allocation.refused",
              "allocation.rejected",
              "allocation.uncertain",
              "application.documents_required",
              "application.opened",
              "application.refused",
              "application.rejected",
              "application.submitted",
              "application.uncertain",
              "application.unplaced",
              "order.cancelled",
              "order.expired",
              "order.filled",
              "order.partially_filled",
              "order.pending",
              "order.refused",
              "order.rejected",
              "order.uncertain",
              "partner.status_changed",
              "security.restriction_changed"
            ]
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "The `updated_at` of the order, application or allocation, or when we changed the controls."
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "description": "Increases with each of your events and is never reused. Other partners' events never move it. Compare it per object: ignore an event whose `version` is lower than the last you applied to that object."
          },
          "data": {
            "description": "The order, application or allocation as the change left it, exactly as its `GET` returned it then; or, for `account.restriction_changed`, `partner.status_changed` and `security.restriction_changed`, the controls as the change left them. Its `object` field says which.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/Order"
              },
              {
                "$ref": "#/components/schemas/Application"
              },
              {
                "$ref": "#/components/schemas/Allocation"
              },
              {
                "$ref": "#/components/schemas/AccountRestrictions"
              },
              {
                "$ref": "#/components/schemas/PartnerStatus"
              },
              {
                "$ref": "#/components/schemas/SecurityRestriction"
              }
            ]
          }
        }
      },
      "EventList": {
        "type": "object",
        "description": "A page of your events.",
        "required": ["object", "has_more", "next_cursor", "data"],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether more events follow this page."
          },
          "next_cursor": {
            "type": ["string", "null"],
            "description": "Pass this as `cursor` to get later events. An empty page returns the same cursor you sent. Null only when your first request returns no events."
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Event"
            },
            "description": "The events on this page."
          }
        }
      },
      "ApplicationRequest": {
        "type": "object",
        "description": "We check that every required field is there; that each field is at most 200 characters, trimmed at both ends, with no control or invisible characters; that each name (`first_name`, `middle_name`, `last_name`, `mothers_maiden_name`, `next_of_kin_name` and `bank_account_name`) is Latin letters, with or without accents, and a single space, a hyphen, an apostrophe or a full stop between words, within its own `maxLength`; that dates are real dates on or after 1900-01-01 and not in the future; that the customer is 18 or older today in West Africa Time (WAT); that `gender` is `M` or `F`; that `bvn` and `nin` are 11 digits; that `bank_account_number` is 10 digits; that `email` is an address, as a browser's email field takes one, with a dot in its domain, and at most 40 characters; that `state`, `state_of_origin`, `lga_of_origin` and `bank` are shaped like the codes in the reference lists; and that `bank` isn't a bank whose licence the CBN revoked. Before the depository is asked, a `state`, `state_of_origin` or `lga_of_origin` the broker's lists don't hold ends the application `rejected`, with `reject_reason` `invalid_field` and `param` naming it, and a `bank` the depository doesn't take ends it `rejected`, with `reject_reason` `declined_by_depository` and `param` `bank`. The broker checks everything else when we add the account to it, after the depository has opened it: a field it can't accept ends the application `rejected`, with `reject_reason` `rejected_by_broker`. We reject unknown fields and any field that appears twice, even with different letter case.",
        "required": [
          "first_name",
          "last_name",
          "gender",
          "date_of_birth",
          "email",
          "phone",
          "mothers_maiden_name",
          "street",
          "city",
          "state",
          "postcode",
          "state_of_origin",
          "lga_of_origin",
          "next_of_kin_name",
          "next_of_kin_phone",
          "bank",
          "bank_account_name",
          "bank_account_number",
          "bank_account_opened",
          "bvn"
        ],
        "additionalProperties": false,
        "properties": {
          "first_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "description": "The customer's first name, written as a name: Latin letters, with or without accents, and a single space, a hyphen, an apostrophe or a full stop between words."
          },
          "middle_name": {
            "type": "string",
            "maxLength": 100,
            "description": "The customer's middle name, or names, if they have one, written as `first_name` is. Our identity checks don't compare it."
          },
          "last_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "description": "The customer's last name, written as `first_name` is."
          },
          "gender": {
            "title": "Gender",
            "type": "string",
            "enum": ["M", "F"],
            "description": "`M` or `F`."
          },
          "date_of_birth": {
            "type": "string",
            "format": "date",
            "description": "Must be on or after 1900-01-01, and the customer must be 18 or older today in West Africa Time (WAT): we refuse a minor with `400 invalid_request`, `param` set to `date_of_birth`."
          },
          "email": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40,
            "description": "The customer's email address, as a browser's email field takes one: one `@`, no spaces, at most 64 characters before the `@`, and a dot in the domain. At most 40 characters, the most the depository (CSCS) takes: a longer one is refused with `400 invalid_request`, `param` set to `email`. In the sandbox, use a new value for each application: the sandbox's broker refuses one it has already accepted, from any partner."
          },
          "phone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^(\\+234|0)[0-9]{10}$",
            "description": "The customer's phone number: a Nigerian number, `0` and 10 digits, or `+234` and the same 10 digits. We send it to the broker as `0` and 10 digits, which the broker asks for."
          },
          "mothers_maiden_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "description": "The customer's mother's maiden name, written as `first_name` is. The broker's document marks it optional, but the broker refuses an application without one, so we require it."
          },
          "street": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The street of the customer's home address."
          },
          "city": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The city of the customer's home address."
          },
          "state": {
            "type": "string",
            "pattern": "^[A-Za-z0-9-]{1,32}$",
            "description": "A code from GET /v1/reference/states."
          },
          "postcode": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The postcode of the customer's home address."
          },
          "state_of_origin": {
            "type": "string",
            "pattern": "^[A-Za-z0-9-]{1,32}$",
            "description": "A code from GET /v1/reference/states."
          },
          "lga_of_origin": {
            "type": "string",
            "pattern": "^[A-Za-z0-9-]{1,32}$",
            "description": "A code from GET /v1/reference/states/{state}/lgas."
          },
          "next_of_kin_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "The name of the customer's next of kin, written as `first_name` is."
          },
          "next_of_kin_phone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^(\\+234|0)[0-9]{10}$",
            "description": "The phone number of the customer's next of kin, written as `phone` is."
          },
          "next_of_kin_relationship": {
            "type": "string",
            "maxLength": 200,
            "description": "How the next of kin is related to the customer."
          },
          "next_of_kin_address": {
            "type": "string",
            "maxLength": 200,
            "description": "The address of the customer's next of kin."
          },
          "bank": {
            "type": "string",
            "pattern": "^[A-Za-z0-9-]{1,32}$",
            "description": "A code from GET /v1/reference/banks. A bank whose licence the CBN revoked, such as Heritage Bank, is refused with `400 invalid_request`: its accounts are closed."
          },
          "bank_account_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "The name on the customer's bank account at `bank`, written as `first_name` is. We don't compare it: we check the bank's own name for the account."
          },
          "bank_account_number": {
            "type": "string",
            "pattern": "^[0-9]{10}$",
            "description": "The customer's account number at `bank`: their NUBAN, 10 digits. We check that the bank holds it in the customer's own name."
          },
          "bank_account_opened": {
            "type": "string",
            "format": "date",
            "description": "Can't be before `date_of_birth` or after today in West Africa Time (WAT)."
          },
          "bvn": {
            "type": "string",
            "pattern": "^[0-9]{11}$",
            "description": "The customer's Bank Verification Number: 11 digits. We check it at the identity registry: the first and last names and the date of birth must match its record. In the sandbox, use one of the [test identities](/sandbox#test-identities)."
          },
          "nin": {
            "type": "string",
            "pattern": "^[0-9]{11}$",
            "description": "The customer's National Identification Number: 11 digits. When you send it, we check it as we check `bvn`."
          },
          "tax_id": {
            "type": "string",
            "maxLength": 200,
            "description": "The customer's tax identification number."
          },
          "chn": {
            "type": "string",
            "maxLength": 200,
            "description": "The customer's existing CHN (Clearing House Number), from any broker, if they have one. We open the account under it, so the customer keeps one CHN. Letters and digits, 6 to 20 of them: we remove spaces and read letters as upper case. We take it only where we've enabled it for your company. Otherwise, and for a CHN of any other form, we refuse the application with `400 invalid_request`, `param` set to `chn`."
          },
          "client_reference": {
            "$ref": "#/components/schemas/ClientReference"
          }
        }
      },
      "Application": {
        "type": "object",
        "description": "An application to open a brokerage account for your customer.",
        "required": [
          "object",
          "id",
          "state",
          "reference",
          "account",
          "reason",
          "reject_reason",
          "param",
          "created_at",
          "updated_at",
          "client_reference"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "application"
          },
          "id": {
            "type": "string",
            "description": "Unique identifier for the application. Starts with `app_`.",
            "pattern": "^app_[a-z2-7]{20}$"
          },
          "state": {
            "title": "ApplicationState",
            "type": "string",
            "description": "`sending`: being stored, while your request is in progress. If it still reads `sending` after its request has ended, its outcome was not recorded, and our operations team reconciles it. `documents_required`: we have it, and need the customer's four documents. `submitted`: we have its four documents, and are checking the customer's identity and opening the account. `opened`: `account` is the new account, and you can trade for it. `uncertain`: we couldn't read an answer from a registry, the depository or the broker, or couldn't confirm a step, or we hadn't asked the depository to open the account within 7 days of when you sent it, or another answer needs a person; `reason` says which. Our operations team settles it: it becomes `submitted` again, and opens or ends as any other application does, or it ends `unplaced`. One that becomes `uncertain` before we've asked the depository can only end `unplaced`. `rejected`: see `reject_reason` and `param`. `refused`: we couldn't take it, and sent nothing. `unplaced`: our operations team found that no account was opened for it. You can send it again under a new key. New values can be added: handle an unrecognised value with a safe default.",
            "enum": [
              "sending",
              "documents_required",
              "submitted",
              "opened",
              "uncertain",
              "rejected",
              "refused",
              "unplaced"
            ]
          },
          "reference": {
            "type": ["string", "null"],
            "description": "Our reference for the account at the broker, once we've added the account to the broker. `null` until then."
          },
          "account": {
            "type": ["string", "null"],
            "description": "The account code, once the account is opened."
          },
          "reason": {
            "type": ["string", "null"],
            "description": "A sentence explaining the application's current state. It's for people to read, so don't use it in your logic."
          },
          "reject_reason": {
            "title": "ApplicationRejectReason",
            "type": ["string", "null"],
            "description": "Why the application was rejected. Set only when `state` is `rejected`. New values can be added: handle an unrecognised value with a safe default.",
            "enum": [
              "invalid_field",
              "already_at_broker",
              "rejected_by_broker",
              "declined_by_broker",
              "identity_mismatch",
              "bank_account_mismatch",
              "identity_unverified",
              "declined_by_depository",
              null
            ]
          },
          "param": {
            "type": ["string", "null"],
            "description": "The field that caused the rejection, when the rejection names one. Never includes the field's value."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When we recorded the application."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the application last changed state."
          },
          "client_reference": {
            "type": ["string", "null"],
            "description": "Your own reference, as you sent it. Null if you didn't send one."
          }
        }
      },
      "ApplicationList": {
        "type": "object",
        "description": "A page of your applications, newest first.",
        "required": ["object", "has_more", "next_cursor", "data"],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether more applications follow this page."
          },
          "next_cursor": {
            "type": ["string", "null"],
            "description": "Pass this as `cursor` to get the next page. Null on the last page."
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Application"
            },
            "description": "The applications on this page."
          }
        }
      },
      "WalletTransfer": {
        "type": "object",
        "description": "One entry in your wallet's ledger.",
        "required": [
          "object",
          "id",
          "type",
          "amount_kobo",
          "available_change_kobo",
          "allocation",
          "account",
          "bank_reference",
          "withdrawal",
          "created_at"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "wallet_transfer"
          },
          "id": {
            "type": "string",
            "description": "Unique identifier for the entry. Starts with `wtr_`. Later entries have higher numbers. Your ledger is numbered on its own: other partners' entries never move it.",
            "pattern": "^wtr_[1-9][0-9]*$"
          },
          "type": {
            "title": "WalletTransferType",
            "type": "string",
            "description": "`credit`: a payment of yours we confirmed. `reserve`: an allocation set aside while we send it. `post`: the broker booked the allocation into the account's balance. `void`: the allocation didn't book, and its amount is returned to your wallet. `withdrawal_held`: we recorded your withdrawal and set its amount aside. `withdrawal_paid`: we paid it to your payout account. `withdrawal_released`: it was cancelled, expired or failed before it was paid, and its amount is returned to your wallet. `withdrawal_returned`: your bank sent a paid withdrawal back, and its amount is returned to your wallet. New values can be added: handle an unrecognised value with a safe default.",
            "enum": [
              "credit",
              "reserve",
              "post",
              "void",
              "withdrawal_held",
              "withdrawal_paid",
              "withdrawal_released",
              "withdrawal_returned"
            ]
          },
          "amount_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "The amount that moved. Always positive."
          },
          "available_change_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "What the entry did to `available_kobo`: positive for a credit, a void, and a released or returned withdrawal; negative for a reserve and a held withdrawal; zero for a post and a paid withdrawal, which move money already set aside."
          },
          "allocation": {
            "type": ["string", "null"],
            "description": "The allocation the entry belongs to: set on `reserve`, `post` and `void`. Null for the other types.",
            "pattern": "^alc_[a-z2-7]{20}$"
          },
          "account": {
            "type": ["string", "null"],
            "description": "The account a post booked into. Null for the other types."
          },
          "bank_reference": {
            "type": ["string", "null"],
            "description": "The bank's own reference for the payment a credit records: for an instant transfer, its session ID. Different for every payment, in uppercase letters and digits. Null for the other types."
          },
          "withdrawal": {
            "type": ["string", "null"],
            "description": "The withdrawal the entry belongs to, as your partner portal shows it: set on the four `withdrawal_` types. Null for the other types.",
            "pattern": "^wdr_[a-z2-7]{20}$"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When we wrote the entry."
          }
        }
      },
      "WalletTransferList": {
        "type": "object",
        "description": "A page of the entries in your wallet's ledger, newest first.",
        "required": ["object", "has_more", "next_cursor", "data"],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether more entries follow this page."
          },
          "next_cursor": {
            "type": ["string", "null"],
            "description": "Pass this as `cursor` to get the next page. Null on the last page."
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WalletTransfer"
            },
            "description": "The entries on this page."
          }
        }
      },
      "Wallet": {
        "type": "object",
        "description": "Every figure is a sum of your wallet's ledger, read at one moment. `available_kobo` is always `credited_kobo` minus `allocated_kobo`, `reserved_kobo`, `withdrawing_kobo` and `withdrawn_kobo`.",
        "required": [
          "object",
          "credited_kobo",
          "allocated_kobo",
          "reserved_kobo",
          "withdrawing_kobo",
          "withdrawn_kobo",
          "available_kobo"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "wallet"
          },
          "credited_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "The total credited by your confirmed payments."
          },
          "allocated_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "The amount booked into your accounts at the broker."
          },
          "reserved_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "The amount in allocations we've sent that aren't yet confirmed as booked."
          },
          "withdrawing_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "The amount set aside for withdrawals we've recorded and not yet paid."
          },
          "withdrawn_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "The amount paid out to your payout account, less any your bank sent back."
          },
          "available_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "The amount you can allocate or withdraw now."
          }
        }
      },
      "AllocationRequest": {
        "type": "object",
        "description": "We reject unknown fields and any field that appears twice, even with different letter case.",
        "required": ["account", "amount_kobo"],
        "additionalProperties": false,
        "properties": {
          "account": {
            "$ref": "#/components/schemas/AccountCode"
          },
          "amount_kobo": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 10000000000,
            "description": "The amount in kobo, as a whole number: at least 1 kobo, and at most ₦100,000,000. The broker doesn't publish a minimum of its own. If the broker refuses an amount, the allocation comes back `allocation_rejected` with `reject_reason` `invalid_amount`."
          },
          "client_reference": {
            "$ref": "#/components/schemas/ClientReference"
          }
        }
      },
      "Allocation": {
        "type": "object",
        "description": "Money from your wallet to one of your customers' accounts.",
        "required": [
          "object",
          "id",
          "account",
          "amount_kobo",
          "state",
          "reason",
          "reject_reason",
          "created_at",
          "updated_at",
          "client_reference"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "allocation"
          },
          "id": {
            "type": "string",
            "description": "Unique identifier for the allocation, also used as the broker's reference for the deposit. Starts with `alc_`.",
            "pattern": "^alc_[a-z2-7]{20}$"
          },
          "account": {
            "type": "string",
            "description": "The account the allocation funds."
          },
          "amount_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "The amount, in kobo."
          },
          "state": {
            "title": "AllocationState",
            "type": "string",
            "description": "`sending`: reserved, and the send is in progress. If it still reads `sending` after its request has ended, its outcome was not recorded. Our operations team reconciles it with the broker as it does an `uncertain` one, and it becomes `booked`, or `rejected` with `reject_reason` `not_booked` and the amount returned to your wallet. Until then, another allocation to the same account for the same amount is refused with `409 similar_allocation_unresolved`. `booked`: the broker booked it into the account's balance. `uncertain`: the broker did not confirm whether it booked it. The amount stays reserved, the gateway does not resubmit it, and our operations team reconciles it with the broker. Until it resolves, another allocation to the same account for the same amount is refused with `409 similar_allocation_unresolved`. `rejected`: the broker rejected it, or our operations team confirmed it didn't book it (`reject_reason` says which), and the amount is returned to your wallet. `refused`: it never reached the broker, and the amount is returned to your wallet. New values can be added: handle an unrecognised value with a safe default.",
            "enum": ["sending", "booked", "uncertain", "rejected", "refused"]
          },
          "reason": {
            "type": ["string", "null"],
            "description": "A sentence explaining the allocation's current state. It's for people to read, so don't use it in your logic."
          },
          "reject_reason": {
            "title": "AllocationRejectReason",
            "type": ["string", "null"],
            "description": "Why the allocation was rejected. Set only when `state` is `rejected`. New values can be added: handle an unrecognised value with a safe default.",
            "enum": [
              "invalid_amount",
              "closed_financial_year",
              "account_not_at_broker",
              "rejected_by_broker",
              "settlement_lockout",
              "not_booked",
              null
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When we recorded the allocation."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the allocation last changed state."
          },
          "client_reference": {
            "type": ["string", "null"],
            "description": "Your own reference, as you sent it. Null if you didn't send one."
          }
        }
      },
      "AllocationList": {
        "type": "object",
        "description": "A page of your allocations, newest first.",
        "required": ["object", "has_more", "next_cursor", "data"],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether more allocations follow this page."
          },
          "next_cursor": {
            "type": ["string", "null"],
            "description": "Pass this as `cursor` to get the next page. Null on the last page."
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Allocation"
            },
            "description": "The allocations on this page."
          }
        }
      },
      "Choice": {
        "type": "object",
        "description": "One entry in a code list from the broker, such as a bank or a state.",
        "required": ["object", "code", "name"],
        "properties": {
          "object": {
            "title": "ChoiceKind",
            "type": "string",
            "enum": ["bank", "state", "lga"],
            "description": "Which list the choice is from. New values can be added: handle an unrecognised value with a safe default."
          },
          "code": {
            "type": "string",
            "description": "The code to send in the application."
          },
          "name": {
            "type": "string",
            "description": "The name to show a person."
          }
        }
      },
      "ChoiceList": {
        "type": "object",
        "description": "Always the complete list.",
        "required": ["object", "has_more", "next_cursor", "data"],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "has_more": {
            "type": "boolean",
            "const": false,
            "description": "Always `false`: every item comes in one response."
          },
          "next_cursor": {
            "type": "null",
            "description": "Always null: the list is complete."
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Choice"
            },
            "description": "Every one of the choices."
          }
        }
      },
      "Balance": {
        "type": "object",
        "description": "The account's cash, with every figure as the broker defines it. The broker keeps cash to fractions of a kobo, so each figure is given twice: exact, as a `_kobo_decimal` string, and in whole kobo, rounded so that what the account can spend is never overstated: `opening_kobo` and `available_kobo` round down, `pending_debits_kobo` rounds up. `opening_kobo` and `available_kobo` can be negative when the account owes money. Size orders by `available_kobo`.",
        "required": [
          "object",
          "account",
          "currency",
          "opening_kobo",
          "opening_kobo_decimal",
          "pending_debits_kobo",
          "pending_debits_kobo_decimal",
          "available_kobo",
          "available_kobo_decimal"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "balance"
          },
          "account": {
            "type": "string",
            "description": "The account code."
          },
          "currency": {
            "type": "string",
            "const": "NGN",
            "description": "Always `NGN`. Every amount in the balance is in kobo."
          },
          "opening_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "The account's opening balance, as the broker defines it, rounded down to the whole kobo. Can be negative."
          },
          "opening_kobo_decimal": {
            "type": "string",
            "description": "The account's opening balance, in kobo, as an exact decimal string. Can be negative.",
            "example": "10000000"
          },
          "pending_debits_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "Money the broker is holding against the account, as the broker defines it, rounded up to the whole kobo. In the sandbox, the cash held for open buy orders, charges included. Never negative."
          },
          "pending_debits_kobo_decimal": {
            "type": "string",
            "description": "Money the broker is holding against the account, in kobo, as an exact decimal string. Never negative.",
            "example": "59831.63125"
          },
          "available_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "What the account can spend, as the broker defines it, rounded down to the whole kobo. In the sandbox, `opening_kobo_decimal` minus `pending_debits_kobo_decimal`. Can be negative."
          },
          "available_kobo_decimal": {
            "type": "string",
            "description": "What the account can spend, in kobo, as an exact decimal string. Can be negative.",
            "example": "9940168.36875"
          }
        }
      },
      "Position": {
        "type": "object",
        "description": "The shares of one security an account holds, as the broker reports them.",
        "required": [
          "object",
          "symbol",
          "name",
          "asset_class",
          "sector",
          "industry",
          "quantity",
          "average_cost_kobo_decimal",
          "market_price_kobo",
          "market_value_kobo"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "position"
          },
          "symbol": {
            "type": "string",
            "description": "The symbol, in uppercase."
          },
          "name": {
            "type": "string",
            "description": "The security's name, as the broker reports it."
          },
          "asset_class": {
            "type": "string",
            "description": "The kind of security, as the broker reports it, such as `Stock`, `Bond` or `ETF`."
          },
          "sector": {
            "type": ["string", "null"],
            "description": "The broker's market sector. Null when the broker gives none."
          },
          "industry": {
            "type": ["string", "null"],
            "description": "The broker's industry. Null when the broker gives none."
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "The number of shares held."
          },
          "average_cost_kobo_decimal": {
            "type": "string",
            "description": "The average price paid per share, in kobo, as an exact decimal string, because an average can include fractions of a kobo. This is the broker's figure. The broker doesn't say whether it includes charges; in the sandbox it doesn't.",
            "example": "47512.5"
          },
          "market_price_kobo": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "The broker's current price per share, in kobo. Null when the broker gives no price."
          },
          "market_value_kobo": {
            "type": ["integer", "null"],
            "format": "int64",
            "description": "`quantity` times `market_price_kobo`, in kobo. Null when `market_price_kobo` is null."
          }
        }
      },
      "Limits": {
        "type": "object",
        "description": "Your limits, what you've used of each, and what's left. See [Limits](/limits).",
        "required": [
          "object",
          "day",
          "requests_per_second",
          "requests_under_way",
          "orders_kobo_per_day",
          "allocations_kobo_per_day",
          "per_request"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "limits"
          },
          "day": {
            "type": "string",
            "format": "date",
            "description": "The day the daily limits count, in West Africa Time (WAT)."
          },
          "requests_per_second": {
            "type": "object",
            "required": ["limit", "burst"],
            "properties": {
              "limit": {
                "type": "integer",
                "format": "int64",
                "description": "Requests a second."
              },
              "burst": {
                "type": "integer",
                "format": "int64",
                "description": "The most requests at once, after a quiet spell."
              }
            },
            "description": "How many requests a second you can make, and how many at once in a burst."
          },
          "requests_under_way": {
            "$ref": "#/components/schemas/LimitUse",
            "description": "Requests in progress at once, across your keys. See [Limits](/limits)."
          },
          "orders_kobo_per_day": {
            "$ref": "#/components/schemas/LimitUse",
            "description": "Order value per day, in kobo, WAT. See [How order value is counted](/limits#how-order-value-is-counted)."
          },
          "allocations_kobo_per_day": {
            "$ref": "#/components/schemas/LimitUse",
            "description": "Allocations per day, in kobo, WAT. See [How allocations are counted](/limits#how-allocations-are-counted)."
          },
          "per_request": {
            "type": "object",
            "required": ["order_quantity", "allocation_kobo", "request_body_bytes"],
            "properties": {
              "order_quantity": {
                "type": "integer",
                "format": "int64",
                "description": "The most shares one order can be for."
              },
              "allocation_kobo": {
                "type": "integer",
                "format": "int64",
                "description": "The most one allocation can move, in kobo."
              },
              "request_body_bytes": {
                "type": "integer",
                "format": "int64",
                "description": "The largest request body, in bytes."
              }
            },
            "description": "What one request can carry. The same for every partner."
          }
        }
      },
      "LimitUse": {
        "type": "object",
        "description": "One limit, what you've used of it, and what's left.",
        "required": ["limit", "used", "remaining", "resets_at"],
        "properties": {
          "limit": {
            "type": "integer",
            "format": "int64",
            "description": "The limit, in the unit its name gives."
          },
          "used": {
            "type": "integer",
            "format": "int64",
            "description": "What you've used, counted as the limit counts it."
          },
          "remaining": {
            "type": "integer",
            "format": "int64",
            "description": "`limit` minus `used`, and never below zero. It's what one more request can use at this moment."
          },
          "resets_at": {
            "type": ["string", "null"],
            "format": "date-time",
            "description": "When the count starts again: midnight, West Africa Time (WAT), given in UTC. Null for requests under way, which end rather than reset."
          }
        }
      },
      "PositionList": {
        "type": "object",
        "description": "Always the complete list.",
        "required": ["object", "has_more", "next_cursor", "data"],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "has_more": {
            "type": "boolean",
            "const": false,
            "description": "Always `false`: every item comes in one response."
          },
          "next_cursor": {
            "type": "null",
            "description": "Always null: the list is complete."
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Position"
            },
            "description": "Every one of the positions."
          }
        }
      },
      "Trade": {
        "type": "object",
        "description": "One fill at the exchange, as the broker reports it.",
        "required": [
          "object",
          "ticket",
          "order_id",
          "exchange_order_id",
          "symbol",
          "name",
          "side",
          "quantity",
          "price_kobo",
          "trade_date"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "trade"
          },
          "ticket": {
            "type": "string",
            "description": "The broker's ticket number for the fill. Its contract note, once the trade settles, has the same `ticket`."
          },
          "order_id": {
            "type": ["string", "null"],
            "description": "The `id` of the order that placed this trade, if it came through the gateway. Null otherwise.",
            "pattern": "^ord_[a-z2-7]{20}$"
          },
          "exchange_order_id": {
            "type": "string",
            "description": "The exchange's identifier for the order this trade filled."
          },
          "symbol": {
            "type": "string",
            "description": "The symbol, in uppercase."
          },
          "name": {
            "type": "string",
            "description": "The security's name, as the broker reports it."
          },
          "side": {
            "$ref": "#/components/schemas/OrderSide",
            "description": "`buy` or `sell`. New values can be added: handle an unrecognised value with a safe default."
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "The number of shares this trade filled."
          },
          "price_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "The price per share this trade filled at, in kobo."
          },
          "trade_date": {
            "type": "string",
            "format": "date",
            "description": "The trade date, in West Africa Time (WAT)."
          }
        }
      },
      "TradeList": {
        "type": "object",
        "description": "Always the complete list.",
        "required": ["object", "has_more", "next_cursor", "data"],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "has_more": {
            "type": "boolean",
            "const": false,
            "description": "Always `false`: every item comes in one response."
          },
          "next_cursor": {
            "type": "null",
            "description": "Always null: the list is complete."
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Trade"
            },
            "description": "Every one of the trades."
          }
        }
      },
      "ContractNote": {
        "type": "object",
        "required": [
          "object",
          "ticket",
          "symbol",
          "name",
          "side",
          "quantity",
          "price_kobo",
          "amount_kobo",
          "amount_kobo_decimal",
          "commission_kobo",
          "commission_kobo_decimal",
          "statutory_fees_kobo",
          "statutory_fees_kobo_decimal",
          "other_fees_kobo",
          "other_fees_kobo_decimal",
          "consideration_kobo",
          "consideration_kobo_decimal",
          "trade_date",
          "transaction_date"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "contract_note"
          },
          "ticket": {
            "type": "string",
            "description": "The broker's ticket number for the trade. The trade it settles has the same `ticket` in `GET /v1/accounts/{account}/trades`, and that trade's `order_id` names your order."
          },
          "symbol": {
            "type": "string",
            "description": "The symbol, in uppercase."
          },
          "name": {
            "type": "string",
            "description": "The security's name, as the broker reports it. Empty when the broker reports none."
          },
          "side": {
            "$ref": "#/components/schemas/OrderSide",
            "description": "`buy` or `sell`. New values can be added: handle an unrecognised value with a safe default."
          },
          "quantity": {
            "type": "integer",
            "format": "int64",
            "description": "The number of shares traded."
          },
          "price_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "The price per share, in kobo."
          },
          "amount_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "The broker's `amount` for the trade, in kobo, rounded to the whole kobo: up on a buy, down on a sell. The broker doesn't define this figure; in the sandbox it's what the account paid or received. To see what the trade cost or paid, use `consideration_kobo` and the three charges."
          },
          "amount_kobo_decimal": {
            "type": "string",
            "description": "The broker's `amount` for the trade, in kobo, as an exact decimal string.",
            "example": "59831.63125"
          },
          "commission_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "The broker's commission, in kobo, rounded up to the whole kobo."
          },
          "commission_kobo_decimal": {
            "type": "string",
            "description": "The broker's commission, in kobo, as an exact decimal string, because a charge can include fractions of a kobo.",
            "example": "432.75"
          },
          "statutory_fees_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "Statutory charges, in kobo, as the broker reports them, rounded up to the whole kobo."
          },
          "statutory_fees_kobo_decimal": {
            "type": "string",
            "description": "Statutory charges, in kobo, as an exact decimal string.",
            "example": "346.2"
          },
          "other_fees_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "Other charges, in kobo, as the broker reports them, rounded up to the whole kobo. When the broker reports none, the difference between the amount and the consideration, less the commission and statutory charges."
          },
          "other_fees_kobo_decimal": {
            "type": "string",
            "description": "Other charges, in kobo, as an exact decimal string.",
            "example": "1352.68125"
          },
          "consideration_kobo": {
            "type": "integer",
            "format": "int64",
            "description": "The value of the shares traded, in kobo: the quantity times the price, before commission and charges, rounded to the whole kobo: up on a buy, down on a sell. In the sandbox, a buy's `consideration_kobo`, `commission_kobo`, `statutory_fees_kobo` and `other_fees_kobo` add up to what the account paid, to the nearest kobo, and a sale's `consideration_kobo` less the three charges is what it received. The broker doesn't specify how its fields add up. Add the `_kobo_decimal` figures for an exact total: each whole-kobo figure is rounded on its own."
          },
          "consideration_kobo_decimal": {
            "type": "string",
            "description": "The value of the shares traded, in kobo, as an exact decimal string.",
            "example": "57700"
          },
          "trade_date": {
            "type": "string",
            "format": "date",
            "description": "The day the trade happened, in West Africa Time (WAT). When the broker's note doesn't give it, the note's `transaction_date`."
          },
          "transaction_date": {
            "type": "string",
            "format": "date",
            "description": "The broker's date for the contract note, as it reports it. In the sandbox, the trade date."
          }
        },
        "description": "One settled trade and what it cost, as the broker reports it. In the sandbox, a contract note appears the day after the trade."
      },
      "ContractNoteList": {
        "type": "object",
        "description": "Always the complete list.",
        "required": ["object", "has_more", "next_cursor", "data"],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "has_more": {
            "type": "boolean",
            "const": false,
            "description": "Always `false`: every item comes in one response."
          },
          "next_cursor": {
            "type": "null",
            "description": "Always null: the list is complete."
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContractNote"
            },
            "description": "Every one of the contract notes."
          }
        }
      },
      "AccountRestrictions": {
        "type": "object",
        "description": "The controls on one of your accounts, as a change left them. Sent as `account.restriction_changed`.",
        "required": [
          "object",
          "account",
          "trading_blocked",
          "trading_blocked_reason",
          "money_blocked",
          "money_blocked_reason",
          "blocked",
          "blocked_reason",
          "at"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "account_restrictions"
          },
          "account": {
            "type": "string",
            "description": "The account's code."
          },
          "trading_blocked": {
            "type": "boolean",
            "description": "New orders on this account are refused with `403 account_trading_blocked`."
          },
          "trading_blocked_reason": {
            "type": ["string", "null"],
            "description": "Why we blocked new orders on this account, in our words, while it's on; `null` once it's lifted. Never a person's name."
          },
          "money_blocked": {
            "type": "boolean",
            "description": "New allocations to this account are refused with `403 account_money_blocked`."
          },
          "money_blocked_reason": {
            "type": ["string", "null"],
            "description": "Why we blocked new allocations to this account, in our words, while it's on; `null` once it's lifted. Never a person's name."
          },
          "blocked": {
            "type": "boolean",
            "description": "New orders and allocations for this account are refused with `403 account_blocked`."
          },
          "blocked_reason": {
            "type": ["string", "null"],
            "description": "Why we blocked this account, in our words, while it's on; `null` once it's lifted. Never a person's name."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "When we made the change."
          }
        }
      },
      "PartnerStatus": {
        "type": "object",
        "description": "Your partner account's controls, as a change left them. Sent as `partner.status_changed`.",
        "required": [
          "object",
          "trading_paused",
          "money_paused",
          "suspended",
          "closed",
          "reason",
          "at"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "partner_status"
          },
          "trading_paused": {
            "type": "boolean",
            "description": "New orders, applications and documents are refused with `403 partner_trading_paused`."
          },
          "money_paused": {
            "type": "boolean",
            "description": "New allocations are refused with `403 partner_money_paused`."
          },
          "suspended": {
            "type": "boolean",
            "description": "Every request with your keys is refused with `403 partner_suspended`."
          },
          "closed": {
            "type": "boolean",
            "description": "Your partner account is closed."
          },
          "reason": {
            "type": ["string", "null"],
            "description": "Why we made the change, in our words. Never a person's name."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "When we made the change."
          }
        }
      },
      "SecurityRestriction": {
        "type": "object",
        "description": "Our restriction on one symbol, for every partner, as a change left it. Sent as `security.restriction_changed`.",
        "required": ["object", "symbol", "state", "at"],
        "properties": {
          "object": {
            "type": "string",
            "const": "security_restriction"
          },
          "symbol": {
            "type": "string",
            "description": "The symbol, in capitals."
          },
          "state": {
            "title": "SecurityRestrictionState",
            "type": ["string", "null"],
            "enum": ["close_only", "blocked", null],
            "description": "`close_only`: buys and buy estimates are refused with `403 security_close_only`, and sells are taken. `blocked`: every new order and estimate is refused with `403 security_blocked`. `null`: we lifted the restriction. New values can be added: handle an unrecognised value with a safe default."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "When we made the change."
          }
        }
      }
    }
  }
}
