{
  "openapi": "3.1.0",
  "info": {
    "title": "Geneh API",
    "version": "1.0.0",
    "summary": "Egypt's currency rates at every bank, gold, silver, transfers, certificates, treasury bills and funds.",
    "description": "The public developer API at api.geneh.app/v1, documented at https://geneh.app/en/developers.\n\nRead only, JSON in UTF-8, snake_case fields, times in UTC (ISO 8601). Prices are in Egyptian pounds (EGP)\nfor `unit` units of the instrument (100 for JPY, 1 gram for gold). `buy` is what a bank pays you, `sell`\nis what it charges you. The Central Bank rate (`cbe`) is a reference and is never a best rate.\n\nSend your key as `Authorization: Bearer gk_live_...` (or `X-API-Key`). Make a free key at\nhttps://geneh.app/en/developers/keys.\n\nEvery answer carries `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` and `X-Geneh-Plan`.\nOver a limit you get 429 with `Retry-After`. Errors are `{ \"error\": code, \"message\": text }`.\n\nBrowsers: a key limited to websites works from those websites in the browser (CORS). Keys that work from\nanywhere are for servers only; keep them out of web pages.\n\nThis file is the source for the reference pages, the code examples and the official libraries. A test in\nservices/account checks it against the API on every push, so it can't drift.\n",
    "contact": {
      "name": "Geneh developers",
      "email": "api@geneh.app",
      "url": "https://geneh.app/en/developers"
    },
    "license": {
      "name": "Geneh API terms",
      "url": "https://geneh.app/en/terms"
    }
  },
  "servers": [
    {
      "url": "https://api.geneh.app",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearer": []
    },
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Rates",
      "description": "Currency rates at every bank and the Central Bank."
    },
    {
      "name": "Banks",
      "description": "Banks and what each one publishes."
    },
    {
      "name": "Metals",
      "description": "Gold and silver prices."
    },
    {
      "name": "Transfers",
      "description": "What arrives in Egypt with each transfer provider."
    },
    {
      "name": "Savings",
      "description": "Certificates, treasury bills and funds."
    },
    {
      "name": "Webhooks",
      "description": "Events we send to your address when prices change."
    },
    {
      "name": "Account",
      "description": "Your usage and the state of each price source."
    }
  ],
  "paths": {
    "/v1/rates/latest": {
      "get": {
        "operationId": "listRates",
        "tags": [
          "Rates"
        ],
        "summary": "Every currency",
        "description": "Every currency with its Central Bank rate, the best bank to buy from and to sell to, and how many banks quote it.",
        "x-geneh-section": "rates",
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RatesLatest"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/rates/{currency}": {
      "get": {
        "operationId": "getRate",
        "tags": [
          "Rates"
        ],
        "summary": "One currency at every bank",
        "description": "One currency at every bank in Egypt, the Central Bank rate, and the best bank to buy from and to sell to.",
        "x-geneh-section": "rates",
        "parameters": [
          {
            "$ref": "#/components/parameters/Currency"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        }
      }
    },
    "/v1/rates/{currency}/history": {
      "get": {
        "operationId": "getRateHistory",
        "tags": [
          "Rates"
        ],
        "summary": "Rate history",
        "description": "Buy and sell over time for the Central Bank (default) or one bank. `1d` has a point for every change,\n`1w` one an hour, longer ranges one a day. Your plan sets how far back you can go.\n",
        "x-geneh-section": "rates",
        "parameters": [
          {
            "$ref": "#/components/parameters/Currency"
          },
          {
            "$ref": "#/components/parameters/Range"
          },
          {
            "name": "bank",
            "in": "query",
            "description": "A bank id from /v1/banks, or cbe.",
            "schema": {
              "type": "string",
              "default": "cbe",
              "example": "nbe"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/History"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/convert": {
      "get": {
        "operationId": "convert",
        "tags": [
          "Rates"
        ],
        "summary": "Convert",
        "description": "Convert between EGP and one other currency at the Central Bank rate or at one bank. Selling foreign currency uses the bank's buy price, buying it uses the sell price.",
        "x-geneh-section": "rates",
        "parameters": [
          {
            "name": "amount",
            "in": "query",
            "required": true,
            "schema": {
              "type": "number",
              "exclusiveMinimum": 0,
              "example": 100
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "usd"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "egp"
            }
          },
          {
            "name": "bank",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "cbe",
              "example": "nbe"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Conversion"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/banks": {
      "get": {
        "operationId": "listBanks",
        "tags": [
          "Banks"
        ],
        "summary": "Every bank",
        "description": "Every bank with its names in Arabic and English, its website and what it publishes. Works on every plan.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/banks/{id}": {
      "get": {
        "operationId": "getBank",
        "tags": [
          "Banks"
        ],
        "summary": "One bank",
        "description": "One bank's currency rates, certificates and funds.",
        "x-geneh-section": "banks",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "nbe"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Bank"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/gold": {
      "get": {
        "operationId": "getGold",
        "tags": [
          "Metals"
        ],
        "summary": "Gold",
        "description": "Gold prices in EGP by karat (per gram), the gold pound and bars, the ounce in US dollars and the gold dollar.",
        "x-geneh-section": "gold",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Gold"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/gold/history": {
      "get": {
        "operationId": "getGoldHistory",
        "tags": [
          "Metals"
        ],
        "summary": "Gold history",
        "x-geneh-section": "gold",
        "parameters": [
          {
            "name": "karat",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "21"
            },
            "description": "Karat: 24, 22, 21, 18 or 14. Default 21."
          },
          {
            "$ref": "#/components/parameters/Range"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/History"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/silver": {
      "get": {
        "operationId": "getSilver",
        "tags": [
          "Metals"
        ],
        "summary": "Silver",
        "description": "Silver prices in EGP by purity (per gram) and the ounce in US dollars.",
        "x-geneh-section": "silver",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Silver"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanRequired"
          }
        }
      }
    },
    "/v1/transfers/corridors": {
      "get": {
        "operationId": "listCorridors",
        "tags": [
          "Transfers"
        ],
        "summary": "Countries and currencies",
        "description": "Every country and currency money is sent from, the ways to receive, the amounts compared and the providers.",
        "x-geneh-section": "transfers",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Corridors"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/PlanRequired"
          }
        }
      }
    },
    "/v1/transfers/quotes": {
      "get": {
        "operationId": "listTransferQuotes",
        "tags": [
          "Transfers"
        ],
        "summary": "Transfer quotes",
        "description": "How many pounds arrive with each provider.",
        "x-geneh-section": "transfers",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "description": "Two-letter country code.",
            "schema": {
              "type": "string",
              "example": "SA"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "The currency you send.",
            "schema": {
              "type": "string",
              "example": "SAR"
            }
          },
          {
            "name": "amount",
            "in": "query",
            "schema": {
              "type": "number",
              "example": 1000
            }
          },
          {
            "name": "receive",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "bank",
                "cash",
                "wallet",
                "card"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransferQuotes"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/PlanRequired"
          }
        }
      }
    },
    "/v1/certificates": {
      "get": {
        "operationId": "listCertificates",
        "tags": [
          "Savings"
        ],
        "summary": "Certificates",
        "description": "Every bank certificate with its rate and terms in `details`.",
        "x-geneh-section": "savings",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Items"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/PlanRequired"
          }
        }
      }
    },
    "/v1/tbills": {
      "get": {
        "operationId": "listTbills",
        "tags": [
          "Savings"
        ],
        "summary": "Treasury bills",
        "description": "The latest accepted yield for each term, before and after tax.",
        "x-geneh-section": "savings",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Tbills"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/PlanRequired"
          }
        }
      }
    },
    "/v1/tbills/auctions": {
      "get": {
        "operationId": "getTbillAuctions",
        "tags": [
          "Savings"
        ],
        "summary": "Treasury bill auctions",
        "description": "The latest auction for each term with accepted and submitted bids, the next auctions, and the yield each time it changed.",
        "x-geneh-section": "savings",
        "parameters": [
          {
            "name": "currency",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "EGP",
              "example": "EGP"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TbillAuctions"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/PlanRequired"
          }
        }
      }
    },
    "/v1/funds": {
      "get": {
        "operationId": "listFunds",
        "tags": [
          "Savings"
        ],
        "summary": "Funds",
        "description": "Every mutual fund with its latest unit price.",
        "x-geneh-section": "savings",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Items"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/PlanRequired"
          }
        }
      }
    },
    "/v1/funds/{id}": {
      "get": {
        "operationId": "getFund",
        "tags": [
          "Savings"
        ],
        "summary": "One fund",
        "description": "One fund's latest price and its prices over the past year (within your plan's history).",
        "x-geneh-section": "savings",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "2662"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Fund"
                }
              }
            }
          },
          "403": {
            "$ref": "#/components/responses/PlanRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "operationId": "getUsage",
        "tags": [
          "Account"
        ],
        "summary": "Your usage",
        "description": "Requests today and this month against your plan, and your webhook endpoints.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/status": {
      "get": {
        "operationId": "getStatus",
        "tags": [
          "Account"
        ],
        "summary": "Source status",
        "description": "Whether each price source is working and how long ago it last updated.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Status"
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "tags": [
          "Webhooks"
        ],
        "summary": "Your webhooks",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "operationId": "createWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Add a webhook",
        "description": "The answer carries the signing secret (`whsec_...`) once. Pro and above.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "403": {
            "$ref": "#/components/responses/PlanRequired"
          }
        }
      }
    },
    "/v1/webhooks/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/WebhookId"
        }
      ],
      "get": {
        "operationId": "getWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "One webhook",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "operationId": "updateWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Change, pause or resume a webhook",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook",
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/webhooks/{id}/test": {
      "parameters": [
        {
          "$ref": "#/components/parameters/WebhookId"
        }
      ],
      "post": {
        "operationId": "testWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a sample event",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "$ref": "#/components/schemas/WebhookEventType"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The delivery result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookTestResult"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/webhooks/{id}/replay": {
      "parameters": [
        {
          "$ref": "#/components/parameters/WebhookId"
        }
      ],
      "post": {
        "operationId": "replayWebhook",
        "tags": [
          "Webhooks"
        ],
        "summary": "Send past events again",
        "description": "Resends this endpoint's events from a point in time, up to 30 days back.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "to": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Queued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookReplay"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The webhook is paused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Your API key, gk_live_..."
      },
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "parameters": {
      "Currency": {
        "name": "currency",
        "in": "path",
        "required": true,
        "description": "Three-letter currency code in any case.",
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z]{3}$",
          "example": "usd"
        }
      },
      "Range": {
        "name": "range",
        "in": "query",
        "schema": {
          "type": "string",
          "enum": [
            "1d",
            "1w",
            "1m",
            "1y",
            "all"
          ],
          "default": "1m"
        }
      },
      "WebhookId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    },
    "headers": {
      "Limit": {
        "description": "Requests a day on your plan.",
        "schema": {
          "type": "integer"
        }
      },
      "Remaining": {
        "description": "Requests left today.",
        "schema": {
          "type": "integer"
        }
      },
      "Reset": {
        "description": "When the count resets (unix seconds).",
        "schema": {
          "type": "integer"
        }
      },
      "X-Geneh-Plan": {
        "description": "Your plan.",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Something in the request is wrong. The message says what.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "missing_key, bad_key or wrong_environment.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "PlanRequired": {
        "description": "plan_required: this section or this much history needs a higher plan. key_restricted: the key is limited to other websites or addresses.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "We have nothing for this.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "TooMany": {
        "description": "too_fast (per second), quota_exceeded (per day, resets at midnight UTC) or blocked (too many wrong keys). Wait Retry-After seconds.",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unavailable": {
        "description": "Prices are not available for a moment. Try again in a minute.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "example": "bad_key"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "Time": {
        "type": "string",
        "format": "date-time"
      },
      "Price": {
        "type": [
          "number",
          "null"
        ]
      },
      "Pair": {
        "type": "object",
        "required": [
          "buy",
          "sell"
        ],
        "properties": {
          "buy": {
            "$ref": "#/components/schemas/Price"
          },
          "sell": {
            "$ref": "#/components/schemas/Price"
          }
        }
      },
      "BestSide": {
        "type": [
          "object",
          "null"
        ],
        "required": [
          "bank",
          "rate"
        ],
        "properties": {
          "bank": {
            "type": "string",
            "example": "nbe"
          },
          "rate": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "Best": {
        "type": "object",
        "description": "`sell`: the cheapest bank to buy from. `buy`: the bank that pays the most.",
        "required": [
          "sell",
          "buy"
        ],
        "properties": {
          "sell": {
            "$ref": "#/components/schemas/BestSide"
          },
          "buy": {
            "$ref": "#/components/schemas/BestSide"
          }
        }
      },
      "BankRate": {
        "type": "object",
        "required": [
          "bank",
          "buy",
          "sell",
          "unit",
          "updated_at",
          "checked_at"
        ],
        "properties": {
          "bank": {
            "type": "string",
            "example": "nbe"
          },
          "provider": {
            "type": "string"
          },
          "buy": {
            "$ref": "#/components/schemas/Price"
          },
          "sell": {
            "$ref": "#/components/schemas/Price"
          },
          "transfer": {
            "$ref": "#/components/schemas/Pair",
            "description": "The transfer (non-cash) rate when the bank publishes a different one."
          },
          "unit": {
            "type": "number"
          },
          "updated_at": {
            "$ref": "#/components/schemas/Time",
            "description": "When this price last changed."
          },
          "checked_at": {
            "$ref": "#/components/schemas/Time",
            "description": "When we last checked it."
          }
        }
      },
      "RatesLatest": {
        "type": "object",
        "required": [
          "updated_at",
          "currencies"
        ],
        "properties": {
          "updated_at": {
            "$ref": "#/components/schemas/Time"
          },
          "currencies": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "currency",
                "unit",
                "cbe",
                "best",
                "banks"
              ],
              "properties": {
                "currency": {
                  "type": "string",
                  "example": "USD"
                },
                "unit": {
                  "type": "number"
                },
                "cbe": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Pair"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "best": {
                  "$ref": "#/components/schemas/Best"
                },
                "banks": {
                  "type": "integer",
                  "description": "How many banks quote it."
                }
              }
            }
          }
        }
      },
      "Rate": {
        "type": "object",
        "required": [
          "currency",
          "unit",
          "updated_at",
          "cbe",
          "best",
          "banks"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "example": "USD"
          },
          "unit": {
            "type": "number",
            "description": "Prices are EGP for this many units."
          },
          "updated_at": {
            "$ref": "#/components/schemas/Time"
          },
          "cbe": {
            "type": [
              "object",
              "null"
            ],
            "description": "The Central Bank rate, a reference that is never ranked.",
            "required": [
              "buy",
              "sell",
              "updated_at"
            ],
            "properties": {
              "buy": {
                "$ref": "#/components/schemas/Price"
              },
              "sell": {
                "$ref": "#/components/schemas/Price"
              },
              "updated_at": {
                "$ref": "#/components/schemas/Time"
              }
            }
          },
          "best": {
            "$ref": "#/components/schemas/Best"
          },
          "banks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BankRate"
            }
          }
        }
      },
      "History": {
        "type": "object",
        "required": [
          "instrument",
          "source",
          "range",
          "interval",
          "points"
        ],
        "properties": {
          "instrument": {
            "type": "string",
            "example": "USD"
          },
          "source": {
            "type": "string",
            "example": "cbe"
          },
          "range": {
            "type": "string",
            "enum": [
              "1d",
              "1w",
              "1m",
              "1y",
              "all"
            ]
          },
          "interval": {
            "type": "string",
            "enum": [
              "change",
              "hour",
              "day"
            ]
          },
          "points": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "at",
                "buy",
                "sell"
              ],
              "properties": {
                "at": {
                  "$ref": "#/components/schemas/Time"
                },
                "buy": {
                  "$ref": "#/components/schemas/Price"
                },
                "sell": {
                  "$ref": "#/components/schemas/Price"
                }
              }
            }
          }
        }
      },
      "Conversion": {
        "type": "object",
        "required": [
          "from",
          "to",
          "amount",
          "bank",
          "rate",
          "unit",
          "result",
          "updated_at"
        ],
        "properties": {
          "from": {
            "type": "string",
            "example": "USD"
          },
          "to": {
            "type": "string",
            "example": "EGP"
          },
          "amount": {
            "type": "number"
          },
          "bank": {
            "type": "string",
            "example": "cbe"
          },
          "rate": {
            "type": "number"
          },
          "unit": {
            "type": "number"
          },
          "result": {
            "type": "number",
            "description": "Rounded to 2 decimals."
          },
          "updated_at": {
            "$ref": "#/components/schemas/Time"
          }
        }
      },
      "Names": {
        "type": "object",
        "required": [
          "en",
          "ar"
        ],
        "properties": {
          "en": {
            "type": "string"
          },
          "ar": {
            "type": "string"
          }
        }
      },
      "BankList": {
        "type": "object",
        "required": [
          "banks"
        ],
        "properties": {
          "banks": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "name",
                "type",
                "website",
                "publishes"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "example": "nbe"
                },
                "name": {
                  "$ref": "#/components/schemas/Names"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "bank",
                    "central_bank"
                  ]
                },
                "website": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "publishes": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "What it publishes: fx_bank, certificate, fund and so on."
                }
              }
            }
          }
        }
      },
      "Item": {
        "type": "object",
        "description": "One price with its terms in `details`.",
        "required": [
          "source",
          "instrument",
          "buy",
          "sell",
          "value",
          "currency",
          "unit",
          "updated_at"
        ],
        "properties": {
          "source": {
            "type": "string"
          },
          "instrument": {
            "type": "string"
          },
          "buy": {
            "$ref": "#/components/schemas/Price"
          },
          "sell": {
            "$ref": "#/components/schemas/Price"
          },
          "value": {
            "type": [
              "number",
              "null"
            ],
            "description": "A single value (a rate or a fund price) when there is no buy and sell."
          },
          "currency": {
            "type": "string",
            "example": "EGP"
          },
          "unit": {
            "type": "number"
          },
          "updated_at": {
            "$ref": "#/components/schemas/Time"
          },
          "details": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "Items": {
        "type": "object",
        "required": [
          "updated_at",
          "items"
        ],
        "properties": {
          "updated_at": {
            "$ref": "#/components/schemas/Time"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Item"
            }
          }
        }
      },
      "Bank": {
        "type": "object",
        "required": [
          "id",
          "name",
          "type",
          "website",
          "updated_at",
          "rates",
          "certificates",
          "funds"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "$ref": "#/components/schemas/Names"
          },
          "type": {
            "type": "string",
            "enum": [
              "bank",
              "central_bank"
            ]
          },
          "website": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "$ref": "#/components/schemas/Time"
          },
          "rates": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "currency",
                "bank",
                "buy",
                "sell",
                "unit",
                "updated_at",
                "checked_at"
              ],
              "properties": {
                "currency": {
                  "type": "string",
                  "example": "USD"
                },
                "bank": {
                  "type": "string"
                },
                "provider": {
                  "type": "string"
                },
                "buy": {
                  "$ref": "#/components/schemas/Price"
                },
                "sell": {
                  "$ref": "#/components/schemas/Price"
                },
                "transfer": {
                  "$ref": "#/components/schemas/Pair"
                },
                "unit": {
                  "type": "number"
                },
                "updated_at": {
                  "$ref": "#/components/schemas/Time"
                },
                "checked_at": {
                  "$ref": "#/components/schemas/Time"
                }
              }
            }
          },
          "certificates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Item"
            }
          },
          "funds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Item"
            }
          }
        }
      },
      "MetalPrice": {
        "type": "object",
        "required": [
          "instrument",
          "source",
          "buy",
          "sell",
          "updated_at"
        ],
        "properties": {
          "instrument": {
            "type": "string",
            "example": "xau_21k_g",
            "description": "xau_24k_g, xau_21k_g, xau_pound, xag_999_g and so on."
          },
          "source": {
            "type": "string"
          },
          "buy": {
            "$ref": "#/components/schemas/Price"
          },
          "sell": {
            "$ref": "#/components/schemas/Price"
          },
          "updated_at": {
            "$ref": "#/components/schemas/Time"
          }
        }
      },
      "Gold": {
        "type": "object",
        "required": [
          "updated_at",
          "ounce_usd",
          "gold_dollar",
          "prices"
        ],
        "properties": {
          "updated_at": {
            "$ref": "#/components/schemas/Time"
          },
          "ounce_usd": {
            "type": [
              "number",
              "null"
            ]
          },
          "gold_dollar": {
            "type": [
              "number",
              "null"
            ],
            "description": "The dollar rate implied by local gold prices."
          },
          "prices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MetalPrice"
            }
          }
        }
      },
      "Silver": {
        "type": "object",
        "required": [
          "updated_at",
          "ounce_usd",
          "prices"
        ],
        "properties": {
          "updated_at": {
            "$ref": "#/components/schemas/Time"
          },
          "ounce_usd": {
            "type": [
              "number",
              "null"
            ]
          },
          "prices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MetalPrice"
            }
          }
        }
      },
      "Corridors": {
        "type": "object",
        "required": [
          "updated_at",
          "corridors"
        ],
        "properties": {
          "updated_at": {
            "$ref": "#/components/schemas/Time"
          },
          "corridors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "country",
                "currency",
                "receive",
                "receive_currencies",
                "amounts",
                "providers"
              ],
              "properties": {
                "country": {
                  "type": "string",
                  "example": "SA"
                },
                "currency": {
                  "type": "string",
                  "example": "SAR"
                },
                "receive": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "receive_currencies": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "amounts": {
                  "type": "array",
                  "items": {
                    "type": "number"
                  }
                },
                "providers": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "TransferQuotes": {
        "type": "object",
        "required": [
          "updated_at",
          "providers",
          "quotes"
        ],
        "properties": {
          "updated_at": {
            "$ref": "#/components/schemas/Time"
          },
          "providers": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "quotes": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "provider",
                "instrument",
                "receive_egp",
                "per_unit",
                "updated_at",
                "details"
              ],
              "properties": {
                "provider": {
                  "type": "string",
                  "example": "western_union"
                },
                "instrument": {
                  "type": "string",
                  "example": "sa_sar_1000_bank_egp"
                },
                "receive_egp": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Pounds that arrive."
                },
                "per_unit": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Pounds per unit sent, after fees."
                },
                "updated_at": {
                  "$ref": "#/components/schemas/Time"
                },
                "details": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "Tbills": {
        "type": "object",
        "required": [
          "updated_at",
          "tax_rate",
          "tenors"
        ],
        "properties": {
          "updated_at": {
            "$ref": "#/components/schemas/Time"
          },
          "tax_rate": {
            "type": "number",
            "example": 0.2
          },
          "tenors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "instrument",
                "currency",
                "yield",
                "yield_after_tax",
                "auction_date",
                "details"
              ],
              "properties": {
                "instrument": {
                  "type": "string",
                  "example": "tbill_6m"
                },
                "currency": {
                  "type": "string"
                },
                "yield": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "yield_after_tax": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "auction_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "details": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "Bids": {
        "type": "object",
        "required": [
          "nominal_egp",
          "bids",
          "min_yield",
          "max_yield",
          "avg_yield"
        ],
        "properties": {
          "nominal_egp": {
            "type": [
              "number",
              "null"
            ]
          },
          "bids": {
            "type": [
              "number",
              "null"
            ]
          },
          "min_yield": {
            "type": [
              "number",
              "null"
            ]
          },
          "max_yield": {
            "type": [
              "number",
              "null"
            ]
          },
          "avg_yield": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "TbillAuctions": {
        "type": "object",
        "required": [
          "currency",
          "updated_at",
          "tax_rate",
          "latest",
          "upcoming",
          "history"
        ],
        "properties": {
          "currency": {
            "type": "string"
          },
          "updated_at": {
            "$ref": "#/components/schemas/Time"
          },
          "tax_rate": {
            "type": "number"
          },
          "latest": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "instrument",
                "tenor_days",
                "auction_date",
                "isin",
                "issue_date",
                "maturity_date",
                "required_egp",
                "yield",
                "yield_after_tax",
                "accepted",
                "submitted"
              ],
              "properties": {
                "instrument": {
                  "type": "string"
                },
                "tenor_days": {
                  "type": "integer"
                },
                "auction_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "isin": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "issue_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "maturity_date": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "required_egp": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "yield": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "yield_after_tax": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "accepted": {
                  "$ref": "#/components/schemas/Bids"
                },
                "submitted": {
                  "$ref": "#/components/schemas/Bids"
                }
              }
            }
          },
          "upcoming": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "instrument",
                "tenor_days",
                "deadline",
                "amount_egp_mio"
              ],
              "properties": {
                "instrument": {
                  "type": "string"
                },
                "tenor_days": {
                  "type": "integer"
                },
                "deadline": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "amount_egp_mio": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              }
            }
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "instrument",
                "tenor_days",
                "points"
              ],
              "properties": {
                "instrument": {
                  "type": "string"
                },
                "tenor_days": {
                  "type": "integer"
                },
                "points": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "date",
                      "yield"
                    ],
                    "properties": {
                      "date": {
                        "type": "string",
                        "format": "date"
                      },
                      "yield": {
                        "type": "number"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "Fund": {
        "type": "object",
        "required": [
          "source",
          "instrument",
          "buy",
          "sell",
          "value",
          "currency",
          "unit",
          "updated_at",
          "history"
        ],
        "properties": {
          "source": {
            "type": "string"
          },
          "instrument": {
            "type": "string"
          },
          "buy": {
            "$ref": "#/components/schemas/Price"
          },
          "sell": {
            "$ref": "#/components/schemas/Price"
          },
          "value": {
            "type": [
              "number",
              "null"
            ],
            "description": "The latest unit price."
          },
          "currency": {
            "type": "string"
          },
          "unit": {
            "type": "number"
          },
          "updated_at": {
            "$ref": "#/components/schemas/Time"
          },
          "details": {
            "type": "object",
            "additionalProperties": true
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "at",
                "value"
              ],
              "properties": {
                "at": {
                  "$ref": "#/components/schemas/Time"
                },
                "value": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              }
            }
          }
        }
      },
      "Usage": {
        "type": "object",
        "required": [
          "plan",
          "day",
          "period",
          "requests",
          "webhooks"
        ],
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "pro",
              "business",
              "enterprise"
            ]
          },
          "day": {
            "type": "string",
            "format": "date"
          },
          "period": {
            "type": "string",
            "example": "2026-11"
          },
          "requests": {
            "type": "object",
            "required": [
              "today",
              "daily_limit",
              "this_month"
            ],
            "properties": {
              "today": {
                "type": "integer"
              },
              "daily_limit": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "this_month": {
                "type": "integer"
              }
            }
          },
          "webhooks": {
            "type": "object",
            "required": [
              "endpoints",
              "limit"
            ],
            "properties": {
              "endpoints": {
                "type": "integer"
              },
              "limit": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          }
        }
      },
      "Status": {
        "type": "object",
        "required": [
          "updated_at",
          "sources"
        ],
        "properties": {
          "updated_at": {
            "$ref": "#/components/schemas/Time"
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "kind",
                "state",
                "last_success_at",
                "age_minutes"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                },
                "state": {
                  "type": "string"
                },
                "last_success_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "age_minutes": {
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              }
            }
          }
        }
      },
      "WebhookEventType": {
        "type": "string",
        "enum": [
          "rate.updated",
          "rate.best_changed",
          "rate.threshold_crossed",
          "cbe.rate_changed",
          "gold.updated",
          "silver.updated",
          "transfer.quotes_updated",
          "certificate.created",
          "certificate.rate_changed",
          "tbill.auction_result",
          "fund.price_updated",
          "status.incident",
          "status.service_incident",
          "price.held",
          "price.live",
          "views.weekly"
        ]
      },
      "WebhookFilters": {
        "type": "object",
        "description": "Narrows events to some currencies or banks. Empty lets everything through.",
        "properties": {
          "currency": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 60
          },
          "bank": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 80
          }
        }
      },
      "WebhookThreshold": {
        "type": "object",
        "description": "Sends rate.threshold_crossed when the best rate (or one bank's) moves below or above a value. Set exactly one of below or above.",
        "required": [
          "currency",
          "side"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "example": "usd"
          },
          "side": {
            "type": "string",
            "enum": [
              "buy",
              "sell"
            ]
          },
          "bank": {
            "type": "string"
          },
          "below": {
            "type": "number"
          },
          "above": {
            "type": "number"
          }
        }
      },
      "WebhookInput": {
        "type": "object",
        "required": [
          "url",
          "events"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 500
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/WebhookEventType"
            }
          },
          "description": {
            "type": "string",
            "maxLength": 100
          },
          "filters": {
            "$ref": "#/components/schemas/WebhookFilters"
          },
          "thresholds": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/WebhookThreshold"
            }
          }
        }
      },
      "WebhookPatch": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 500
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/WebhookEventType"
            }
          },
          "description": {
            "type": "string",
            "maxLength": 100
          },
          "filters": {
            "$ref": "#/components/schemas/WebhookFilters"
          },
          "thresholds": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/WebhookThreshold"
            }
          },
          "paused": {
            "type": "boolean"
          }
        }
      },
      "Webhook": {
        "type": "object",
        "required": [
          "id",
          "url",
          "description",
          "events",
          "filters",
          "thresholds",
          "status",
          "paused_reason",
          "created_at",
          "last_delivery"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEventType"
            }
          },
          "filters": {
            "$ref": "#/components/schemas/WebhookFilters"
          },
          "thresholds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookThreshold"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused"
            ]
          },
          "paused_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "you",
              "failing",
              null
            ]
          },
          "created_at": {
            "$ref": "#/components/schemas/Time"
          },
          "last_delivery": {
            "type": [
              "object",
              "null"
            ],
            "required": [
              "at",
              "status_code",
              "ok",
              "ms"
            ],
            "properties": {
              "at": {
                "$ref": "#/components/schemas/Time"
              },
              "status_code": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "ok": {
                "type": "boolean"
              },
              "ms": {
                "type": "number"
              }
            }
          },
          "secret": {
            "type": "string",
            "description": "The signing secret, only in the answer to POST /v1/webhooks."
          }
        }
      },
      "WebhookList": {
        "type": "object",
        "required": [
          "items",
          "endpoints",
          "limit"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Webhook"
            }
          },
          "endpoints": {
            "type": "integer"
          },
          "limit": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "WebhookEvent": {
        "type": "object",
        "description": "The body of every delivery, signed with Geneh-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of \"t.body\">.",
        "required": [
          "id",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/WebhookEventType"
          },
          "created_at": {
            "$ref": "#/components/schemas/Time"
          },
          "data": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "WebhookTestResult": {
        "type": "object",
        "required": [
          "ok",
          "status_code",
          "ms",
          "error",
          "event"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "status_code": {
            "type": [
              "integer",
              "null"
            ]
          },
          "ms": {
            "type": "number"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "event": {
            "$ref": "#/components/schemas/WebhookEvent"
          }
        }
      },
      "WebhookReplay": {
        "type": "object",
        "required": [
          "queued",
          "from",
          "to",
          "more"
        ],
        "properties": {
          "queued": {
            "type": "integer"
          },
          "from": {
            "$ref": "#/components/schemas/Time"
          },
          "to": {
            "$ref": "#/components/schemas/Time"
          },
          "more": {
            "type": "boolean",
            "description": "More events matched than one replay sends; replay again from the last one."
          }
        }
      }
    }
  }
}