{
  "openapi": "3.0.3",
  "info": {
    "title": "Melio Payouts API",
    "version": "1.0",
    "description": "Self-serve payouts API. Partners onboard an Entity, which is the business\n(organization plus owner, with the details required to be payment-eligible),\nthen attach accounts (internal accounts and external accounts) and make\npayments.\n\n## Resource ids\n\nEvery resource has an opaque, prefixed id that is stable for the life of the resource:\n`ent_` (entity), `pay_` (payment), `acct_` (account, internal or external).\nIds are Melio-issued; treat them as opaque strings and never parse or construct them. To\nattach your own identifier to a resource, use `externalId`.\n\n## Pagination\n\nList endpoints are cursor-paginated and always return results newest-first\n(`createdAt` descending). The response envelope is:\n\n```json\n{ \"data\": [ /* resources */ ], \"hasMore\": true }\n```\n\nPage through results with `limit` (1 to 50, default 50) plus a cursor:\n\n- `startingAfter=<id>`: return the page immediately **after** the given resource id\n  (the next, older page). This is how you walk forward through a list.\n- `endingBefore=<id>`: return the page immediately **before** the given resource id\n  (the previous, newer page).\n\n`startingAfter` and `endingBefore` are mutually exclusive. The cursor is a resource id\nyou already received (e.g. the `id` of the last item on the current page), not an index.\nKeep requesting the next page until `hasMore` is `false`.\n\n## Filtering & sorting\n\nOrdering is fixed (newest-first); there is no `sortBy`. To narrow a list, filter it.\nEach list endpoint documents its own filter parameters (there is no generic query\nlanguage). Date-range filters use bracket suffixes and accept RFC 3339 timestamps:\n`created[gte]`, `created[lte]`. Filter by your own identifier with `externalId`, and\nby metadata with `metadata[<key>]=<value>` (matches resources whose metadata contains\nevery supplied key/value pair). Filters combine with AND and compose with pagination.\n\n## External ids\n\nEvery created resource accepts an optional `externalId`, your own unique identifier for\nthe resource (≤255 chars, letters/digits/`-`/`_`). It is unique per partner per resource\ntype: reusing one returns `409 DUPLICATE_EXTERNAL_ID`. Use it to correlate Melio resources\nwith records in your system and to look resources up (`?externalId=`) without storing\nMelio ids. `externalId` identifies a *resource*; it is not a request-deduplication key\n(that is the `Idempotency-Key` header, below); the two are complementary.\n\n## Idempotency\n\nSend an `Idempotency-Key` header on every create so retries are safe: the original response\nis replayed instead of creating a second resource. It is required on `POST /payments`.\n\n## Metadata\n\nMost resources accept a `metadata` object: free-form string key/value pairs that Melio\nstores and returns verbatim but never interprets. Limits: up to 500 keys, key ≤40 chars,\nvalue ≤100 chars, and ≤128KB serialized for the whole object. Use it to stash your own\nstructured context on a resource; it is also filterable (see above).\n\nMetadata is **not** included in webhook event payloads — fetch the resource to read it.\n\n## Melio Sonar Session Token\n\nWrite endpoints optionally accept a `Melio-Sonar-Token` header: a signed session token\nminted by the MelioSonar SDK on the end user's device, carrying device signals used for\nrisk evaluation. Omit it when no SDK session is available.\n\n## Webhooks\n\nMelio notifies you of changes (an entity, account, or payment created or updated, a limitation\nchanged) by POSTing a JSON delivery to your webhook endpoint. The payloads are documented by the\n`WebhookDelivery` schema; the event types by `WebhookEventName`.\n\n**Configuring your endpoint.** Your endpoint, the events it's subscribed to, and its signing\nsecret are managed in the Melio developers portal (Developers → Webhooks), not through this API.\n\n**Delivery headers.** Deliveries follow the [Standard Webhooks](https://www.standardwebhooks.com)\nspec. Every delivery carries:\n\n- `webhook-id`: the delivery's message id, stable across retries (the same value as the body's\n  `messageId`). Use it for idempotency.\n- `webhook-timestamp`: Unix time, in seconds, when the delivery was signed.\n- `webhook-signature`: `v1,<base64 HMAC-SHA256>`. During a secret rotation more than one secret\n  signs, and the header holds a space-separated list (`v1,abc v1,def`); one matching entry is\n  enough.\n- `Content-Type: application/json`, `X-Melio-Event` (the event type), and `X-Melio-Delivery-Id`\n  (the same value as `webhook-id`).\n\nThere is no `X-Melio-Signature` header.\n\n**Signing secret.** The signing secret is a `whsec_<base64>` value. It is not an API key and\ncan't call the API. The portal shows it once — when you create your endpoint, and again each time\nyou rotate — and afterwards only a masked preview (`whsec_••••`), so store it when it's shown; if\nyou lose it, rotate to get a new one. It is in the Standard Webhooks format, so pass it to a\nlibrary unchanged; verifying by hand, the HMAC key is the base64 after `whsec_`.\n\n**Verifying a delivery.** The signed content is `${webhook-id}.${webhook-timestamp}.${rawBody}`,\nwhere `rawBody` is the raw request body bytes, before any JSON parsing (re-serialized JSON won't\nmatch). Reject deliveries whose `webhook-timestamp` is more than 5 minutes from now (replay\nprotection). The official `standardwebhooks` library does both:\n\n```js\nimport { Webhook } from 'standardwebhooks';\n\n// whsec_<base64>, exactly as the portal shows it\nconst wh = new Webhook(process.env.MELIO_WEBHOOK_SECRET);\n\napp.post('/melio/webhooks', express.raw({ type: 'application/json' }), (req, res) => {\n  try {\n    const event = wh.verify(req.body.toString('utf8'), req.headers); // throws if invalid or older than 5 min\n    handle(event);\n    res.sendStatus(200);\n  } catch {\n    res.sendStatus(400);\n  }\n});\n```\n\nWithout a library:\n\n```js\nimport crypto from 'crypto';\n\n// whsec_<base64>: the HMAC key is the base64 part\nconst secret = Buffer.from(process.env.MELIO_WEBHOOK_SECRET.replace(/^whsec_/, ''), 'base64');\nconst TOLERANCE_SECONDS = 300;\n\nfunction isValidMelioWebhook(rawBody, headers) {\n  const id = headers['webhook-id'];\n  const timestamp = headers['webhook-timestamp'];\n  const signatureHeader = headers['webhook-signature'];\n  if (!id || !timestamp || !signatureHeader) return false;\n\n  // Reject old deliveries (replay protection)\n  if (Math.abs(Math.floor(Date.now() / 1000) - Number(timestamp)) > TOLERANCE_SECONDS) return false;\n\n  // Sign id.timestamp.rawBody, using the raw body before any JSON parsing\n  const expected = crypto.createHmac('sha256', secret).update(`${id}.${timestamp}.${rawBody}`).digest();\n\n  // The header may hold several signatures (\"v1,abc v1,def\"); one match is enough\n  return signatureHeader.split(' ').some((entry) => {\n    if (!entry.startsWith('v1,')) return false;\n    const received = Buffer.from(entry.slice(3), 'base64');\n    return received.length === expected.length && crypto.timingSafeEqual(received, expected);\n  });\n}\n```\n\n**Rotating the secret.** Rotating in the developers portal creates a new secret. By default the\nprevious secret keeps signing for 24 hours (each delivery carries both signatures), so you can\nredeploy your receiver with the new secret without dropping deliveries. Only one rotation\noverlaps at a time: while the previous secret is still signing, rotating with an overlap is\nrefused until it stops. \"Rotate now\" stops the previous secret immediately, whenever you need it.\nDeleting the endpoint retires its secret, so an endpoint you recreate gets a new one.\n",
    "contact": {
      "name": "Melio Platform External API",
      "email": "platform@melio.com"
    }
  },
  "servers": [
    {
      "description": "Production",
      "url": "https://api.melio.com/v2"
    },
    {
      "description": "Staging01",
      "url": "https://api.staging01.melio.com/v2"
    }
  ],
  "tags": [
    {
      "name": "Entities",
      "description": "A business you onboard and operate on behalf of: its profile, compliance details, and per-operation limitations."
    },
    {
      "name": "Accounts",
      "description": "Accounts the entity pays from (internal) and payees it pays to (external)."
    },
    {
      "name": "Attachments",
      "description": "Supporting documents an entity uploads once and references from a payment."
    },
    {
      "name": "Payments",
      "description": "Money moved from an internal account to an external account, and their lifecycle."
    },
    {
      "name": "Tools",
      "description": "Pre-flight calculators for fees, fast-payment eligibility, and delivery estimates. No resource is created."
    }
  ],
  "paths": {
    "/entities": {
      "get": {
        "tags": [
          "Entities"
        ],
        "summary": "List entities",
        "description": "Returns your entities, newest first. Use the filters below to narrow the list.",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "externalId",
            "in": "query",
            "required": false,
            "description": "Return only the entity whose `externalId` matches (your own id).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "metadata",
            "in": "query",
            "required": false,
            "style": "deepObject",
            "explode": true,
            "description": "Filter by metadata key/value pairs, e.g. `metadata[crmId]=C-1`. Matches entities whose metadata contains every supplied pair.\n",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Entities (limitations omitted; fetch an entity's limitations separately).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Entity"
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "ent_7c9e6679-7425-40de-944b-e07fc1f90ae7",
                      "type": "business",
                      "externalId": "partner-biz-1234",
                      "createdAt": "2026-07-08T15:00:00Z",
                      "updatedAt": "2026-07-08T15:00:00Z",
                      "name": "Acme Supplies",
                      "legalName": "Acme Supplies LLC",
                      "businessType": "llc",
                      "taxInfo": {
                        "type": "ein",
                        "identifierLast4": "6789"
                      },
                      "phoneNumber": "+12125551234",
                      "contact": {
                        "firstName": "Jane",
                        "lastName": "Doe"
                      },
                      "website": "https://acmesupplies.com",
                      "address": {
                        "line1": "350 5th Ave",
                        "city": "New York",
                        "state": "NY",
                        "postalCode": "10118",
                        "countryCode": "US"
                      },
                      "legalAddress": {
                        "line1": "350 5th Ave",
                        "city": "New York",
                        "state": "NY",
                        "postalCode": "10118",
                        "countryCode": "US"
                      },
                      "industry": {
                        "naicsCode": "424410"
                      },
                      "owner": {
                        "firstName": "Jane",
                        "lastName": "Doe",
                        "email": "jane.doe@acmesupplies.com"
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Entities"
        ],
        "summary": "Create an entity",
        "description": "Creates an entity (a business). A direct partner manages a single entity; a platform partner can create as many as it needs.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/MelioSonarToken"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEntityRequest"
              },
              "example": {
                "type": "business",
                "externalId": "partner-biz-1234",
                "name": "Acme Supplies",
                "legalName": "Acme Supplies LLC",
                "phoneNumber": "+12125551234",
                "businessType": "llc",
                "taxInfo": {
                  "type": "ein",
                  "identifier": "12-3456789"
                },
                "industry": {
                  "naicsCode": "424410"
                },
                "contact": {
                  "firstName": "Jane",
                  "lastName": "Doe"
                },
                "website": "https://acmesupplies.com",
                "address": {
                  "line1": "350 5th Ave",
                  "city": "New York",
                  "state": "NY",
                  "postalCode": "10118"
                },
                "legalAddress": {
                  "line1": "350 5th Ave",
                  "city": "New York",
                  "state": "NY",
                  "postalCode": "10118"
                },
                "owner": {
                  "firstName": "Jane",
                  "lastName": "Doe",
                  "email": "jane.doe@acmesupplies.com",
                  "dateOfBirth": "1985-04-12",
                  "phoneNumber": "+12125559876"
                },
                "termsAcceptance": {
                  "accepted": true,
                  "acceptedAt": "2026-09-22T14:31:07Z"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Entity created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Entity"
                },
                "example": {
                  "id": "ent_7c9e6679-7425-40de-944b-e07fc1f90ae7",
                  "type": "business",
                  "externalId": "partner-biz-1234",
                  "createdAt": "2026-07-08T15:00:00Z",
                  "updatedAt": "2026-07-08T15:00:00Z",
                  "name": "Acme Supplies",
                  "legalName": "Acme Supplies LLC",
                  "businessType": "llc",
                  "taxInfo": {
                    "type": "ein",
                    "identifierLast4": "6789"
                  },
                  "phoneNumber": "+12125551234",
                  "contact": {
                    "firstName": "Jane",
                    "lastName": "Doe"
                  },
                  "website": "https://acmesupplies.com",
                  "address": {
                    "line1": "350 5th Ave",
                    "city": "New York",
                    "state": "NY",
                    "postalCode": "10118",
                    "countryCode": "US"
                  },
                  "legalAddress": {
                    "line1": "350 5th Ave",
                    "city": "New York",
                    "state": "NY",
                    "postalCode": "10118",
                    "countryCode": "US"
                  },
                  "industry": {
                    "naicsCode": "424410"
                  },
                  "owner": {
                    "firstName": "Jane",
                    "lastName": "Doe",
                    "email": "jane.doe@acmesupplies.com"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation error (includes formation-type / tax-id-type mismatch)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "A direct partner already has an entity (DUPLICATE_ENTITY), the `externalId` is already used by another entity (DUPLICATE_EXTERNAL_ID), or the `Idempotency-Key` was reused with a different body (IDEMPOTENCY_KEY_REUSED) / is still being processed by an earlier request (IDEMPOTENCY_KEY_IN_PROGRESS). On DUPLICATE_EXTERNAL_ID you can retrieve the existing entity with `GET /entities?externalId=<yourId>` and reuse it; this makes retries (e.g. from a queue) safe once the idempotency-key window has elapsed.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "duplicateEntity": {
                    "summary": "Direct partner already has an entity",
                    "value": {
                      "error": {
                        "type": "conflict_error",
                        "code": "DUPLICATE_ENTITY",
                        "message": "Entity already exists; only platform partners may create additional entities"
                      }
                    }
                  },
                  "duplicateExternalId": {
                    "summary": "externalId already in use, recover with GET /entities?externalId=",
                    "value": {
                      "error": {
                        "type": "conflict_error",
                        "code": "DUPLICATE_EXTERNAL_ID",
                        "message": "An entity with externalId 'acme-123' already exists."
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/entities/{entityId}": {
      "parameters": [
        {
          "name": "entityId",
          "in": "path",
          "required": true,
          "description": "An entity id (ent_<uuid>) or the sentinel `me` (the partner's sole entity).",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "Entities"
        ],
        "summary": "Get an entity",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The entity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Entity"
                },
                "example": {
                  "id": "ent_7c9e6679-7425-40de-944b-e07fc1f90ae7",
                  "type": "business",
                  "externalId": "partner-biz-1234",
                  "createdAt": "2026-07-08T15:00:00Z",
                  "updatedAt": "2026-07-08T15:00:00Z",
                  "name": "Acme Supplies",
                  "legalName": "Acme Supplies LLC",
                  "businessType": "llc",
                  "taxInfo": {
                    "type": "ein",
                    "identifierLast4": "6789"
                  },
                  "phoneNumber": "+12125551234",
                  "contact": {
                    "firstName": "Jane",
                    "lastName": "Doe"
                  },
                  "website": "https://acmesupplies.com",
                  "address": {
                    "line1": "350 5th Ave",
                    "city": "New York",
                    "state": "NY",
                    "postalCode": "10118",
                    "countryCode": "US"
                  },
                  "legalAddress": {
                    "line1": "350 5th Ave",
                    "city": "New York",
                    "state": "NY",
                    "postalCode": "10118",
                    "countryCode": "US"
                  },
                  "industry": {
                    "naicsCode": "424410"
                  },
                  "owner": {
                    "firstName": "Jane",
                    "lastName": "Doe",
                    "email": "jane.doe@acmesupplies.com"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Entities"
        ],
        "summary": "Update an entity",
        "description": "Updates an entity. Only the fields you send are changed. Some compliance fields (`legalName`, `legalAddress`, `taxInfo`) are fixed once the entity is created.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/MelioSonarToken"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEntityRequest"
              },
              "example": {
                "name": "Acme Supplies Co",
                "website": "https://acme-supplies.example.com",
                "metadata": {
                  "crmId": "C-1"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated entity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Entity"
                },
                "example": {
                  "id": "ent_7c9e6679-7425-40de-944b-e07fc1f90ae7",
                  "type": "business",
                  "externalId": "partner-biz-1234",
                  "metadata": {
                    "crmId": "C-1"
                  },
                  "createdAt": "2026-07-08T15:00:00Z",
                  "updatedAt": "2026-07-08T15:10:00Z",
                  "name": "Acme Supplies Co",
                  "legalName": "Acme Supplies LLC",
                  "businessType": "llc",
                  "taxInfo": {
                    "type": "ein",
                    "identifierLast4": "6789"
                  },
                  "phoneNumber": "+12125551234",
                  "contact": {
                    "firstName": "Jane",
                    "lastName": "Doe"
                  },
                  "website": "https://acme-supplies.example.com",
                  "address": {
                    "line1": "350 5th Ave",
                    "city": "New York",
                    "state": "NY",
                    "postalCode": "10118",
                    "countryCode": "US"
                  },
                  "legalAddress": {
                    "line1": "350 5th Ave",
                    "city": "New York",
                    "state": "NY",
                    "postalCode": "10118",
                    "countryCode": "US"
                  },
                  "industry": {
                    "naicsCode": "424410"
                  },
                  "owner": {
                    "firstName": "Jane",
                    "lastName": "Doe",
                    "email": "jane.doe@acmesupplies.com"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/entities/{entityId}/beneficial-owners": {
      "parameters": [
        {
          "name": "entityId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "Entities"
        ],
        "summary": "List beneficial owners",
        "description": "The people recorded against the business for compliance: its ultimate beneficial owners, its directors, and the individual who acts for it on its international (FX) payments.\n\nThis is distinct from the entity's `owner`, which is the person the Melio account belongs to. The two are usually the same human, but `owner` carries no address, tax identifier or ownership stake, so it cannot satisfy international onboarding on its own.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The business's beneficial owners. Empty until any are recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BeneficialOwnerList"
                }
              }
            }
          },
          "404": {
            "description": "Entity not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Entities"
        ],
        "summary": "Replace beneficial owners",
        "description": "Replaces the business's entire set of beneficial owners. Entries carrying an `id` are updated, entries without one are created, and **any person the payload omits is deleted**.\n\nReplace rather than patch because ownership percentages are only meaningful as a set: their total is validated across all entries, so a partial update has no coherent meaning. Read the current set first, modify it, and send it back whole.\n\nRecording an `fx-account-holder` is what unblocks `international-fx` accounts. Check `GET /limitations` afterwards to confirm nothing else is outstanding.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplaceBeneficialOwnersRequest"
              },
              "example": {
                "data": [
                  {
                    "firstName": "Dana",
                    "lastName": "Okonjo",
                    "dateOfBirth": "1984-03-11",
                    "address": {
                      "line1": "500 Congress Ave",
                      "city": "Austin",
                      "state": "TX",
                      "postalCode": "78701",
                      "countryCode": "US"
                    },
                    "usResident": true,
                    "ownershipPercentage": 0.6,
                    "jobTitle": "chief-executive-officer",
                    "taxInfo": {
                      "type": "ssn",
                      "identifier": "123-45-6789"
                    },
                    "types": [
                      "ubo",
                      "director",
                      "fx-account-holder"
                    ],
                    "email": "dana@example.com"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The business's beneficial owners after the replacement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BeneficialOwnerList"
                }
              }
            }
          },
          "400": {
            "description": "Validation error — a malformed entry, an `id` that does not belong to this entity, or identification that does not match the declared residency\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Entity not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/limitations": {
      "parameters": [
        {
          "$ref": "#/components/parameters/MelioEntityId"
        }
      ],
      "get": {
        "tags": [
          "Entities"
        ],
        "summary": "Get limitations",
        "description": "Returns the entity's per-operation capabilities. Each operation (named `resource.subtype:action`) is either allowed or, if not, lists the reasons why (for example, missing information). Only write operations can be limited; read operations are always allowed and are not listed.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Limitations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BusinessLimitations"
                },
                "example": {
                  "capabilities": [
                    {
                      "operation": "payment.domestic:write",
                      "allowed": false,
                      "reasons": [
                        {
                          "code": "MissingInformation",
                          "message": "Additional information is required before this business can send payments.",
                          "missingFields": [
                            "taxInfo"
                          ]
                        }
                      ]
                    },
                    {
                      "operation": "account.internal:write",
                      "allowed": true,
                      "reasons": []
                    },
                    {
                      "operation": "account.external:write",
                      "allowed": true,
                      "reasons": []
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/accounts": {
      "parameters": [
        {
          "$ref": "#/components/parameters/MelioEntityId"
        }
      ],
      "post": {
        "tags": [
          "Accounts"
        ],
        "summary": "Create an account",
        "description": "Creates an account for the entity. An internal account is one the entity pays from (a bank account added through Plaid or, for selected partners, by its account and routing numbers). An external account is a payee the entity pays to, reachable by ACH, paper check, domestic wire, or virtual card. Authenticate with your api-key, or with a scoped session token from `POST /accounts/link` (which can only create internal accounts).\n",
        "security": [
          {
            "ApiKey": []
          },
          {
            "SessionToken": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/MelioSonarToken"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAccountRequest"
              },
              "examples": {
                "internalAch": {
                  "summary": "Internal ACH account (account and routing numbers, selected partners)",
                  "value": {
                    "ownershipType": "internal",
                    "type": "ach",
                    "nickname": "Operating account",
                    "bankAccount": {
                      "accountType": "checking",
                      "accountNumber": "000123456789",
                      "routingNumber": "021000021"
                    }
                  }
                },
                "internalPlaid": {
                  "summary": "Internal Plaid account (submitted by the Melio-hosted link page)",
                  "value": {
                    "ownershipType": "internal",
                    "type": "plaid",
                    "nickname": "Business checking",
                    "details": {
                      "plaidToken": "public-sandbox-0000aaaa-1111-bbbb-2222-cccc3333dddd",
                      "plaidAccountId": "aBcDeFgHiJkLmNoP"
                    }
                  }
                },
                "internalCard": {
                  "summary": "Internal card account (vaulted token, submitted by the Melio-hosted link page)",
                  "value": {
                    "ownershipType": "internal",
                    "type": "card",
                    "nickname": "Corporate card",
                    "details": {
                      "token": "3f8a1c2e-9b4d-4e6f-8a1b-2c3d4e5f6a7b",
                      "tokenProvider": "basistheory",
                      "cardBin": "424242",
                      "expirationMonth": "11",
                      "expirationYear": "2029",
                      "lastFourDigits": "4242",
                      "cardOwner": {
                        "firstName": "Jane",
                        "lastName": "Doe"
                      },
                      "address": {
                        "line1": "123 Main St",
                        "city": "New York",
                        "state": "NY",
                        "postalCode": "10001"
                      }
                    }
                  }
                },
                "externalAch": {
                  "summary": "External ACH account (counterParty)",
                  "value": {
                    "ownershipType": "external",
                    "type": "ach",
                    "counterPartyName": "Globex Manufacturing",
                    "counterPartyEmail": "ap@globex.example.com",
                    "bankAccount": {
                      "accountType": "checking",
                      "accountNumber": "987654321",
                      "routingNumber": "111000025"
                    }
                  }
                },
                "externalCheck": {
                  "summary": "External paper-check account (counterParty)",
                  "value": {
                    "ownershipType": "external",
                    "type": "check",
                    "counterPartyName": "Initech",
                    "counterPartyEmail": "ap@initech.example.com",
                    "paperCheck": {
                      "address": {
                        "line1": "500 Market St",
                        "city": "San Francisco",
                        "state": "CA",
                        "postalCode": "94105"
                      }
                    }
                  }
                },
                "externalDomesticWire": {
                  "summary": "External domestic-wire account (counterParty)",
                  "value": {
                    "ownershipType": "external",
                    "type": "domestic-wire",
                    "counterPartyName": "Wayne Enterprises",
                    "counterPartyEmail": "ap@wayne.example.com",
                    "bankAccount": {
                      "accountNumber": "555987654",
                      "routingNumber": "021000021"
                    },
                    "address": {
                      "line1": "1007 Mountain Drive",
                      "city": "Gotham",
                      "state": "NJ",
                      "postalCode": "07001"
                    }
                  }
                },
                "externalVirtualCard": {
                  "summary": "External virtual-card account (counterParty)",
                  "value": {
                    "ownershipType": "external",
                    "type": "virtual-card",
                    "counterPartyName": "Stark Industries",
                    "counterPartyEmail": "payments@stark.example.com"
                  }
                },
                "externalCounterpartyChoice": {
                  "summary": "External counterparty-choice account (the counterparty provides their details)",
                  "value": {
                    "ownershipType": "external",
                    "type": "counterparty-choice",
                    "counterPartyName": "Wayne Enterprises",
                    "counterPartyEmail": "ap@wayne.example.com"
                  }
                },
                "externalInternationalFxAed": {
                  "summary": "international-fx — AED to AE",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Gulf Trading LLC",
                    "counterPartyEmail": "ap@gulf.example.com",
                    "currency": "AED",
                    "bankCountryCode": "AE",
                    "bankDetails": {
                      "accountHolderName": "Gulf Trading LLC",
                      "iban": "AE070331234567890123456"
                    },
                    "address": {
                      "line1": "12 Sheikh Zayed Rd",
                      "city": "Dubai",
                      "postalCode": "00000",
                      "countryCode": "AE"
                    }
                  }
                },
                "externalInternationalFxAud": {
                  "summary": "international-fx — AUD to AU",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Southern Cross Pty Ltd",
                    "counterPartyEmail": "ap@southern.example.com",
                    "currency": "AUD",
                    "bankCountryCode": "AU",
                    "bankDetails": {
                      "accountHolderName": "Southern Cross Pty Ltd",
                      "bsbCode": "802985",
                      "accountNumber": "123456789"
                    },
                    "address": {
                      "line1": "1 Martin Pl",
                      "city": "Sydney",
                      "state": "NSW",
                      "postalCode": "2000",
                      "countryCode": "AU"
                    }
                  }
                },
                "externalInternationalFxBob": {
                  "summary": "international-fx — BOB to BO",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Andes Comercial SRL",
                    "counterPartyEmail": "ap@andes.example.com",
                    "currency": "BOB",
                    "bankCountryCode": "BO",
                    "bankDetails": {
                      "accountHolderName": "Andes Comercial SRL",
                      "bic": "BUKBGB22",
                      "accountNumber": "1234567890123"
                    },
                    "address": {
                      "line1": "Av. Arce 2081",
                      "city": "La Paz",
                      "postalCode": "0000",
                      "countryCode": "BO"
                    }
                  }
                },
                "externalInternationalFxBrl": {
                  "summary": "international-fx — BRL to BR",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Ipanema Comercio Ltda",
                    "counterPartyEmail": "ap@ipanema.example.com",
                    "currency": "BRL",
                    "bankCountryCode": "BR",
                    "bankDetails": {
                      "email": "ap@ipanema.example.com",
                      "accountHolderName": "Ipanema Comercio Ltda",
                      "bankCode": "332",
                      "branchCode": "1234",
                      "accountNumber": "12345678-9",
                      "accountType": "CHECKING",
                      "cnpj": "64.753.719/0001-86"
                    },
                    "address": {
                      "line1": "Av. Paulista 1578",
                      "city": "Sao Paulo",
                      "state": "SP",
                      "postalCode": "01310-200",
                      "countryCode": "BR"
                    }
                  }
                },
                "externalInternationalFxCad": {
                  "summary": "international-fx — CAD to CA",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Northwind Trading Ltd",
                    "counterPartyEmail": "ap@northwind.example.com",
                    "currency": "CAD",
                    "bankCountryCode": "CA",
                    "bankDetails": {
                      "accountHolderName": "Northwind Trading Ltd",
                      "institutionNumber": "006",
                      "transitNumber": "04841",
                      "accountNumber": "1234567",
                      "accountType": "CHECKING"
                    },
                    "address": {
                      "line1": "1 King St W",
                      "city": "Toronto",
                      "state": "ON",
                      "postalCode": "M5H 1A1",
                      "countryCode": "CA"
                    }
                  }
                },
                "externalInternationalFxChf": {
                  "summary": "international-fx — CHF to CH/LI",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Alpenwerk AG",
                    "counterPartyEmail": "ap@alpenwerk.example.com",
                    "currency": "CHF",
                    "bankCountryCode": "CH",
                    "bankDetails": {
                      "accountHolderName": "Alpenwerk AG",
                      "iban": "CH9300762011623852957"
                    },
                    "address": {
                      "line1": "Bahnhofstrasse 12",
                      "city": "Zurich",
                      "postalCode": "8001",
                      "countryCode": "CH"
                    }
                  }
                },
                "externalInternationalFxCny": {
                  "summary": "international-fx — CNY to CN",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Shanghai Hongqiao Trading Co",
                    "counterPartyEmail": "ap@shanghai.example.com",
                    "currency": "CNY",
                    "bankCountryCode": "CN",
                    "bankDetails": {
                      "accountHolderName": "Shanghai Hongqiao Trading Co",
                      "bic": "BOSHCNSH",
                      "accountNumber": "123456789012"
                    },
                    "address": {
                      "line1": "1000 Nanjing Rd",
                      "city": "Shanghai",
                      "postalCode": "200001",
                      "countryCode": "CN"
                    }
                  }
                },
                "externalInternationalFxCzk": {
                  "summary": "international-fx — CZK to CZ",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Vltava Obchod s.r.o.",
                    "counterPartyEmail": "ap@vltava.example.com",
                    "currency": "CZK",
                    "bankCountryCode": "CZ",
                    "bankDetails": {
                      "accountHolderName": "Vltava Obchod s.r.o.",
                      "bankCode": "5500",
                      "accountNumber": "5060011118"
                    },
                    "address": {
                      "line1": "Narodni 12",
                      "city": "Prague",
                      "postalCode": "110 00",
                      "countryCode": "CZ"
                    }
                  }
                },
                "externalInternationalFxDkk": {
                  "summary": "international-fx — DKK to DK",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Nordlys ApS",
                    "counterPartyEmail": "ap@nordlys.example.com",
                    "currency": "DKK",
                    "bankCountryCode": "DK",
                    "bankDetails": {
                      "accountHolderName": "Nordlys ApS",
                      "iban": "DE12345678901234567890"
                    },
                    "address": {
                      "line1": "Vesterbrogade 8",
                      "city": "Copenhagen",
                      "postalCode": "1620",
                      "countryCode": "DK"
                    }
                  }
                },
                "externalInternationalFxDop": {
                  "summary": "international-fx — DOP to DO",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Caribe Comercial SRL",
                    "counterPartyEmail": "ap@caribe.example.com",
                    "currency": "DOP",
                    "bankCountryCode": "DO",
                    "bankDetails": {
                      "accountHolderName": "Caribe Comercial SRL",
                      "bic": "BUKBGB22",
                      "accountNumber": "0021234567890"
                    },
                    "address": {
                      "line1": "Av. Winston Churchill 50",
                      "city": "Santo Domingo",
                      "postalCode": "10148",
                      "countryCode": "DO"
                    }
                  }
                },
                "externalInternationalFxEgp": {
                  "summary": "international-fx — EGP to EG",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Nile Trading Co",
                    "counterPartyEmail": "ap@nile.example.com",
                    "currency": "EGP",
                    "bankCountryCode": "EG",
                    "bankDetails": {
                      "accountHolderName": "Nile Trading Co",
                      "iban": "EG380019000500000000263180002"
                    },
                    "address": {
                      "line1": "15 Talaat Harb St",
                      "city": "Cairo",
                      "postalCode": "11511",
                      "countryCode": "EG"
                    }
                  }
                },
                "externalInternationalFxEur": {
                  "summary": "international-fx — EUR to 24 countries",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Muster Handels GmbH",
                    "counterPartyEmail": "ap@muster.example.com",
                    "currency": "EUR",
                    "bankCountryCode": "DE",
                    "bankDetails": {
                      "accountHolderName": "Muster Handels GmbH",
                      "iban": "DE12345678901234567890"
                    },
                    "address": {
                      "line1": "Unter den Linden 5",
                      "city": "Berlin",
                      "postalCode": "10117",
                      "countryCode": "DE"
                    }
                  }
                },
                "externalInternationalFxGbpAlt1": {
                  "summary": "international-fx — GBP (local identifiers)",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Northwind Ltd",
                    "counterPartyEmail": "ap@northwind.example.com",
                    "currency": "GBP",
                    "bankCountryCode": "GB",
                    "bankDetails": {
                      "accountHolderName": "Northwind Ltd",
                      "sortCode": "40-30-20",
                      "accountNumber": "12345678"
                    },
                    "address": {
                      "line1": "1 High St",
                      "city": "London",
                      "postalCode": "EC1A 1BB",
                      "countryCode": "GB"
                    }
                  }
                },
                "externalInternationalFxGbpAlt2": {
                  "summary": "international-fx — GBP (IBAN)",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Northwind Ltd",
                    "counterPartyEmail": "ap@northwind.example.com",
                    "currency": "GBP",
                    "bankCountryCode": "GB",
                    "bankDetails": {
                      "accountHolderName": "Northwind Ltd",
                      "iban": "GB12ABCD34567891234567"
                    },
                    "address": {
                      "line1": "1 High St",
                      "city": "London",
                      "postalCode": "EC1A 1BB",
                      "countryCode": "GB"
                    }
                  }
                },
                "externalInternationalFxGel": {
                  "summary": "international-fx — GEL to GE",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Kolkheti LLC",
                    "counterPartyEmail": "ap@kolkheti.example.com",
                    "currency": "GEL",
                    "bankCountryCode": "GE",
                    "bankDetails": {
                      "accountHolderName": "Kolkheti LLC",
                      "iban": "DE12345678901234567890"
                    },
                    "address": {
                      "line1": "12 Rustaveli Ave",
                      "city": "Tbilisi",
                      "postalCode": "0108",
                      "countryCode": "GE"
                    }
                  }
                },
                "externalInternationalFxGhs": {
                  "summary": "international-fx — GHS to GH",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Accra Trading Ltd",
                    "counterPartyEmail": "ap@accra.example.com",
                    "currency": "GHS",
                    "bankCountryCode": "GH",
                    "bankDetails": {
                      "accountHolderName": "Accra Trading Ltd",
                      "bankCode": "ABNGGHAC",
                      "accountNumber": "0020444381028"
                    },
                    "address": {
                      "line1": "21 Independence Ave",
                      "city": "Accra",
                      "postalCode": "GA-000",
                      "countryCode": "GH"
                    }
                  }
                },
                "externalInternationalFxGtq": {
                  "summary": "international-fx — GTQ to GT",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Comercial Antigua SA",
                    "counterPartyEmail": "ap@antigua.example.com",
                    "currency": "GTQ",
                    "bankCountryCode": "GT",
                    "bankDetails": {
                      "accountHolderName": "Comercial Antigua SA",
                      "bic": "BUKBGB22",
                      "accountNumber": "0101234567890"
                    },
                    "address": {
                      "line1": "6a Avenida 12-30",
                      "city": "Guatemala City",
                      "postalCode": "01001",
                      "countryCode": "GT"
                    }
                  }
                },
                "externalInternationalFxHkd": {
                  "summary": "international-fx — HKD to HK",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Victoria Harbour Trading Ltd",
                    "counterPartyEmail": "ap@victoria.example.com",
                    "currency": "HKD",
                    "bankCountryCode": "HK",
                    "bankDetails": {
                      "accountHolderName": "Victoria Harbour Trading Ltd",
                      "bankCode": "552",
                      "accountNumber": "231289112"
                    },
                    "address": {
                      "line1": "8 Connaught Rd",
                      "city": "Hong Kong",
                      "postalCode": "999077",
                      "countryCode": "HK"
                    }
                  }
                },
                "externalInternationalFxHufAlt1": {
                  "summary": "international-fx — HUF (local identifiers)",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Duna Kereskedelmi Kft",
                    "counterPartyEmail": "ap@duna.example.com",
                    "currency": "HUF",
                    "bankCountryCode": "HU",
                    "bankDetails": {
                      "accountHolderName": "Duna Kereskedelmi Kft",
                      "accountNumber": "120000071234567800000008"
                    },
                    "address": {
                      "line1": "Andrassy ut 20",
                      "city": "Budapest",
                      "postalCode": "1061",
                      "countryCode": "HU"
                    }
                  }
                },
                "externalInternationalFxHufAlt2": {
                  "summary": "international-fx — HUF (IBAN)",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Duna Kereskedelmi Kft",
                    "counterPartyEmail": "ap@duna.example.com",
                    "currency": "HUF",
                    "bankCountryCode": "HU",
                    "bankDetails": {
                      "accountHolderName": "Duna Kereskedelmi Kft",
                      "iban": "DE12345678901234567890"
                    },
                    "address": {
                      "line1": "Andrassy ut 20",
                      "city": "Budapest",
                      "postalCode": "1061",
                      "countryCode": "HU"
                    }
                  }
                },
                "externalInternationalFxIls": {
                  "summary": "international-fx — ILS to IL",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Carmel Trading Ltd",
                    "counterPartyEmail": "ap@carmel.example.com",
                    "currency": "ILS",
                    "bankCountryCode": "IL",
                    "bankDetails": {
                      "accountHolderName": "Carmel Trading Ltd",
                      "iban": "IL620108000000099999999"
                    },
                    "address": {
                      "line1": "12 Rothschild Blvd",
                      "city": "Tel Aviv",
                      "postalCode": "6688112",
                      "countryCode": "IL"
                    }
                  }
                },
                "externalInternationalFxInr": {
                  "summary": "international-fx — INR to IN",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Deccan Exports Pvt Ltd",
                    "counterPartyEmail": "ap@deccan.example.com",
                    "currency": "INR",
                    "bankCountryCode": "IN",
                    "bankDetails": {
                      "accountHolderName": "Deccan Exports Pvt Ltd",
                      "ifscCode": "YESB0236041",
                      "accountNumber": "678911234567891"
                    },
                    "address": {
                      "line1": "21 MG Rd",
                      "city": "Bengaluru",
                      "postalCode": "560001",
                      "countryCode": "IN"
                    }
                  }
                },
                "externalInternationalFxKes": {
                  "summary": "international-fx — KES to KE",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Rift Valley Traders Ltd",
                    "counterPartyEmail": "ap@rift.example.com",
                    "currency": "KES",
                    "bankCountryCode": "KE",
                    "bankDetails": {
                      "accountHolderName": "Rift Valley Traders Ltd",
                      "bankCode": "BARCKENX",
                      "accountNumber": "0023183991919"
                    },
                    "address": {
                      "line1": "12 Kenyatta Ave",
                      "city": "Nairobi",
                      "postalCode": "00100",
                      "countryCode": "KE"
                    }
                  }
                },
                "externalInternationalFxKrw": {
                  "summary": "international-fx — KRW to KR",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Hangang Trading Co",
                    "counterPartyEmail": "ap@hangang.example.com",
                    "currency": "KRW",
                    "bankCountryCode": "KR",
                    "bankDetails": {
                      "email": "ap@hangang.example.com",
                      "accountHolderName": "Hangang Trading Co",
                      "bankCode": "HSBCKRSE",
                      "accountNumber": "1254693521232"
                    },
                    "address": {
                      "line1": "15 Sejong-daero",
                      "city": "Seoul",
                      "postalCode": "04520",
                      "countryCode": "KR"
                    }
                  }
                },
                "externalInternationalFxMad": {
                  "summary": "international-fx — MAD to MA",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Atlas Negoce SARL",
                    "counterPartyEmail": "ap@atlas.example.com",
                    "currency": "MAD",
                    "bankCountryCode": "MA",
                    "bankDetails": {
                      "accountHolderName": "Atlas Negoce SARL",
                      "bankCode": "ABBMMAMC",
                      "accountNumber": "123456789012345678901234"
                    },
                    "address": {
                      "line1": "25 Bd Mohammed V",
                      "city": "Casablanca",
                      "postalCode": "20250",
                      "countryCode": "MA"
                    }
                  }
                },
                "externalInternationalFxMxn": {
                  "summary": "international-fx — MXN to MX",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Comercial Reforma SA de CV",
                    "counterPartyEmail": "ap@reforma.example.com",
                    "currency": "MXN",
                    "bankCountryCode": "MX",
                    "bankDetails": {
                      "accountHolderName": "Comercial Reforma SA de CV",
                      "clabe": "032180000118359719"
                    },
                    "address": {
                      "line1": "Paseo de la Reforma 222",
                      "city": "Mexico City",
                      "postalCode": "06600",
                      "countryCode": "MX"
                    }
                  }
                },
                "externalInternationalFxNgn": {
                  "summary": "international-fx — NGN to NG",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Lagos Trading Ltd",
                    "counterPartyEmail": "ap@lagos.example.com",
                    "currency": "NGN",
                    "bankCountryCode": "NG",
                    "bankDetails": {
                      "accountHolderName": "Lagos Trading Ltd",
                      "bankCode": "ECOCNGLAXXX",
                      "accountNumber": "0584412903"
                    },
                    "address": {
                      "line1": "12 Broad St",
                      "city": "Lagos",
                      "postalCode": "101001",
                      "countryCode": "NG"
                    }
                  }
                },
                "externalInternationalFxNok": {
                  "summary": "international-fx — NOK to NO",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Fjord Handel AS",
                    "counterPartyEmail": "ap@fjord.example.com",
                    "currency": "NOK",
                    "bankCountryCode": "NO",
                    "bankDetails": {
                      "accountHolderName": "Fjord Handel AS",
                      "iban": "DE12345678901234567890"
                    },
                    "address": {
                      "line1": "Karl Johans gate 10",
                      "city": "Oslo",
                      "postalCode": "0154",
                      "countryCode": "NO"
                    }
                  }
                },
                "externalInternationalFxNzd": {
                  "summary": "international-fx — NZD to NZ",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Kiwi Trading Ltd",
                    "counterPartyEmail": "ap@kiwi.example.com",
                    "currency": "NZD",
                    "bankCountryCode": "NZ",
                    "bankDetails": {
                      "accountHolderName": "Kiwi Trading Ltd",
                      "accountNumber": "00-0000-0000000-00"
                    },
                    "address": {
                      "line1": "12 Queen St",
                      "city": "Auckland",
                      "postalCode": "1010",
                      "countryCode": "NZ"
                    }
                  }
                },
                "externalInternationalFxPhp": {
                  "summary": "international-fx — PHP to PH",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Manila Bay Trading Inc",
                    "counterPartyEmail": "ap@manila.example.com",
                    "currency": "PHP",
                    "bankCountryCode": "PH",
                    "bankDetails": {
                      "accountHolderName": "Manila Bay Trading Inc",
                      "bankCode": "ANZ",
                      "accountNumber": "0044123"
                    },
                    "address": {
                      "line1": "1200 Ayala Ave",
                      "city": "Makati",
                      "postalCode": "1226",
                      "countryCode": "PH"
                    }
                  }
                },
                "externalInternationalFxPlnAlt1": {
                  "summary": "international-fx — PLN (local identifiers)",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Wisla Handel Sp. z o.o.",
                    "counterPartyEmail": "ap@wisla.example.com",
                    "currency": "PLN",
                    "bankCountryCode": "PL",
                    "bankDetails": {
                      "accountHolderName": "Wisla Handel Sp. z o.o.",
                      "accountNumber": "12345678901234567890123456"
                    },
                    "address": {
                      "line1": "Nowy Swiat 12",
                      "city": "Warsaw",
                      "postalCode": "00-497",
                      "countryCode": "PL"
                    }
                  }
                },
                "externalInternationalFxPlnAlt2": {
                  "summary": "international-fx — PLN (IBAN)",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Wisla Handel Sp. z o.o.",
                    "counterPartyEmail": "ap@wisla.example.com",
                    "currency": "PLN",
                    "bankCountryCode": "PL",
                    "bankDetails": {
                      "accountHolderName": "Wisla Handel Sp. z o.o.",
                      "iban": "PL12345678901234567890"
                    },
                    "address": {
                      "line1": "Nowy Swiat 12",
                      "city": "Warsaw",
                      "postalCode": "00-497",
                      "countryCode": "PL"
                    }
                  }
                },
                "externalInternationalFxRon": {
                  "summary": "international-fx — RON to RO",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Carpati Comert SRL",
                    "counterPartyEmail": "ap@carpati.example.com",
                    "currency": "RON",
                    "bankCountryCode": "RO",
                    "bankDetails": {
                      "accountHolderName": "Carpati Comert SRL",
                      "iban": "DE12345678901234567890"
                    },
                    "address": {
                      "line1": "Calea Victoriei 20",
                      "city": "Bucharest",
                      "postalCode": "010061",
                      "countryCode": "RO"
                    }
                  }
                },
                "externalInternationalFxSek": {
                  "summary": "international-fx — SEK to SE",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Norrsken Handel AB",
                    "counterPartyEmail": "ap@norrsken.example.com",
                    "currency": "SEK",
                    "bankCountryCode": "SE",
                    "bankDetails": {
                      "accountHolderName": "Norrsken Handel AB",
                      "iban": "SE12345678901234567890"
                    },
                    "address": {
                      "line1": "Drottninggatan 22",
                      "city": "Stockholm",
                      "postalCode": "111 51",
                      "countryCode": "SE"
                    }
                  }
                },
                "externalInternationalFxSgd": {
                  "summary": "international-fx — SGD to SG",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Marina Trading Pte Ltd",
                    "counterPartyEmail": "ap@marina.example.com",
                    "currency": "SGD",
                    "bankCountryCode": "SG",
                    "bankDetails": {
                      "accountHolderName": "Marina Trading Pte Ltd",
                      "bankCode": "BAERSGSGXXX",
                      "accountNumber": "0052312891"
                    },
                    "address": {
                      "line1": "1 Raffles Pl",
                      "city": "Singapore",
                      "postalCode": "048616",
                      "countryCode": "SG"
                    }
                  }
                },
                "externalInternationalFxThb": {
                  "summary": "international-fx — THB to TH",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Chao Phraya Trading Co Ltd",
                    "counterPartyEmail": "ap@chao.example.com",
                    "currency": "THB",
                    "bankCountryCode": "TH",
                    "bankDetails": {
                      "accountHolderName": "Chao Phraya Trading Co Ltd",
                      "bankCode": "BAABTHBK",
                      "accountNumber": "951-7-38426-0"
                    },
                    "address": {
                      "line1": "200 Silom Rd",
                      "city": "Bangkok",
                      "postalCode": "10500",
                      "countryCode": "TH"
                    }
                  }
                },
                "externalInternationalFxTry": {
                  "summary": "international-fx — TRY to TR",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Bogazici Ticaret AS",
                    "counterPartyEmail": "ap@bogazici.example.com",
                    "currency": "TRY",
                    "bankCountryCode": "TR",
                    "bankDetails": {
                      "accountHolderName": "Bogazici Ticaret AS",
                      "iban": "TR320010009999901234567890"
                    },
                    "address": {
                      "line1": "Istiklal Cd 100",
                      "city": "Istanbul",
                      "postalCode": "34430",
                      "countryCode": "TR"
                    }
                  }
                },
                "externalInternationalFxVnd": {
                  "summary": "international-fx — VND to VN",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Saigon Trading Co Ltd",
                    "counterPartyEmail": "ap@saigon.example.com",
                    "currency": "VND",
                    "bankCountryCode": "VN",
                    "bankDetails": {
                      "accountHolderName": "Saigon Trading Co Ltd",
                      "bic": "ABBKVNVX",
                      "accountNumber": "1234567890"
                    },
                    "address": {
                      "line1": "12 Nguyen Hue",
                      "city": "Ho Chi Minh City",
                      "postalCode": "700000",
                      "countryCode": "VN"
                    }
                  }
                },
                "externalInternationalFxZar": {
                  "summary": "international-fx — ZAR to ZA",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-fx",
                    "counterPartyName": "Table Bay Trading Pty Ltd",
                    "counterPartyEmail": "ap@table.example.com",
                    "currency": "ZAR",
                    "bankCountryCode": "ZA",
                    "bankDetails": {
                      "accountHolderName": "Table Bay Trading Pty Ltd",
                      "bic": "ABSAZAJJ",
                      "accountNumber": "00052312891",
                      "zarIdentificationNumber": "7901011234083",
                      "email": "ap@table.example.com"
                    },
                    "address": {
                      "line1": "12 Long St",
                      "city": "Cape Town",
                      "postalCode": "8001",
                      "countryCode": "ZA"
                    }
                  }
                },
                "externalInternationalGusd": {
                  "summary": "international-gusd — stablecoin wallet (USD-denominated)",
                  "value": {
                    "ownershipType": "external",
                    "type": "international-gusd",
                    "counterPartyName": "Meridian Digital Ltd",
                    "counterPartyEmail": "ap@meridian.example.com",
                    "walletAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Account created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                },
                "examples": {
                  "internalAch": {
                    "summary": "Internal ACH account",
                    "value": {
                      "id": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                      "ownershipType": "internal",
                      "type": "ach",
                      "nickname": "Operating account",
                      "isVerified": true,
                      "bankAccount": {
                        "accountType": "checking",
                        "routingNumber": "021000021",
                        "accountNumberLast4": "6789"
                      },
                      "createdAt": "2026-07-08T15:04:05Z",
                      "updatedAt": "2026-07-08T15:04:05Z"
                    }
                  },
                  "internalPlaid": {
                    "summary": "Internal Plaid account (returned as type ach)",
                    "value": {
                      "id": "acct_5e6f7a8b-1c2d-4e3f-9a0b-1c2d3e4f5a6b",
                      "ownershipType": "internal",
                      "type": "ach",
                      "nickname": "Business checking",
                      "isVerified": true,
                      "bankAccount": {
                        "accountType": "checking",
                        "routingNumber": "011401533",
                        "accountNumberLast4": "0000"
                      },
                      "createdAt": "2026-07-08T15:04:30Z",
                      "updatedAt": "2026-07-08T15:04:30Z"
                    }
                  },
                  "internalCard": {
                    "summary": "Internal card account",
                    "value": {
                      "id": "acct_15648478-270c-4d9b-855c-92e0466edaa1",
                      "ownershipType": "internal",
                      "type": "card",
                      "nickname": "Corporate card",
                      "isVerified": true,
                      "card": {
                        "lastFourDigits": "1111",
                        "network": "Visa",
                        "expiration": "07/27"
                      },
                      "createdAt": "2026-07-08T15:04:45Z",
                      "updatedAt": "2026-07-08T15:04:45Z"
                    }
                  },
                  "externalAch": {
                    "summary": "External ACH account",
                    "value": {
                      "id": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                      "ownershipType": "external",
                      "type": "ach",
                      "counterPartyName": "Globex Manufacturing",
                      "counterPartyEmail": "ap@globex.example.com",
                      "bankAccount": {
                        "accountType": "checking",
                        "routingNumber": "111000025",
                        "accountNumberLast4": "4321"
                      },
                      "createdAt": "2026-07-08T15:05:00Z",
                      "updatedAt": "2026-07-08T15:05:00Z"
                    }
                  },
                  "externalCheck": {
                    "summary": "External paper-check account",
                    "value": {
                      "id": "acct_8be01c32-9378-4aad-9f0d-229e4454259c",
                      "ownershipType": "external",
                      "type": "check",
                      "counterPartyName": "Initech",
                      "counterPartyEmail": "ap@initech.example.com",
                      "paperCheck": {
                        "printName": "Initech",
                        "address": {
                          "line1": "500 Market St",
                          "city": "San Francisco",
                          "state": "CA",
                          "postalCode": "94105"
                        }
                      },
                      "createdAt": "2026-07-08T15:05:15Z",
                      "updatedAt": "2026-07-08T15:05:15Z"
                    }
                  },
                  "externalDomesticWire": {
                    "summary": "External domestic-wire account",
                    "value": {
                      "id": "acct_ecbd32e8-7be4-4d91-a0fd-19bf2b6eca44",
                      "ownershipType": "external",
                      "type": "domestic-wire",
                      "counterPartyName": "Wayne Enterprises",
                      "counterPartyEmail": "ap@wayne.example.com",
                      "domesticWire": {
                        "routingNumber": "021000021",
                        "accountNumberLast4": "7654",
                        "address": {
                          "line1": "1007 Mountain Drive",
                          "city": "Gotham",
                          "state": "NJ",
                          "postalCode": "07001"
                        }
                      },
                      "createdAt": "2026-07-08T15:05:30Z",
                      "updatedAt": "2026-07-08T15:05:30Z"
                    }
                  },
                  "externalVirtualCard": {
                    "summary": "External virtual-card account",
                    "value": {
                      "id": "acct_62b00efd-e3fd-4be9-9376-949257669ba9",
                      "ownershipType": "external",
                      "type": "virtual-card",
                      "counterPartyName": "Stark Industries",
                      "counterPartyEmail": "payments@stark.example.com",
                      "createdAt": "2026-07-08T15:05:45Z",
                      "updatedAt": "2026-07-08T15:05:45Z"
                    }
                  },
                  "externalCounterpartyChoice": {
                    "summary": "External counterparty-choice account, waiting for the counterparty's details",
                    "value": {
                      "id": "acct_8d1c5e2a-4b7f-4f0e-9a63-1e2b3c4d5e6f",
                      "ownershipType": "external",
                      "type": "counterparty-choice",
                      "counterPartyName": "Wayne Enterprises",
                      "counterPartyEmail": "ap@wayne.example.com",
                      "createdAt": "2026-07-08T15:05:50Z",
                      "updatedAt": "2026-07-08T15:05:50Z"
                    }
                  },
                  "externalInternationalFx": {
                    "summary": "External international (FX) account",
                    "value": {
                      "id": "acct_2a4f9c31-77ad-4c1e-8b52-6d3f0a91c4e7",
                      "ownershipType": "external",
                      "type": "international-fx",
                      "counterPartyName": "Muster GmbH",
                      "counterPartyEmail": "ap@muster.example.de",
                      "internationalFx": {
                        "currency": "EUR",
                        "bankCountryCode": "DE",
                        "bankName": "Deutsche Bank",
                        "accountIdentifierLast4": "3000",
                        "address": {
                          "line1": "Unter den Linden 5",
                          "city": "Berlin",
                          "postalCode": "10117",
                          "countryCode": "DE"
                        }
                      },
                      "createdAt": "2026-07-08T15:06:00Z",
                      "updatedAt": "2026-07-08T15:06:00Z"
                    }
                  },
                  "externalInternationalGusd": {
                    "summary": "External international (GUSD) account",
                    "value": {
                      "id": "acct_c7d1e5b2-4a90-4f38-9e6c-1b8a2f7d0c53",
                      "ownershipType": "external",
                      "type": "international-gusd",
                      "counterPartyName": "Northwind Trading Ltd",
                      "counterPartyEmail": "ap@northwind.example.sg",
                      "internationalGusd": {
                        "walletAddressLast4": "9xQz"
                      },
                      "createdAt": "2026-07-08T15:06:15Z",
                      "updatedAt": "2026-07-08T15:06:15Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation error, or an unsupported currency for an international account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The scoped token cannot create this account type, the business is restricted by a risk/compliance limitation from adding an internal account (BUSINESS_NOT_ELIGIBLE), or international accounts are not enabled for this partner (INTERNATIONAL_NOT_ENABLED).\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Entity not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict: an account already exists for this resource (DUPLICATE_ACCOUNT), the `externalId` is already used by another account (DUPLICATE_EXTERNAL_ID), the `Idempotency-Key` was reused with a different body (IDEMPOTENCY_KEY_REUSED) / is still being processed by an earlier request (IDEMPOTENCY_KEY_IN_PROGRESS), or the business has not completed international onboarding (ENTITY_ONBOARDING_INCOMPLETE).\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "type": "conflict_error",
                    "code": "DUPLICATE_EXTERNAL_ID",
                    "message": "An account with externalId 'partner-acct-42' already exists."
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Accounts"
        ],
        "summary": "List accounts",
        "description": "Returns the entity's accounts. Any internal Plaid account that isn't yet verified has its verification status refreshed from Plaid before the response is returned.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "ownershipType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "internal",
                "external"
              ]
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ach",
                "check",
                "card",
                "domestic-wire",
                "virtual-card",
                "counterparty-choice"
              ]
            }
          },
          {
            "name": "externalId",
            "in": "query",
            "required": false,
            "description": "Return only the account whose `externalId` matches (your own id).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "metadata",
            "in": "query",
            "required": false,
            "style": "deepObject",
            "explode": true,
            "description": "Filter by metadata key/value pairs, e.g. `metadata[ledgerId]=L-9`. Matches accounts whose metadata contains every supplied pair.\n",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Accounts.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Account"
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                      "ownershipType": "external",
                      "type": "ach",
                      "counterPartyName": "Globex Manufacturing",
                      "counterPartyEmail": "ap@globex.example.com",
                      "bankAccount": {
                        "accountType": "checking",
                        "routingNumber": "111000025",
                        "accountNumberLast4": "4321"
                      },
                      "createdAt": "2026-07-08T15:05:00Z",
                      "updatedAt": "2026-07-08T15:05:00Z"
                    },
                    {
                      "id": "acct_8be01c32-9378-4aad-9f0d-229e4454259c",
                      "ownershipType": "external",
                      "type": "check",
                      "counterPartyName": "Initech",
                      "counterPartyEmail": "ap@initech.example.com",
                      "paperCheck": {
                        "printName": "Initech",
                        "address": {
                          "line1": "500 Market St",
                          "city": "San Francisco",
                          "state": "CA",
                          "postalCode": "94105"
                        }
                      },
                      "createdAt": "2026-07-08T15:05:15Z",
                      "updatedAt": "2026-07-08T15:05:15Z"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/accounts/link": {
      "parameters": [
        {
          "$ref": "#/components/parameters/MelioEntityId"
        }
      ],
      "post": {
        "tags": [
          "Accounts"
        ],
        "summary": "Create a link to add a Plaid or card account",
        "description": "Returns a short-lived link you hand to the entity. Opening it takes them to a Melio-hosted page that runs the Plaid or card flow and adds the internal account for them, so bank and card details never pass through your servers. Authenticate with your api-key.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/MelioSonarToken"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAccountLinkRequest"
              },
              "examples": {
                "plaid": {
                  "summary": "Mint a link that runs the Plaid flow",
                  "value": {
                    "type": "plaid"
                  }
                },
                "card": {
                  "summary": "Mint a link that runs the card flow",
                  "value": {
                    "type": "card"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Link created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AccountLink"
                    }
                  }
                },
                "example": {
                  "data": {
                    "url": "https://developers.melio.com/accounts/add?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9&type=plaid",
                    "expiration": "2026-07-08T16:04:05Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The business is restricted by a risk/compliance limitation from adding an internal account (BUSINESS_NOT_ELIGIBLE).\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "type": "authorization_error",
                    "code": "BUSINESS_NOT_ELIGIBLE",
                    "message": "Business is not eligible to add an internal account. See the limitations endpoint for details."
                  }
                }
              }
            }
          },
          "404": {
            "description": "Entity not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/accounts/{accountId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/MelioEntityId"
        },
        {
          "name": "accountId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "Accounts"
        ],
        "summary": "Get an account",
        "description": "Returns a single account. If it's an internal Plaid account that isn't yet verified, its verification status is refreshed from Plaid before the response is returned.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                },
                "example": {
                  "id": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                  "ownershipType": "internal",
                  "type": "ach",
                  "nickname": "Operating account",
                  "isVerified": false,
                  "bankAccount": {
                    "accountType": "checking",
                    "routingNumber": "021000021",
                    "accountNumberLast4": "6789"
                  },
                  "createdAt": "2026-07-08T15:04:05Z",
                  "updatedAt": "2026-07-08T15:04:05Z"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Accounts"
        ],
        "summary": "Delete an account",
        "description": "Deletes an account. An account referenced by any payment can't be deleted.",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "204": {
            "description": "Account deleted."
          },
          "403": {
            "description": "The business is restricted by a risk/compliance limitation from modifying its accounts (BUSINESS_NOT_ELIGIBLE).\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "type": "authorization_error",
                    "code": "BUSINESS_NOT_ELIGIBLE",
                    "message": "Business is not eligible to modify its accounts. See the limitations endpoint for details."
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "The account is referenced by one or more payments and cannot be deleted (ACCOUNT_IN_USE).\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "type": "conflict_error",
                    "code": "ACCOUNT_IN_USE",
                    "message": "Account cannot be deleted because it is referenced by one or more payments"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/accounts/{accountId}/verify/link": {
      "parameters": [
        {
          "$ref": "#/components/parameters/MelioEntityId"
        },
        {
          "name": "accountId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "Accounts"
        ],
        "summary": "Create a link to verify a Plaid account",
        "description": "For an unverified internal Plaid account, returns a short-lived link you hand to the entity. Opening it takes them to a Melio-hosted page where they complete same-day micro-deposit verification in Plaid. Authenticate with your api-key.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/MelioSonarToken"
          }
        ],
        "responses": {
          "201": {
            "description": "Link created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/AccountLink"
                    }
                  }
                },
                "example": {
                  "data": {
                    "url": "https://developers.melio.com/accounts/verify?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9&type=plaid",
                    "expiration": "2026-07-08T16:04:05Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The business is restricted by a risk/compliance limitation from adding an internal account (BUSINESS_NOT_ELIGIBLE).\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "type": "authorization_error",
                    "code": "BUSINESS_NOT_ELIGIBLE",
                    "message": "Business is not eligible to add an internal account. See the limitations endpoint for details."
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/attachments": {
      "parameters": [
        {
          "$ref": "#/components/parameters/MelioEntityId"
        }
      ],
      "post": {
        "tags": [
          "Attachments"
        ],
        "summary": "Upload an attachment",
        "description": "Stores a supporting document for the entity and returns an opaque id you can pass as `attachmentId` when creating a payment. Upload once, reference from as many payments as you need.\n\nSend `multipart/form-data` with the document in a part named `file`. PDF, JPEG and PNG are accepted, up to 8 MB. The bytes are not readable back through this API — only the metadata below is returned.\n\nThe main reason to use this: some international destinations will not accept a payment without a supporting document, and `POST /payments` then fails with `400 ATTACHMENT_REQUIRED`. See `attachmentId` on the payment request.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The document: PDF, JPEG or PNG, up to 8 MB."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Attachment stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Attachment"
                },
                "examples": {
                  "invoice": {
                    "summary": "An uploaded invoice",
                    "value": {
                      "id": "att_9f8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
                      "fileName": "invoice-2043.pdf",
                      "mimeType": "application/pdf",
                      "byteSize": 182734,
                      "createdAt": "2026-09-07T10:15:00.000Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing file, unsupported type, or the file could not be stored.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "unsupportedType": {
                    "summary": "Unsupported file type",
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "VALIDATION_ERROR",
                        "message": "Invalid file type: text/csv. Supported types are application/pdf, image/jpeg, image/png."
                      }
                    }
                  },
                  "uploadFailed": {
                    "summary": "The document could not be stored",
                    "value": {
                      "error": {
                        "type": "invalid_request_error",
                        "code": "ATTACHMENT_UPLOAD_FAILED",
                        "message": "The attachment could not be stored. Check the file type and try again."
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Entity not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/payments": {
      "parameters": [
        {
          "$ref": "#/components/parameters/MelioEntityId"
        }
      ],
      "get": {
        "tags": [
          "Payments"
        ],
        "summary": "List payments",
        "description": "Returns the entity's payments, newest first. Use the filters below to narrow the list; they can be combined with each other and with pagination.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/StartingAfter"
          },
          {
            "$ref": "#/components/parameters/EndingBefore"
          },
          {
            "name": "externalId",
            "in": "query",
            "required": false,
            "description": "Return only the payment whose `externalId` matches (your own id).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Filter by payment status.",
            "schema": {
              "type": "string",
              "enum": [
                "scheduled",
                "in-progress",
                "completed",
                "failed",
                "canceled"
              ]
            }
          },
          {
            "name": "originatingAccountId",
            "in": "query",
            "required": false,
            "description": "Return only payments drawn from this internal originating account (acct_<id>).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "receivingAccountId",
            "in": "query",
            "required": false,
            "description": "Return only payments sent to this external receiving account (acct_<id>).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "created[gte]",
            "in": "query",
            "required": false,
            "description": "Return payments created at or after this RFC 3339 timestamp.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "created[lte]",
            "in": "query",
            "required": false,
            "description": "Return payments created at or before this RFC 3339 timestamp.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "metadata",
            "in": "query",
            "required": false,
            "style": "deepObject",
            "explode": true,
            "description": "Filter by metadata key/value pairs, e.g. `metadata[invoiceId]=INV-42`. Matches payments whose metadata contains every supplied pair.\n",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of payments, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentList"
                },
                "examples": {
                  "firstPage": {
                    "summary": "First page (limit=2, more available)",
                    "value": {
                      "hasMore": true,
                      "data": [
                        {
                          "id": "pay_9f8c7b6a5d4e3f21",
                          "externalId": "invoice-2043",
                          "amount": 125000,
                          "currency": "USD",
                          "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                          "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                          "deductionDate": "2026-07-10",
                          "deliveryPreference": "standard-ach",
                          "deliveryDate": "2026-07-14",
                          "status": "scheduled",
                          "metadata": {
                            "invoiceId": "INV-2043",
                            "department": "operations"
                          },
                          "fees": [],
                          "createdAt": "2026-07-08T15:04:05Z",
                          "updatedAt": "2026-07-08T15:04:05Z"
                        },
                        {
                          "id": "pay_1a2b3c4d5e6f7a8b",
                          "externalId": "invoice-2041",
                          "amount": 4200,
                          "currency": "USD",
                          "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                          "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                          "deductionDate": "2026-07-09",
                          "deliveryPreference": "same-day-ach",
                          "deliveryDate": "2026-07-11",
                          "status": "completed",
                          "metadata": {},
                          "fees": [
                            {
                              "type": "same-day-ach",
                              "chargeTo": "originator",
                              "percent": {
                                "rate": 0.5,
                                "max": 3000
                              },
                              "amount": 21,
                              "status": "charged"
                            }
                          ],
                          "tracking": {
                            "type": "ach",
                            "traceNumber": "021000021234567",
                            "sentAt": "2026-07-09T18:30:00Z",
                            "clearedAt": "2026-07-11T07:15:00Z"
                          },
                          "createdAt": "2026-07-07T09:22:00Z",
                          "updatedAt": "2026-07-07T09:22:00Z"
                        }
                      ]
                    }
                  },
                  "lastPage": {
                    "summary": "Final page (hasMore=false)",
                    "value": {
                      "hasMore": false,
                      "data": [
                        {
                          "id": "pay_0000111122223333",
                          "externalId": "invoice-1900",
                          "amount": 8000,
                          "currency": "USD",
                          "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                          "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                          "deductionDate": "2026-06-30",
                          "deliveryPreference": "standard-ach",
                          "deliveryDate": "2026-07-02",
                          "status": "completed",
                          "metadata": {},
                          "fees": [],
                          "tracking": {
                            "type": "ach",
                            "traceNumber": "021000029876543",
                            "sentAt": "2026-06-30T18:30:00Z",
                            "clearedAt": "2026-07-02T07:05:00Z"
                          },
                          "createdAt": "2026-06-29T12:00:00Z",
                          "updatedAt": "2026-06-29T12:00:00Z"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Entity not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Payments"
        ],
        "summary": "Create a payment",
        "description": "Creates a payment from one of the entity's internal accounts to one of its external accounts. An `Idempotency-Key` header is required so the request is safe to retry.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Required unique key (UUID recommended) that makes payment creation safe to retry by replaying the original response; retained 24h per partner, omitting it returns 400.\n",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          },
          {
            "$ref": "#/components/parameters/MelioSonarToken"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePaymentRequest"
              },
              "examples": {
                "bankFunded": {
                  "summary": "Bank (ACH) originating account, standard ACH delivery",
                  "value": {
                    "amount": 125000,
                    "currency": "USD",
                    "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                    "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                    "deductionDate": "2026-07-10",
                    "deliveryPreference": "standard-ach",
                    "compliance": {
                      "type": "goods-and-services"
                    },
                    "externalId": "invoice-2043",
                    "noteToRecipient": "July materials order",
                    "metadata": {
                      "invoiceId": "INV-2043",
                      "department": "operations"
                    }
                  }
                },
                "cardFunded": {
                  "summary": "Card originating account — same-day-ach (standard-ach is rejected for card) and card compliance",
                  "value": {
                    "amount": 125000,
                    "currency": "USD",
                    "originatingAccountId": "acct_5c1f0e88-2d1b-4a6a-9f3e-8a4b6c2d1e0f",
                    "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                    "deductionDate": "2026-07-10",
                    "deliveryPreference": "same-day-ach",
                    "compliance": {
                      "type": "goods-and-services",
                      "goodsReceived": true,
                      "card": {
                        "merchantCategoryCode": "5045",
                        "merchantAddress": {
                          "line1": "350 5th Ave",
                          "city": "New York",
                          "state": "NY",
                          "postalCode": "10118"
                        }
                      }
                    },
                    "externalId": "invoice-2044",
                    "noteToRecipient": "July materials order"
                  }
                },
                "internationalFxWithQuote": {
                  "summary": "international-fx — CreateFxPaymentRequest with a locked rate and a supporting document",
                  "value": {
                    "amount": 100000,
                    "currency": "EUR",
                    "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                    "receivingAccountId": "acct_7d4e2a10-6c93-4f57-b8a1-2e5f0c9d4b3a",
                    "deductionDate": "2026-07-10",
                    "deliveryPreference": "international-fx",
                    "fxQuoteToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbW91bnQiOjEwMDAwMH0.6bJ0kQ",
                    "attachmentId": "att_9f8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
                    "compliance": {
                      "type": "goods-and-services",
                      "purpose": "payment for consulting services"
                    },
                    "externalId": "invoice-2045",
                    "noteToRecipient": "Q3 design retainer",
                    "metadata": {
                      "invoiceId": "INV-2045"
                    }
                  }
                },
                "internationalFxAtMarketRate": {
                  "summary": "international-fx — no quote token, so the rate at creation applies (purpose is still required)",
                  "value": {
                    "amount": 100000,
                    "currency": "EUR",
                    "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                    "receivingAccountId": "acct_7d4e2a10-6c93-4f57-b8a1-2e5f0c9d4b3a",
                    "deductionDate": "2026-07-10",
                    "deliveryPreference": "international-fx",
                    "compliance": {
                      "type": "goods-and-services",
                      "purpose": "payment for consulting services"
                    },
                    "externalId": "invoice-2046"
                  }
                },
                "internationalFxPurposeCode": {
                  "summary": "international-fx to a corridor that takes a purpose code instead of free text (INR)",
                  "value": {
                    "amount": 850000,
                    "currency": "INR",
                    "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                    "receivingAccountId": "acct_2c8b6f41-9a07-4d12-8e35-7b1f4a6d0c92",
                    "deductionDate": "2026-07-10",
                    "deliveryPreference": "international-fx",
                    "compliance": {
                      "type": "goods-and-services",
                      "purpose": "SOFTWARE_EXPORT"
                    },
                    "externalId": "invoice-2047"
                  }
                },
                "internationalGusd": {
                  "summary": "international-gusd — dollar-denominated, so it is a CreateUsdPaymentRequest (no currency, token or purpose)",
                  "value": {
                    "amount": 125000,
                    "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                    "receivingAccountId": "acct_4a9d1e73-5b28-4c06-9f14-3d8e2b7a6c50",
                    "deductionDate": "2026-07-10",
                    "deliveryPreference": "international-gusd",
                    "compliance": {
                      "type": "goods-and-services"
                    },
                    "externalId": "invoice-2048"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Payment created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payment"
                },
                "examples": {
                  "bankFunded": {
                    "summary": "Bank-funded standard ACH payment",
                    "value": {
                      "id": "pay_9f8c7b6a5d4e3f21",
                      "externalId": "invoice-2043",
                      "amount": 125000,
                      "currency": "USD",
                      "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                      "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                      "deductionDate": "2026-07-10",
                      "deliveryPreference": "standard-ach",
                      "deliveryDate": "2026-07-14",
                      "status": "scheduled",
                      "noteToRecipient": "July materials order",
                      "metadata": {
                        "invoiceId": "INV-2043",
                        "department": "operations"
                      },
                      "fees": [],
                      "createdAt": "2026-07-08T15:04:05Z",
                      "updatedAt": "2026-07-08T15:04:05Z"
                    }
                  },
                  "cardFunded": {
                    "summary": "Card-funded payment — reports the fast name, delivers same business day",
                    "value": {
                      "id": "pay_1b2c3d4e5f6a7b8c",
                      "externalId": "invoice-2044",
                      "amount": 125000,
                      "currency": "USD",
                      "originatingAccountId": "acct_5c1f0e88-2d1b-4a6a-9f3e-8a4b6c2d1e0f",
                      "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                      "deductionDate": "2026-07-10",
                      "deliveryPreference": "same-day-ach",
                      "deliveryDate": "2026-07-10",
                      "status": "scheduled",
                      "noteToRecipient": "July materials order",
                      "fees": [],
                      "createdAt": "2026-07-08T15:04:05Z",
                      "updatedAt": "2026-07-08T15:04:05Z"
                    }
                  },
                  "internationalFx": {
                    "summary": "Converted payment — reported in the currency the counterparty receives",
                    "value": {
                      "id": "pay_4d5e6f7a8b9c0d1e",
                      "externalId": "invoice-2045",
                      "amount": 100000,
                      "currency": "EUR",
                      "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                      "receivingAccountId": "acct_7d4e2a10-6c93-4f57-b8a1-2e5f0c9d4b3a",
                      "deductionDate": "2026-07-10",
                      "deliveryPreference": "international-fx",
                      "deliveryDate": "2026-07-16",
                      "status": "scheduled",
                      "noteToRecipient": "Q3 design retainer",
                      "metadata": {
                        "invoiceId": "INV-2045"
                      },
                      "fees": [],
                      "createdAt": "2026-07-08T15:04:05Z",
                      "updatedAt": "2026-07-08T15:04:05Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation error, the required `Idempotency-Key` header is missing (IDEMPOTENCY_KEY_REQUIRED), the originating account is a bank account that has not been verified yet (ACCOUNT_NOT_VERIFIED).\n\nOn a converted payment also: a quote token that is expired or was issued for a different amount or currency (FX_QUOTE_INVALID), and a destination that will not accept the payment without a supporting document (ATTACHMENT_REQUIRED).\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "type": "invalid_request_error",
                    "code": "ACCOUNT_NOT_VERIFIED",
                    "message": "The originating account must be verified before it can be used to create a payment"
                  }
                }
              }
            }
          },
          "403": {
            "description": "The business is restricted by a risk/compliance limitation from making payments (BUSINESS_NOT_ELIGIBLE).\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "type": "authorization_error",
                    "code": "BUSINESS_NOT_ELIGIBLE",
                    "message": "Business is not eligible to make payments. See the limitations endpoint for details."
                  }
                }
              }
            }
          },
          "404": {
            "description": "Entity / internal account / external account not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "A payment already exists for this request (DUPLICATE_PAYMENT), the `externalId` is already used by another payment (DUPLICATE_EXTERNAL_ID), or the `Idempotency-Key` was reused with a different body (IDEMPOTENCY_KEY_REUSED) / is still being processed by an earlier request (IDEMPOTENCY_KEY_IN_PROGRESS).\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "type": "conflict_error",
                    "code": "DUPLICATE_EXTERNAL_ID",
                    "message": "A payment with externalId 'invoice-2043' already exists."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/payments/{paymentId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/MelioEntityId"
        },
        {
          "name": "paymentId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "tags": [
          "Payments"
        ],
        "summary": "Get a payment",
        "description": "Returns a single payment by its Melio id (`pay_<id>`). To look one up by your own identifier instead, list payments with `?externalId=`.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payment"
                },
                "examples": {
                  "scheduled": {
                    "summary": "Scheduled — no tracking yet",
                    "description": "The payment has not begun delivery, so `tracking` is absent. It appears once the delivery transfer is submitted.\n",
                    "value": {
                      "id": "pay_9f8c7b6a5d4e3f21",
                      "externalId": "invoice-2043",
                      "amount": 125000,
                      "currency": "USD",
                      "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                      "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                      "deductionDate": "2026-07-10",
                      "deliveryPreference": "standard-ach",
                      "deliveryDate": "2026-07-14",
                      "status": "scheduled",
                      "metadata": {
                        "invoiceId": "INV-2043",
                        "department": "operations"
                      },
                      "fees": [
                        {
                          "type": "standard-ach",
                          "chargeTo": "originator",
                          "fixed": {
                            "value": 50
                          },
                          "amount": 50,
                          "status": "charged"
                        }
                      ],
                      "createdAt": "2026-07-08T15:04:05Z",
                      "updatedAt": "2026-07-08T15:04:05Z"
                    }
                  },
                  "inProgressAch": {
                    "summary": "ACH in flight — trace number, not yet cleared",
                    "description": "The delivery transfer has been submitted, so `traceNumber` and `sentAt` are set. `clearedAt` is still absent and fills in once the transfer settles.\n",
                    "value": {
                      "id": "pay_9f8c7b6a5d4e3f21",
                      "externalId": "invoice-2043",
                      "amount": 125000,
                      "currency": "USD",
                      "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                      "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                      "deductionDate": "2026-07-10",
                      "deliveryPreference": "standard-ach",
                      "deliveryDate": "2026-07-14",
                      "status": "in-progress",
                      "metadata": {
                        "invoiceId": "INV-2043",
                        "department": "operations"
                      },
                      "fees": [
                        {
                          "type": "standard-ach",
                          "chargeTo": "originator",
                          "fixed": {
                            "value": 50
                          },
                          "amount": 50,
                          "status": "charged"
                        }
                      ],
                      "tracking": {
                        "type": "ach",
                        "traceNumber": "021000021234567",
                        "sentAt": "2026-07-12T18:30:00Z"
                      },
                      "createdAt": "2026-07-08T15:04:05Z",
                      "updatedAt": "2026-07-12T18:30:00Z"
                    }
                  },
                  "completedCheck": {
                    "summary": "Check delivered — serial number and the full date trail",
                    "description": "A paper check that has been printed, mailed and deposited. `checkNumber` is the serial number printed on the check.\n",
                    "value": {
                      "id": "pay_4c3b2a1908f7e6d5",
                      "externalId": "invoice-2050",
                      "amount": 72500,
                      "currency": "USD",
                      "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                      "receivingAccountId": "acct_7c2f91aa-55e8-4a1e-9f3b-6d8c01f2a4b7",
                      "deductionDate": "2026-07-01",
                      "deliveryPreference": "standard-check",
                      "deliveryDate": "2026-07-09",
                      "status": "completed",
                      "metadata": {
                        "invoiceId": "INV-2050"
                      },
                      "fees": [
                        {
                          "type": "standard-check",
                          "chargeTo": "originator",
                          "fixed": {
                            "value": 150
                          },
                          "amount": 150,
                          "status": "charged"
                        }
                      ],
                      "tracking": {
                        "type": "check",
                        "checkNumber": "90210",
                        "issuedAt": "2026-07-01T16:00:00Z",
                        "mailedAt": "2026-07-02T14:20:00Z",
                        "clearedAt": "2026-07-09T11:45:00Z"
                      },
                      "createdAt": "2026-06-29T10:11:12Z",
                      "updatedAt": "2026-07-09T11:45:00Z"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Payments"
        ],
        "summary": "Update a payment",
        "description": "Updates a payment while its `status` is still `scheduled`. Once processing has begun, the request returns `409 PAYMENT_NOT_EDITABLE`. Once the receiver has upgraded the payment (see `receiverUpgrade`), it can no longer be updated and the request returns `409 PAYMENT_UPGRADED_BY_RECEIVER`. Only the fields you send are changed.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/MelioSonarToken"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePaymentRequest"
              },
              "example": {
                "deliveryPreference": "rtp",
                "noteToRecipient": "Invoice 42 (updated)",
                "metadata": {
                  "invoiceId": "INV-2043"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payment"
                },
                "example": {
                  "id": "pay_9f8c7b6a5d4e3f21",
                  "externalId": "invoice-2043",
                  "amount": 125000,
                  "currency": "USD",
                  "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                  "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                  "deductionDate": "2026-07-10",
                  "deliveryPreference": "rtp",
                  "deliveryDate": "2026-07-10",
                  "status": "scheduled",
                  "noteToRecipient": "Invoice 42 (updated)",
                  "metadata": {
                    "invoiceId": "INV-2043"
                  },
                  "fees": [],
                  "createdAt": "2026-07-08T15:04:05Z",
                  "updatedAt": "2026-07-08T15:12:00Z"
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "The business is restricted by a risk/compliance limitation from making payments (BUSINESS_NOT_ELIGIBLE).\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "type": "authorization_error",
                    "code": "BUSINESS_NOT_ELIGIBLE",
                    "message": "Business is not eligible to make payments. See the limitations endpoint for details."
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "The payment has begun processing and can no longer be edited (PAYMENT_NOT_EDITABLE), or the receiver upgraded it (PAYMENT_UPGRADED_BY_RECEIVER)\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/payments/{paymentId}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/MelioEntityId"
        },
        {
          "name": "paymentId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "tags": [
          "Payments"
        ],
        "summary": "Cancel a payment",
        "description": "Cancels a payment while its `status` is still `scheduled` — i.e. before it begins processing. The payment moves to `status: canceled` and the response is `200`.\n\nThe one exception is a check that has already been issued but has not yet cleared: canceling it voids the check and refunds the originating account. That runs asynchronously, so the response is `202` and the payment keeps its current `status` until the void completes — poll the payment to observe the result. A check that has already cleared cannot be voided.\n\nIn every other case, once processing has begun, the request returns `409 PAYMENT_NOT_CANCELABLE`.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The canceled payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payment"
                },
                "example": {
                  "id": "pay_9f8c7b6a5d4e3f21",
                  "externalId": "invoice-2043",
                  "amount": 125000,
                  "currency": "USD",
                  "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                  "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                  "deductionDate": "2026-07-10",
                  "deliveryPreference": "standard-ach",
                  "deliveryDate": "2026-07-14",
                  "status": "canceled",
                  "metadata": {
                    "invoiceId": "INV-2043"
                  },
                  "fees": [],
                  "createdAt": "2026-07-08T15:04:05Z",
                  "updatedAt": "2026-07-08T15:20:00Z"
                }
              }
            }
          },
          "202": {
            "description": "The cancel was accepted: the issued check is being voided and the originating account refunded. The payment keeps its current status until the void completes.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payment"
                },
                "example": {
                  "id": "pay_9f8c7b6a5d4e3f21",
                  "externalId": "invoice-2043",
                  "amount": 125000,
                  "currency": "USD",
                  "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                  "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                  "deductionDate": "2026-07-10",
                  "deliveryPreference": "standard-check",
                  "deliveryDate": "2026-07-14",
                  "status": "in-progress",
                  "tracking": {
                    "type": "check",
                    "checkNumber": "48217",
                    "issuedAt": "2026-07-10T00:00:00Z",
                    "mailedAt": "2026-07-11T00:00:00Z"
                  },
                  "metadata": {
                    "invoiceId": "INV-2043"
                  },
                  "fees": [],
                  "createdAt": "2026-07-08T15:04:05Z",
                  "updatedAt": "2026-07-08T15:20:00Z"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "The payment has begun processing and can no longer be canceled, and is not a voidable issued check (PAYMENT_NOT_CANCELABLE)\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/tools/fee-calculator": {
      "parameters": [
        {
          "$ref": "#/components/parameters/MelioEntityId"
        }
      ],
      "post": {
        "tags": [
          "Tools"
        ],
        "summary": "Calculate fees",
        "description": "Estimates the fees for a payment between two of the entity's accounts, without creating one. Fees depend on the originating account, the receiving account, the `deliveryPreference`, and the `amount`. All amounts are in minor units (cents).\n\nFor a payment that converts currency this prices the fees only; use `POST /tools/fx-quote` for the exchange rate and the amount that would be debited.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CalculateFeesRequest"
              },
              "examples": {
                "bankFunded": {
                  "summary": "Bank (ACH) originating account, same-day ACH",
                  "value": {
                    "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                    "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                    "deliveryPreference": "same-day-ach",
                    "amount": 125000
                  }
                },
                "cardFunded": {
                  "summary": "Card originating account (same-day-ach is the card ACH value)",
                  "value": {
                    "originatingAccountId": "acct_5c1f0e88-2d1b-4a6a-9f3e-8a4b6c2d1e0f",
                    "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                    "deliveryPreference": "same-day-ach",
                    "amount": 125000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculated fees.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Fee"
                  }
                },
                "examples": {
                  "bankFunded": {
                    "summary": "Bank-funded same-day ACH — the fast-delivery fee applies",
                    "value": [
                      {
                        "type": "same-day-ach",
                        "chargeTo": "originator",
                        "percent": {
                          "rate": 0.5,
                          "max": 3000
                        },
                        "amount": 625
                      }
                    ]
                  },
                  "cardFunded": {
                    "summary": "Card-funded same-day ACH — card fee plus standard-speed delivery pricing (no fast surcharge)",
                    "value": [
                      {
                        "type": "card",
                        "chargeTo": "originator",
                        "percent": {
                          "rate": 2.9
                        },
                        "amount": 3625
                      }
                    ]
                  },
                  "internationalFx": {
                    "summary": "Converted payment — fees only; the rate comes from /tools/fx-quote",
                    "value": [
                      {
                        "type": "international-fx",
                        "chargeTo": "originator",
                        "percent": {
                          "rate": 1.5
                        },
                        "amount": 1650
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation error, invalid account type, unsupported currency, or the fees could not be calculated for the request\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Entity or account not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/tools/fx-quote": {
      "parameters": [
        {
          "$ref": "#/components/parameters/MelioEntityId"
        }
      ],
      "post": {
        "tags": [
          "Tools"
        ],
        "summary": "Quote a currency conversion",
        "description": "Prices a conversion for a payment to an `international-fx` account denominated in a currency other than USD, and returns a short-lived `quoteToken` that locks the rate.\n\nPass the token as `fxQuoteToken` on `POST /payments` to be charged exactly what was quoted. The token is optional — omit it and the payment is priced again at creation time, at whatever rate then applies.\n\nFees are priced separately by `POST /tools/fee-calculator`; the two are independent and can be called in either order.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FxQuoteRequest"
              },
              "example": {
                "receivingAccountId": "acct_2a4f9c31-77ad-4c1e-8b52-6d3f0a91c4e7",
                "amount": 100000,
                "currency": "EUR",
                "purpose": "payment for consulting services"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The priced conversion and the token that locks it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FxQuote"
                },
                "example": {
                  "currency": "EUR",
                  "foreignAmount": 100000,
                  "amount": 110250,
                  "usdToForeignRate": 0.907,
                  "midMarketRate": 0.9125,
                  "quoteToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb3JlaWduQ3VycmVuY3kiOiJFVVIifQ.sig",
                  "expiresAt": "2026-09-06T12:34:56Z"
                }
              }
            }
          },
          "400": {
            "description": "Validation error (the account does not convert currency, or `currency` does not match it), or the currency is not supported (UNSUPPORTED_CURRENCY)\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Entity or account not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/tools/fast-payment-eligibility": {
      "parameters": [
        {
          "$ref": "#/components/parameters/MelioEntityId"
        }
      ],
      "post": {
        "tags": [
          "Tools"
        ],
        "summary": "Check fast payment eligibility",
        "description": "Checks which faster-than-standard delivery options a payment between two of the entity's accounts is eligible for, without creating one. Eligibility depends on the originating account, the receiving account, and the `amount` (minor units, cents). The response has one entry per fast option valid for the receiving account and the originating account's funding type, for example `same-day-ach` and `rtp` for ACH, or `express-check` and `overnight-check` for check. With a card originating account the collect is immediate, so `same-day-ach` and `instant-domestic-wire` are always eligible.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FastPaymentEligibilityRequest"
              },
              "example": {
                "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                "amount": 125000
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Fast-payment eligibility decisions, one per fast delivery preference for the receiving rail.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FastPaymentEligibility"
                },
                "examples": {
                  "bankFunded": {
                    "summary": "Bank (ACH) originating account — each fast preference is decided per payment",
                    "value": {
                      "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                      "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                      "amount": 125000,
                      "currency": "USD",
                      "eligibilities": [
                        {
                          "deliveryPreference": "same-day-ach",
                          "eligible": true
                        },
                        {
                          "deliveryPreference": "rtp",
                          "eligible": false
                        }
                      ]
                    }
                  },
                  "cardFunded": {
                    "summary": "Card originating account — same-day-ach is always eligible (immediate collect)",
                    "value": {
                      "originatingAccountId": "acct_5c1f0e88-2d1b-4a6a-9f3e-8a4b6c2d1e0f",
                      "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                      "amount": 125000,
                      "currency": "USD",
                      "eligibilities": [
                        {
                          "deliveryPreference": "same-day-ach",
                          "eligible": true
                        },
                        {
                          "deliveryPreference": "rtp",
                          "eligible": false
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation error or invalid account type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Entity or account not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/tools/delivery-eta": {
      "parameters": [
        {
          "$ref": "#/components/parameters/MelioEntityId"
        }
      ],
      "post": {
        "tags": [
          "Tools"
        ],
        "summary": "Estimate delivery dates",
        "description": "Estimates when a payment between two of the entity's accounts would be delivered, without creating one. The response has one estimate per delivery option valid for the receiving account and the originating account's funding type, for example `standard-ach`, `same-day-ach`, and `rtp` for ACH with a bank originating account, or `same-day-ach` and `rtp` with a card. `deductionDate` is the debit date used for the estimate (defaults to today); `amount` is in minor units (cents).\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeliveryEtaRequest"
              },
              "example": {
                "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                "amount": 125000,
                "deductionDate": "2026-07-10"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Estimated delivery dates, one per delivery preference for the receiving rail.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryEta"
                },
                "examples": {
                  "bankFunded": {
                    "summary": "Bank (ACH) originating account — all three ACH speeds",
                    "value": {
                      "originatingAccountId": "acct_3f2504e0-4f89-41d3-9a0c-0305e82c3301",
                      "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                      "amount": 125000,
                      "currency": "USD",
                      "deductionDate": "2026-07-10",
                      "estimates": [
                        {
                          "deliveryPreference": "standard-ach",
                          "deliveryDate": "2026-07-14"
                        },
                        {
                          "deliveryPreference": "same-day-ach",
                          "deliveryDate": "2026-07-10"
                        },
                        {
                          "deliveryPreference": "rtp",
                          "deliveryDate": "2026-07-10"
                        }
                      ]
                    }
                  },
                  "cardFunded": {
                    "summary": "Card originating account — only the card-allowed ACH values (no standard-ach)",
                    "value": {
                      "originatingAccountId": "acct_5c1f0e88-2d1b-4a6a-9f3e-8a4b6c2d1e0f",
                      "receivingAccountId": "acct_9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
                      "amount": 125000,
                      "currency": "USD",
                      "deductionDate": "2026-07-10",
                      "estimates": [
                        {
                          "deliveryPreference": "same-day-ach",
                          "deliveryDate": "2026-07-10"
                        },
                        {
                          "deliveryPreference": "rtp",
                          "deliveryDate": "2026-07-10"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation error or invalid account type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Entity or account not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/simulations/payments/{paymentId}/actions": {
      "post": {
        "tags": [
          "Payments"
        ],
        "summary": "Simulate a payment action",
        "description": "Advances a payment through its lifecycle for testing: approve or decline the risk review, collect or deliver the funds, or simulate a collection or delivery failure. The action runs against the real payment, so the status change and any webhooks fire just as in production. Available in non-production environments only.\n",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "paymentId",
            "in": "path",
            "required": true,
            "description": "A payment id (pay_<id>).",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SimulationActionRequest"
              },
              "examples": {
                "riskApprove": {
                  "summary": "Approve the payment's risk review",
                  "value": {
                    "action": "risk-approve"
                  }
                },
                "failCollect": {
                  "summary": "Simulate a failed collection",
                  "value": {
                    "action": "fail-collect"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Action applied."
          },
          "404": {
            "description": "Payment not found, or the endpoint is unavailable in this environment (it is non-production only, and returns 404 in production).\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "The `Idempotency-Key` was reused with a different body (IDEMPOTENCY_KEY_REUSED) or is still being processed by an earlier request (IDEMPOTENCY_KEY_IN_PROGRESS).\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "api-key"
      },
      "SessionToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Scoped session token minted by POST .../accounts/link."
      }
    },
    "parameters": {
      "Limit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "Maximum number of resources to return, 1 to 50. Defaults to 50.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 50,
          "default": 50
        }
      },
      "StartingAfter": {
        "name": "startingAfter",
        "in": "query",
        "required": false,
        "description": "Cursor for forward (older) pagination: a resource id. The page returned starts immediately after this resource. Mutually exclusive with `endingBefore`.\n",
        "schema": {
          "type": "string"
        }
      },
      "EndingBefore": {
        "name": "endingBefore",
        "in": "query",
        "required": false,
        "description": "Cursor for backward (newer) pagination: a resource id. The page returned ends immediately before this resource. Mutually exclusive with `startingAfter`.\n",
        "schema": {
          "type": "string"
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Unique key (UUID recommended) that makes a create request safe to retry by replaying the original response; retained 24h per partner.\n",
        "schema": {
          "type": "string",
          "maxLength": 255
        }
      },
      "MelioSonarToken": {
        "name": "Melio-Sonar-Token",
        "in": "header",
        "required": false,
        "description": "Signed MelioSonar session token from the initiating device, used for risk evaluation; invalid or expired tokens return 400 INVALID_SONAR_TOKEN.\n",
        "schema": {
          "type": "string"
        }
      },
      "MelioEntityId": {
        "name": "Melio-Entity-Id",
        "in": "header",
        "required": true,
        "description": "Entity the request operates on — an entity id (`ent_<uuid>`) or `me` (the partner's sole entity).",
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "SimulationActionType": {
        "type": "string",
        "description": "The payment lifecycle transition to simulate.",
        "enum": [
          "risk-approve",
          "risk-decline",
          "collect",
          "deliver",
          "fail-collect",
          "fail-deliver"
        ]
      },
      "SimulationActionRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "action"
        ],
        "properties": {
          "action": {
            "$ref": "#/components/schemas/SimulationActionType"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "Optional metadata. Not stored on the payment."
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "type",
          "code",
          "message"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "Coarse, machine-readable error category. Branch on this to handle a whole class of failures without enumerating every `code`.",
            "enum": [
              "invalid_request_error",
              "authentication_error",
              "authorization_error",
              "not_found_error",
              "conflict_error",
              "rate_limit_error",
              "service_unavailable_error",
              "internal_error"
            ]
          },
          "code": {
            "type": "string",
            "description": "Machine-readable error code.",
            "enum": [
              "VALIDATION_ERROR",
              "INVALID_ACCOUNT_TYPE",
              "ACCOUNT_NOT_VERIFIED",
              "INVALID_DELIVERY_PREFERENCE",
              "MCC_REQUIRED",
              "MERCHANT_ADDRESS_REQUIRED",
              "GOODS_RECEIVED_REQUIRED",
              "IDEMPOTENCY_KEY_REQUIRED",
              "FEE_CALCULATION_FAILED",
              "UNSUPPORTED_CURRENCY",
              "FX_QUOTE_INVALID",
              "INVALID_SONAR_TOKEN",
              "ATTACHMENT_REQUIRED",
              "COMPLIANCE_UPLOAD_FAILED",
              "ATTACHMENT_UPLOAD_FAILED",
              "INTERNATIONAL_NOT_ENABLED",
              "ENTITY_ONBOARDING_INCOMPLETE",
              "UNAUTHORIZED",
              "IP_NOT_ALLOWED",
              "NOT_FOUND",
              "DUPLICATE_ENTITY",
              "DUPLICATE_ACCOUNT",
              "DUPLICATE_PAYMENT",
              "DUPLICATE_EXTERNAL_ID",
              "ACCOUNT_IN_USE",
              "BUSINESS_NOT_ELIGIBLE",
              "PAYMENT_NOT_EDITABLE",
              "PAYMENT_UPGRADED_BY_RECEIVER",
              "PAYMENT_NOT_CANCELABLE",
              "IDEMPOTENCY_KEY_REUSED",
              "IDEMPOTENCY_KEY_IN_PROGRESS",
              "IDEMPOTENCY_STORE_UNAVAILABLE",
              "INTERNAL_ERROR"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human-readable error message."
          },
          "details": {
            "type": "object",
            "description": "Additional error context (e.g. field-level validation failures)."
          }
        }
      },
      "AddressSuggestion": {
        "type": "object",
        "required": [
          "id",
          "formattedText"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "formattedText": {
            "type": "string"
          },
          "addressParts": {
            "type": "object",
            "properties": {
              "line1": {
                "type": "string"
              },
              "line2": {
                "type": "string"
              },
              "city": {
                "type": "string"
              },
              "state": {
                "type": "string"
              },
              "postalCode": {
                "type": "string"
              },
              "country": {
                "type": "string"
              }
            }
          }
        }
      },
      "AddressParts": {
        "type": "object",
        "required": [
          "id",
          "addressParts"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "addressParts": {
            "type": "object",
            "required": [
              "line1",
              "line2",
              "city",
              "state",
              "postalCode",
              "country"
            ],
            "properties": {
              "line1": {
                "type": "string"
              },
              "line2": {
                "type": "string"
              },
              "city": {
                "type": "string"
              },
              "state": {
                "type": "string"
              },
              "postalCode": {
                "type": "string"
              },
              "country": {
                "type": "string"
              }
            }
          }
        }
      },
      "IndustryTypeSuggestion": {
        "type": "object",
        "required": [
          "naicsCode",
          "title",
          "subtitle"
        ],
        "properties": {
          "naicsCode": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "subtitle": {
            "type": "string"
          }
        }
      },
      "Address": {
        "type": "object",
        "required": [
          "line1",
          "city",
          "state",
          "postalCode"
        ],
        "properties": {
          "line1": {
            "type": "string",
            "description": "Street address. Must not be a PO box for the business (physical) address.\n"
          },
          "line2": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "description": "Two-letter US state or territory code (e.g. NY, CA). Must be a recognized USPS abbreviation.",
            "pattern": "^[A-Za-z]{2}$"
          },
          "postalCode": {
            "type": "string",
            "description": "US ZIP code, 5 or 9 digits, with or without a hyphen before the last 4 (e.g. 10118, 10118-1234).",
            "pattern": "^\\d{5}(-?\\d{4})?$"
          },
          "aptNumber": {
            "type": "string"
          },
          "countryCode": {
            "type": "string",
            "enum": [
              "US"
            ],
            "default": "US"
          }
        }
      },
      "InternationalAddress": {
        "type": "object",
        "description": "A counterparty address outside the US. Unlike `Address`, `state` is free-form (most countries have no state; send an empty string or omit it) and `postalCode` is not a US ZIP. `countryCode` is required and must not be `US` — a US-domiciled counterparty belongs on a domestic account type.\n",
        "required": [
          "line1",
          "city",
          "postalCode",
          "countryCode"
        ],
        "properties": {
          "line1": {
            "type": "string",
            "description": "Street address. Must be a real street address, not a PO box."
          },
          "line2": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "description": "State, province or region. Optional — send an empty string where the country has none."
          },
          "postalCode": {
            "type": "string"
          },
          "countryCode": {
            "type": "string",
            "description": "Two-letter ISO 3166-1 alpha-2 country code.",
            "pattern": "^[A-Za-z]{2}$"
          }
        }
      },
      "AddressResponse": {
        "type": "object",
        "description": "Address as returned in responses; fields may be absent when the stored record is incomplete.",
        "properties": {
          "line1": {
            "type": "string"
          },
          "line2": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "postalCode": {
            "type": "string"
          },
          "aptNumber": {
            "type": "string"
          },
          "countryCode": {
            "type": "string"
          }
        }
      },
      "TaxInfo": {
        "type": "object",
        "description": "Business tax identifier. Allowed `type` values depend on the business formation type: `ein` is accepted for every formation type, while `ssn` is accepted only for sole-proprietorship and trust. `itin` is retained for backward compatibility but is no longer accepted for any formation type.\n",
        "required": [
          "type",
          "identifier"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "ein",
              "ssn",
              "itin"
            ]
          },
          "identifier": {
            "type": "string",
            "description": "9-digit tax identifier, optionally dash-separated (e.g. 12-3456789).",
            "pattern": "^[0-9]{2}-?[0-9]{7}$|^[0-9]{3}-?[0-9]{2}-?[0-9]{4}$"
          }
        }
      },
      "Industry": {
        "type": "object",
        "required": [
          "naicsCode"
        ],
        "properties": {
          "naicsCode": {
            "type": "string",
            "description": "NAICS industry classification code (digits).",
            "pattern": "^[0-9]+$"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "Contact": {
        "type": "object",
        "description": "Organization-level point of contact (a person). First and last name must be at least 2 characters and contain only letters, spaces, hyphens, dots or commas.\n",
        "required": [
          "firstName",
          "lastName"
        ],
        "properties": {
          "firstName": {
            "type": "string",
            "minLength": 2
          },
          "lastName": {
            "type": "string",
            "minLength": 2
          }
        }
      },
      "ContactResponse": {
        "type": "object",
        "description": "Contact as returned in responses; fields may be absent when the stored record is incomplete.",
        "properties": {
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          }
        }
      },
      "Owner": {
        "type": "object",
        "description": "The person who owns the entity (the account owner). Name and date of birth are required and are collected for sanctions screening; the owner must be between 18 and 120 years old. Stricter date-of-birth validation applies when the entity's tax id type is SSN.\n",
        "required": [
          "firstName",
          "lastName",
          "email",
          "dateOfBirth"
        ],
        "properties": {
          "firstName": {
            "type": "string",
            "minLength": 2
          },
          "lastName": {
            "type": "string",
            "minLength": 2
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "dateOfBirth": {
            "type": "string",
            "format": "date"
          },
          "phoneNumber": {
            "type": "string",
            "description": "Optional. When supplied, must contain at least 9 digits."
          }
        }
      },
      "CreateEntityRequest": {
        "type": "object",
        "description": "The business's own attributes. Allowed tax id types depend on businessType (e.g. corporation/llc/partnership → ein only; sole-proprietorship/trust → ssn or ein).\n",
        "required": [
          "type",
          "name",
          "legalName",
          "phoneNumber",
          "businessType",
          "taxInfo",
          "industry",
          "contact",
          "address",
          "legalAddress",
          "owner",
          "termsAcceptance"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "business"
            ],
            "description": "Entity type discriminator. Only `business` is supported today."
          },
          "externalId": {
            "type": "string",
            "description": "Partner's own id for the entity (unique per partner)"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "name": {
            "type": "string",
            "description": "Company (doing-business-as) name. Between 3 and 100 characters.",
            "minLength": 3,
            "maxLength": 100
          },
          "legalName": {
            "type": "string",
            "description": "Full legal business name as it appears on the tax return. Between 3 and 100 characters.",
            "minLength": 3,
            "maxLength": 100
          },
          "phoneNumber": {
            "type": "string",
            "description": "Business phone number. Must contain at least 9 digits."
          },
          "businessType": {
            "type": "string",
            "enum": [
              "partnership",
              "sole-proprietorship",
              "llc",
              "corporation",
              "trust",
              "non-profit",
              "municipality"
            ]
          },
          "taxInfo": {
            "$ref": "#/components/schemas/TaxInfo"
          },
          "industry": {
            "$ref": "#/components/schemas/Industry"
          },
          "contact": {
            "$ref": "#/components/schemas/Contact"
          },
          "website": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "address": {
            "$ref": "#/components/schemas/Address"
          },
          "legalAddress": {
            "$ref": "#/components/schemas/Address"
          },
          "owner": {
            "$ref": "#/components/schemas/Owner"
          },
          "termsAcceptance": {
            "$ref": "#/components/schemas/TermsAcceptanceRequest"
          }
        }
      },
      "TermsAcceptanceRequest": {
        "type": "object",
        "description": "Your attestation that the business was shown Melio's terms of service in your UI and accepted them. Recorded with the entity and cannot be changed afterwards.\n\nRequired: an entity cannot be created without the business accepting the terms of service.\n",
        "required": [
          "accepted",
          "acceptedAt"
        ],
        "properties": {
          "accepted": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Must be `true`. A `false` value is rejected rather than recorded."
          },
          "acceptedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the business accepted, as recorded in your UI. Must carry a UTC offset - `Z` or `+09:00` - so the instant is unambiguous; a timestamp without one is rejected, because it would be recorded as a different instant than the one the business accepted at. Any timezone is fine. Must also be within the last 90 days and no more than 14 hours ahead of server time, which allows for a skewed clock.\n"
          }
        }
      },
      "TermsAcceptance": {
        "type": "object",
        "description": "The terms of service acceptance on file for this business. Absent when none has been recorded.\n",
        "properties": {
          "acceptedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "UpdateEntityRequest": {
        "type": "object",
        "description": "All fields optional; only supplied fields are updated. The compliance-sensitive fields `legalName`, `legalAddress` and `taxInfo` are immutable once the entity is created; supplying any of them returns a 400.\n",
        "properties": {
          "name": {
            "type": "string"
          },
          "phoneNumber": {
            "type": "string"
          },
          "businessType": {
            "type": "string",
            "enum": [
              "partnership",
              "sole-proprietorship",
              "llc",
              "corporation",
              "trust",
              "non-profit",
              "municipality"
            ]
          },
          "industry": {
            "$ref": "#/components/schemas/Industry"
          },
          "contact": {
            "$ref": "#/components/schemas/Contact"
          },
          "website": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "address": {
            "$ref": "#/components/schemas/Address"
          },
          "externalId": {
            "$ref": "#/components/schemas/ExternalId"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "owner": {
            "type": "object",
            "description": "The account owner's personal details.",
            "properties": {
              "firstName": {
                "type": "string"
              },
              "lastName": {
                "type": "string"
              },
              "email": {
                "type": "string",
                "format": "email"
              },
              "dateOfBirth": {
                "type": "string",
                "format": "date"
              },
              "phoneNumber": {
                "type": "string"
              }
            }
          }
        }
      },
      "BeneficialOwnerType": {
        "type": "string",
        "description": "The role a person holds in the business. `ubo` is an ultimate beneficial owner (someone with a material ownership stake), `director` is a control person, and `fx-account-holder` is the individual who acts for the business on its international (FX) payments. One person may hold several roles; exactly one person must be the `fx-account-holder`.\n",
        "enum": [
          "ubo",
          "director",
          "fx-account-holder"
        ]
      },
      "BeneficialOwnerJobTitle": {
        "type": "string",
        "enum": [
          "chief-executive-officer",
          "chief-financial-officer",
          "managing-member",
          "general-partner",
          "president",
          "vice-president",
          "treasurer"
        ]
      },
      "BeneficialOwnerRequest": {
        "type": "object",
        "description": "A person to record against the business. Supply `id` to update the person with that id; omit it to create a new one.\n\nIdentification depends on residency: a US resident must have `taxInfo` (an SSN or ITIN), and a non-US resident must have `internationalIdType` and `internationalId`.\n",
        "required": [
          "firstName",
          "lastName",
          "dateOfBirth",
          "address",
          "usResident",
          "types"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "description": "The id of an existing person to update. Omit to create."
          },
          "firstName": {
            "type": "string",
            "minLength": 2
          },
          "lastName": {
            "type": "string",
            "minLength": 2
          },
          "dateOfBirth": {
            "type": "string",
            "format": "date"
          },
          "address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/InternationalAddress"
              }
            ],
            "description": "The person's home address. Unlike a counterparty address this may be in the US — send `countryCode: US` for a US resident.\n"
          },
          "usResident": {
            "type": "boolean"
          },
          "ownershipPercentage": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Share of the business held, as a decimal (0.25 = 25%). Required for anyone whose `types` include `ubo`. The total across all `ubo` entries is validated as a set, so send the complete set in one request.\n"
          },
          "jobTitle": {
            "$ref": "#/components/schemas/BeneficialOwnerJobTitle"
          },
          "taxInfo": {
            "type": "object",
            "description": "Required when `usResident` is true.",
            "required": [
              "type",
              "identifier"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "ssn",
                  "itin"
                ]
              },
              "identifier": {
                "type": "string",
                "description": "9-digit identifier, optionally dash-separated.",
                "pattern": "^[0-9]{3}-?[0-9]{2}-?[0-9]{4}$"
              }
            }
          },
          "internationalIdType": {
            "type": "string",
            "enum": [
              "passport",
              "driver-license",
              "national-id"
            ],
            "description": "Required when `usResident` is false."
          },
          "internationalId": {
            "type": "string",
            "description": "Required when `usResident` is false."
          },
          "types": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/BeneficialOwnerType"
            }
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phoneNumber": {
            "type": "string"
          },
          "identityDocument": {
            "type": "object",
            "description": "A scan or photo of this person's government-issued ID, uploaded with `POST /attachments`.\n\nOptional in general. It is required in exactly two cases, and the request is rejected with `400 VALIDATION_ERROR` naming the person if it is absent: when `usResident` is `false`, or for **every** beneficial owner when the entity's `businessType` is `sole-proprietorship` — including US residents.\n\nOnly the front is required. Send `backAttachmentId` as well when the ID has a back (a driver's licence or national ID) and you have it.\n\nWrite-only: `BeneficialOwner` reports `hasIdentityDocument` and never a reference to the file.\n",
            "required": [
              "frontAttachmentId"
            ],
            "properties": {
              "frontAttachmentId": {
                "type": "string",
                "description": "Attachment id (att_<id>) of the front of the ID.",
                "example": "att_9f8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d"
              },
              "backAttachmentId": {
                "type": "string",
                "description": "Attachment id of the back, where the ID has one. Must differ from the front."
              }
            }
          }
        }
      },
      "BeneficialOwner": {
        "type": "object",
        "description": "A person recorded against the business. Identifiers are never echoed in full — `taxInfo` reports only the last four digits, and `internationalId` only its last four characters.\n",
        "required": [
          "id",
          "firstName",
          "lastName",
          "dateOfBirth",
          "address",
          "usResident",
          "types",
          "hasIdentityDocument"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "dateOfBirth": {
            "type": "string",
            "format": "date"
          },
          "address": {
            "$ref": "#/components/schemas/InternationalAddress"
          },
          "usResident": {
            "type": "boolean"
          },
          "ownershipPercentage": {
            "type": "number",
            "description": "Decimal share (0.25 = 25%)"
          },
          "jobTitle": {
            "$ref": "#/components/schemas/BeneficialOwnerJobTitle"
          },
          "taxInfo": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "ssn",
                  "itin"
                ]
              },
              "identifierLast4": {
                "type": "string"
              }
            }
          },
          "internationalIdType": {
            "type": "string",
            "enum": [
              "passport",
              "driver-license",
              "national-id"
            ]
          },
          "internationalId": {
            "type": "string",
            "description": "Last four characters of the identifier on file"
          },
          "hasIdentityDocument": {
            "type": "boolean",
            "description": "Whether a government ID is on file for this person. The document itself cannot be read back through this API.\n"
          },
          "types": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BeneficialOwnerType"
            }
          },
          "email": {
            "type": "string"
          },
          "phoneNumber": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ReplaceBeneficialOwnersRequest": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BeneficialOwnerRequest"
            }
          }
        }
      },
      "BeneficialOwnerList": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BeneficialOwner"
            }
          }
        }
      },
      "BusinessLimitationReason": {
        "type": "object",
        "description": "A single reason a capability is not allowed.",
        "required": [
          "code",
          "message",
          "missingFields"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "Machine-readable reason code. New codes will be added over time; treat unknown values leniently.\n",
            "enum": [
              "MissingInformation",
              "EntityBlocked",
              "EntityUnderReview",
              "EntityUnresponsive",
              "OutstandingBalance",
              "LocationRestricted"
            ]
          },
          "message": {
            "type": "string",
            "description": "Static, English-language message, safe to show to your users."
          },
          "missingFields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Dot-paths to the Entity fields that must be completed to lift this reason, e.g. \"taxInfo\". Empty when the reason is not about missing information.\n"
          },
          "contactEmail": {
            "type": "string",
            "description": "Melio contact address for resolving this reason. Present only when a contact address is available for the limitation; omitted otherwise.\n"
          }
        }
      },
      "BusinessCapabilityOperation": {
        "type": "string",
        "description": "The operation a capability gates, named inline as `resource.subtype:action`. `write` covers create, update and delete; only write operations can be limited. Read operations are always allowed and are never listed. New operations will be added to this enum over time; treat unknown values leniently.\n\n`payment.domestic:write` and `payment.international:write` are decided independently — which one applies to a payment is determined by the receiving account's rail, so a business may be able to pay domestically while being blocked internationally, or the reverse. `payment.international:write` also reports the onboarding data still outstanding (see `PUT /entities/{entityId}/beneficial-owners`), not only risk restrictions.\n",
        "enum": [
          "payment.domestic:write",
          "payment.international:write",
          "account.internal:write",
          "account.external:write"
        ]
      },
      "BusinessCapability": {
        "type": "object",
        "description": "A single operation, gated by `allowed`.",
        "required": [
          "operation",
          "allowed",
          "reasons"
        ],
        "properties": {
          "operation": {
            "$ref": "#/components/schemas/BusinessCapabilityOperation"
          },
          "allowed": {
            "type": "boolean",
            "description": "Whether the business may perform this operation today."
          },
          "reasons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BusinessLimitationReason"
            },
            "description": "The reasons this operation is not allowed. Empty when `allowed` is true.\n"
          }
        }
      },
      "BusinessLimitations": {
        "type": "object",
        "description": "The business's per-operation capabilities. Every entry reports whether a write operation (create/update/delete) is allowed today and, if not, why. Only limitable operations are listed; read operations are always allowed and never appear. New operations will be added over time.\n",
        "required": [
          "capabilities"
        ],
        "properties": {
          "capabilities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BusinessCapability"
            }
          }
        }
      },
      "Entity": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/BusinessEntity"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "business": "#/components/schemas/BusinessEntity"
          }
        }
      },
      "BusinessEntity": {
        "type": "object",
        "required": [
          "id",
          "type"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Opaque entity id (ent_<uuid>)"
          },
          "type": {
            "type": "string",
            "enum": [
              "business"
            ]
          },
          "externalId": {
            "type": "string"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "name": {
            "type": "string"
          },
          "legalName": {
            "type": "string"
          },
          "businessType": {
            "type": "string"
          },
          "taxInfo": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "ein",
                  "ssn",
                  "itin"
                ]
              },
              "identifierLast4": {
                "type": "string"
              }
            }
          },
          "phoneNumber": {
            "type": "string"
          },
          "contact": {
            "$ref": "#/components/schemas/ContactResponse"
          },
          "website": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "address": {
            "$ref": "#/components/schemas/AddressResponse"
          },
          "legalAddress": {
            "$ref": "#/components/schemas/AddressResponse"
          },
          "industry": {
            "$ref": "#/components/schemas/Industry"
          },
          "owner": {
            "type": "object",
            "properties": {
              "firstName": {
                "type": "string"
              },
              "lastName": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            }
          },
          "termsAcceptance": {
            "$ref": "#/components/schemas/TermsAcceptance"
          }
        }
      },
      "CreateAccountRequest": {
        "description": "Create an account. `ownershipType` selects internal (an internal account the entity pays from) or external (an external account the entity pays to); `type` selects the instrument. Supported combinations: internal ach, internal card, external ach, external check, external domestic-wire, external virtual-card, external counterparty-choice, external international-fx, external international-gusd.\n\nThe two international types additionally require the partner to be enabled for international payouts, and the entity to have completed international onboarding — see `PUT /entities/{entityId}/beneficial-owners`. A business that has not returns `409 ENTITY_ONBOARDING_INCOMPLETE` listing the outstanding fields.\n",
        "oneOf": [
          {
            "$ref": "#/components/schemas/CreateInternalAchAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateInternalPlaidAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateInternalCardAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalAchAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalCheckAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalDomesticWireAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalVirtualCardAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalCounterpartyChoiceAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalInternationalFxAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalInternationalGusdAccountRequest"
          }
        ]
      },
      "CreateInternalAchAccountRequest": {
        "type": "object",
        "required": [
          "ownershipType",
          "type",
          "bankAccount"
        ],
        "properties": {
          "ownershipType": {
            "type": "string",
            "enum": [
              "internal"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "ach"
            ]
          },
          "externalId": {
            "$ref": "#/components/schemas/ExternalId"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "nickname": {
            "type": "string"
          },
          "bankAccount": {
            "type": "object",
            "description": "The account and routing numbers. Available to selected partners; otherwise add the account through the Plaid link flow. When accepted, the account is created in a verified state.\n",
            "required": [
              "accountNumber",
              "routingNumber"
            ],
            "properties": {
              "accountNumber": {
                "type": "string"
              },
              "routingNumber": {
                "type": "string"
              }
            }
          }
        }
      },
      "CreateInternalPlaidAccountRequest": {
        "type": "object",
        "x-internal": true,
        "required": [
          "ownershipType",
          "type",
          "details"
        ],
        "description": "Created from the tokens returned by the Plaid Link SDK. Submitted by the Melio-hosted link page using the scoped session token (Bearer) minted by POST .../accounts/link.\n",
        "properties": {
          "ownershipType": {
            "type": "string",
            "enum": [
              "internal"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "plaid"
            ]
          },
          "externalId": {
            "$ref": "#/components/schemas/ExternalId"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "nickname": {
            "type": "string"
          },
          "details": {
            "type": "object",
            "required": [
              "plaidToken",
              "plaidAccountId"
            ],
            "properties": {
              "plaidToken": {
                "type": "string",
                "description": "Plaid public_token from Link onSuccess"
              },
              "plaidAccountId": {
                "type": "string",
                "description": "Selected account id from Link metadata"
              }
            }
          }
        }
      },
      "CreateInternalCardAccountRequest": {
        "type": "object",
        "x-internal": true,
        "required": [
          "ownershipType",
          "type",
          "details"
        ],
        "description": "Created from a vaulted-card token collected client-side on the Melio-hosted link page; the full card number never reaches the API. Submitted with the scoped session token (Bearer).\n",
        "properties": {
          "ownershipType": {
            "type": "string",
            "enum": [
              "internal"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "card"
            ]
          },
          "externalId": {
            "$ref": "#/components/schemas/ExternalId"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "nickname": {
            "type": "string"
          },
          "details": {
            "type": "object",
            "required": [
              "token",
              "cardBin",
              "expirationMonth",
              "expirationYear",
              "lastFourDigits",
              "cardOwner",
              "address"
            ],
            "properties": {
              "token": {
                "type": "string",
                "description": "Vault token for the card"
              },
              "tokenProvider": {
                "type": "string",
                "enum": [
                  "basistheory"
                ],
                "default": "basistheory"
              },
              "cardBin": {
                "type": "string",
                "description": "First 6 digits"
              },
              "expirationMonth": {
                "type": "string",
                "description": "MM"
              },
              "expirationYear": {
                "type": "string",
                "description": "YYYY"
              },
              "lastFourDigits": {
                "type": "string"
              },
              "cardOwner": {
                "type": "object",
                "required": [
                  "firstName",
                  "lastName"
                ],
                "properties": {
                  "firstName": {
                    "type": "string"
                  },
                  "lastName": {
                    "type": "string"
                  }
                }
              },
              "address": {
                "type": "object",
                "required": [
                  "line1",
                  "city",
                  "state",
                  "postalCode"
                ],
                "properties": {
                  "line1": {
                    "type": "string"
                  },
                  "line2": {
                    "type": "string"
                  },
                  "city": {
                    "type": "string"
                  },
                  "state": {
                    "type": "string"
                  },
                  "postalCode": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "CreateExternalAchAccountRequest": {
        "type": "object",
        "required": [
          "ownershipType",
          "type",
          "counterPartyName",
          "counterPartyEmail",
          "bankAccount"
        ],
        "properties": {
          "ownershipType": {
            "type": "string",
            "enum": [
              "external"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "ach"
            ]
          },
          "externalId": {
            "$ref": "#/components/schemas/ExternalId"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "counterPartyName": {
            "type": "string",
            "description": "Counterparty name"
          },
          "counterPartyEmail": {
            "type": "string",
            "format": "email",
            "description": "Counterparty (payee) email"
          },
          "bankAccount": {
            "type": "object",
            "required": [
              "accountNumber",
              "routingNumber"
            ],
            "properties": {
              "accountNumber": {
                "type": "string"
              },
              "routingNumber": {
                "type": "string"
              }
            }
          }
        }
      },
      "CreateExternalCheckAccountRequest": {
        "type": "object",
        "required": [
          "ownershipType",
          "type",
          "counterPartyName",
          "counterPartyEmail",
          "paperCheck"
        ],
        "properties": {
          "ownershipType": {
            "type": "string",
            "enum": [
              "external"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "check"
            ]
          },
          "externalId": {
            "$ref": "#/components/schemas/ExternalId"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "counterPartyName": {
            "type": "string",
            "description": "Counterparty name"
          },
          "counterPartyEmail": {
            "type": "string",
            "format": "email",
            "description": "Counterparty (payee) email"
          },
          "paperCheck": {
            "type": "object",
            "required": [
              "address"
            ],
            "properties": {
              "address": {
                "$ref": "#/components/schemas/Address"
              }
            }
          }
        }
      },
      "CreateExternalDomesticWireAccountRequest": {
        "type": "object",
        "required": [
          "ownershipType",
          "type",
          "counterPartyName",
          "counterPartyEmail",
          "bankAccount",
          "address"
        ],
        "properties": {
          "ownershipType": {
            "type": "string",
            "enum": [
              "external"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "domestic-wire"
            ]
          },
          "externalId": {
            "$ref": "#/components/schemas/ExternalId"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "counterPartyName": {
            "type": "string",
            "description": "Counterparty name"
          },
          "counterPartyEmail": {
            "type": "string",
            "format": "email",
            "description": "Counterparty (payee) email"
          },
          "bankAccount": {
            "type": "object",
            "required": [
              "accountNumber",
              "routingNumber"
            ],
            "properties": {
              "accountNumber": {
                "type": "string"
              },
              "routingNumber": {
                "type": "string",
                "description": "ABA routing number of the receiving bank"
              }
            }
          },
          "address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Address"
              }
            ],
            "description": "Counterparty address on the wire"
          }
        }
      },
      "CreateExternalVirtualCardAccountRequest": {
        "type": "object",
        "required": [
          "ownershipType",
          "type",
          "counterPartyName",
          "counterPartyEmail"
        ],
        "properties": {
          "ownershipType": {
            "type": "string",
            "enum": [
              "external"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "virtual-card"
            ]
          },
          "externalId": {
            "$ref": "#/components/schemas/ExternalId"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "counterPartyName": {
            "type": "string",
            "description": "Counterparty name"
          },
          "counterPartyEmail": {
            "type": "string",
            "format": "email",
            "description": "Email the single-use virtual card is delivered to"
          }
        }
      },
      "CreateExternalCounterpartyChoiceAccountRequest": {
        "description": "A counterparty who provides their own receiving details. You supply only a name and an email; creating the account emails the counterparty an invitation to choose how to get paid (bank account, paper check, virtual card, ...).\n\nYou can pay the account right away with `deliveryPreference: counterparty-choice`: the payment is scheduled and waits for the counterparty. Until they respond, the account has type `counterparty-choice` and `counterparty-choice` is the only delivery preference it accepts.\n\nOnce they provide their details, the same account (same `id`) takes the type of the delivery method they chose (e.g. `ach`, `check`, `virtual-card`) and you receive `api.account.updated`. Every pending payment to it stays on the account and now reports that rail's normal-speed preference (e.g. `standard-ach`); you receive `api.payment.updated` for each. New payments to it then use that rail's delivery preferences like any other external account of that type.\n",
        "type": "object",
        "required": [
          "ownershipType",
          "type",
          "counterPartyName",
          "counterPartyEmail"
        ],
        "properties": {
          "ownershipType": {
            "type": "string",
            "enum": [
              "external"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "counterparty-choice"
            ]
          },
          "externalId": {
            "$ref": "#/components/schemas/ExternalId"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "counterPartyName": {
            "type": "string",
            "description": "Counterparty name"
          },
          "counterPartyEmail": {
            "type": "string",
            "format": "email",
            "description": "Email the invitation to provide receiving details is sent to"
          }
        }
      },
      "CreateExternalInternationalFxAccountRequest": {
        "description": "A counterparty bank account outside the US, paid over Melio's international rail. The payment is debited in USD and delivered in `currency`; every payment to this account carries an FX conversion (see `POST /tools/fx-quote`).\n\nThe shape of `bankDetails` depends on `currency`, because each corridor is identified differently. Currencies identified the same way share one variant, so there are **twelve** variants rather than one per currency — pick the one whose `currency` enum lists yours. Each variant states its own required fields with their patterns, lengths and an example value, plus the `currency` → `bankCountryCode` pairs it accepts. Supplying a field the corridor does not use, or omitting one it needs, is rejected with `400 VALIDATION_ERROR`.\n\n| Variant | Identified by | Currencies | |---|---|---| | `…FxIbanAccountRequest` | IBAN | AED, CHF, DKK, EGP, EUR, GBP, GEL, HUF, ILS, NOK, PLN, RON, SEK, TRY | | `…FxBankCodeAccountRequest` | A national bank code and account number | CZK, GHS, HKD, KES, MAD, NGN, PHP, SGD, THB | | `…FxBicAccountRequest` | A BIC/SWIFT code and account number | BOB, CNY, DOP, GTQ, VND | | `…FxAccountNumberAccountRequest` | A single national account number | HUF, NZD, PLN | | `…FxSouthAfricanAccountRequest` | A South African BIC, ID number and email | ZAR | | `…FxBsbAccountRequest` | An Australian BSB code and account number | AUD | | `…FxClabeAccountRequest` | A Mexican CLABE | MXN | | `…FxIfscAccountRequest` | An Indian IFSC code and account number | INR | | `…FxCanadianAccountRequest` | Canadian institution and transit numbers | CAD | | `…FxSortCodeAccountRequest` | A UK sort code and account number | GBP | | `…FxKoreanAccountRequest` | A Korean bank code, account number and email | KRW | | `…FxBrazilianAccountRequest` | Brazilian bank, branch, account type and CNPJ | BRL |\n\n`GBP`, `HUF` and `PLN` appear twice because each accepts two shapes. That is also why these variants form a plain `oneOf` with no discriminator: `currency` alone does not determine the shape for those three.\n\nTwo limits on what the schemas can state. Where a variant spans several currencies its constraints are the permissive union, and Melio applies the exact per-currency rule on create. And for `BRL`, `GHS`, `HKD`, `KES`, `KRW`, `MAD`, `NGN`, `PHP`, `SGD`, `THB`, `VND` and `ZAR`, `bankCode`/`bic` must be an exact supported code — too many to enumerate, so **start from the request example for your currency** on `POST /accounts`, which carries a valid one.\n\n`AUD`, `BRL` and `CAD` additionally require `address.state`; the other corridors do not.\n\n`USD` is **not** accepted on this account type: a USD payment converts nothing, so there is no FX rail to put it on. Use a domestic account type, or `international-gusd`, and a `currency` of `USD` is rejected with `400 VALIDATION_ERROR`.\n\nA currency outside this table is rejected with `400 UNSUPPORTED_CURRENCY`. Availability can change, so a currency listed here may still be refused for a given partner or destination.\n\n| Currency | Destination | `bankDetails` | |---|---|---| | `AED` | AE | `accountHolderName` + `iban` | | `AUD` | AU | `accountHolderName` + `bsbCode` + `accountNumber` | | `BOB` | BO | `accountHolderName` + `bic` + `accountNumber` | | `BRL` | BR | `email` + `accountHolderName` + `bankCode` + `branchCode` + `accountNumber` + `accountType` + `cnpj` | | `CAD` | CA | `accountHolderName` + `institutionNumber` + `transitNumber` + `accountNumber` + `accountType` | | `CHF` | CH, LI | `accountHolderName` + `iban` | | `CNY` | CN | `accountHolderName` + `bic` + `accountNumber` | | `CZK` | CZ | `accountHolderName` + `bankCode` + `accountNumber` | | `DKK` | DK | `accountHolderName` + `iban` | | `DOP` | DO | `accountHolderName` + `bic` + `accountNumber` | | `EGP` | EG | `accountHolderName` + `iban` | | `EUR` | 24 countries | `accountHolderName` + `iban` | | `GBP` | GB | `accountHolderName` + `sortCode` + `accountNumber`, or `accountHolderName` + `iban` | | `GEL` | GE | `accountHolderName` + `iban` | | `GHS` | GH | `accountHolderName` + `bankCode` + `accountNumber` | | `GTQ` | GT | `accountHolderName` + `bic` + `accountNumber` | | `HKD` | HK | `accountHolderName` + `bankCode` + `accountNumber` | | `HUF` | HU | `accountHolderName` + `accountNumber`, or `accountHolderName` + `iban` | | `ILS` | IL | `accountHolderName` + `iban` | | `INR` | IN | `accountHolderName` + `ifscCode` + `accountNumber` | | `KES` | KE | `accountHolderName` + `bankCode` + `accountNumber` | | `KRW` | KR | `email` + `accountHolderName` + `bankCode` + `accountNumber` | | `MAD` | MA | `accountHolderName` + `bankCode` + `accountNumber` | | `MXN` | MX | `accountHolderName` + `clabe` | | `NGN` | NG | `accountHolderName` + `bankCode` + `accountNumber` | | `NOK` | NO | `accountHolderName` + `iban` | | `NZD` | NZ | `accountHolderName` + `accountNumber` | | `PHP` | PH | `accountHolderName` + `bankCode` + `accountNumber` | | `PLN` | PL | `accountHolderName` + `accountNumber`, or `accountHolderName` + `iban` | | `RON` | RO | `accountHolderName` + `iban` | | `SEK` | SE | `accountHolderName` + `iban` | | `SGD` | SG | `accountHolderName` + `bankCode` + `accountNumber` | | `THB` | TH | `accountHolderName` + `bankCode` + `accountNumber` | | `TRY` | TR | `accountHolderName` + `iban` | | `VND` | VN | `accountHolderName` + `bic` + `accountNumber` | | `ZAR` | ZA | `accountHolderName` + `bic` + `accountNumber` + `zarIdentificationNumber` + `email` |\n",
        "oneOf": [
          {
            "$ref": "#/components/schemas/CreateExternalInternationalFxIbanAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalInternationalFxBankCodeAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalInternationalFxBicAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalInternationalFxAccountNumberAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalInternationalFxSouthAfricanAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalInternationalFxBsbAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalInternationalFxClabeAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalInternationalFxIfscAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalInternationalFxCanadianAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalInternationalFxSortCodeAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalInternationalFxKoreanAccountRequest"
          },
          {
            "$ref": "#/components/schemas/CreateExternalInternationalFxBrazilianAccountRequest"
          }
        ]
      },
      "CreateExternalInternationalFxIbanAccountRequest": {
        "description": "Counterparty accounts identified by IBAN. `bankDetails` takes exactly the fields listed below: all are required and no others are accepted.\n\nPermitted `currency` → `bankCountryCode`: `AED` → `AE`; `CHF` → `CH`, `LI`; `DKK` → `DK`; `EGP` → `EG`; `EUR` → the 24 euro-area countries; `GBP` → `GB`; `GEL` → `GE`; `HUF` → `HU`; `ILS` → `IL`; `NOK` → `NO`; `PLN` → `PL`; `RON` → `RO`; `SEK` → `SE`; `TRY` → `TR`.\n\nFor `GBP`, `HUF`, `PLN` this is one of two accepted shapes; send the fields of one shape only, never a mixture.\n\nBecause this variant spans several currencies, the constraints on `accountHolderName`, `iban` are the permissive union across them, and where the currencies share no common format none is stated at all. Melio applies the exact per-currency rule when the account is created.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/InternationalFxAccountBase"
          },
          {
            "type": "object",
            "required": [
              "currency",
              "bankCountryCode",
              "bankDetails"
            ],
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "AED",
                  "CHF",
                  "DKK",
                  "EGP",
                  "EUR",
                  "GBP",
                  "GEL",
                  "HUF",
                  "ILS",
                  "NOK",
                  "PLN",
                  "RON",
                  "SEK",
                  "TRY"
                ],
                "description": "The currency delivered to the counterparty."
              },
              "bankCountryCode": {
                "type": "string",
                "enum": [
                  "AD",
                  "AE",
                  "AT",
                  "BE",
                  "BG",
                  "CH",
                  "CY",
                  "DE",
                  "DK",
                  "EE",
                  "EG",
                  "ES",
                  "FI",
                  "FR",
                  "GB",
                  "GE",
                  "GR",
                  "HR",
                  "HU",
                  "IE",
                  "IL",
                  "IT",
                  "LI",
                  "LT",
                  "LU",
                  "LV",
                  "MC",
                  "NL",
                  "NO",
                  "PL",
                  "PT",
                  "RO",
                  "SE",
                  "SI",
                  "SK",
                  "SM",
                  "TR",
                  "VA"
                ],
                "description": "ISO 3166-1 alpha-2 country of the counterparty bank. Must be one the chosen `currency` reaches, per the pairs above.\n"
              },
              "bankDetails": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "accountHolderName",
                  "iban"
                ],
                "properties": {
                  "accountHolderName": {
                    "type": "string",
                    "description": "The counterparty's name exactly as their bank holds it, not their trading name if the two differ.",
                    "pattern": "^[0-9A-Za-zÀ-ÖØ-öø-ÿ-_()'*,.%#^@&{}~<>+$\"\\[\\]\\\\ ]+$",
                    "minLength": 2,
                    "maxLength": 140,
                    "example": "Muster Handels GmbH"
                  },
                  "iban": {
                    "type": "string",
                    "description": "IBAN of the counterparty account. Spaces are allowed.",
                    "pattern": "^[a-zA-Z]{2}[a-zA-Z0-9 ]{12,40}$",
                    "minLength": 14,
                    "maxLength": 42,
                    "example": "DE12345678901234567890"
                  }
                }
              }
            }
          }
        ]
      },
      "CreateExternalInternationalFxBankCodeAccountRequest": {
        "description": "Counterparty accounts identified by a national bank code and account number. `bankDetails` takes exactly the fields listed below: all are required and no others are accepted.\n\nPermitted `currency` → `bankCountryCode`: `CZK` → `CZ`; `GHS` → `GH`; `HKD` → `HK`; `KES` → `KE`; `MAD` → `MA`; `NGN` → `NG`; `PHP` → `PH`; `SGD` → `SG`; `THB` → `TH`.\n\n`bankCode` is not free text: it must be an exact code from the supported list for the chosen currency (up to 325 of them). The list is too large to enumerate here — copy the value from this corridor’s request example on `POST /accounts`.\n\nBecause this variant spans several currencies, the constraints on `bankCode`, `accountNumber` are the permissive union across them, and where the currencies share no common format none is stated at all. Melio applies the exact per-currency rule when the account is created.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/InternationalFxAccountBase"
          },
          {
            "type": "object",
            "required": [
              "currency",
              "bankCountryCode",
              "bankDetails"
            ],
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "CZK",
                  "GHS",
                  "HKD",
                  "KES",
                  "MAD",
                  "NGN",
                  "PHP",
                  "SGD",
                  "THB"
                ],
                "description": "The currency delivered to the counterparty."
              },
              "bankCountryCode": {
                "type": "string",
                "enum": [
                  "CZ",
                  "GH",
                  "HK",
                  "KE",
                  "MA",
                  "NG",
                  "PH",
                  "SG",
                  "TH"
                ],
                "description": "ISO 3166-1 alpha-2 country of the counterparty bank. Must be one the chosen `currency` reaches, per the pairs above.\n"
              },
              "bankDetails": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "accountHolderName",
                  "bankCode",
                  "accountNumber"
                ],
                "properties": {
                  "accountHolderName": {
                    "type": "string",
                    "description": "The counterparty's name exactly as their bank holds it, not their trading name if the two differ.",
                    "pattern": "^[0-9A-Za-zÀ-ÖØ-öø-ÿ-_()'*,.%#^@&{}~<>+$\"\\[\\]\\\\ ]+$",
                    "minLength": 2,
                    "maxLength": 140,
                    "example": "Victoria Harbour Trading Ltd"
                  },
                  "bankCode": {
                    "type": "string",
                    "description": "The counterparty bank's national code. Must be one of the supported codes for this currency, not free text.",
                    "example": "552"
                  },
                  "accountNumber": {
                    "type": "string",
                    "description": "The counterparty account number.",
                    "pattern": "^[\\d -]+$",
                    "maxLength": 25,
                    "example": "231289112"
                  }
                }
              }
            }
          }
        ]
      },
      "CreateExternalInternationalFxBicAccountRequest": {
        "description": "Counterparty accounts identified by a BIC/SWIFT code and account number. `bankDetails` takes exactly the fields listed below: all are required and no others are accepted.\n\nPermitted `currency` → `bankCountryCode`: `BOB` → `BO`; `CNY` → `CN`; `DOP` → `DO`; `GTQ` → `GT`; `VND` → `VN`.\n\n`bic` is not free text: it must be an exact code from the supported list for the chosen currency (up to 115 of them). The list is too large to enumerate here — copy the value from this corridor’s request example on `POST /accounts`.\n\nBecause this variant spans several currencies, the constraints on `bic`, `accountNumber` are the permissive union across them, and where the currencies share no common format none is stated at all. Melio applies the exact per-currency rule when the account is created.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/InternationalFxAccountBase"
          },
          {
            "type": "object",
            "required": [
              "currency",
              "bankCountryCode",
              "bankDetails"
            ],
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "BOB",
                  "CNY",
                  "DOP",
                  "GTQ",
                  "VND"
                ],
                "description": "The currency delivered to the counterparty."
              },
              "bankCountryCode": {
                "type": "string",
                "enum": [
                  "BO",
                  "CN",
                  "DO",
                  "GT",
                  "VN"
                ],
                "description": "ISO 3166-1 alpha-2 country of the counterparty bank. Must be one the chosen `currency` reaches, per the pairs above.\n"
              },
              "bankDetails": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "accountHolderName",
                  "bic",
                  "accountNumber"
                ],
                "properties": {
                  "accountHolderName": {
                    "type": "string",
                    "description": "The counterparty's name exactly as their bank holds it, not their trading name if the two differ.",
                    "pattern": "^[0-9A-Za-zÀ-ÖØ-öø-ÿ-_()'*,.%#^@&{}~<>+$\"\\[\\]\\\\ ]+$",
                    "minLength": 2,
                    "maxLength": 255,
                    "example": "Shanghai Hongqiao Trading Co"
                  },
                  "bic": {
                    "type": "string",
                    "description": "BIC/SWIFT code of the counterparty's bank. Must be one of the supported codes for this currency, not free text.",
                    "example": "BOSHCNSH"
                  },
                  "accountNumber": {
                    "type": "string",
                    "description": "The counterparty account number.",
                    "maxLength": 34,
                    "example": "123456789012"
                  }
                }
              }
            }
          }
        ]
      },
      "CreateExternalInternationalFxAccountNumberAccountRequest": {
        "description": "Counterparty accounts identified by a single national account number. `bankDetails` takes exactly the fields listed below: all are required and no others are accepted.\n\nPermitted `currency` → `bankCountryCode`: `HUF` → `HU`; `NZD` → `NZ`; `PLN` → `PL`.\n\nFor `HUF`, `PLN` this is one of two accepted shapes; send the fields of one shape only, never a mixture.\n\nBecause this variant spans several currencies, the constraints on `accountHolderName`, `accountNumber` are the permissive union across them, and where the currencies share no common format none is stated at all. Melio applies the exact per-currency rule when the account is created.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/InternationalFxAccountBase"
          },
          {
            "type": "object",
            "required": [
              "currency",
              "bankCountryCode",
              "bankDetails"
            ],
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "HUF",
                  "NZD",
                  "PLN"
                ],
                "description": "The currency delivered to the counterparty."
              },
              "bankCountryCode": {
                "type": "string",
                "enum": [
                  "HU",
                  "NZ",
                  "PL"
                ],
                "description": "ISO 3166-1 alpha-2 country of the counterparty bank. Must be one the chosen `currency` reaches, per the pairs above.\n"
              },
              "bankDetails": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "accountHolderName",
                  "accountNumber"
                ],
                "properties": {
                  "accountHolderName": {
                    "type": "string",
                    "description": "The counterparty's name exactly as their bank holds it, not their trading name if the two differ.",
                    "pattern": "^[0-9A-Za-zÀ-ÖØ-öø-ÿ-_()'*,.%#^@&{}~<>+$\"\\[\\]\\\\ ]+$",
                    "minLength": 2,
                    "maxLength": 255,
                    "example": "Wisla Handel Sp. z o.o."
                  },
                  "accountNumber": {
                    "type": "string",
                    "description": "The counterparty account number.",
                    "minLength": 15,
                    "maxLength": 26,
                    "example": "12345678901234567890123456"
                  }
                }
              }
            }
          }
        ]
      },
      "CreateExternalInternationalFxSouthAfricanAccountRequest": {
        "description": "Counterparty accounts identified by a South African BIC, ID number and email. `bankDetails` takes exactly the fields listed below: all are required and no others are accepted.\n\nPermitted `currency` → `bankCountryCode`: `ZAR` → `ZA`.\n\n`bic` is not free text: it must be an exact code from the supported list for the chosen currency (up to 26 of them). The list is too large to enumerate here — copy the value from this corridor’s request example on `POST /accounts`.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/InternationalFxAccountBase"
          },
          {
            "type": "object",
            "required": [
              "currency",
              "bankCountryCode",
              "bankDetails"
            ],
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "ZAR"
                ],
                "description": "The currency delivered to the counterparty."
              },
              "bankCountryCode": {
                "type": "string",
                "enum": [
                  "ZA"
                ],
                "description": "ISO 3166-1 alpha-2 country of the counterparty bank. Must be one the chosen `currency` reaches, per the pairs above.\n"
              },
              "bankDetails": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "accountHolderName",
                  "bic",
                  "accountNumber",
                  "zarIdentificationNumber",
                  "email"
                ],
                "properties": {
                  "accountHolderName": {
                    "type": "string",
                    "description": "The counterparty's name exactly as their bank holds it, not their trading name if the two differ.",
                    "pattern": "^[0-9A-Za-zÀ-ÖØ-öø-ÿ-_()'’*,.%#^@&/{}~<>+$\"\\[\\]\\\\ ]+$",
                    "minLength": 2,
                    "maxLength": 100,
                    "example": "Table Bay Trading Pty Ltd"
                  },
                  "bic": {
                    "type": "string",
                    "description": "BIC/SWIFT code of the counterparty's bank. Must be one of the supported codes for this currency, not free text.",
                    "example": "ABSAZAJJ"
                  },
                  "accountNumber": {
                    "type": "string",
                    "description": "The counterparty account number.",
                    "pattern": "^\\d{7,11}$",
                    "minLength": 7,
                    "maxLength": 11,
                    "example": "00052312891"
                  },
                  "zarIdentificationNumber": {
                    "type": "string",
                    "description": "The counterparty's South African ID or passport number.",
                    "pattern": "^.{8,14}$",
                    "minLength": 8,
                    "maxLength": 14,
                    "example": "7901011234083"
                  },
                  "email": {
                    "type": "string",
                    "description": "The counterparty's email address. Required for this corridor.",
                    "pattern": "\\s*[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+\\s*",
                    "maxLength": 255,
                    "example": "ap@table.example.com"
                  }
                }
              }
            }
          }
        ]
      },
      "CreateExternalInternationalFxBsbAccountRequest": {
        "description": "Counterparty accounts identified by an Australian BSB code and account number. `bankDetails` takes exactly the fields listed below: all are required and no others are accepted.\n\nPermitted `currency` → `bankCountryCode`: `AUD` → `AU`.\n\n`address.state` is required for this corridor, unlike most others.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/InternationalFxAccountBase"
          },
          {
            "type": "object",
            "required": [
              "currency",
              "bankCountryCode",
              "bankDetails"
            ],
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "AUD"
                ],
                "description": "The currency delivered to the counterparty."
              },
              "bankCountryCode": {
                "type": "string",
                "enum": [
                  "AU"
                ],
                "description": "ISO 3166-1 alpha-2 country of the counterparty bank. Must be one the chosen `currency` reaches, per the pairs above.\n"
              },
              "bankDetails": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "accountHolderName",
                  "bsbCode",
                  "accountNumber"
                ],
                "properties": {
                  "accountHolderName": {
                    "type": "string",
                    "description": "The counterparty's name exactly as their bank holds it, not their trading name if the two differ.",
                    "pattern": "^[0-9A-Za-zÀ-ÖØ-öø-ÿ-_()'*,.%#^@&{}~<>+$\"\\[\\]\\\\ ]+$",
                    "minLength": 3,
                    "maxLength": 35,
                    "example": "Southern Cross Pty Ltd"
                  },
                  "bsbCode": {
                    "type": "string",
                    "description": "Australian BSB code, six digits. A hyphen after the third digit is optional.",
                    "pattern": "^\\d{3}-?\\d{3}$",
                    "minLength": 6,
                    "maxLength": 7,
                    "example": "802985"
                  },
                  "accountNumber": {
                    "type": "string",
                    "description": "The counterparty account number.",
                    "pattern": "^\\d{4,9}$",
                    "minLength": 4,
                    "maxLength": 28,
                    "example": "123456789"
                  }
                }
              }
            }
          }
        ]
      },
      "CreateExternalInternationalFxClabeAccountRequest": {
        "description": "Counterparty accounts identified by a Mexican CLABE. `bankDetails` takes exactly the fields listed below: all are required and no others are accepted.\n\nPermitted `currency` → `bankCountryCode`: `MXN` → `MX`.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/InternationalFxAccountBase"
          },
          {
            "type": "object",
            "required": [
              "currency",
              "bankCountryCode",
              "bankDetails"
            ],
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "MXN"
                ],
                "description": "The currency delivered to the counterparty."
              },
              "bankCountryCode": {
                "type": "string",
                "enum": [
                  "MX"
                ],
                "description": "ISO 3166-1 alpha-2 country of the counterparty bank. Must be one the chosen `currency` reaches, per the pairs above.\n"
              },
              "bankDetails": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "accountHolderName",
                  "clabe"
                ],
                "properties": {
                  "accountHolderName": {
                    "type": "string",
                    "description": "The counterparty's name exactly as their bank holds it, not their trading name if the two differ.",
                    "pattern": "^[0-9A-Za-zÀ-ÖØ-öø-ÿ-_()'*,.%#^@&{}~<>+$\"\\[\\]\\\\ ]+$",
                    "minLength": 2,
                    "maxLength": 40,
                    "example": "Comercial Reforma SA de CV"
                  },
                  "clabe": {
                    "type": "string",
                    "description": "Mexican CLABE, eighteen digits.",
                    "pattern": "^\\d{5}\\s?\\d{8}\\s?\\d{5}$",
                    "minLength": 18,
                    "maxLength": 18,
                    "example": "032180000118359719"
                  }
                }
              }
            }
          }
        ]
      },
      "CreateExternalInternationalFxIfscAccountRequest": {
        "description": "Counterparty accounts identified by an Indian IFSC code and account number. `bankDetails` takes exactly the fields listed below: all are required and no others are accepted.\n\nPermitted `currency` → `bankCountryCode`: `INR` → `IN`.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/InternationalFxAccountBase"
          },
          {
            "type": "object",
            "required": [
              "currency",
              "bankCountryCode",
              "bankDetails"
            ],
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "INR"
                ],
                "description": "The currency delivered to the counterparty."
              },
              "bankCountryCode": {
                "type": "string",
                "enum": [
                  "IN"
                ],
                "description": "ISO 3166-1 alpha-2 country of the counterparty bank. Must be one the chosen `currency` reaches, per the pairs above.\n"
              },
              "bankDetails": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "accountHolderName",
                  "ifscCode",
                  "accountNumber"
                ],
                "properties": {
                  "accountHolderName": {
                    "type": "string",
                    "description": "The counterparty's name exactly as their bank holds it, not their trading name if the two differ.",
                    "pattern": "^[0-9A-Za-zÀ-ÖØ-öø-ÿ-_()'*,.%#^@&{}~<>+$\"\\[\\]\\\\ ]+$",
                    "minLength": 2,
                    "maxLength": 140,
                    "example": "Deccan Exports Pvt Ltd"
                  },
                  "ifscCode": {
                    "type": "string",
                    "description": "Indian IFSC code, eleven characters.",
                    "pattern": "^[A-Za-z]{4}0[A-Za-z0-9]{6}$",
                    "minLength": 11,
                    "maxLength": 11,
                    "example": "YESB0236041"
                  },
                  "accountNumber": {
                    "type": "string",
                    "description": "The counterparty account number.",
                    "pattern": "^[a-zA-Z0-9]{5,20}$",
                    "minLength": 5,
                    "maxLength": 20,
                    "example": "678911234567891"
                  }
                }
              }
            }
          }
        ]
      },
      "CreateExternalInternationalFxCanadianAccountRequest": {
        "description": "Counterparty accounts identified by Canadian institution and transit numbers. `bankDetails` takes exactly the fields listed below: all are required and no others are accepted.\n\nPermitted `currency` → `bankCountryCode`: `CAD` → `CA`.\n\n`address.state` is required for this corridor, unlike most others.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/InternationalFxAccountBase"
          },
          {
            "type": "object",
            "required": [
              "currency",
              "bankCountryCode",
              "bankDetails"
            ],
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "CAD"
                ],
                "description": "The currency delivered to the counterparty."
              },
              "bankCountryCode": {
                "type": "string",
                "enum": [
                  "CA"
                ],
                "description": "ISO 3166-1 alpha-2 country of the counterparty bank. Must be one the chosen `currency` reaches, per the pairs above.\n"
              },
              "bankDetails": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "accountHolderName",
                  "institutionNumber",
                  "transitNumber",
                  "accountNumber",
                  "accountType"
                ],
                "properties": {
                  "accountHolderName": {
                    "type": "string",
                    "description": "The counterparty's name exactly as their bank holds it, not their trading name if the two differ.",
                    "pattern": "[0-9A-Za-zÀ-ÖØ-öø-ÿ-_()'*,.%#^@&{}~<>+$\"\\[\\]\\\\ ]+$",
                    "minLength": 3,
                    "maxLength": 80,
                    "example": "Northwind Trading Ltd"
                  },
                  "institutionNumber": {
                    "type": "string",
                    "description": "Canadian three-digit institution (bank) number.",
                    "pattern": "\\d{3}",
                    "minLength": 3,
                    "maxLength": 3,
                    "example": "006"
                  },
                  "transitNumber": {
                    "type": "string",
                    "description": "Canadian five-digit transit (branch) number.",
                    "pattern": "\\d{5}",
                    "minLength": 5,
                    "maxLength": 5,
                    "example": "04841"
                  },
                  "accountNumber": {
                    "type": "string",
                    "description": "The counterparty account number.",
                    "pattern": "\\d{7,12}",
                    "minLength": 7,
                    "maxLength": 12,
                    "example": "1234567"
                  },
                  "accountType": {
                    "type": "string",
                    "description": "Whether the destination account is a chequing or a savings account.",
                    "enum": [
                      "CHECKING",
                      "SAVINGS"
                    ],
                    "example": "CHECKING"
                  }
                }
              }
            }
          }
        ]
      },
      "CreateExternalInternationalFxSortCodeAccountRequest": {
        "description": "Counterparty accounts identified by a UK sort code and account number. `bankDetails` takes exactly the fields listed below: all are required and no others are accepted.\n\nPermitted `currency` → `bankCountryCode`: `GBP` → `GB`.\n\nFor `GBP` this is one of two accepted shapes; send the fields of one shape only, never a mixture.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/InternationalFxAccountBase"
          },
          {
            "type": "object",
            "required": [
              "currency",
              "bankCountryCode",
              "bankDetails"
            ],
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "GBP"
                ],
                "description": "The currency delivered to the counterparty."
              },
              "bankCountryCode": {
                "type": "string",
                "enum": [
                  "GB"
                ],
                "description": "ISO 3166-1 alpha-2 country of the counterparty bank. Must be one the chosen `currency` reaches, per the pairs above.\n"
              },
              "bankDetails": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "accountHolderName",
                  "sortCode",
                  "accountNumber"
                ],
                "properties": {
                  "accountHolderName": {
                    "type": "string",
                    "description": "The counterparty's name exactly as their bank holds it, not their trading name if the two differ.",
                    "pattern": "^[0-9A-Za-zÀ-ÖØ-öø-ÿ-_()'*,.%#^@&{}~<>+$\"\\[\\]\\\\ ]+$",
                    "minLength": 2,
                    "maxLength": 140,
                    "example": "Northwind Ltd"
                  },
                  "sortCode": {
                    "type": "string",
                    "description": "UK sort code, six digits. Hyphens optional.",
                    "pattern": "^\\d{2}-?\\d{2}-?\\d{2}$",
                    "minLength": 6,
                    "maxLength": 8,
                    "example": "40-30-20"
                  },
                  "accountNumber": {
                    "type": "string",
                    "description": "The counterparty account number.",
                    "pattern": "[0-9]{8}",
                    "minLength": 8,
                    "maxLength": 8,
                    "example": "12345678"
                  }
                }
              }
            }
          }
        ]
      },
      "CreateExternalInternationalFxKoreanAccountRequest": {
        "description": "Counterparty accounts identified by a Korean bank code, account number and email. `bankDetails` takes exactly the fields listed below: all are required and no others are accepted.\n\nPermitted `currency` → `bankCountryCode`: `KRW` → `KR`.\n\n`bankCode` is not free text: it must be an exact code from the supported list for the chosen currency (up to 63 of them). The list is too large to enumerate here — copy the value from this corridor’s request example on `POST /accounts`.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/InternationalFxAccountBase"
          },
          {
            "type": "object",
            "required": [
              "currency",
              "bankCountryCode",
              "bankDetails"
            ],
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "KRW"
                ],
                "description": "The currency delivered to the counterparty."
              },
              "bankCountryCode": {
                "type": "string",
                "enum": [
                  "KR"
                ],
                "description": "ISO 3166-1 alpha-2 country of the counterparty bank. Must be one the chosen `currency` reaches, per the pairs above.\n"
              },
              "bankDetails": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "email",
                  "accountHolderName",
                  "bankCode",
                  "accountNumber"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "The counterparty's email address. Required for this corridor.",
                    "pattern": "^[^\\s]+@[^\\s]+\\.[^\\s]{2,}$",
                    "maxLength": 255,
                    "example": "ap@hangang.example.com"
                  },
                  "accountHolderName": {
                    "type": "string",
                    "description": "The counterparty's name exactly as their bank holds it, not their trading name if the two differ.",
                    "pattern": "^[0-9A-Za-zÀ-ÖØ-öø-ÿ-_()'*,.%#^@&{}~<>+$\"\\[\\]\\\\ ]+$",
                    "minLength": 2,
                    "maxLength": 140,
                    "example": "Hangang Trading Co"
                  },
                  "bankCode": {
                    "type": "string",
                    "description": "The counterparty bank's national code. Must be one of the supported codes for this currency, not free text.",
                    "example": "HSBCKRSE"
                  },
                  "accountNumber": {
                    "type": "string",
                    "description": "The counterparty account number.",
                    "minLength": 10,
                    "maxLength": 16,
                    "example": "1254693521232"
                  }
                }
              }
            }
          }
        ]
      },
      "CreateExternalInternationalFxBrazilianAccountRequest": {
        "description": "Counterparty accounts identified by Brazilian bank, branch, account type and CNPJ. `bankDetails` takes exactly the fields listed below: all are required and no others are accepted.\n\nPermitted `currency` → `bankCountryCode`: `BRL` → `BR`.\n\n`address.state` is required for this corridor, unlike most others.\n\n`bankCode` is not free text: it must be an exact code from the supported list for the chosen currency (up to 104 of them). The list is too large to enumerate here — copy the value from this corridor’s request example on `POST /accounts`.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/InternationalFxAccountBase"
          },
          {
            "type": "object",
            "required": [
              "currency",
              "bankCountryCode",
              "bankDetails"
            ],
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "BRL"
                ],
                "description": "The currency delivered to the counterparty."
              },
              "bankCountryCode": {
                "type": "string",
                "enum": [
                  "BR"
                ],
                "description": "ISO 3166-1 alpha-2 country of the counterparty bank. Must be one the chosen `currency` reaches, per the pairs above.\n"
              },
              "bankDetails": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "email",
                  "accountHolderName",
                  "bankCode",
                  "branchCode",
                  "accountNumber",
                  "accountType",
                  "cnpj"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "The counterparty's email address. Required for this corridor.",
                    "pattern": "\\s*[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+\\s*",
                    "maxLength": 255,
                    "example": "ap@ipanema.example.com"
                  },
                  "accountHolderName": {
                    "type": "string",
                    "description": "The counterparty's name exactly as their bank holds it, not their trading name if the two differ.",
                    "pattern": "^[0-9A-Za-zÀ-ÖØ-öø-ÿ-_()'*,.%#^@&{}~<>+$\"\\[\\]\\\\ ]+$",
                    "minLength": 2,
                    "maxLength": 140,
                    "example": "Ipanema Comercio Ltda"
                  },
                  "bankCode": {
                    "type": "string",
                    "description": "The counterparty bank's national code. Must be one of the supported codes for this currency, not free text.",
                    "example": "332"
                  },
                  "branchCode": {
                    "type": "string",
                    "description": "Brazilian branch (agencia) code.",
                    "pattern": "^[\\d-]{3,5}[\\dxX]$",
                    "minLength": 4,
                    "maxLength": 6,
                    "example": "1234"
                  },
                  "accountNumber": {
                    "type": "string",
                    "description": "The counterparty account number.",
                    "minLength": 2,
                    "maxLength": 12,
                    "example": "12345678-9"
                  },
                  "accountType": {
                    "type": "string",
                    "description": "Whether the destination account is a chequing or a savings account.",
                    "enum": [
                      "CHECKING",
                      "SAVINGS"
                    ],
                    "example": "CHECKING"
                  },
                  "cnpj": {
                    "type": "string",
                    "description": "The counterparty's Brazilian CNPJ tax registration number, punctuation optional.",
                    "example": "64.753.719/0001-86"
                  }
                }
              }
            }
          }
        ]
      },
      "Attachment": {
        "type": "object",
        "description": "A stored document. The bytes are write-only through this API; what comes back is the id to reference from a payment plus enough metadata to recognise which file it was.\n",
        "required": [
          "id",
          "fileName",
          "mimeType",
          "byteSize",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Attachment id (att_<id>). Pass as `attachmentId` on `POST /payments`.",
            "example": "att_9f8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d"
          },
          "fileName": {
            "type": "string",
            "description": "The filename as uploaded.",
            "example": "invoice-2043.pdf"
          },
          "mimeType": {
            "type": "string",
            "enum": [
              "application/pdf",
              "image/jpeg",
              "image/png"
            ],
            "description": "The document's media type."
          },
          "byteSize": {
            "type": "integer",
            "description": "Size of the uploaded document in bytes.",
            "example": 182734
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the document was stored."
          }
        }
      },
      "InternationalFxAccountBase": {
        "type": "object",
        "description": "The fields every international-fx account carries, whatever its currency.",
        "required": [
          "ownershipType",
          "type",
          "counterPartyName",
          "counterPartyEmail",
          "currency",
          "bankCountryCode",
          "bankDetails",
          "address"
        ],
        "properties": {
          "ownershipType": {
            "type": "string",
            "enum": [
              "external"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "international-fx"
            ]
          },
          "externalId": {
            "$ref": "#/components/schemas/ExternalId"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "counterPartyName": {
            "type": "string",
            "description": "Counterparty name, as registered with their bank"
          },
          "counterPartyEmail": {
            "type": "string",
            "format": "email",
            "description": "Counterparty (payee) email"
          },
          "address": {
            "allOf": [
              {
                "$ref": "#/components/schemas/InternationalAddress"
              }
            ],
            "description": "The counterparty's address."
          }
        }
      },
      "CreateExternalInternationalGusdAccountRequest": {
        "type": "object",
        "description": "A counterparty stablecoin wallet, paid in USD-denominated GUSD. Only the last four characters of the wallet address are stored; the full address is never returned.\n",
        "required": [
          "ownershipType",
          "type",
          "counterPartyName",
          "counterPartyEmail",
          "walletAddress"
        ],
        "properties": {
          "ownershipType": {
            "type": "string",
            "enum": [
              "external"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "international-gusd"
            ]
          },
          "externalId": {
            "$ref": "#/components/schemas/ExternalId"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "counterPartyName": {
            "type": "string",
            "description": "Counterparty name"
          },
          "counterPartyEmail": {
            "type": "string",
            "format": "email",
            "description": "Counterparty (payee) email"
          },
          "walletAddress": {
            "type": "string",
            "description": "The counterparty's wallet address, between 32 and 44 characters.",
            "minLength": 32,
            "maxLength": 44
          }
        }
      },
      "CreateAccountLinkRequest": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "plaid",
              "card"
            ]
          },
          "externalId": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ExternalId"
              }
            ],
            "description": "Your own unique identifier for the account. When set, the account created through this link is pinned to this externalId; the submitter cannot supply a different one.\n"
          }
        }
      },
      "AccountLink": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "Melio-hosted URL the entity opens to add the account. It embeds a short-lived session token, so do not log or share it."
          },
          "expiration": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Account": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Opaque account id (acct_<id>)"
          },
          "externalId": {
            "$ref": "#/components/schemas/ExternalId"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "ownershipType": {
            "type": "string",
            "enum": [
              "internal",
              "external"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "ach",
              "check",
              "card",
              "domestic-wire",
              "virtual-card",
              "counterparty-choice",
              "international-fx",
              "international-gusd"
            ],
            "description": "Plaid-backed internal accounts are returned as ach."
          },
          "nickname": {
            "type": "string",
            "description": "Present for internal accounts."
          },
          "counterPartyName": {
            "type": "string",
            "description": "Present for external accounts."
          },
          "counterPartyEmail": {
            "type": "string",
            "description": "Counterparty (payee) email. Present for external accounts."
          },
          "isVerified": {
            "type": "boolean",
            "description": "Present for internal accounts. For ach, `false` while micro-deposit verification is outstanding and `true` once it completes. Absent for external accounts, where verification does not apply.\n"
          },
          "bankAccount": {
            "type": "object",
            "description": "Present when type=ach.",
            "properties": {
              "accountType": {
                "type": "string",
                "enum": [
                  "checking",
                  "savings"
                ]
              },
              "routingNumber": {
                "type": "string"
              },
              "accountNumberLast4": {
                "type": "string"
              }
            }
          },
          "card": {
            "type": "object",
            "description": "Present when type=card.",
            "properties": {
              "lastFourDigits": {
                "type": "string"
              },
              "network": {
                "type": "string"
              },
              "expiration": {
                "type": "string",
                "description": "MM/YY"
              }
            }
          },
          "paperCheck": {
            "type": "object",
            "description": "Present when type=check.",
            "properties": {
              "printName": {
                "type": "string"
              },
              "address": {
                "$ref": "#/components/schemas/AddressResponse"
              }
            }
          },
          "domesticWire": {
            "type": "object",
            "description": "Present when type=domestic-wire.",
            "properties": {
              "routingNumber": {
                "type": "string",
                "description": "ABA routing number of the receiving bank"
              },
              "accountNumberLast4": {
                "type": "string"
              },
              "address": {
                "$ref": "#/components/schemas/AddressResponse"
              }
            }
          },
          "internationalFx": {
            "type": "object",
            "description": "Present when type=international-fx. The submitted bank identifiers are stored encrypted, so only the last four characters are returned.\n",
            "properties": {
              "currency": {
                "type": "string",
                "description": "ISO 4217 code the counterparty is paid in"
              },
              "bankCountryCode": {
                "type": "string"
              },
              "bankName": {
                "type": "string"
              },
              "accountIdentifierLast4": {
                "type": "string",
                "description": "Last four characters of the IBAN or account number on file."
              },
              "address": {
                "$ref": "#/components/schemas/AddressResponse"
              }
            }
          },
          "internationalGusd": {
            "type": "object",
            "description": "Present when type=international-gusd.",
            "properties": {
              "walletAddressLast4": {
                "type": "string",
                "description": "Last four characters of the wallet address"
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Metadata": {
        "type": "object",
        "description": "Free-form string key/value pairs stored and returned verbatim, never interpreted by Melio. Up to 500 keys; each key 1 to 40 chars and may not contain square brackets (`[` `]`, reserved for the `metadata[key]` filter); value ≤100 chars. The whole object must serialize to at most 128KB of JSON. Filterable via `metadata[key]`.\n",
        "additionalProperties": {
          "type": "string",
          "maxLength": 100
        },
        "maxProperties": 500
      },
      "ExternalId": {
        "type": "string",
        "description": "Your own unique identifier for the resource. Unique per partner per resource type (reusing one returns 409 DUPLICATE_EXTERNAL_ID). Distinct from the Idempotency-Key header, which dedupes the request rather than identifying the resource.\n",
        "maxLength": 255,
        "pattern": "^[A-Za-z0-9_-]+$"
      },
      "GoodsAndServicesCompliance": {
        "type": "object",
        "description": "Compliance details for a goods-and-services payment.",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "goods-and-services"
            ]
          },
          "goodsReceived": {
            "type": "boolean",
            "description": "The payer confirms the goods or services were received. Required to be `true` only for card-originated payments above $3,000 (amount greater than 300000 minor units). Not required for non-card payments or for amounts at or below the threshold.\n"
          },
          "card": {
            "$ref": "#/components/schemas/CardCompliance"
          }
        }
      },
      "CardCompliance": {
        "type": "object",
        "description": "Compliance details the card networks require about the counterparty. Required, with all of its fields, when the originating account is a card; ignored for every other originating account type.\n",
        "required": [
          "merchantCategoryCode"
        ],
        "properties": {
          "merchantCategoryCode": {
            "type": "string",
            "description": "The counterparty's 4-digit MCC (merchant category code).",
            "pattern": "^\\d{4}$"
          },
          "merchantAddress": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Address"
              }
            ],
            "description": "The counterparty's business address. Required for card-originated payments, the same as the MCC. Saved on the counterparty, so the most recent payment's address is the one held on record.\n"
          }
        }
      },
      "FxGoodsAndServicesCompliance": {
        "description": "Goods-and-services compliance for an `international-fx` payment: everything the domestic variant asks for, plus a required `purpose`.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/GoodsAndServicesCompliance"
          },
          {
            "type": "object",
            "required": [
              "purpose"
            ],
            "properties": {
              "purpose": {
                "type": "string",
                "description": "Why the money is being sent. Required — a converted payment cannot be submitted without one.\n\nUsually free text (e.g. \"payment for consulting services\"), but a few corridors take a code from a fixed set instead and refuse anything else. Today those are **INR** (10 codes, e.g. `GOODS_EXPORTED`, `SOFTWARE_EXPORT`, `TRAVEL_EXPENSES`), **BRL** (7, e.g. `BUY_OR_SELL_BUSINESS_SERVICE`, `INTERNATIONAL_TRAVEL`) and **CNY** (`GOODS`, `SERVICES`, `INVESTMENTS`, `OTHER_BUSINESS`). Sending free text to one of those is rejected with `400 VALIDATION_ERROR` listing the values it accepts. The lists can change, so treat these as examples and read the error for the current set.\n",
                "example": "payment for consulting services"
              }
            }
          }
        ]
      },
      "PaymentCompliance": {
        "description": "Compliance details, discriminated by `type`. Only `goods-and-services` is supported today; other payment types may add their own variants with different fields.\n",
        "oneOf": [
          {
            "$ref": "#/components/schemas/GoodsAndServicesCompliance"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "goods-and-services": "#/components/schemas/GoodsAndServicesCompliance"
          }
        }
      },
      "FxPaymentCompliance": {
        "description": "Compliance details for a converted payment, discriminated by `type`.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/FxGoodsAndServicesCompliance"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "goods-and-services": "#/components/schemas/FxGoodsAndServicesCompliance"
          }
        }
      },
      "PaymentRequestBase": {
        "type": "object",
        "description": "The fields every payment carries. The rail-specific variants add `deliveryPreference` and `compliance`; the converted one also adds `fxQuoteToken` and makes `currency` required.\n",
        "required": [
          "amount",
          "originatingAccountId",
          "receivingAccountId",
          "deductionDate"
        ],
        "properties": {
          "amount": {
            "type": "integer",
            "description": "Minor units of the currency the counterparty is paid in — the amount they receive. For a converted payment (`CreateFxPaymentRequest`) that is the foreign amount, and the entity is debited the equivalent in USD at the applied rate.\n"
          },
          "originatingAccountId": {
            "type": "string",
            "description": "Internal originating account id (acct_<id>), the debit account"
          },
          "receivingAccountId": {
            "type": "string",
            "description": "External receiving account id (acct_<id>), the credit account"
          },
          "deductionDate": {
            "type": "string",
            "format": "date"
          },
          "currency": {
            "type": "string",
            "default": "USD",
            "description": "The currency the counterparty is paid in, which must match the receiving account's. `USD` for every domestic rail and for `international-gusd`, where it is the default and safe to omit; on `CreateFxPaymentRequest` it is required and must be the account's own `currency`. A mismatch — including `USD` against an `international-fx` account, which is never dollar-denominated — is rejected with `400 VALIDATION_ERROR`.\n"
          },
          "attachmentId": {
            "type": "string",
            "description": "A supporting document for this payment, from `POST /attachments` (`att_<id>`).\n\nSome international destinations will not accept a payment without one — the provider decides which, based on the destination country's risk rating, and the requirement can also depend on whether you have paid that counterparty before. When it applies and no `attachmentId` is given, the payment is rejected with `400 ATTACHMENT_REQUIRED`; upload the document and retry. Sending one where it is not required is always accepted.\n\nThe document is attached at creation, so it cannot be added or replaced with `PATCH /payments/{paymentId}`. The attachment must belong to the same entity as the payment, otherwise the request is rejected with `404`.\n",
            "example": "att_9f8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d"
          },
          "noteToSelf": {
            "type": "string",
            "description": "Payer-private memo, never shown to the recipient"
          },
          "noteToRecipient": {
            "type": "string",
            "description": "Note shown to the payment recipient"
          },
          "externalId": {
            "$ref": "#/components/schemas/ExternalId"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          }
        }
      },
      "CreateUsdPaymentRequest": {
        "description": "A payment the counterparty receives in USD: every domestic rail, and `international-gusd`, which converts nothing. `currency` defaults to `USD` and is the only value accepted. There is no rate to lock and no purpose to declare, so neither `fxQuoteToken` nor `compliance.purpose` exists on this payload.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/PaymentRequestBase"
          },
          {
            "type": "object",
            "required": [
              "deliveryPreference",
              "compliance"
            ],
            "properties": {
              "deliveryPreference": {
                "type": "string",
                "enum": [
                  "standard-ach",
                  "same-day-ach",
                  "rtp",
                  "standard-check",
                  "express-check",
                  "overnight-check",
                  "domestic-wire",
                  "instant-domestic-wire",
                  "virtual-card",
                  "instant-virtual-card",
                  "counterparty-choice",
                  "international-gusd"
                ],
                "description": "Required, and explicit about the receiving rail and delivery speed.\n\nThe preference's rail must match the receiving external account, otherwise the\nrequest is rejected with `400`.\n\nWith a bank (ACH) originating account, funds are collected before they are\ndelivered (the good-funds model): the standard values deliver at the rail's normal\nspeed, and the faster variants are subject to a per-payment eligibility check — an\nineligible fast variant is rejected with `400` (never silently downgraded).\n\nWith a card originating account, the collect is immediate, so ACH and wire payments\nalready deliver at the fast speed: use `same-day-ach` (not `standard-ach`) and\n`instant-domestic-wire` (not `domestic-wire`) — the superseded standard values are\nrejected with `400`, and no eligibility check applies to these two. Check values\nare unchanged, and virtual-card receiving accounts cannot be paid from a card\noriginating account.\n\n`counterparty-choice` is the only value for a `counterparty-choice` receiving\naccount: the counterparty picks the rail when they provide their details, and the\npayment then reports that rail's normal-speed preference.\n"
              },
              "compliance": {
                "$ref": "#/components/schemas/PaymentCompliance"
              }
            }
          }
        ]
      },
      "CreateFxPaymentRequest": {
        "description": "A payment converted into the receiving account's currency: `currency` is required rather than defaulted, and `fxQuoteToken` and `compliance.purpose` exist only here, because only this rail converts.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/PaymentRequestBase"
          },
          {
            "type": "object",
            "required": [
              "currency",
              "deliveryPreference",
              "compliance"
            ],
            "properties": {
              "fxQuoteToken": {
                "type": "string",
                "description": "The `quoteToken` returned by `POST /tools/fx-quote`, which locks the rate the payment is executed at. Optional: when omitted, the rate prevailing at creation is applied.\n\nA converted payment takes both its amounts from the quote, so the token must have been issued for this payment: one that is expired, or issued for a different `currency` or a different `amount`, is rejected with `400 FX_QUOTE_INVALID` rather than silently replacing what you asked to send.\n"
              },
              "deliveryPreference": {
                "type": "string",
                "enum": [
                  "international-fx",
                  "fast-international-fx"
                ],
                "description": "Required, and its rail must match the receiving external account, otherwise the request is rejected with `400`. `fast-international-fx` is subject to a per-payment eligibility check — an ineligible fast variant is rejected with `400` (never silently downgraded).\n"
              },
              "compliance": {
                "$ref": "#/components/schemas/FxPaymentCompliance"
              }
            }
          }
        ]
      },
      "CreatePaymentRequest": {
        "description": "Which payload applies follows from `deliveryPreference`: the two `international-fx` values take `CreateFxPaymentRequest`, every other value takes `CreateUsdPaymentRequest`.\n",
        "oneOf": [
          {
            "$ref": "#/components/schemas/CreateUsdPaymentRequest"
          },
          {
            "$ref": "#/components/schemas/CreateFxPaymentRequest"
          }
        ],
        "discriminator": {
          "propertyName": "deliveryPreference",
          "mapping": {
            "standard-ach": "#/components/schemas/CreateUsdPaymentRequest",
            "same-day-ach": "#/components/schemas/CreateUsdPaymentRequest",
            "rtp": "#/components/schemas/CreateUsdPaymentRequest",
            "standard-check": "#/components/schemas/CreateUsdPaymentRequest",
            "express-check": "#/components/schemas/CreateUsdPaymentRequest",
            "overnight-check": "#/components/schemas/CreateUsdPaymentRequest",
            "domestic-wire": "#/components/schemas/CreateUsdPaymentRequest",
            "instant-domestic-wire": "#/components/schemas/CreateUsdPaymentRequest",
            "virtual-card": "#/components/schemas/CreateUsdPaymentRequest",
            "instant-virtual-card": "#/components/schemas/CreateUsdPaymentRequest",
            "counterparty-choice": "#/components/schemas/CreateUsdPaymentRequest",
            "international-gusd": "#/components/schemas/CreateUsdPaymentRequest",
            "international-fx": "#/components/schemas/CreateFxPaymentRequest",
            "fast-international-fx": "#/components/schemas/CreateFxPaymentRequest"
          }
        }
      },
      "UpdatePaymentRequest": {
        "type": "object",
        "description": "Fields that can be changed on a payment before it begins processing. All fields are optional; only supplied fields are updated.\n",
        "properties": {
          "amount": {
            "type": "integer",
            "description": "Minor units (cents). Amount changes may be rejected (400) when they are not enabled for your account.\n"
          },
          "deductionDate": {
            "type": "string",
            "format": "date",
            "description": "The debit/schedule date"
          },
          "deliveryPreference": {
            "type": "string",
            "enum": [
              "standard-ach",
              "same-day-ach",
              "rtp",
              "standard-check",
              "express-check",
              "overnight-check",
              "domestic-wire",
              "instant-domestic-wire",
              "virtual-card",
              "instant-virtual-card",
              "counterparty-choice",
              "international-fx",
              "fast-international-fx",
              "international-gusd"
            ],
            "description": "See CreatePaymentRequest.deliveryPreference. The preference's rail must match the payment's receiving account, and only the values allowed for the payment's originating account are accepted (card-funded ACH/wire payments use `same-day-ach` / `instant-domestic-wire`); fast variants remain subject to the per-payment eligibility check and are rejected with 400 when ineligible."
          },
          "noteToSelf": {
            "type": "string",
            "description": "Payer-private memo, never shown to the recipient"
          },
          "noteToRecipient": {
            "type": "string",
            "description": "Note shown to the payment recipient"
          },
          "externalId": {
            "$ref": "#/components/schemas/ExternalId"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          }
        }
      },
      "Payment": {
        "type": "object",
        "required": [
          "deliveryPreference",
          "fees"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Opaque payment id (pay_<id>)"
          },
          "externalId": {
            "$ref": "#/components/schemas/ExternalId"
          },
          "amount": {
            "type": "integer"
          },
          "currency": {
            "type": "string"
          },
          "originatingAccountId": {
            "type": "string",
            "description": "Internal originating account id (acct_<id>)"
          },
          "receivingAccountId": {
            "type": "string",
            "description": "External receiving account id (acct_<id>)"
          },
          "deductionDate": {
            "type": "string",
            "format": "date"
          },
          "deliveryPreference": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DeliveryPreference"
              }
            ],
            "description": "Effective delivery preference. Reflects the faster variant when one was applied, otherwise the receiving rail's normal-speed value. Card-funded ACH and wire payments always report the fast name (`same-day-ach` / `instant-domestic-wire`) — a card collect is immediate, so those payments deliver at the fast speed.\n"
          },
          "deliveryDate": {
            "type": "string",
            "format": "date"
          },
          "status": {
            "type": "string",
            "enum": [
              "scheduled",
              "in-progress",
              "completed",
              "failed",
              "canceled"
            ],
            "description": "While a payment is being reviewed it is reported as `scheduled`; there is no separate review status.\n"
          },
          "failureReason": {
            "$ref": "#/components/schemas/PaymentFailure"
          },
          "noteToSelf": {
            "type": "string",
            "description": "Payer-private memo, never shown to the recipient"
          },
          "noteToRecipient": {
            "type": "string",
            "description": "Note shown to the payment recipient"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "fees": {
            "type": "array",
            "description": "The fees charged for this payment. Includes both the originator-side and receiver-side fees; use `chargeTo` on each item to tell them apart. Always present — an empty array when no fees have been recorded yet (e.g. a freshly created payment). Receiver-side fees appear when the receiver upgraded the payment (see `receiverUpgrade`): `rtp` and `same-day-ach` are netted — deducted from the amount the receiver is paid. An `instant-virtual-card` upgrade carries no fee.\n",
            "items": {
              "$ref": "#/components/schemas/PaymentFee"
            }
          },
          "tracking": {
            "$ref": "#/components/schemas/PaymentTracking"
          },
          "receiverUpgrade": {
            "$ref": "#/components/schemas/PaymentReceiverUpgrade"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PaymentReceiverUpgrade": {
        "type": "object",
        "description": "Present when the receiving party upgraded the payment from the payment notification Melio sent them. The upgrade itself is the payment's `deliveryPreference` (`rtp`, `same-day-ach` or `instant-virtual-card`) and `receivingAccountId`; the `upgradedFrom*` fields hold what you originally chose. A speed upgrade (`rtp`, `same-day-ach`) keeps the receiving account; the others move the payment to an account the receiver added (a bank account in place of a check, or a virtual card). The receiver pays for the upgrade — see the receiver-side entries in `fees`. An upgraded payment can no longer be updated (`409 PAYMENT_UPGRADED_BY_RECEIVER`).\n",
        "required": [
          "upgradedFromDeliveryPreference",
          "upgradedFromReceivingAccountId"
        ],
        "properties": {
          "upgradedFromDeliveryPreference": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DeliveryPreference"
              }
            ],
            "description": "The normal-speed delivery preference of the receiving account you chose, named as in `deliveryPreference` (e.g. `standard-ach`, `standard-check`, or `same-day-ach` for a card-funded payment).\n"
          },
          "upgradedFromReceivingAccountId": {
            "type": "string",
            "description": "The receiving account you chose (acct_<id>). Equal to `receivingAccountId` when the upgrade kept it.\n"
          }
        }
      },
      "DeliveryPreference": {
        "type": "string",
        "enum": [
          "standard-ach",
          "same-day-ach",
          "rtp",
          "standard-check",
          "express-check",
          "overnight-check",
          "domestic-wire",
          "instant-domestic-wire",
          "virtual-card",
          "instant-virtual-card",
          "counterparty-choice",
          "international-fx",
          "fast-international-fx",
          "international-gusd"
        ],
        "description": "How a payment is delivered: the receiving rail and its speed. A payment reports the preference it is delivered with; see `CreatePaymentRequest.deliveryPreference` for the values a request may use.\n"
      },
      "AchTracking": {
        "type": "object",
        "required": [
          "type"
        ],
        "description": "Delivery tracking for a payment delivered over ACH (including same-day ACH and RTP).",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "ach"
            ]
          },
          "traceNumber": {
            "type": "string",
            "description": "The ACH trace number of the delivery transfer, as reported by the network — the RTP root id for an RTP delivery. Absent until the transfer has been submitted.\n"
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the delivery transfer was submitted to the network."
          },
          "clearedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the delivery transfer settled at the receiving bank."
          }
        }
      },
      "CheckTracking": {
        "type": "object",
        "required": [
          "type"
        ],
        "description": "Delivery tracking for a payment delivered as a paper check.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "check"
            ]
          },
          "checkNumber": {
            "type": "string",
            "description": "The serial number printed on the check. Absent until the check has been issued."
          },
          "issuedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the check was printed."
          },
          "mailedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the check was handed to the mail carrier."
          },
          "clearedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the check was deposited and cleared."
          }
        }
      },
      "PaymentTracking": {
        "description": "Delivery tracking for the payment, discriminated by `type`. Appears once the rail has actually reported something — absent for wire and virtual-card payments, which report nothing, and for payments whose delivery has not reached the rail yet (a `scheduled` payment never carries it). A present object always holds at least one identifier or timestamp; the remaining fields fill in as the delivery progresses, so treat each of them as optional.\n",
        "oneOf": [
          {
            "$ref": "#/components/schemas/AchTracking"
          },
          {
            "$ref": "#/components/schemas/CheckTracking"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "ach": "#/components/schemas/AchTracking",
            "check": "#/components/schemas/CheckTracking"
          }
        }
      },
      "PaymentFailure": {
        "type": "object",
        "description": "Why a payment failed. Present only when `status` is `failed`, and absent otherwise.\n\nCodes are named after the industry code that produced them - the NACHA return code for an ACH return (`R02_ACCOUNT_CLOSED`), `CARD_` for an ISO 8583 card decline - so a code can be matched against a bank return without a translation table. Failures with no industry code behind them (a returned check, a risk decision) carry a descriptive name instead.\n\n`type` says which leg of the payment failed, so the same code serves both legs: `R02_ACCOUNT_CLOSED` under `failed-to-collect` refers to the payer's account, and under `failed-to-deliver` to the recipient's. Always read `code` together with `type`.\n\n`message` is human-readable and may be reworded at any time, so do not parse or match on it. New `code` values may be added within an existing `type`, so treat an unrecognized `code` as the generic code for its `type` (`COLLECTION_FAILED`, `DELIVERY_FAILED` or `RISK_DECLINED`) rather than as an error.\n",
        "required": [
          "type",
          "code",
          "message"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "Which leg of the payment failed.\n\n`failed-to-collect` - the funds could not be debited from the originating account, so no money left the payer. Typically fixable by the payer (top up the account, fix the bank details) and then re-creating the payment.\n\n`failed-to-deliver` - the funds were collected but could not be credited to the receiving account, and are returned to the payer. Usually needs corrected recipient details before re-creating the payment.\n\n`risk-declined` - the payment was declined in review before any money moved.\n",
            "enum": [
              "failed-to-collect",
              "failed-to-deliver",
              "risk-declined"
            ]
          },
          "code": {
            "type": "string",
            "description": "Stable, machine-readable failure code, named after the industry code behind it.\n\n**NACHA return codes** (`R##_*`) can appear under `failed-to-collect` or `failed-to-deliver`; `type` says which account the code refers to.\n\n**Card declines** (`CARD_*`) are ISO 8583 issuer responses and appear only under `failed-to-collect`, since only the payer funds a payment with a card.\n\n**Delivery outcomes** (`CHECK_RETURNED`, `VIRTUAL_CARD_EXPIRED`, `CANCELED_BY_RECIPIENT`, `RECIPIENT_DETAILS_NOT_PROVIDED`) have no industry code behind them and appear only under `failed-to-deliver`.\n\n**Risk codes** (`VERIFICATION_FAILED`, `UNSUPPORTED_BUSINESS_TYPE`, `UNSUPPORTED_LOCATION`, `PAYMENT_NOT_ALLOWED`, `DUPLICATE_PAYMENT_DETECTED`, `RISK_DECLINED`) appear only under `risk-declined`. Declines are reported as the bare `RISK_DECLINED` whenever the underlying reason cannot be disclosed, so it does not imply the reason is unknown.\n",
            "enum": [
              "R01_INSUFFICIENT_FUNDS",
              "R02_ACCOUNT_CLOSED",
              "R03_NO_ACCOUNT",
              "R04_INVALID_ACCOUNT_NUMBER",
              "R05_UNAUTHORIZED_DEBIT",
              "R08_PAYMENT_STOPPED",
              "R09_UNCOLLECTED_FUNDS",
              "R10_NOT_AUTHORIZED",
              "R13_INVALID_ROUTING_NUMBER",
              "R16_ACCOUNT_FROZEN",
              "R20_NON_TRANSACTION_ACCOUNT",
              "R23_CREDIT_REFUSED",
              "R29_CORPORATE_NOT_AUTHORIZED",
              "R84_CREDIT_EXCEPTION",
              "CARD_DO_NOT_HONOR",
              "CARD_INVALID_TRANSACTION",
              "CARD_INSUFFICIENT_FUNDS",
              "CARD_LIMIT_EXCEEDED",
              "CARD_BALANCE_UNAVAILABLE",
              "CHECK_RETURNED",
              "VIRTUAL_CARD_EXPIRED",
              "CANCELED_BY_RECIPIENT",
              "RECIPIENT_DETAILS_NOT_PROVIDED",
              "VERIFICATION_FAILED",
              "UNSUPPORTED_BUSINESS_TYPE",
              "UNSUPPORTED_LOCATION",
              "PAYMENT_NOT_ALLOWED",
              "DUPLICATE_PAYMENT_DETECTED",
              "RISK_DECLINED",
              "COLLECTION_FAILED",
              "DELIVERY_FAILED"
            ]
          },
          "message": {
            "type": "string",
            "description": "Human-readable explanation of the failure. Display-only; do not match on it."
          }
        },
        "example": {
          "type": "failed-to-collect",
          "code": "R01_INSUFFICIENT_FUNDS",
          "message": "The account had insufficient funds to cover the payment."
        }
      },
      "PaymentFee": {
        "description": "A single fee charged for a payment. Shares the `Fee` shape used by the fee calculator (`type`, `chargeTo`, `fixed`/`percent`, `amount`, all monetary values in minor units), and adds `status`, which only applies once a fee has actually been applied to a payment.\n",
        "allOf": [
          {
            "$ref": "#/components/schemas/Fee"
          },
          {
            "type": "object",
            "required": [
              "status"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "charged",
                  "pending"
                ],
                "description": "Whether the fee has been charged or is still pending."
              }
            }
          }
        ]
      },
      "PaymentList": {
        "type": "object",
        "required": [
          "data",
          "hasMore"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Payment"
            }
          },
          "hasMore": {
            "type": "boolean",
            "description": "True when more resources exist after this page; page again using the last item's id as `startingAfter`."
          }
        }
      },
      "CalculateFeesRequest": {
        "type": "object",
        "required": [
          "originatingAccountId",
          "receivingAccountId",
          "deliveryPreference",
          "amount"
        ],
        "properties": {
          "originatingAccountId": {
            "type": "string",
            "description": "Internal originating account id (acct_<id>), the debit account"
          },
          "receivingAccountId": {
            "type": "string",
            "description": "External receiving account id (acct_<id>), the credit account"
          },
          "deliveryPreference": {
            "type": "string",
            "enum": [
              "standard-ach",
              "same-day-ach",
              "rtp",
              "standard-check",
              "express-check",
              "overnight-check",
              "domestic-wire",
              "instant-domestic-wire",
              "virtual-card",
              "instant-virtual-card",
              "counterparty-choice",
              "international-fx",
              "fast-international-fx",
              "international-gusd"
            ],
            "description": "The delivery preference to price. Its rail must match the receiving account, and only the values allowed for the originating account are accepted (see CreatePaymentRequest.deliveryPreference — card-funded ACH/wire payments use `same-day-ach` / `instant-domestic-wire`). The normal-speed values (`standard-ach`, `standard-check`, `domestic-wire`, `virtual-card`) price that rail at normal speed."
          },
          "amount": {
            "type": "integer",
            "description": "The payment amount to price, in minor units of `currency` — for an international account, the amount the counterparty receives.\n"
          },
          "currency": {
            "type": "string",
            "default": "USD",
            "description": "Must match the receiving account's currency, exactly as on `POST /payments`.\n"
          }
        }
      },
      "Fee": {
        "type": "object",
        "description": "A single fee that would apply to the payment. All monetary values are minor units (cents).",
        "required": [
          "type",
          "chargeTo"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "standard-ach",
              "same-day-ach",
              "rtp",
              "standard-check",
              "express-check",
              "overnight-check",
              "domestic-wire",
              "instant-domestic-wire",
              "counterparty-choice",
              "international-fx",
              "fast-international-fx",
              "international-gusd",
              "card"
            ],
            "description": "What the fee is for. Delivery-method fees use the delivery preference they apply to (`standard-ach`, `same-day-ach`, `rtp`, `standard-check`, `express-check`, `overnight-check`, `domestic-wire`, `instant-domestic-wire`, `counterparty-choice`, `international-fx`, `fast-international-fx`, `international-gusd`); funding-source fees use the funding-source type (`card`).\n"
          },
          "chargeTo": {
            "type": "string",
            "enum": [
              "originator",
              "receiver"
            ],
            "description": "Which side of the payment the fee is levied on: the account originating the payment or the account receiving it. Works for both estimated (calculator) and applied (payment) fees.\n"
          },
          "fixed": {
            "type": "object",
            "description": "Present when the fee is a flat amount.",
            "properties": {
              "value": {
                "type": "integer",
                "description": "Flat fee, minor units (cents)"
              }
            }
          },
          "percent": {
            "type": "object",
            "description": "Present when the fee is a percentage of the payment amount.",
            "properties": {
              "rate": {
                "type": "number",
                "description": "Percentage rate (e.g. 2.9 = 2.9%)"
              },
              "min": {
                "type": "integer",
                "description": "Minimum fee, minor units (cents)"
              },
              "max": {
                "type": "integer",
                "description": "Maximum fee, minor units (cents)"
              }
            }
          },
          "amount": {
            "type": "integer",
            "description": "The resolved fee for the requested payment amount, in minor units (cents). Absent only when the fee cannot be resolved without a per-payment quote (e.g. tiered pricing).\n"
          }
        }
      },
      "FxQuoteRequest": {
        "type": "object",
        "description": "Only accounts that actually convert currency can be quoted: an `international-fx` account denominated in something other than USD. Anything else — a domestic account, a USD-denominated international account, or `international-gusd`, which is dollar-denominated — is rejected with `400`.\n",
        "required": [
          "receivingAccountId",
          "amount"
        ],
        "properties": {
          "receivingAccountId": {
            "type": "string",
            "description": "External receiving account id (acct_<id>), the credit account"
          },
          "amount": {
            "type": "integer",
            "description": "Minor units of `currency` — the amount the counterparty would receive.\n"
          },
          "currency": {
            "type": "string",
            "description": "Must match the receiving account's currency. Optional, but sending it turns a wrong assumption into a `400` instead of a quote in an unexpected currency.\n",
            "pattern": "^[A-Za-z]{3}$"
          },
          "purpose": {
            "type": "string",
            "description": "Why the money is being sent. Used to price the quote, so send the same value you will send as `compliance.purpose` on the payment.\n"
          }
        }
      },
      "FxQuote": {
        "type": "object",
        "description": "A priced currency conversion. `foreignAmount` is what the counterparty receives and `amount` is what the entity is debited, both in minor units of their own currency and both excluding fees.\n",
        "required": [
          "currency",
          "foreignAmount",
          "amount",
          "usdToForeignRate",
          "quoteToken"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "description": "ISO 4217 code of the currency delivered"
          },
          "foreignAmount": {
            "type": "integer",
            "description": "Minor units of `currency` delivered to the counterparty"
          },
          "amount": {
            "type": "integer",
            "description": "Minor units of USD debited from the entity, before fees"
          },
          "usdToForeignRate": {
            "type": "number",
            "description": "The applied rate: units of `currency` per USD"
          },
          "midMarketRate": {
            "type": "number",
            "description": "The mid-market reference rate, for comparison"
          },
          "quoteToken": {
            "type": "string",
            "description": "Opaque, short-lived token locking this rate. Pass it as `fxQuoteToken` on `POST /payments`, for a payment of this `amount` in this `currency` — the token is checked against both, so it cannot be spent on a payment it was not quoted for. Treat it as opaque; its format is not part of this contract.\n"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the token stops being accepted. After this, quote again."
          }
        }
      },
      "FastPaymentEligibilityRequest": {
        "type": "object",
        "required": [
          "originatingAccountId",
          "receivingAccountId",
          "amount"
        ],
        "properties": {
          "originatingAccountId": {
            "type": "string",
            "description": "Internal originating account id (acct_<id>), the debit account"
          },
          "receivingAccountId": {
            "type": "string",
            "description": "External receiving account id (acct_<id>), the credit account"
          },
          "amount": {
            "type": "integer",
            "description": "The prospective payment amount to check, in minor units (cents)."
          },
          "currency": {
            "type": "string",
            "default": "USD"
          }
        }
      },
      "FastPaymentEligibilityDecision": {
        "type": "object",
        "description": "Whether a single fast delivery preference is available for the prospective payment.",
        "required": [
          "deliveryPreference",
          "eligible"
        ],
        "properties": {
          "deliveryPreference": {
            "type": "string",
            "enum": [
              "same-day-ach",
              "rtp",
              "express-check",
              "overnight-check",
              "instant-domestic-wire",
              "instant-virtual-card",
              "fast-international-fx"
            ],
            "description": "A faster-than-standard delivery preference valid for the receiving external account and the originating account's funding type."
          },
          "eligible": {
            "type": "boolean",
            "description": "True when this fast delivery preference can be used for the prospective payment. When false (including when eligibility cannot be determined), only the receiving rail's standard-speed preference should be used.\n"
          }
        }
      },
      "FastPaymentEligibility": {
        "type": "object",
        "required": [
          "originatingAccountId",
          "receivingAccountId",
          "amount",
          "currency",
          "eligibilities"
        ],
        "properties": {
          "originatingAccountId": {
            "type": "string"
          },
          "receivingAccountId": {
            "type": "string"
          },
          "amount": {
            "type": "integer",
            "description": "Echoes the requested payment amount, minor units (cents)."
          },
          "currency": {
            "type": "string"
          },
          "eligibilities": {
            "type": "array",
            "description": "One entry per fast delivery preference valid for the receiving external account and the originating account's funding type. Card-funded `same-day-ach` / `instant-domestic-wire` are always eligible — the collect is immediate, so no eligibility check applies. Empty when no fast variants are available for the combination (e.g. a card originating account with a virtual-card receiving account).\n",
            "items": {
              "$ref": "#/components/schemas/FastPaymentEligibilityDecision"
            }
          }
        }
      },
      "DeliveryEtaRequest": {
        "type": "object",
        "required": [
          "originatingAccountId",
          "receivingAccountId",
          "amount"
        ],
        "properties": {
          "originatingAccountId": {
            "type": "string",
            "description": "Internal originating account id (acct_<id>), the debit account"
          },
          "receivingAccountId": {
            "type": "string",
            "description": "External receiving account id (acct_<id>), the credit account"
          },
          "amount": {
            "type": "integer",
            "description": "The prospective payment amount to estimate for, in minor units (cents)."
          },
          "deductionDate": {
            "type": "string",
            "format": "date",
            "description": "The debit/schedule date the estimate is based on. Defaults to the current date when omitted."
          },
          "currency": {
            "type": "string",
            "default": "USD"
          }
        }
      },
      "DeliveryEtaEstimate": {
        "type": "object",
        "description": "The estimated delivery date for a single delivery preference.",
        "required": [
          "deliveryPreference"
        ],
        "properties": {
          "deliveryPreference": {
            "type": "string",
            "enum": [
              "standard-ach",
              "same-day-ach",
              "rtp",
              "standard-check",
              "express-check",
              "overnight-check",
              "domestic-wire",
              "instant-domestic-wire",
              "virtual-card",
              "instant-virtual-card",
              "counterparty-choice",
              "international-fx",
              "fast-international-fx",
              "international-gusd"
            ],
            "description": "A delivery preference valid for the receiving external account and the originating account's funding type."
          },
          "deliveryDate": {
            "type": "string",
            "format": "date",
            "description": "The estimated date the funds would be delivered for this delivery preference. Absent when no date can be estimated for the preference.\n"
          }
        }
      },
      "DeliveryEta": {
        "type": "object",
        "required": [
          "originatingAccountId",
          "receivingAccountId",
          "amount",
          "currency",
          "deductionDate",
          "estimates"
        ],
        "properties": {
          "originatingAccountId": {
            "type": "string"
          },
          "receivingAccountId": {
            "type": "string"
          },
          "amount": {
            "type": "integer",
            "description": "Echoes the requested payment amount, minor units (cents)."
          },
          "currency": {
            "type": "string"
          },
          "deductionDate": {
            "type": "string",
            "format": "date",
            "description": "The debit/schedule date the estimates are based on."
          },
          "estimates": {
            "type": "array",
            "description": "One entry per delivery preference valid for the receiving external account. Empty when the rail has no valid preferences.\n",
            "items": {
              "$ref": "#/components/schemas/DeliveryEtaEstimate"
            }
          }
        }
      },
      "WebhookEventName": {
        "type": "string",
        "description": "An event type a webhook endpoint can subscribe to (in the Melio developers portal).",
        "enum": [
          "api.entity.created",
          "api.entity.updated",
          "api.account.created",
          "api.account.updated",
          "api.account.deleted",
          "api.payment.created",
          "api.payment.updated",
          "api.limitation.updated"
        ]
      },
      "WebhookDeliveryBase": {
        "type": "object",
        "description": "Fields present on every webhook delivery. Each delivery is a lightweight notification: it identifies the\naffected resource, not its full state; fetch the current resource with GET\n/entities/{entityId} to avoid acting on a stale snapshot.\n\nDeliveries are POSTed as `application/json` to the endpoint configured in the Melio developers\nportal, and are signed per the [Standard Webhooks](https://www.standardwebhooks.com) spec: verify\nthe `webhook-signature` header (`v1,<base64 HMAC-SHA256>` of `${webhook-id}.${webhook-timestamp}.${rawBody}`,\nkeyed with your `whsec_` signing secret) and reject deliveries whose `webhook-timestamp` is more\nthan 5 minutes from now. See **Webhooks** in the API overview for the full header list,\nverification code, and secret rotation.\n",
        "required": [
          "event",
          "messageId",
          "id",
          "entityId",
          "occurredAt"
        ],
        "properties": {
          "event": {
            "$ref": "#/components/schemas/WebhookEventName"
          },
          "messageId": {
            "type": "string",
            "description": "Unique event id, stable across retries (also sent as the `webhook-id` and `X-Melio-Delivery-Id` headers). Use for idempotency.\n"
          },
          "id": {
            "type": "string",
            "description": "The id of the affected resource (ent_<uuid> for api.entity.* and api.limitation.updated, acct_<...> for api.account.*, pay_<id> for api.payment.*).\n"
          },
          "externalId": {
            "type": "string",
            "description": "Your own id for the affected resource, if one was set when it was created. For api.entity.* this is the entity's externalId; for api.account.* the account's; for api.payment.* the payment's.\n"
          },
          "entityId": {
            "type": "string",
            "description": "The business entity that holds the resource."
          },
          "entityExternalId": {
            "type": "string",
            "description": "Your own id for the business entity that holds the resource, if one was set. Present on api.account.* and api.payment.* events so you can correlate the parent entity without storing Melio ids.\n"
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the change occurred (ISO-8601, UTC)."
          }
        }
      },
      "WebhookAccountEventData": {
        "type": "object",
        "required": [
          "ownershipType",
          "accountType"
        ],
        "properties": {
          "ownershipType": {
            "type": "string",
            "enum": [
              "internal",
              "external"
            ]
          },
          "accountType": {
            "type": "string",
            "enum": [
              "ach",
              "check",
              "card",
              "domestic-wire",
              "virtual-card",
              "counterparty-choice",
              "international-fx",
              "international-gusd"
            ]
          }
        }
      },
      "WebhookDeliveryEntityCreated": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookDeliveryBase"
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "enum": [
                  "api.entity.created"
                ]
              }
            }
          }
        ]
      },
      "WebhookDeliveryEntityUpdated": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookDeliveryBase"
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "enum": [
                  "api.entity.updated"
                ]
              }
            }
          }
        ],
        "description": "Sent whenever the entity changes, including when a risk decision is reached. Carries no `data`; fetch GET /entities/{entityId} for the current state.\n"
      },
      "WebhookDeliveryAccountCreated": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookDeliveryBase"
          },
          {
            "type": "object",
            "required": [
              "data"
            ],
            "properties": {
              "event": {
                "type": "string",
                "enum": [
                  "api.account.created"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/WebhookAccountEventData"
              }
            }
          }
        ]
      },
      "WebhookDeliveryAccountDeleted": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookDeliveryBase"
          },
          {
            "type": "object",
            "required": [
              "data"
            ],
            "properties": {
              "event": {
                "type": "string",
                "enum": [
                  "api.account.deleted"
                ]
              },
              "data": {
                "$ref": "#/components/schemas/WebhookAccountEventData"
              }
            }
          }
        ]
      },
      "WebhookDeliveryAccountUpdated": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookDeliveryBase"
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "enum": [
                  "api.account.updated"
                ]
              }
            }
          }
        ],
        "description": "Sent whenever the account changes, including when it becomes verified. Carries no `data`; fetch GET /accounts/{accountId} (Melio-Entity-Id header) to read the current `isVerified`.\n"
      },
      "WebhookDeliveryPaymentCreated": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookDeliveryBase"
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "enum": [
                  "api.payment.created"
                ]
              }
            }
          }
        ]
      },
      "WebhookDeliveryPaymentUpdated": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookDeliveryBase"
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "enum": [
                  "api.payment.updated"
                ]
              }
            }
          }
        ],
        "description": "Notifies you that a payment changed (a status transition such as in-progress / completed / failed, an edit, a cancellation, or an upgrade by the receiver — see `Payment.receiverUpgrade`). Carries no `data`; fetch GET /payments/{id} for the payment's current state. When a receiver upgrade moves the payment to an account the receiver added, an api.account.created for that account precedes it.\n"
      },
      "WebhookDeliveryLimitationUpdated": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookDeliveryBase"
          },
          {
            "type": "object",
            "properties": {
              "event": {
                "type": "string",
                "enum": [
                  "api.limitation.updated"
                ]
              }
            }
          }
        ],
        "description": "Notifies you that an entity's limitations changed. `id` is the entity's id. Carries no `data`; fetch GET /limitations (Melio-Entity-Id header) for the current limitations.\n"
      },
      "WebhookDelivery": {
        "description": "The request body Melio POSTs to a registered endpoint. The shape of `data` depends on `event`.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/WebhookDeliveryEntityCreated"
          },
          {
            "$ref": "#/components/schemas/WebhookDeliveryEntityUpdated"
          },
          {
            "$ref": "#/components/schemas/WebhookDeliveryAccountCreated"
          },
          {
            "$ref": "#/components/schemas/WebhookDeliveryAccountUpdated"
          },
          {
            "$ref": "#/components/schemas/WebhookDeliveryAccountDeleted"
          },
          {
            "$ref": "#/components/schemas/WebhookDeliveryPaymentCreated"
          },
          {
            "$ref": "#/components/schemas/WebhookDeliveryPaymentUpdated"
          },
          {
            "$ref": "#/components/schemas/WebhookDeliveryLimitationUpdated"
          }
        ],
        "discriminator": {
          "propertyName": "event",
          "mapping": {
            "api.entity.created": "#/components/schemas/WebhookDeliveryEntityCreated",
            "api.entity.updated": "#/components/schemas/WebhookDeliveryEntityUpdated",
            "api.account.created": "#/components/schemas/WebhookDeliveryAccountCreated",
            "api.account.updated": "#/components/schemas/WebhookDeliveryAccountUpdated",
            "api.account.deleted": "#/components/schemas/WebhookDeliveryAccountDeleted",
            "api.payment.created": "#/components/schemas/WebhookDeliveryPaymentCreated",
            "api.payment.updated": "#/components/schemas/WebhookDeliveryPaymentUpdated",
            "api.limitation.updated": "#/components/schemas/WebhookDeliveryLimitationUpdated"
          }
        }
      }
    }
  }
}