{
  "openapi": "3.1.0",
  "info": {
    "title": "Quidkey API",
    "version": "1.0.0",
    "description": "The Quidkey public API.\n\nWithin a version, a response can carry what this document doesn't list yet: a new field, a new value of an enum, a new error code. Handle a value you don't recognise rather than refusing the response. A client generated from this document turns an `enum` into a closed type unless told otherwise, so turn on its option for unknown values, such as openapi-generator's `enumUnknownDefaultCase`. A request is held to what's listed: a value it doesn't list is refused.",
    "contact": {
      "name": "Quidkey",
      "url": "https://docs.quidkey.com"
    }
  },
  "servers": [
    {
      "url": "https://api.quidkey.com/v1"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "account_owner"
    },
    {
      "name": "agreement"
    },
    {
      "name": "agreement_acceptance"
    },
    {
      "name": "api_key"
    },
    {
      "name": "bank"
    },
    {
      "name": "bank_account"
    },
    {
      "name": "capability"
    },
    {
      "name": "country"
    },
    {
      "name": "identity_verification"
    },
    {
      "name": "legal_entity"
    },
    {
      "name": "merchant"
    },
    {
      "name": "party"
    },
    {
      "name": "payment_link"
    },
    {
      "name": "payout"
    },
    {
      "name": "transaction"
    },
    {
      "name": "webhook_endpoint"
    }
  ],
  "paths": {
    "/account-owners/{id}": {
      "get": {
        "operationId": "account_owner.get",
        "summary": "Read an account owner",
        "description": "Reads one account owner.\n\nCredentials: `partner`, `merchant`\n\nPermission: `account-owners:get`",
        "tags": [
          "account_owner"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "account-owners:get",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The account_owner, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/AccountOwnerFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/agreement-acceptances/{id}": {
      "get": {
        "operationId": "agreement_acceptance.get",
        "summary": "Read an agreement acceptance",
        "description": "Reads one agreement acceptance, as its merchant's list shows it.\n\nCredentials: `partner`, `merchant`\n\nPermission: `agreement-acceptances:get`",
        "tags": [
          "agreement_acceptance"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "agreement-acceptances:get",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The agreement_acceptance, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/AgreementAcceptanceFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/agreements": {
      "get": {
        "operationId": "agreement.list",
        "summary": "List agreements",
        "description": "Lists the current version of each kind of agreement, in a fixed order, the order of the `kind` enum, whatever order the filter names. It needs no token, and a token sent to it is ignored.\n\nCredentials: none. It takes no token.",
        "tags": [
          "agreement"
        ],
        "security": [],
        "x-credentials": [],
        "x-permission": null,
        "x-views": [
          "full"
        ],
        "x-pagination": "none",
        "x-includes": [],
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "style": "form",
            "explode": false,
            "schema": {
              "minItems": 1,
              "maxItems": 13,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "merchant_terms",
                  "privacy_notice",
                  "data_processing_addendum",
                  "prohibited_use_policy",
                  "pricing_plan",
                  "third_party_services",
                  "banking_partner_authorization",
                  "bank_debit_authorization",
                  "nacha_acknowledgment",
                  "payto_merchant_terms",
                  "ach_authorization",
                  "payto_customer_service_agreement",
                  "customer_privacy_policy"
                ]
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of agreement, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AgreementFull"
                      }
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/agreements/{id}": {
      "get": {
        "operationId": "agreement.get",
        "summary": "Read an agreement",
        "description": "Reads one version of an agreement, current or superseded, by its stable code: `merchant_terms-5993bf48`. A superseded version stays readable, except a third party's document, such as `banking_partner_authorization`, where Quidkey holds only one version. Anything else names no version, and answers 404. It needs no token, and a token sent to it is ignored.\n\nCredentials: none. It takes no token.",
        "tags": [
          "agreement"
        ],
        "security": [],
        "x-credentials": [],
        "x-permission": null,
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The agreement, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/AgreementFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/api-keys/current": {
      "get": {
        "operationId": "api_key.getCurrent",
        "summary": "Read the current API key",
        "description": "Reads the credential that made this request, which tells a caller who it is. `id` is what it sends as `client_id`. A partner owner can't be included, so `?include=owner` lists it in `not_included`.\n\nCredentials: `partner`, `merchant`\n\nPermission: `api-keys:get-current`",
        "tags": [
          "api_key"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "api-keys:get-current",
        "x-views": [
          "full"
        ],
        "x-includes": [
          {
            "field": "owner",
            "view": "full",
            "is_default": false
          }
        ],
        "parameters": [
          {
            "name": "include",
            "in": "query",
            "required": false,
            "description": "Link fields to hydrate into `entities`, comma-separated. Sending it replaces the default, which is nothing.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "owner"
                ]
              }
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The api_key, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/ApiKeyFull"
                    },
                    "entities": {
                      "additionalProperties": {
                        "$ref": "#/components/schemas/MerchantFull"
                      },
                      "description": "Included linked resources, keyed by URI.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/api-keys/{id}": {
      "get": {
        "operationId": "api_key.get",
        "summary": "Read an API key",
        "description": "Reads the credential that made this request, by its ID. Any other ID answers 404. A partner owner can't be included, so `?include=owner` lists it in `not_included`.\n\nCredentials: `partner`, `merchant`\n\nPermission: `api-keys:get-current`",
        "tags": [
          "api_key"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "api-keys:get-current",
        "x-views": [
          "full"
        ],
        "x-includes": [
          {
            "field": "owner",
            "view": "full",
            "is_default": false
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "description": "Link fields to hydrate into `entities`, comma-separated. Sending it replaces the default, which is nothing.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "owner"
                ]
              }
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The api_key, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/ApiKeyFull"
                    },
                    "entities": {
                      "additionalProperties": {
                        "$ref": "#/components/schemas/MerchantFull"
                      },
                      "description": "Included linked resources, keyed by URI.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/bank-accounts/{id}": {
      "get": {
        "operationId": "bank_account.get",
        "summary": "Read a bank account",
        "description": "Reads one live bank account. An account that serves only test payment transactions answers 404, and so does a `virtual` account at a provider the merchant isn't onboarded with. A caller without permission to read balances gets the account, with its balance in `not_included`.\n\nCredentials: `partner`, `merchant`\n\nPermission: `bank-accounts:get`",
        "tags": [
          "bank_account"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "bank-accounts:get",
        "x-views": [
          "full"
        ],
        "x-includes": [
          {
            "field": "balance",
            "view": "full",
            "is_default": false
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "description": "Link fields to hydrate into `entities`, comma-separated. Sending it replaces the default, which is nothing.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "balance"
                ]
              }
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The bank_account, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/BankAccountFull"
                    },
                    "entities": {
                      "additionalProperties": {
                        "$ref": "#/components/schemas/BalanceFull"
                      },
                      "description": "Included linked resources, keyed by URI.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/bank-accounts/{id}/balance": {
      "get": {
        "operationId": "bank_account.getBalance",
        "summary": "Read a balance",
        "description": "Reads what the provider reports in a live, active virtual bank account. Any other account answers 404. It can be up to a minute old, so poll it no more often than that. A provider failure gives a `null` `amount` rather than an error. The account's currency and roles are on the bank account: `payment` means a route can send payment transactions here, where their funds wait to be paid out, and `refund` is the account refunds are paid from.\n\nCredentials: `partner`, `merchant`\n\nPermission: `balances:get`",
        "tags": [
          "bank_account"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "balances:get",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The balance, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/BalanceFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/bank-accounts/{id}:deactivate": {
      "post": {
        "operationId": "bank_account.deactivate",
        "summary": "Deactivate a bank account",
        "description": "Deactivates an `owned` account, which is final. Payment and payout routes on it move to another eligible account in that currency if there is one, and otherwise the route is removed. It's refused when this is the last payout account in the home currency and the merchant has routes in other currencies. Safe to repeat: an account that's already `inactive` answers 200 with no change.\n\nCredentials: `partner`, `merchant`\n\nPermission: `bank-accounts:deactivate`",
        "tags": [
          "bank_account"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "bank-accounts:deactivate",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The bank_account, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/BankAccountFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`HOME_CURRENCY_ROUTE_REQUIRED`: This is the last payout account in the home currency, and the merchant has routes in other currencies.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "HOME_CURRENCY_ROUTE_REQUIRED"
            ]
          },
          "422": {
            "description": "`BANK_ACCOUNT_VIRTUAL`: A virtual account can't be deactivated.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "BANK_ACCOUNT_VIRTUAL"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/banks/{id}": {
      "get": {
        "operationId": "bank.get",
        "summary": "Read a bank",
        "description": "Reads one bank, by its ID. A bank Quidkey doesn't offer answers 404, as an ID naming none does.\n\nCredentials: `partner`, `merchant`\n\nPermission: `banks:get`",
        "tags": [
          "bank"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "banks:get",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The bank, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/BankFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/countries": {
      "get": {
        "operationId": "country.list",
        "summary": "List countries",
        "description": "Lists every country and the rules for collecting details there, ordered by name. Most of these refuse a customer at create: `CURRENCY_COUNTRY_MISMATCH`, or `CUSTOMER_COUNTRY_NOT_SUPPORTED` when the payment transaction is in the country's own currency.\n\nCredentials: `partner`, `merchant`\n\nPermission: `countries:list`",
        "tags": [
          "country"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "countries:list",
        "x-views": [
          "full"
        ],
        "x-pagination": "cursor",
        "x-includes": [],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "has_onboarding_rules",
            "in": "query",
            "required": false,
            "description": "Only countries where this holds, or only those where it doesn't.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of country, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CountryFull"
                      }
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/countries/{id}": {
      "get": {
        "operationId": "country.get",
        "summary": "Read a country",
        "description": "Reads one country, by its upper-case ISO 3166-1 alpha-2 code. Anything else names no country, and answers 404.\n\nCredentials: `partner`, `merchant`\n\nPermission: `countries:get`",
        "tags": [
          "country"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "countries:get",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The country, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/CountryFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/identity-verifications/{id}": {
      "get": {
        "operationId": "identity_verification.get",
        "summary": "Read an identity check",
        "description": "Reads a merchant's newest identity check of a party. Starting another check adds a new one, and the older one then answers 404, as one of a removed party does.\n\nCredentials: `partner`, `merchant`\n\nPermission: `identity-verifications:get`",
        "tags": [
          "identity_verification"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "identity-verifications:get",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The identity_verification, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/IdentityVerificationFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/legal-entities/{id}": {
      "get": {
        "operationId": "legal_entity.get",
        "summary": "Read a legal entity",
        "description": "Reads one legal entity, if this credential can read any merchant it's under. A party's holder isn't a legal entity here: it answers 404, and its details are on the party.\n\nCredentials: `partner`, `merchant`\n\nPermission: `legal-entities:get`",
        "tags": [
          "legal_entity"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "legal-entities:get",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The legal_entity, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/LegalEntityFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      },
      "patch": {
        "operationId": "legal_entity.update",
        "summary": "Update a legal entity",
        "description": "Changes the fields sent, which have to be ones its `type` has. `null` is refused, because these fields can't be cleared. An address sent replaces the one held. Safe to repeat.\n\nCredentials: `partner`, `merchant`\n\nPermission: `legal-entities:update`",
        "tags": [
          "legal_entity"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "legal-entities:update",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "minProperties": 1,
                "additionalProperties": false,
                "type": "object",
                "properties": {
                  "legal_name": {
                    "minLength": 2,
                    "maxLength": 160,
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "registration_number": {
                    "minLength": 4,
                    "maxLength": 20,
                    "type": "string"
                  },
                  "legal_structure": {
                    "type": "string",
                    "enum": [
                      "limited_liability_company",
                      "private_limited_company",
                      "public_limited_company",
                      "general_partnership",
                      "limited_liability_partnership",
                      "limited_partnership",
                      "limited_liability_entrepreneurial_company",
                      "joint_stock_company",
                      "single_member_llc",
                      "multi_member_llc",
                      "private_partnership",
                      "private_corporation",
                      "public_company"
                    ]
                  },
                  "country_of_incorporation": {
                    "pattern": "^[A-Z]{2}$",
                    "type": "string"
                  },
                  "incorporation_date": {
                    "format": "date",
                    "type": "string"
                  },
                  "registered_address": {
                    "$ref": "#/components/schemas/AddressInput"
                  },
                  "contact_full_name": {
                    "minLength": 2,
                    "maxLength": 160,
                    "type": "string"
                  },
                  "contact_email": {
                    "format": "email",
                    "maxLength": 320,
                    "type": "string",
                    "pattern": "^[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])?)*$"
                  },
                  "contact_phone": {
                    "pattern": "^\\+[1-9]\\d{1,14}$",
                    "type": "string",
                    "minLength": 8
                  },
                  "vat_number": {
                    "minLength": 4,
                    "maxLength": 20,
                    "type": "string"
                  },
                  "tax_id": {
                    "minLength": 4,
                    "maxLength": 20,
                    "description": "Held to its country's format where the country sets one, as an ABN is.",
                    "type": "string"
                  },
                  "operating_address": {
                    "$ref": "#/components/schemas/AddressInput"
                  },
                  "annual_revenue": {
                    "type": "object",
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/Money"
                      },
                      {
                        "type": "object",
                        "required": [
                          "value"
                        ],
                        "properties": {
                          "value": {
                            "minimum": 0,
                            "maximum": 900719925474,
                            "type": "integer"
                          }
                        }
                      }
                    ],
                    "description": "A whole number of major units, so a value with non-zero minor units is refused rather than rounded, and at most 900719925474 in minor units."
                  },
                  "employee_count_band": {
                    "type": "string",
                    "enum": [
                      "small",
                      "medium",
                      "large",
                      "enterprise"
                    ]
                  },
                  "first_name": {
                    "minLength": 1,
                    "maxLength": 30,
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "last_name": {
                    "minLength": 1,
                    "maxLength": 30,
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "email": {
                    "format": "email",
                    "maxLength": 320,
                    "type": "string",
                    "pattern": "^[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])?)*$"
                  },
                  "phone": {
                    "pattern": "^\\+[1-9]\\d{1,14}$",
                    "type": "string",
                    "minLength": 8
                  },
                  "date_of_birth": {
                    "format": "date",
                    "type": "string"
                  },
                  "country_of_citizenship": {
                    "pattern": "^[A-Z]{2}$",
                    "type": "string"
                  },
                  "residential_address": {
                    "$ref": "#/components/schemas/AddressInput"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The legal_entity, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/LegalEntityFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`AMOUNT_TOO_LARGE`: The amount is more than this endpoint accepts.\n\n`LEGAL_ENTITY_TAX_ID_INVALID`: The tax ID doesn't match its country's format.\n\n`REGION_NOT_SUPPORTED`: A region isn't supported for this country.\n\n`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "AMOUNT_TOO_LARGE",
              "LEGAL_ENTITY_TAX_ID_INVALID",
              "REGION_NOT_SUPPORTED",
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/legal-entities/{id}/parties": {
      "get": {
        "operationId": "party.list",
        "summary": "List parties",
        "description": "Lists a legal entity's parties, newest first.\n\nCredentials: `partner`, `merchant`\n\nPermission: `parties:list`",
        "tags": [
          "party"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "parties:list",
        "x-views": [
          "full"
        ],
        "x-pagination": "cursor",
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of party, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PartyFull"
                      }
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      },
      "post": {
        "operationId": "party.create",
        "summary": "Create a party",
        "description": "Adds a person or company connected to a legal entity. `OWNERSHIP_TOTAL_EXCEEDED` gives the percentage still available in `details`, as `available_percent`. A retry with the same key answers the party the first one created. If the first ended without recording what it made, a retry answers `IDEMPOTENCY_IN_PROGRESS` until Quidkey resolves the key.\n\nCredentials: `partner`, `merchant`\n\nPermission: `parties:create`",
        "tags": [
          "party"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "parties:create",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "1 to 255 printable ASCII characters with no spaces, quotes or backslashes, in double quotes as the IETF draft defines, or without them. We recommend a UUID. Make one for each thing you mean to happen once and store it before you send the request, so a retry after a crash sends the same key. Keys are scoped to your account and the endpoint, not to a token, so a new token or a rotated secret doesn't affect a retry. A partner and its merchant are separate accounts, so the same key sent with each credential starts two requests. Keys are kept for at least 7 days. After that, the same key starts a new request.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 257,
              "pattern": "^(?:([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})|\"([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})\")$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "if": {
                  "properties": {
                    "type": {
                      "const": "company"
                    }
                  },
                  "required": [
                    "type"
                  ]
                },
                "then": {
                  "additionalProperties": false,
                  "required": [
                    "legal_name",
                    "registration_number",
                    "legal_structure",
                    "country_of_incorporation",
                    "registered_address",
                    "contact_full_name",
                    "contact_email",
                    "contact_phone"
                  ],
                  "properties": {
                    "type": {},
                    "party_roles": {},
                    "ownership_percent": {},
                    "legal_name": {},
                    "registration_number": {},
                    "legal_structure": {},
                    "country_of_incorporation": {},
                    "incorporation_date": {
                      "format": "date",
                      "type": "string"
                    },
                    "registered_address": {},
                    "contact_full_name": {},
                    "contact_email": {},
                    "contact_phone": {}
                  }
                },
                "else": {
                  "additionalProperties": false,
                  "required": [
                    "first_name",
                    "last_name",
                    "email",
                    "phone",
                    "date_of_birth",
                    "country_of_citizenship",
                    "residential_address"
                  ],
                  "properties": {
                    "type": {},
                    "party_roles": {},
                    "ownership_percent": {},
                    "first_name": {},
                    "last_name": {},
                    "email": {},
                    "phone": {},
                    "date_of_birth": {
                      "format": "date",
                      "type": "string"
                    },
                    "country_of_citizenship": {},
                    "residential_address": {}
                  }
                },
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "type",
                  "party_roles",
                  "ownership_percent"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "individual",
                      "company"
                    ]
                  },
                  "party_roles": {
                    "minItems": 1,
                    "uniqueItems": true,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "director",
                        "executive",
                        "representative"
                      ]
                    }
                  },
                  "ownership_percent": {
                    "pattern": "^(100(\\.0{1,2})?|\\d{1,2}(\\.\\d{1,2})?)$",
                    "description": "From `\"0.00\"`, which a director can hold, to `\"100.00\"`, to two decimal places.",
                    "type": "string"
                  },
                  "first_name": {
                    "minLength": 1,
                    "maxLength": 30,
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "last_name": {
                    "minLength": 1,
                    "maxLength": 30,
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "email": {
                    "format": "email",
                    "maxLength": 320,
                    "type": "string",
                    "pattern": "^[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])?)*$"
                  },
                  "phone": {
                    "pattern": "^\\+[1-9]\\d{1,14}$",
                    "type": "string",
                    "minLength": 8
                  },
                  "date_of_birth": {
                    "format": "date",
                    "type": "string"
                  },
                  "country_of_citizenship": {
                    "pattern": "^[A-Z]{2}$",
                    "type": "string"
                  },
                  "residential_address": {
                    "$ref": "#/components/schemas/AddressInput"
                  },
                  "legal_name": {
                    "minLength": 2,
                    "maxLength": 160,
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "registration_number": {
                    "minLength": 4,
                    "maxLength": 20,
                    "type": "string"
                  },
                  "legal_structure": {
                    "type": "string",
                    "enum": [
                      "limited_liability_company",
                      "private_limited_company",
                      "public_limited_company",
                      "general_partnership",
                      "limited_liability_partnership",
                      "limited_partnership",
                      "limited_liability_entrepreneurial_company",
                      "joint_stock_company",
                      "single_member_llc",
                      "multi_member_llc",
                      "private_partnership",
                      "private_corporation",
                      "public_company"
                    ]
                  },
                  "country_of_incorporation": {
                    "pattern": "^[A-Z]{2}$",
                    "type": "string"
                  },
                  "incorporation_date": {
                    "format": "date",
                    "type": "string"
                  },
                  "registered_address": {
                    "$ref": "#/components/schemas/AddressInput"
                  },
                  "contact_full_name": {
                    "minLength": 2,
                    "maxLength": 160,
                    "type": "string"
                  },
                  "contact_email": {
                    "format": "email",
                    "maxLength": 320,
                    "type": "string",
                    "pattern": "^[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])?)*$"
                  },
                  "contact_phone": {
                    "pattern": "^\\+[1-9]\\d{1,14}$",
                    "type": "string",
                    "minLength": 8
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The party, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Location": {
                "description": "The URL of the created resource.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/PartyFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`IDEMPOTENCY_KEY_REQUIRED`: This endpoint requires an Idempotency-Key header.\n\n`REGION_NOT_SUPPORTED`: A region isn't supported for this country.\n\n`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_KEY_REQUIRED",
              "REGION_NOT_SUPPORTED",
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`IDEMPOTENCY_IN_PROGRESS`: An earlier request with this Idempotency-Key hasn't finished. If this persists, contact support.\n\n`OWNERSHIP_TOTAL_EXCEEDED`: This would take total ownership past 100%.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_IN_PROGRESS",
              "OWNERSHIP_TOTAL_EXCEEDED"
            ]
          },
          "422": {
            "description": "`IDEMPOTENCY_KEY_REUSED`: This Idempotency-Key was used with a different request.\n\n`PARTY_NOT_ALLOWED`: An individual legal entity can't have parties.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_KEY_REUSED",
              "PARTY_NOT_ALLOWED"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}": {
      "get": {
        "operationId": "merchant.get",
        "summary": "Read a merchant",
        "description": "Reads one merchant.\n\nCredentials: `partner`, `merchant`\n\nPermission: `merchants:get`",
        "tags": [
          "merchant"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "merchants:get",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The merchant, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/MerchantFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      },
      "patch": {
        "operationId": "merchant.update",
        "summary": "Update a merchant",
        "description": "Changes the fields sent. `null` is refused, because these fields can't be cleared. `country` is set when the merchant is created, and can't be changed. Safe to repeat.\n\nCredentials: `partner`, `merchant`\n\nPermission: `merchants:update`",
        "tags": [
          "merchant"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "merchants:update",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "minProperties": 1,
                "additionalProperties": false,
                "type": "object",
                "properties": {
                  "brand_name": {
                    "minLength": 1,
                    "maxLength": 255,
                    "type": "string"
                  },
                  "website_url": {
                    "format": "uri",
                    "pattern": "^https://",
                    "maxLength": 255,
                    "type": "string"
                  },
                  "category_code": {
                    "pattern": "^[0-9]{4}$",
                    "type": "string",
                    "description": "An ISO 18245 merchant category code: four digits, `0742` for veterinary services."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The merchant, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/MerchantFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`MERCHANT_ALREADY_EXISTS`: A merchant already holds this website.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "MERCHANT_ALREADY_EXISTS"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/account-owners": {
      "get": {
        "operationId": "account_owner.list",
        "summary": "List account owners",
        "description": "Lists a merchant's account owners, ordered by `id`.\n\nCredentials: `partner`, `merchant`\n\nPermission: `account-owners:list`",
        "tags": [
          "account_owner"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "account-owners:list",
        "x-views": [
          "full"
        ],
        "x-pagination": "cursor",
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of account_owner, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AccountOwnerFull"
                      }
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/agreement-acceptances": {
      "get": {
        "operationId": "agreement_acceptance.list",
        "summary": "List agreement acceptances",
        "description": "Lists a merchant's agreement acceptances, newest recorded first, however each was recorded: at signup, with a create, or on its own. A `bank_debit_authorization` is listed once for each account it names. A customer's acceptance at checkout, such as `ach_authorization`, isn't listed.\n\nCredentials: `partner`, `merchant`\n\nPermission: `agreement-acceptances:list`",
        "tags": [
          "agreement_acceptance"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "agreement-acceptances:list",
        "x-views": [
          "full"
        ],
        "x-pagination": "cursor",
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "agreement_kind",
            "in": "query",
            "required": false,
            "style": "form",
            "explode": false,
            "schema": {
              "minItems": 1,
              "maxItems": 10,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "merchant_terms",
                  "privacy_notice",
                  "data_processing_addendum",
                  "prohibited_use_policy",
                  "pricing_plan",
                  "third_party_services",
                  "banking_partner_authorization",
                  "bank_debit_authorization",
                  "nacha_acknowledgment",
                  "payto_merchant_terms"
                ]
              }
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of agreement_acceptance, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AgreementAcceptanceFull"
                      }
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      },
      "post": {
        "operationId": "agreement_acceptance.create",
        "summary": "Record an agreement acceptance",
        "description": "Records that a person accepted one version of an agreement for a merchant. You state that they accepted, who, when and the exact wording they saw, and you are attesting to it. These details are never returned. Any agreement the merchant accepts can be recorded here, including one a create could have taken in `consent`. A `bank_debit_authorization` names the account in `bank_account`. A `nacha_acknowledgment` or a `bank_debit_authorization` needs the merchant's legal entity first. Safe to repeat: a version already on file for this merchant, for the same account where it names one, answers 200 with the existing acceptance, and nothing is recorded, even once a newer version is current or `accepted_at` would now be refused. `CONSENT_AGREEMENT_STALE` names the current version in `details`.\n\nCredentials: `partner`, `merchant`\n\nPermission: `agreement-acceptances:create`",
        "tags": [
          "agreement_acceptance"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "agreement-acceptances:create",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "agreement",
                  "is_accepted",
                  "accepted_at",
                  "accepted_by",
                  "accepted_ip",
                  "wording",
                  "locale"
                ],
                "properties": {
                  "agreement": {
                    "$ref": "#/components/schemas/AgreementRequestLink",
                    "description": "The current version of one agreement, usually from the onboarding's or a capability's required actions."
                  },
                  "bank_account": {
                    "$ref": "#/components/schemas/BankAccountRequestLink",
                    "description": "The merchant's `owned` account a `bank_debit_authorization` authorises debits from. Required for that agreement, and refused for any other."
                  },
                  "is_accepted": {
                    "const": true,
                    "type": "boolean"
                  },
                  "accepted_at": {
                    "format": "date-time",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
                    "type": "string",
                    "description": "When the person accepted. Before the agreement took effect, more than 5 minutes in the future or more than 30 days old is refused, with `CONSENT_ACCEPTED_AT_INVALID`."
                  },
                  "accepted_by": {
                    "additionalProperties": false,
                    "type": "object",
                    "required": [
                      "full_name",
                      "email"
                    ],
                    "properties": {
                      "full_name": {
                        "minLength": 1,
                        "maxLength": 200,
                        "pattern": "^[^\\x00-\\x1F\\x7F]*$",
                        "description": "On one line, with no control character.",
                        "type": "string"
                      },
                      "email": {
                        "format": "email",
                        "maxLength": 320,
                        "type": "string",
                        "pattern": "^[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])?)*$"
                      }
                    }
                  },
                  "accepted_ip": {
                    "anyOf": [
                      {
                        "format": "ipv4",
                        "type": "string"
                      },
                      {
                        "format": "ipv6",
                        "type": "string"
                      }
                    ]
                  },
                  "wording": {
                    "minLength": 1,
                    "maxLength": 10000,
                    "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
                    "description": "The exact text the person saw, with no control character but a line break or a tab.",
                    "type": "string"
                  },
                  "locale": {
                    "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{1,8})*$",
                    "type": "string",
                    "maxLength": 35
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The agreement_acceptance already there, in the full view: a repeat records nothing.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/AgreementAcceptanceFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "The agreement_acceptance, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Location": {
                "description": "The URL of the created resource.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/AgreementAcceptanceFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`CONSENT_ACCEPTED_AT_INVALID`: accepted_at is before the agreement took effect, too far in the future or too old.\n\n`CONSENT_AGREEMENT_STALE`: Consent names an agreement version that isn't current.\n\n`CONSENT_NOT_ACCEPTED`: `is_accepted` must be `true`, stating that the person accepted.\n\n`UNKNOWN_AGREEMENT`: This names no agreement.\n\n`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "CONSENT_ACCEPTED_AT_INVALID",
              "CONSENT_AGREEMENT_STALE",
              "CONSENT_NOT_ACCEPTED",
              "UNKNOWN_AGREEMENT",
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`LEGAL_ENTITY_REQUIRED`: The merchant needs a legal entity with a name first.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "LEGAL_ENTITY_REQUIRED"
            ]
          },
          "422": {
            "description": "`AGREEMENT_NOT_ACCEPTABLE`: This agreement can't be accepted for a merchant.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "AGREEMENT_NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/bank-accounts": {
      "get": {
        "operationId": "bank_account.list",
        "summary": "List bank accounts",
        "description": "Lists a merchant's live bank accounts, active and inactive: `virtual` before `owned`, then oldest first. An account that serves only test payment transactions isn't listed, and neither is a `virtual` account at a provider the merchant isn't onboarded with. To total a currency, filter by `currency`, `account_type=virtual` and `status=active`, add `include=balance`, and sum each balance in `entities`. That totals the currency's active virtual accounts at the providers the merchant is onboarded with: an inactive account isn't counted, and a sum covers only the page it's on. A null `amount` means the total isn't known, and it never counts as zero. A caller without permission to read balances gets the accounts, with each balance in `not_included`.\n\nCredentials: `partner`, `merchant`\n\nPermission: `bank-accounts:list`",
        "tags": [
          "bank_account"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "bank-accounts:list",
        "x-views": [
          "full"
        ],
        "x-pagination": "cursor",
        "x-includes": [
          {
            "field": "balance",
            "view": "full",
            "is_default": false
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "account_roles",
            "in": "query",
            "required": false,
            "description": "An account with any of these.",
            "style": "form",
            "explode": false,
            "schema": {
              "minItems": 1,
              "maxItems": 3,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "payment",
                  "payout",
                  "refund"
                ]
              }
            }
          },
          {
            "name": "account_type",
            "in": "query",
            "required": false,
            "style": "form",
            "explode": false,
            "schema": {
              "minItems": 1,
              "maxItems": 2,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "owned",
                  "virtual"
                ]
              }
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "style": "form",
            "explode": false,
            "schema": {
              "minItems": 1,
              "maxItems": 100,
              "type": "array",
              "items": {
                "pattern": "^[A-Z]{3}$",
                "type": "string"
              }
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "description": "Link fields to hydrate into `entities`, comma-separated. Sending it replaces the default, which is nothing.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "balance"
                ]
              }
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "style": "form",
            "explode": false,
            "schema": {
              "minItems": 1,
              "maxItems": 2,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "active",
                  "inactive"
                ]
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of bank_account, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/BankAccountFull"
                      }
                    },
                    "entities": {
                      "additionalProperties": {
                        "$ref": "#/components/schemas/BalanceFull"
                      },
                      "description": "Included linked resources, keyed by URI.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      },
      "post": {
        "operationId": "bank_account.create",
        "summary": "Create a bank account",
        "description": "Adds an account the merchant owns, with the roles `payment` and `payout`. It's created `active`, and its `ownership_status` starts `pending`. Another `owned` account can't be added here while one is active, unless `is_multi_account_allowed`. A bank link isn't limited by this. `consent` records the person's authorisation of debits from the account with the create. Leave it out to record it later through `agreement_acceptance`, naming the account. The `CONSENT_AGREEMENT_*` codes name the agreement in `details`. A retry with the same key answers the account the first one created, and records no consent again.\n\nCredentials: `partner`, `merchant`\n\nPermission: `bank-accounts:create`",
        "tags": [
          "bank_account"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "bank-accounts:create",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "1 to 255 printable ASCII characters with no spaces, quotes or backslashes, in double quotes as the IETF draft defines, or without them. We recommend a UUID. Make one for each thing you mean to happen once and store it before you send the request, so a retry after a crash sends the same key. Keys are scoped to your account and the endpoint, not to a token, so a new token or a rotated secret doesn't affect a retry. A partner and its merchant are separate accounts, so the same key sent with each credential starts two requests. Keys are kept for at least 7 days. After that, the same key starts a new request.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 257,
              "pattern": "^(?:([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})|\"([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})\")$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "currency",
                  "country",
                  "account_holder_name"
                ],
                "properties": {
                  "currency": {
                    "pattern": "^[A-Z]{3}$",
                    "type": "string"
                  },
                  "country": {
                    "pattern": "^[A-Z]{2}$",
                    "type": "string",
                    "description": "Must be a country Quidkey activates for domestic payments."
                  },
                  "account_holder_name": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "iban": {
                    "minLength": 1,
                    "description": "Write-only. An IBAN that can't address the account's country is refused. Which identifiers a country needs is listed in the reference.",
                    "type": "string"
                  },
                  "account_number": {
                    "minLength": 1,
                    "description": "Write-only.",
                    "type": "string"
                  },
                  "bban": {
                    "minLength": 1,
                    "description": "Write-only.",
                    "type": "string"
                  },
                  "plusgiro_number": {
                    "minLength": 1,
                    "description": "Write-only.",
                    "type": "string"
                  },
                  "bic": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "sort_code": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "routing_number": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "bsb": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "payment_schemes": {
                    "minItems": 1,
                    "maxItems": 10,
                    "description": "Read-only after create. Left out, the country's schemes are attached and active, except an additional payment method such as `multibanco`, which an account only has by naming it. What a country offers is on the country's `payment_schemes`.",
                    "type": "array",
                    "items": {
                      "additionalProperties": false,
                      "type": "object",
                      "required": [
                        "id",
                        "is_active"
                      ],
                      "properties": {
                        "_type": {
                          "const": "payment_scheme",
                          "type": "string"
                        },
                        "id": {
                          "type": "string",
                          "enum": [
                            "sepa_credit_transfer",
                            "sepa_instant_credit_transfer",
                            "multibanco",
                            "danish_domestic_credit_transfer",
                            "faster_payments",
                            "bacs",
                            "ach",
                            "becs"
                          ],
                          "description": "The scheme's stable code. What a country offers is on the country's `payment_schemes`."
                        },
                        "is_active": {
                          "description": "Whether Quidkey offers this scheme for a payment transaction routed to this account. A false doesn't by itself refuse a payment transaction.",
                          "type": "boolean"
                        }
                      }
                    }
                  },
                  "consent": {
                    "$ref": "#/components/schemas/Consent",
                    "description": "The person authorises Quidkey and its processors to debit this account for amounts due to Quidkey. `agreements` must hold the current `bank_debit_authorization` version and nothing else. Optional. Send it to record the person's acceptance with the create, or accept later through `agreement_acceptance`."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The bank_account, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Location": {
                "description": "The URL of the created resource.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/BankAccountFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`BANK_ACCOUNT_CURRENCY_UNSUPPORTED`: The account's country, or the country its IBAN was issued in, can't be paid in this currency.\n\n`BANK_DETAILS_COUNTRY_MISMATCH`: This IBAN can't address an account in this country.\n\n`BANK_DETAILS_INCOMPLETE`: The bank details don't include what this country requires.\n\n`BANK_DETAILS_INVALID`: The bank details aren't valid, such as an IBAN that doesn't pass its checks.\n\n`CONSENT_ACCEPTED_AT_INVALID`: accepted_at is before the agreement took effect, too far in the future or too old.\n\n`CONSENT_AGREEMENT_DUPLICATE`: Consent names the same agreement more than once.\n\n`CONSENT_AGREEMENT_MISSING`: Consent is missing an agreement this operation requires.\n\n`CONSENT_AGREEMENT_NOT_REQUIRED`: Consent names an agreement this operation doesn't require.\n\n`CONSENT_AGREEMENT_STALE`: Consent names an agreement version that isn't current.\n\n`CONSENT_NOT_ACCEPTED`: `is_accepted` must be `true`, stating that the person accepted.\n\n`COUNTRY_NOT_SUPPORTED`: This country isn't supported.\n\n`CURRENCY_NOT_SUPPORTED`: This currency isn't supported.\n\n`DUPLICATE_PAYMENT_SCHEMES`: The same payment scheme is listed more than once.\n\n`IDEMPOTENCY_KEY_REQUIRED`: This endpoint requires an Idempotency-Key header.\n\n`SCHEME_NOT_AVAILABLE_IN_COUNTRY`: A payment scheme isn't available in this country.\n\n`UNKNOWN_AGREEMENT`: This names no agreement.\n\n`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "BANK_ACCOUNT_CURRENCY_UNSUPPORTED",
              "BANK_DETAILS_COUNTRY_MISMATCH",
              "BANK_DETAILS_INCOMPLETE",
              "BANK_DETAILS_INVALID",
              "CONSENT_ACCEPTED_AT_INVALID",
              "CONSENT_AGREEMENT_DUPLICATE",
              "CONSENT_AGREEMENT_MISSING",
              "CONSENT_AGREEMENT_NOT_REQUIRED",
              "CONSENT_AGREEMENT_STALE",
              "CONSENT_NOT_ACCEPTED",
              "COUNTRY_NOT_SUPPORTED",
              "CURRENCY_NOT_SUPPORTED",
              "DUPLICATE_PAYMENT_SCHEMES",
              "IDEMPOTENCY_KEY_REQUIRED",
              "SCHEME_NOT_AVAILABLE_IN_COUNTRY",
              "UNKNOWN_AGREEMENT",
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`IDEMPOTENCY_IN_PROGRESS`: An earlier request with this Idempotency-Key hasn't finished. If this persists, contact support.\n\n`LEGAL_ENTITY_REQUIRED`: The merchant needs a legal entity with a name first.\n\n`MULTI_ACCOUNT_NOT_ALLOWED`: The merchant already has an active account of its own, and may hold only one.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_IN_PROGRESS",
              "LEGAL_ENTITY_REQUIRED",
              "MULTI_ACCOUNT_NOT_ALLOWED"
            ]
          },
          "422": {
            "description": "`IDEMPOTENCY_KEY_REUSED`: This Idempotency-Key was used with a different request.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_KEY_REUSED"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/banks": {
      "get": {
        "operationId": "bank.list",
        "summary": "List a merchant's banks",
        "description": "Lists the banks a payment transaction to this merchant could be paid from, for a customer in `country` paying in `currency`: the banks Quidkey's checkout offers that customer. The route's popular banks come first, in Quidkey's curated order, then the rest by name. The order is the same for every customer. Listing a live route's banks doesn't need the merchant to take live payment transactions. `BANK_SELECTION_NOT_SUPPORTED` means the payment transaction's provider takes it on its own page, where the customer doesn't choose a bank.\n\nCredentials: `partner`, `merchant`\n\nPermission: `banks:list`",
        "tags": [
          "bank"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "banks:list",
        "x-views": [
          "full"
        ],
        "x-pagination": "cursor",
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": true,
            "description": "The customer's country, ISO 3166-1 alpha-2.",
            "schema": {
              "pattern": "^[A-Z]{2}$",
              "type": "string"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": true,
            "description": "The payment transaction's currency, ISO 4217.",
            "schema": {
              "pattern": "^[A-Z]{3}$",
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "is_test",
            "in": "query",
            "required": false,
            "description": "Lists the banks of a test payment transaction instead of a live one.",
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Only banks whose name holds this, ignoring case.",
            "schema": {
              "minLength": 1,
              "maxLength": 100,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of bank, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/BankFull"
                      }
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`CURRENCY_COUNTRY_MISMATCH`: This currency can't be used for a customer in this country.\n\n`CURRENCY_NOT_SUPPORTED`: This currency isn't supported.\n\n`CUSTOMER_COUNTRY_NOT_SUPPORTED`: Payment transactions from this customer's country aren't accepted.\n\n`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "CURRENCY_COUNTRY_MISMATCH",
              "CURRENCY_NOT_SUPPORTED",
              "CUSTOMER_COUNTRY_NOT_SUPPORTED",
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`MERCHANT_CANNOT_TAKE_PAYMENT`: This merchant can't take a payment transaction in this currency from a customer in this country.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "MERCHANT_CANNOT_TAKE_PAYMENT"
            ]
          },
          "422": {
            "description": "`BANK_SELECTION_NOT_SUPPORTED`: A payment transaction in this currency from a customer in this country is paid on its provider's own page, with no choice of bank.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "BANK_SELECTION_NOT_SUPPORTED"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/capabilities": {
      "get": {
        "operationId": "capability.list",
        "summary": "List capabilities",
        "description": "Lists every capability and where it stands for a merchant, in the order `id` lists them. A merchant the credential can't reach answers 404.\n\nCredentials: `partner`, `merchant`\n\nPermission: `capabilities:list`",
        "tags": [
          "capability"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "capabilities:list",
        "x-views": [
          "full"
        ],
        "x-pagination": "none",
        "x-includes": [
          {
            "field": "required_agreements",
            "view": "full",
            "is_default": true
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "description": "Link fields to hydrate into `entities`, comma-separated. Sending it replaces the default, which is `required_agreements`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "required_agreements"
                ]
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of capability, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CapabilityFull"
                      }
                    },
                    "entities": {
                      "additionalProperties": {
                        "$ref": "#/components/schemas/AgreementFull"
                      },
                      "description": "Included linked resources, keyed by URI.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/capabilities/{capability_id}": {
      "get": {
        "operationId": "capability.get",
        "summary": "Read a capability",
        "description": "Reads one capability of a merchant. A merchant the credential can't reach answers 404.\n\nCredentials: `partner`, `merchant`\n\nPermission: `capabilities:get`",
        "tags": [
          "capability"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "capabilities:get",
        "x-views": [
          "full"
        ],
        "x-includes": [
          {
            "field": "required_agreements",
            "view": "full",
            "is_default": true
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "capability_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "pay_by_bank_uk_eu",
                "pay_by_bank_us",
                "payto_au",
                "virtual_accounts"
              ]
            }
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "description": "Link fields to hydrate into `entities`, comma-separated. Sending it replaces the default, which is `required_agreements`.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "required_agreements"
                ]
              }
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The capability, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/CapabilityFull"
                    },
                    "entities": {
                      "additionalProperties": {
                        "$ref": "#/components/schemas/AgreementFull"
                      },
                      "description": "Included linked resources, keyed by URI.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/capabilities/{capability_id}:request": {
      "post": {
        "operationId": "capability.request",
        "summary": "Request a capability",
        "description": "Asks for a capability that reads `ready`. Safe to repeat: one already `in_review` or `active` answers 200 with the capability, and so does `pay_by_bank_uk_eu`, which a merchant has once Quidkey signs off. An agreement it requires is accepted first as an `agreement_acceptance`. `CAPABILITY_NOT_READY` lists what is missing in `details`, as `required_actions` codes. One not offered to the merchant answers `CAPABILITY_UNAVAILABLE`, and `pay_by_bank_us`, which is requested another way for now, `CAPABILITY_NOT_REQUESTABLE`. While another request for the capability is going through, and once this one runs out of time, it answers 503 `SERVICE_UNAVAILABLE`: the request goes on, so repeat it to see where it stands. `OUTCOME_UNKNOWN` means it may have gone through without saying so: Quidkey checks, and until then every request for the capability answers `OUTCOME_UNKNOWN` again, so contact Quidkey. A merchant the credential can't reach answers 404, and a merchant's own credential gets 403.\n\nCredentials: `partner`\n\nPermission: `capabilities:request`",
        "tags": [
          "capability"
        ],
        "x-credentials": [
          "partner"
        ],
        "x-permission": "capabilities:request",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "capability_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "pay_by_bank_uk_eu",
                "pay_by_bank_us",
                "payto_au",
                "virtual_accounts"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The capability, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/CapabilityFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`CAPABILITY_NOT_READY`: This capability can't be requested yet.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "CAPABILITY_NOT_READY"
            ]
          },
          "422": {
            "description": "`CAPABILITY_NOT_REQUESTABLE`: This capability is requested another way for now. Contact Quidkey to request it.\n\n`CAPABILITY_UNAVAILABLE`: This capability isn't offered to this merchant.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "CAPABILITY_NOT_REQUESTABLE",
              "CAPABILITY_UNAVAILABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "502": {
            "description": "`CAPABILITY_REQUEST_FAILED`: The request didn't go through. Read the capability, then retry if it still reads ready.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "CAPABILITY_REQUEST_FAILED"
            ]
          },
          "503": {
            "description": "`OUTCOME_UNKNOWN`: The request may have taken effect. Read the resource before trying again.\n\n`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter",
                "description": "How many seconds to wait before retrying `SERVICE_UNAVAILABLE`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "OUTCOME_UNKNOWN",
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/identity-verifications": {
      "get": {
        "operationId": "identity_verification.list",
        "summary": "List identity checks",
        "description": "Lists each party's newest identity check under this merchant, newest first, and none of a removed party's.\n\nCredentials: `partner`, `merchant`\n\nPermission: `identity-verifications:list`",
        "tags": [
          "identity_verification"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "identity-verifications:list",
        "x-views": [
          "full"
        ],
        "x-pagination": "cursor",
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          },
          {
            "name": "party_id",
            "in": "query",
            "required": false,
            "style": "form",
            "explode": false,
            "schema": {
              "minItems": 1,
              "maxItems": 100,
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "style": "form",
            "explode": false,
            "schema": {
              "minItems": 1,
              "maxItems": 9,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "created",
                  "in_progress",
                  "processing",
                  "in_review",
                  "approved",
                  "declined",
                  "abandoned",
                  "expired",
                  "failed"
                ]
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of identity_verification, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/IdentityVerificationFull"
                      }
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/legal-entities": {
      "get": {
        "operationId": "legal_entity.list",
        "summary": "List legal entities",
        "description": "Lists a merchant's legal entities, of which it holds at most one.\n\nCredentials: `partner`, `merchant`\n\nPermission: `legal-entities:list`",
        "tags": [
          "legal_entity"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "legal-entities:list",
        "x-views": [
          "full"
        ],
        "x-pagination": "cursor",
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of legal_entity, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LegalEntityFull"
                      }
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      },
      "post": {
        "operationId": "legal_entity.create",
        "summary": "Create a legal entity",
        "description": "Creates the company or sole trader a merchant is. A merchant has one, so a repeat answers `LEGAL_ENTITY_ALREADY_EXISTS`, naming the one it has in `details`, as `legal_entity`. `consent` records the person's acknowledgment of the current `nacha_acknowledgment` with the create. Leave it out to record it later through `agreement_acceptance`. The `CONSENT_AGREEMENT_*` codes name the agreement in `details`.\n\nCredentials: `partner`, `merchant`\n\nPermission: `legal-entities:create`",
        "tags": [
          "legal_entity"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "legal-entities:create",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "if": {
                  "properties": {
                    "type": {
                      "const": "company"
                    }
                  },
                  "required": [
                    "type"
                  ]
                },
                "then": {
                  "additionalProperties": false,
                  "required": [
                    "legal_name",
                    "registration_number",
                    "legal_structure",
                    "country_of_incorporation",
                    "registered_address",
                    "contact_full_name",
                    "contact_email",
                    "contact_phone"
                  ],
                  "properties": {
                    "type": {},
                    "consent": {},
                    "legal_name": {},
                    "registration_number": {},
                    "legal_structure": {},
                    "country_of_incorporation": {},
                    "incorporation_date": {
                      "format": "date",
                      "type": "string"
                    },
                    "registered_address": {},
                    "contact_full_name": {},
                    "contact_email": {},
                    "contact_phone": {},
                    "vat_number": {},
                    "tax_id": {},
                    "operating_address": {},
                    "annual_revenue": {},
                    "employee_count_band": {}
                  }
                },
                "else": {
                  "additionalProperties": false,
                  "required": [
                    "first_name",
                    "last_name",
                    "email",
                    "phone",
                    "date_of_birth",
                    "country_of_citizenship",
                    "residential_address"
                  ],
                  "properties": {
                    "type": {},
                    "consent": {},
                    "first_name": {},
                    "last_name": {},
                    "email": {},
                    "phone": {},
                    "date_of_birth": {
                      "format": "date",
                      "type": "string"
                    },
                    "country_of_citizenship": {},
                    "residential_address": {}
                  }
                },
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "type"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "company",
                      "individual"
                    ]
                  },
                  "legal_name": {
                    "minLength": 2,
                    "maxLength": 160,
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "registration_number": {
                    "minLength": 4,
                    "maxLength": 20,
                    "type": "string"
                  },
                  "legal_structure": {
                    "type": "string",
                    "enum": [
                      "limited_liability_company",
                      "private_limited_company",
                      "public_limited_company",
                      "general_partnership",
                      "limited_liability_partnership",
                      "limited_partnership",
                      "limited_liability_entrepreneurial_company",
                      "joint_stock_company",
                      "single_member_llc",
                      "multi_member_llc",
                      "private_partnership",
                      "private_corporation",
                      "public_company"
                    ]
                  },
                  "country_of_incorporation": {
                    "pattern": "^[A-Z]{2}$",
                    "type": "string"
                  },
                  "incorporation_date": {
                    "format": "date",
                    "type": "string"
                  },
                  "registered_address": {
                    "$ref": "#/components/schemas/AddressInput"
                  },
                  "contact_full_name": {
                    "minLength": 2,
                    "maxLength": 160,
                    "type": "string"
                  },
                  "contact_email": {
                    "format": "email",
                    "maxLength": 320,
                    "type": "string",
                    "pattern": "^[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])?)*$"
                  },
                  "contact_phone": {
                    "pattern": "^\\+[1-9]\\d{1,14}$",
                    "type": "string",
                    "minLength": 8
                  },
                  "vat_number": {
                    "minLength": 4,
                    "maxLength": 20,
                    "type": "string"
                  },
                  "tax_id": {
                    "minLength": 4,
                    "maxLength": 20,
                    "description": "Held to its country's format where the country sets one, as an ABN is.",
                    "type": "string"
                  },
                  "operating_address": {
                    "$ref": "#/components/schemas/AddressInput"
                  },
                  "annual_revenue": {
                    "type": "object",
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/Money"
                      },
                      {
                        "type": "object",
                        "required": [
                          "value"
                        ],
                        "properties": {
                          "value": {
                            "minimum": 0,
                            "maximum": 900719925474,
                            "type": "integer"
                          }
                        }
                      }
                    ],
                    "description": "A whole number of major units, so a value with non-zero minor units is refused rather than rounded, and at most 900719925474 in minor units."
                  },
                  "employee_count_band": {
                    "type": "string",
                    "enum": [
                      "small",
                      "medium",
                      "large",
                      "enterprise"
                    ]
                  },
                  "first_name": {
                    "minLength": 1,
                    "maxLength": 30,
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "last_name": {
                    "minLength": 1,
                    "maxLength": 30,
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "email": {
                    "format": "email",
                    "maxLength": 320,
                    "type": "string",
                    "pattern": "^[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])?)*$"
                  },
                  "phone": {
                    "pattern": "^\\+[1-9]\\d{1,14}$",
                    "type": "string",
                    "minLength": 8
                  },
                  "date_of_birth": {
                    "format": "date",
                    "type": "string"
                  },
                  "country_of_citizenship": {
                    "pattern": "^[A-Z]{2}$",
                    "type": "string"
                  },
                  "residential_address": {
                    "$ref": "#/components/schemas/AddressInput"
                  },
                  "consent": {
                    "$ref": "#/components/schemas/Consent",
                    "description": "`agreements` must hold the current `nacha_acknowledgment` version and nothing else. Optional. Send it to record the person's acceptance with the create, or accept later through `agreement_acceptance`."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The legal_entity, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Location": {
                "description": "The URL of the created resource.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/LegalEntityFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`AMOUNT_TOO_LARGE`: The amount is more than this endpoint accepts.\n\n`CONSENT_ACCEPTED_AT_INVALID`: accepted_at is before the agreement took effect, too far in the future or too old.\n\n`CONSENT_AGREEMENT_DUPLICATE`: Consent names the same agreement more than once.\n\n`CONSENT_AGREEMENT_MISSING`: Consent is missing an agreement this operation requires.\n\n`CONSENT_AGREEMENT_NOT_REQUIRED`: Consent names an agreement this operation doesn't require.\n\n`CONSENT_AGREEMENT_STALE`: Consent names an agreement version that isn't current.\n\n`CONSENT_NOT_ACCEPTED`: `is_accepted` must be `true`, stating that the person accepted.\n\n`LEGAL_ENTITY_TAX_ID_INVALID`: The tax ID doesn't match its country's format.\n\n`REGION_NOT_SUPPORTED`: A region isn't supported for this country.\n\n`UNKNOWN_AGREEMENT`: This names no agreement.\n\n`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "AMOUNT_TOO_LARGE",
              "CONSENT_ACCEPTED_AT_INVALID",
              "CONSENT_AGREEMENT_DUPLICATE",
              "CONSENT_AGREEMENT_MISSING",
              "CONSENT_AGREEMENT_NOT_REQUIRED",
              "CONSENT_AGREEMENT_STALE",
              "CONSENT_NOT_ACCEPTED",
              "LEGAL_ENTITY_TAX_ID_INVALID",
              "REGION_NOT_SUPPORTED",
              "UNKNOWN_AGREEMENT",
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`LEGAL_ENTITY_ALREADY_EXISTS`: This merchant already has a legal entity.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "LEGAL_ENTITY_ALREADY_EXISTS"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/onboarding": {
      "get": {
        "operationId": "merchant.getOnboarding",
        "summary": "Read a merchant's onboarding",
        "description": "Where a merchant stands on its way to live, and what's needed next. Follow it by polling: only going live, a suspension and a reinstatement send an event. A merchant the credential can't reach answers 404.\n\nCredentials: `partner`, `merchant`\n\nPermission: `onboarding:get`",
        "tags": [
          "merchant"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "onboarding:get",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The onboarding, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/OnboardingFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/payment-links": {
      "get": {
        "operationId": "payment_link.list",
        "summary": "List payment links",
        "description": "Lists a merchant's payment links, newest first. It returns live links, and `is_test=true` returns test ones. No merchant webhook covers a link's payment transactions, so poll its `transactions` link for them: `GET /merchants/{merchant_id}/transactions?payment_link_id={id}`, with `is_test=true` for a test link.\n\nCredentials: `partner`, `merchant`\n\nPermission: `payment-links:list`",
        "tags": [
          "payment_link"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "payment-links:list",
        "x-views": [
          "summary"
        ],
        "x-pagination": "cursor",
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "is_test",
            "in": "query",
            "required": false,
            "description": "Lists test links instead of live ones. One list holds one kind.",
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of payment_link, in the summary view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PaymentLinkSummary"
                      }
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      },
      "post": {
        "operationId": "payment_link.create",
        "summary": "Create a payment link",
        "description": "Creates a page that takes payment without an integration, by URL or QR code. A retry with the same key answers the link the first one created, `checkout` and `qr_code` included. Treat `checkout` and `qr_code` as secrets. The page shows the merchant's name and branding, the amount and the statement descriptor, and it can tell whether an email belongs to a returning customer. Anyone holding the URL can pay, and on a single-use link can start or take over the checkout. No merchant webhook covers a link's payment transactions, so poll its `transactions` link for them: `GET /merchants/{merchant_id}/transactions?payment_link_id={id}`, with `is_test=true` for a test link.\n\nCredentials: `partner`, `merchant`\n\nPermission: `payment-links:create`",
        "tags": [
          "payment_link"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "payment-links:create",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "1 to 255 printable ASCII characters with no spaces, quotes or backslashes, in double quotes as the IETF draft defines, or without them. We recommend a UUID. Make one for each thing you mean to happen once and store it before you send the request, so a retry after a crash sends the same key. Keys are scoped to your account and the endpoint, not to a token, so a new token or a rotated secret doesn't affect a retry. A partner and its merchant are separate accounts, so the same key sent with each credential starts two requests. Keys are kept for at least 7 days. After that, the same key starts a new request.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 257,
              "pattern": "^(?:([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})|\"([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})\")$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "if": {
                  "properties": {
                    "success_url": {}
                  },
                  "required": [
                    "success_url"
                  ]
                },
                "then": {
                  "properties": {
                    "failure_url": {}
                  },
                  "required": [
                    "failure_url"
                  ]
                },
                "else": {
                  "properties": {
                    "failure_url": {
                      "not": {}
                    }
                  }
                },
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "amount",
                  "statement_descriptor"
                ],
                "properties": {
                  "amount": {
                    "type": "object",
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/Money"
                      },
                      {
                        "type": "object",
                        "required": [
                          "value"
                        ],
                        "properties": {
                          "value": {
                            "minimum": 1,
                            "maximum": 9999999,
                            "type": "integer"
                          }
                        }
                      }
                    ]
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "single_use",
                      "reusable"
                    ],
                    "default": "single_use"
                  },
                  "is_test": {
                    "description": "Makes the link's payment transactions test ones. Without it the link is live, which answers `LIVE_PAYMENTS_NOT_ALLOWED` for a merchant not yet activated. A suspended merchant still gets its live link, whose payment transactions are refused until it can take live payment transactions again.",
                    "type": "boolean",
                    "default": false
                  },
                  "order": {
                    "$ref": "#/components/schemas/Order"
                  },
                  "statement_descriptor": {
                    "minLength": 1,
                    "maxLength": 18,
                    "description": "Becomes alphanumeric on the way to the bank. On a payment transaction through a virtual account, the customer's statement shows Quidkey's reconciliation reference instead.",
                    "type": "string"
                  },
                  "locale": {
                    "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{1,8})*$",
                    "type": "string",
                    "default": "en"
                  },
                  "success_url": {
                    "format": "uri",
                    "pattern": "^https://",
                    "maxLength": 2048,
                    "type": "string",
                    "description": "Both URLs or neither."
                  },
                  "failure_url": {
                    "format": "uri",
                    "pattern": "^https://",
                    "maxLength": 2048,
                    "type": "string",
                    "description": "Both URLs or neither."
                  },
                  "expires_at": {
                    "format": "date-time",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
                    "type": "string",
                    "description": "60 seconds to 1 year ahead. Defaults to 7 days from now."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The payment_link, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Location": {
                "description": "The URL of the created resource.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/PaymentLinkFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`AMOUNT_TOO_LARGE`: The amount is more than this endpoint accepts.\n\n`CURRENCY_NOT_SUPPORTED`: This currency isn't supported.\n\n`EXPIRY_INVALID`: expires_at must be 60 seconds to 1 year ahead.\n\n`IDEMPOTENCY_KEY_REQUIRED`: This endpoint requires an Idempotency-Key header.\n\n`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "AMOUNT_TOO_LARGE",
              "CURRENCY_NOT_SUPPORTED",
              "EXPIRY_INVALID",
              "IDEMPOTENCY_KEY_REQUIRED",
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`CURRENCY_NOT_RECEIVABLE`: This merchant can't receive this currency.\n\n`IDEMPOTENCY_IN_PROGRESS`: An earlier request with this Idempotency-Key hasn't finished. If this persists, contact support.\n\n`LIVE_PAYMENTS_NOT_ALLOWED`: This merchant can't take this live payment transaction now.\n\n`NO_RECEIVING_ACCOUNTS`: This merchant has nothing routed to receive this currency in this environment.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "CURRENCY_NOT_RECEIVABLE",
              "IDEMPOTENCY_IN_PROGRESS",
              "LIVE_PAYMENTS_NOT_ALLOWED",
              "NO_RECEIVING_ACCOUNTS"
            ]
          },
          "422": {
            "description": "`IDEMPOTENCY_KEY_REUSED`: This Idempotency-Key was used with a different request.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_KEY_REUSED"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/payouts": {
      "get": {
        "operationId": "payout.list",
        "summary": "List payouts",
        "description": "Lists a merchant's payouts, newest first. No event says when one changes, so poll this. A payout that fails while being sent leaves this list and answers 404 until Quidkey staff resolve it, when it returns under the same `id`. Part or all of its money may have moved by then.\n\nCredentials: `partner`, `merchant`\n\nPermission: `payouts:list`",
        "tags": [
          "payout"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "payouts:list",
        "x-views": [
          "full"
        ],
        "x-pagination": "cursor",
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of payout, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PayoutFull"
                      }
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/receivable-currencies": {
      "get": {
        "operationId": "merchant.getReceivableCurrencies",
        "summary": "Read receivable currencies",
        "description": "Reads the currencies routed to this merchant's active accounts, for live and for test payment transactions. A live payment transaction in one can still be refused: while `status` isn't `active`, after dormancy, or while the receiving account awaits verification.\n\nCredentials: `partner`, `merchant`\n\nPermission: `receivable-currencies:get`",
        "tags": [
          "merchant"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "receivable-currencies:get",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The receivable_currencies, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/ReceivableCurrenciesFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/transactions": {
      "get": {
        "operationId": "transaction.list",
        "summary": "List transactions",
        "description": "Lists payment transactions, refunds and reversals, newest first. Unfiltered, it returns live records of every type and status, and `is_test=true` returns test ones. The \"Transaction export\" reference lists the columns of its file. A file also needs `transactions:get`, since each row is a full transaction.\n\nWith `Accept: text/csv` or `Accept: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`, answers the whole result as one file, with one row per record. A file takes no `limit`, `cursor` or `include`, and a result of more than 10000 rows answers `EXPORT_TOO_LARGE`.\n\nCredentials: `partner`, `merchant`\n\nPermission: `transactions:list`",
        "tags": [
          "transaction"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "transactions:list",
        "x-views": [
          "summary"
        ],
        "x-pagination": "cursor",
        "x-includes": [
          {
            "field": "customer_details",
            "view": "full",
            "is_default": false
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "amount:gte",
            "in": "query",
            "required": false,
            "description": "Greater than or equal to this value.",
            "schema": {
              "minimum": 0,
              "maximum": 9007199254740991,
              "type": "integer"
            }
          },
          {
            "name": "amount:gt",
            "in": "query",
            "required": false,
            "description": "Greater than this value.",
            "schema": {
              "minimum": 0,
              "maximum": 9007199254740991,
              "type": "integer"
            }
          },
          {
            "name": "amount:lte",
            "in": "query",
            "required": false,
            "description": "Less than or equal to this value.",
            "schema": {
              "minimum": 0,
              "maximum": 9007199254740991,
              "type": "integer"
            }
          },
          {
            "name": "amount:lt",
            "in": "query",
            "required": false,
            "description": "Less than this value.",
            "schema": {
              "minimum": 0,
              "maximum": 9007199254740991,
              "type": "integer"
            }
          },
          {
            "name": "created_at:gte",
            "in": "query",
            "required": false,
            "description": "Greater than or equal to this value.",
            "schema": {
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
              "type": "string"
            }
          },
          {
            "name": "created_at:gt",
            "in": "query",
            "required": false,
            "description": "Greater than this value.",
            "schema": {
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
              "type": "string"
            }
          },
          {
            "name": "created_at:lte",
            "in": "query",
            "required": false,
            "description": "Less than or equal to this value.",
            "schema": {
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
              "type": "string"
            }
          },
          {
            "name": "created_at:lt",
            "in": "query",
            "required": false,
            "description": "Less than this value.",
            "schema": {
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
              "type": "string"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "description": "The currency `amount` shows.",
            "style": "form",
            "explode": false,
            "schema": {
              "minItems": 1,
              "maxItems": 100,
              "type": "array",
              "items": {
                "pattern": "^[A-Z]{3}$",
                "type": "string"
              }
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "description": "Link fields to hydrate into `entities`, comma-separated. Sending it replaces the default, which is nothing.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "customer_details"
                ]
              }
            }
          },
          {
            "name": "is_test",
            "in": "query",
            "required": false,
            "description": "Lists test records instead of live ones. One list holds one kind.",
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          },
          {
            "name": "order_id",
            "in": "query",
            "required": false,
            "description": "An exact match.",
            "style": "form",
            "explode": false,
            "schema": {
              "minItems": 1,
              "maxItems": 100,
              "type": "array",
              "items": {
                "minLength": 1,
                "maxLength": 255,
                "type": "string"
              }
            }
          },
          {
            "name": "payment_link_id",
            "in": "query",
            "required": false,
            "style": "form",
            "explode": false,
            "schema": {
              "minItems": 1,
              "maxItems": 100,
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "payout_id",
            "in": "query",
            "required": false,
            "style": "form",
            "explode": false,
            "schema": {
              "minItems": 1,
              "maxItems": 100,
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "style": "form",
            "explode": false,
            "schema": {
              "minItems": 1,
              "maxItems": 6,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "pending",
                  "processing",
                  "completed",
                  "failed",
                  "cancelled",
                  "unresolved"
                ]
              }
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "style": "form",
            "explode": false,
            "schema": {
              "minItems": 1,
              "maxItems": 3,
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "payment",
                  "refund",
                  "reversal"
                ]
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of transaction, in the summary view. Or the whole result as one file, for an `Accept` that asks for one.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Content-Disposition": {
                "description": "On a file, `attachment` with its name, such as `transactions.csv`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TransactionSummary"
                      }
                    },
                    "entities": {
                      "additionalProperties": {
                        "$ref": "#/components/schemas/CustomerDetailsFull"
                      },
                      "description": "Included linked resources, keyed by URI.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string",
                  "description": "RFC 4180, UTF-8, with a header row."
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "string",
                  "format": "binary",
                  "description": "One sheet with a header row, each amount a number and every other cell text."
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "422": {
            "description": "`EXPORT_TOO_LARGE`: The result has more rows than a file holds. Narrow the filters.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "EXPORT_TOO_LARGE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      },
      "post": {
        "operationId": "transaction.create",
        "summary": "Create a payment transaction",
        "description": "Creates a payment transaction for one customer, and answers with the one-time `checkout`, the hosted page that sends them to pay. A retry with the same key leaves it out: `:issueCheckout` recovers it. A request sent once can be answered the same way, if a dropped connection lost its first answer. `MERCHANT_CANNOT_TAKE_PAYMENT` means the merchant can't take a payment transaction in this currency from a customer in this country: it isn't set up for one yet, or such a payment transaction can't be routed to its receiving account.\n\nCredentials: `partner`, `merchant`\n\nPermission: `transactions:create`",
        "tags": [
          "transaction"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "transactions:create",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "1 to 255 printable ASCII characters with no spaces, quotes or backslashes, in double quotes as the IETF draft defines, or without them. We recommend a UUID. Make one for each thing you mean to happen once and store it before you send the request, so a retry after a crash sends the same key. Keys are scoped to your account and the endpoint, not to a token, so a new token or a rotated secret doesn't affect a retry. A partner and its merchant are separate accounts, so the same key sent with each credential starts two requests. Keys are kept for at least 7 days. After that, the same key starts a new request.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 257,
              "pattern": "^(?:([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})|\"([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})\")$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "if": {
                  "properties": {
                    "simulation": {}
                  },
                  "required": [
                    "simulation"
                  ]
                },
                "then": {
                  "type": "object",
                  "required": [
                    "is_test"
                  ],
                  "properties": {
                    "is_test": {
                      "const": true,
                      "type": "boolean"
                    }
                  }
                },
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "type",
                  "amount",
                  "order",
                  "customer_details",
                  "statement_descriptor",
                  "authorization"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "payment"
                    ],
                    "description": "What to create."
                  },
                  "amount": {
                    "type": "object",
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/Money"
                      },
                      {
                        "type": "object",
                        "required": [
                          "value"
                        ],
                        "properties": {
                          "value": {
                            "minimum": 1,
                            "maximum": 9999999,
                            "type": "integer"
                          }
                        }
                      }
                    ]
                  },
                  "order": {
                    "$ref": "#/components/schemas/Order"
                  },
                  "customer_details": {
                    "additionalProperties": false,
                    "type": "object",
                    "required": [
                      "full_name",
                      "email",
                      "country"
                    ],
                    "properties": {
                      "full_name": {
                        "minLength": 1,
                        "type": "string"
                      },
                      "email": {
                        "format": "email",
                        "maxLength": 320,
                        "type": "string",
                        "pattern": "^[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])?)*$"
                      },
                      "phone": {
                        "pattern": "^\\+[1-9]\\d{1,14}$",
                        "type": "string"
                      },
                      "country": {
                        "pattern": "^[A-Z]{2}$",
                        "type": "string",
                        "description": "Decides routing."
                      },
                      "billing_address": {
                        "anyOf": [
                          {
                            "$ref": "#/components/schemas/AddressInput"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "description": "The person paying, as a plain object. On the response, `customer_details` is a link to these details."
                  },
                  "is_test": {
                    "default": false,
                    "description": "Creates a test payment transaction, which any merchant can do before going live.",
                    "type": "boolean"
                  },
                  "statement_descriptor": {
                    "minLength": 1,
                    "maxLength": 18,
                    "description": "Becomes alphanumeric on the way to the bank. On a payment transaction through a virtual account, the customer's statement shows Quidkey's reconciliation reference instead.",
                    "type": "string"
                  },
                  "authorization": {
                    "$ref": "#/components/schemas/CheckoutAuthorization"
                  },
                  "rewards": {
                    "$ref": "#/components/schemas/RewardsInput"
                  },
                  "webhook_endpoints": {
                    "maxItems": 10,
                    "description": "Not for a partner, whose payment transactions report to the partner's endpoint. Answers `UNKNOWN_WEBHOOK_ENDPOINT` if one doesn't exist, isn't `active`, or doesn't take this payment transaction's environment.",
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/WebhookEndpointRequestLink"
                    }
                  },
                  "simulation": {
                    "$ref": "#/components/schemas/Simulation"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The transaction, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Location": {
                "description": "The URL of the created resource.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/TransactionFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`AMOUNT_TOO_LARGE`: The amount is more than this endpoint accepts.\n\n`CURRENCY_COUNTRY_MISMATCH`: This currency can't be used for a customer in this country.\n\n`CURRENCY_NOT_SUPPORTED`: This currency isn't supported.\n\n`CUSTOMER_COUNTRY_CONFLICT`: customer_details.country and customer_details.billing_address.country don't match.\n\n`CUSTOMER_COUNTRY_NOT_SUPPORTED`: Payment transactions from this customer's country aren't accepted.\n\n`IDEMPOTENCY_KEY_REQUIRED`: This endpoint requires an Idempotency-Key header.\n\n`REGION_NOT_SUPPORTED`: A region isn't supported for this country.\n\n`REWARDS_INVALID`: rewards needs extra_rewards, and each of extra_rewards and total_rewards is a decimal string from \"0\" to \"99999999.99\", with at most 2 decimal places.\n\n`SIMULATION_REQUIRES_TEST`: simulation needs is_test: true.\n\n`UNKNOWN_WEBHOOK_ENDPOINT`: `webhook_endpoints` names an endpoint that doesn't exist, isn't `active`, or doesn't take this payment transaction's environment.\n\n`VALIDATION_FAILED`: The request is malformed or failed validation.\n\n`WEBHOOK_ENDPOINTS_NOT_ALLOWED`: A partner's payment transactions report to the partner's endpoint, so it can't name endpoints.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "AMOUNT_TOO_LARGE",
              "CURRENCY_COUNTRY_MISMATCH",
              "CURRENCY_NOT_SUPPORTED",
              "CUSTOMER_COUNTRY_CONFLICT",
              "CUSTOMER_COUNTRY_NOT_SUPPORTED",
              "IDEMPOTENCY_KEY_REQUIRED",
              "REGION_NOT_SUPPORTED",
              "REWARDS_INVALID",
              "SIMULATION_REQUIRES_TEST",
              "UNKNOWN_WEBHOOK_ENDPOINT",
              "VALIDATION_FAILED",
              "WEBHOOK_ENDPOINTS_NOT_ALLOWED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`IDEMPOTENCY_IN_PROGRESS`: An earlier request with this Idempotency-Key hasn't finished. If this persists, contact support.\n\n`LIVE_PAYMENTS_NOT_ALLOWED`: This merchant can't take this live payment transaction now.\n\n`MERCHANT_CANNOT_TAKE_PAYMENT`: This merchant can't take a payment transaction in this currency from a customer in this country.\n\n`NO_RECEIVING_ACCOUNTS`: This merchant has nothing routed to receive this currency in this environment.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_IN_PROGRESS",
              "LIVE_PAYMENTS_NOT_ALLOWED",
              "MERCHANT_CANNOT_TAKE_PAYMENT",
              "NO_RECEIVING_ACCOUNTS"
            ]
          },
          "422": {
            "description": "`BANK_NOT_AVAILABLE`: `bank` isn't one `GET /merchants/{id}/banks` lists for this payment transaction.\n\n`BANK_SELECTION_NOT_SUPPORTED`: A payment transaction in this currency from a customer in this country is paid on its provider's own page, with no choice of bank.\n\n`IDEMPOTENCY_KEY_REUSED`: This Idempotency-Key was used with a different request.\n\n`PAYMENT_LIMIT_EXCEEDED`: The amount is over a limit on what this merchant may take: on one payment transaction, on its daily or monthly total, or, on a USD payment, the payment provider's limit on one charge. A smaller amount may pass, and one over a daily or monthly total may pass later. Quidkey can raise the limit on one USD charge.\n\n`SIMULATION_NOT_SUPPORTED`: This test payment transaction won't use a route that can honour simulation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "BANK_NOT_AVAILABLE",
              "BANK_SELECTION_NOT_SUPPORTED",
              "IDEMPOTENCY_KEY_REUSED",
              "PAYMENT_LIMIT_EXCEEDED",
              "SIMULATION_NOT_SUPPORTED"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/transactions:search": {
      "post": {
        "operationId": "transaction.search",
        "summary": "Search transactions",
        "description": "Takes the list's filters in a JSON body, plus `q` and `customer_email`, which carry personal data and don't belong in a query string. Answers as the list does, in the same order, as JSON or as a file. The \"Transaction export\" reference lists the columns of its file. A file also needs `transactions:get`, since each row is a full transaction.\n\nWith `Accept: text/csv` or `Accept: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`, answers the whole result as one file, with one row per record. A file takes no `limit`, `cursor` or `include`, and a result of more than 10000 rows answers `EXPORT_TOO_LARGE`.\n\nCredentials: `partner`, `merchant`\n\nPermission: `transactions:list`",
        "tags": [
          "transaction"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "transactions:list",
        "x-views": [
          "summary"
        ],
        "x-pagination": "cursor",
        "x-includes": [
          {
            "field": "customer_details",
            "view": "full",
            "is_default": false
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "description": "Link fields to hydrate into `entities`, comma-separated. Sending it replaces the default, which is nothing.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "customer_details"
                ]
              }
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "if": {
                  "properties": {
                    "amount": {}
                  },
                  "required": [
                    "amount"
                  ]
                },
                "then": {
                  "properties": {
                    "currency": {
                      "type": "array",
                      "items": {
                        "pattern": "^[A-Z]{3}$",
                        "type": "string"
                      },
                      "maxItems": 1
                    }
                  },
                  "required": [
                    "currency"
                  ]
                },
                "additionalProperties": false,
                "type": "object",
                "properties": {
                  "type": {
                    "minItems": 1,
                    "maxItems": 3,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "payment",
                        "refund",
                        "reversal"
                      ]
                    }
                  },
                  "status": {
                    "minItems": 1,
                    "maxItems": 6,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "processing",
                        "completed",
                        "failed",
                        "cancelled",
                        "unresolved"
                      ]
                    }
                  },
                  "currency": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "pattern": "^[A-Z]{3}$",
                      "type": "string"
                    }
                  },
                  "amount": {
                    "additionalProperties": false,
                    "minProperties": 1,
                    "type": "object",
                    "properties": {
                      "gte": {
                        "minimum": 0,
                        "maximum": 9007199254740991,
                        "type": "integer",
                        "description": "Greater than or equal to this value."
                      },
                      "gt": {
                        "minimum": 0,
                        "maximum": 9007199254740991,
                        "type": "integer",
                        "description": "Greater than this value."
                      },
                      "lte": {
                        "minimum": 0,
                        "maximum": 9007199254740991,
                        "type": "integer",
                        "description": "Less than or equal to this value."
                      },
                      "lt": {
                        "minimum": 0,
                        "maximum": 9007199254740991,
                        "type": "integer",
                        "description": "Less than this value."
                      }
                    }
                  },
                  "created_at": {
                    "additionalProperties": false,
                    "minProperties": 1,
                    "type": "object",
                    "properties": {
                      "gte": {
                        "format": "date-time",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
                        "type": "string",
                        "description": "Greater than or equal to this value."
                      },
                      "gt": {
                        "format": "date-time",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
                        "type": "string",
                        "description": "Greater than this value."
                      },
                      "lte": {
                        "format": "date-time",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
                        "type": "string",
                        "description": "Less than or equal to this value."
                      },
                      "lt": {
                        "format": "date-time",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
                        "type": "string",
                        "description": "Less than this value."
                      }
                    }
                  },
                  "payment_link_id": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "payout_id": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "order_id": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "minLength": 1,
                      "maxLength": 255,
                      "type": "string"
                    }
                  },
                  "is_test": {
                    "default": false,
                    "description": "Lists test records instead of live ones. One list holds one kind.",
                    "type": "boolean"
                  },
                  "q": {
                    "minLength": 1,
                    "maxLength": 255,
                    "description": "A contains match on the order ID, the transaction number, the name and email given on the payment transaction, and the customer's name as their bank has it.",
                    "type": "string"
                  },
                  "customer_email": {
                    "format": "email",
                    "maxLength": 320,
                    "type": "string",
                    "pattern": "^[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])?)*$",
                    "description": "An exact match on the email given on the payment transaction."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A list of transaction, in the summary view. Or the whole result as one file, for an `Accept` that asks for one.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Content-Disposition": {
                "description": "On a file, `attachment` with its name, such as `transactions.csv`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TransactionSummary"
                      }
                    },
                    "entities": {
                      "additionalProperties": {
                        "$ref": "#/components/schemas/CustomerDetailsFull"
                      },
                      "description": "Included linked resources, keyed by URI.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string",
                  "description": "RFC 4180, UTF-8, with a header row."
                }
              },
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "type": "string",
                  "format": "binary",
                  "description": "One sheet with a header row, each amount a number and every other cell text."
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "422": {
            "description": "`EXPORT_TOO_LARGE`: The result has more rows than a file holds. Narrow the filters.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "EXPORT_TOO_LARGE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/merchants/{id}/webhook-endpoints": {
      "get": {
        "operationId": "webhook_endpoint.listForMerchant",
        "summary": "List a merchant's webhook endpoints",
        "description": "Lists a merchant's webhook endpoints, newest first, `inactive` ones included. It takes the merchant's own credential: a partner's answers 403. The Webhooks guide says which endpoint receives each event.\n\nCredentials: `merchant`\n\nPermission: `webhook-endpoints:list`",
        "tags": [
          "webhook_endpoint"
        ],
        "x-credentials": [
          "merchant"
        ],
        "x-permission": "webhook-endpoints:list",
        "x-views": [
          "full"
        ],
        "x-pagination": "cursor",
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of webhook_endpoint, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookEndpointFull"
                      }
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      },
      "post": {
        "operationId": "webhook_endpoint.createForMerchant",
        "summary": "Create a merchant's webhook endpoint",
        "description": "Creates a merchant's webhook endpoint, which receives events for test payment transactions as well as live ones. A signed endpoint's response carries `signing_secret`, which isn't shown again. A retry with the same key answers the endpoint the first one created, without `signing_secret`: `:rotateSecret` issues a new one. A request sent once can be answered the same way, if a dropped connection lost its first answer. A merchant with more than one active endpoint sets a default, or names one on each payment transaction.\n\nCredentials: `merchant`\n\nPermission: `webhook-endpoints:create`",
        "tags": [
          "webhook_endpoint"
        ],
        "x-credentials": [
          "merchant"
        ],
        "x-permission": "webhook-endpoints:create",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "1 to 255 printable ASCII characters with no spaces, quotes or backslashes, in double quotes as the IETF draft defines, or without them. We recommend a UUID. Make one for each thing you mean to happen once and store it before you send the request, so a retry after a crash sends the same key. Keys are scoped to your account and the endpoint, not to a token, so a new token or a rotated secret doesn't affect a retry. A partner and its merchant are separate accounts, so the same key sent with each credential starts two requests. Keys are kept for at least 7 days. After that, the same key starts a new request.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 257,
              "pattern": "^(?:([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})|\"([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})\")$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "name",
                  "url"
                ],
                "properties": {
                  "name": {
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "Unique per merchant, and can't change.",
                    "type": "string"
                  },
                  "url": {
                    "format": "uri",
                    "pattern": "^https://",
                    "maxLength": 2048,
                    "type": "string",
                    "description": "An absolute HTTPS URL."
                  },
                  "is_signed": {
                    "description": "Whether deliveries are signed.",
                    "type": "boolean",
                    "default": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The webhook_endpoint, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Location": {
                "description": "The URL of the created resource.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/WebhookEndpointFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`IDEMPOTENCY_KEY_REQUIRED`: This endpoint requires an Idempotency-Key header.\n\n`VALIDATION_FAILED`: The request is malformed or failed validation.\n\n`WEBHOOK_URL_INVALID`: The URL must be an absolute HTTPS URL.\n\n`WEBHOOK_URL_NOT_PUBLIC`: The URL's host must resolve to public addresses only.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_KEY_REQUIRED",
              "VALIDATION_FAILED",
              "WEBHOOK_URL_INVALID",
              "WEBHOOK_URL_NOT_PUBLIC"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`IDEMPOTENCY_IN_PROGRESS`: An earlier request with this Idempotency-Key hasn't finished. If this persists, contact support.\n\n`WEBHOOK_ENDPOINT_NAME_EXISTS`: This merchant already has a webhook endpoint with this name.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_IN_PROGRESS",
              "WEBHOOK_ENDPOINT_NAME_EXISTS"
            ]
          },
          "422": {
            "description": "`IDEMPOTENCY_KEY_REUSED`: This Idempotency-Key was used with a different request.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_KEY_REUSED"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.\n\n`WEBHOOK_URL_UNVERIFIABLE`: The URL's host can't be resolved right now. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE",
              "WEBHOOK_URL_UNVERIFIABLE"
            ]
          }
        }
      }
    },
    "/oauth2/token": {
      "post": {
        "operationId": "api_key.getToken",
        "summary": "Get an access token",
        "description": "Exchanges a credential for an access token, using the OAuth 2.0 client credentials grant. Send a form-encoded or JSON body, with the credentials in the body or in HTTP Basic, where each is form-encoded first, as OAuth 2.0 says. The response and its errors follow OAuth 2.0, and there is no refresh token: when the token expires, exchange the credentials again.\n\nCredentials: `partner`, `merchant`, as the API key's `client_id` and `client_secret` rather than a token",
        "tags": [
          "api_key"
        ],
        "security": [
          {
            "basic": []
          },
          {}
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": null,
        "x-includes": [],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TokenRequest"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The response. It is not a resource document.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccessToken"
                }
              }
            }
          },
          "400": {
            "description": "`invalid_request`: The request can't be processed as it was sent.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "x-error-codes": [
              "invalid_request"
            ]
          },
          "401": {
            "description": "`invalid_client`: Client authentication failed.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "x-error-codes": [
              "invalid_client"
            ]
          },
          "406": {
            "description": "`invalid_request`: The request can't be processed as it was sent.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "x-error-codes": [
              "invalid_request"
            ]
          },
          "429": {
            "description": "`invalid_request`: The request can't be processed as it was sent.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "x-error-codes": [
              "invalid_request"
            ]
          },
          "500": {
            "description": "`server_error`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "x-error-codes": [
              "server_error"
            ]
          },
          "503": {
            "description": "`temporarily_unavailable`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            },
            "x-error-codes": [
              "temporarily_unavailable"
            ]
          }
        }
      }
    },
    "/parties/{id}": {
      "get": {
        "operationId": "party.get",
        "summary": "Read a party",
        "description": "Reads one party.\n\nCredentials: `partner`, `merchant`\n\nPermission: `parties:get`",
        "tags": [
          "party"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "parties:get",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The party, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/PartyFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      },
      "patch": {
        "operationId": "party.update",
        "summary": "Update a party",
        "description": "Changes the fields sent, which have to be ones its `type` has. `null` is refused, because these fields can't be cleared. `party_roles` replaces the roles held. An address sent replaces the one held. `OWNERSHIP_TOTAL_EXCEEDED` gives the percentage still available in `details`, as `available_percent`. A party that owns part of the company through another company keeps the `owner` role and a share. Safe to repeat.\n\nCredentials: `partner`, `merchant`\n\nPermission: `parties:update`",
        "tags": [
          "party"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "parties:update",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "minProperties": 1,
                "additionalProperties": false,
                "type": "object",
                "properties": {
                  "party_roles": {
                    "minItems": 1,
                    "uniqueItems": true,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "director",
                        "executive",
                        "representative"
                      ]
                    }
                  },
                  "ownership_percent": {
                    "pattern": "^(100(\\.0{1,2})?|\\d{1,2}(\\.\\d{1,2})?)$",
                    "description": "From `\"0.00\"`, which a director can hold, to `\"100.00\"`, to two decimal places.",
                    "type": "string"
                  },
                  "first_name": {
                    "minLength": 1,
                    "maxLength": 30,
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "last_name": {
                    "minLength": 1,
                    "maxLength": 30,
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "email": {
                    "format": "email",
                    "maxLength": 320,
                    "type": "string",
                    "pattern": "^[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])?)*$"
                  },
                  "phone": {
                    "pattern": "^\\+[1-9]\\d{1,14}$",
                    "type": "string",
                    "minLength": 8
                  },
                  "date_of_birth": {
                    "format": "date",
                    "type": "string"
                  },
                  "country_of_citizenship": {
                    "pattern": "^[A-Z]{2}$",
                    "type": "string"
                  },
                  "residential_address": {
                    "$ref": "#/components/schemas/AddressInput"
                  },
                  "legal_name": {
                    "minLength": 2,
                    "maxLength": 160,
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "registration_number": {
                    "minLength": 4,
                    "maxLength": 20,
                    "type": "string"
                  },
                  "legal_structure": {
                    "type": "string",
                    "enum": [
                      "limited_liability_company",
                      "private_limited_company",
                      "public_limited_company",
                      "general_partnership",
                      "limited_liability_partnership",
                      "limited_partnership",
                      "limited_liability_entrepreneurial_company",
                      "joint_stock_company",
                      "single_member_llc",
                      "multi_member_llc",
                      "private_partnership",
                      "private_corporation",
                      "public_company"
                    ]
                  },
                  "country_of_incorporation": {
                    "pattern": "^[A-Z]{2}$",
                    "type": "string"
                  },
                  "incorporation_date": {
                    "format": "date",
                    "type": "string"
                  },
                  "registered_address": {
                    "$ref": "#/components/schemas/AddressInput"
                  },
                  "contact_full_name": {
                    "minLength": 2,
                    "maxLength": 160,
                    "type": "string"
                  },
                  "contact_email": {
                    "format": "email",
                    "maxLength": 320,
                    "type": "string",
                    "pattern": "^[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])?)*$"
                  },
                  "contact_phone": {
                    "pattern": "^\\+[1-9]\\d{1,14}$",
                    "type": "string",
                    "minLength": 8
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The party, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/PartyFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`REGION_NOT_SUPPORTED`: A region isn't supported for this country.\n\n`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "REGION_NOT_SUPPORTED",
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`OWNERSHIP_TOTAL_EXCEEDED`: This would take total ownership past 100%.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "OWNERSHIP_TOTAL_EXCEEDED"
            ]
          },
          "422": {
            "description": "`PARTY_OWNERSHIP_REQUIRED`: This party owns part of the company through another company, so `ownership_percent` has to stay above 0.\n\n`PARTY_OWNER_ROLE_REQUIRED`: This party owns part of the company through another company, so `party_roles` has to keep `owner`.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "PARTY_OWNERSHIP_REQUIRED",
              "PARTY_OWNER_ROLE_REQUIRED"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      },
      "delete": {
        "operationId": "party.delete",
        "summary": "Delete a party",
        "description": "Removes a party, so later reads answer 404, and so does a repeat of the delete.\n\nCredentials: `partner`, `merchant`\n\nPermission: `parties:delete`",
        "tags": [
          "party"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "parties:delete",
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "409": {
            "description": "`PARTY_LOCKED`: This party can't be removed. Contact support.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "PARTY_LOCKED"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`OUTCOME_UNKNOWN`: The request may have taken effect. Read the resource before trying again.\n\n`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter",
                "description": "How many seconds to wait before retrying `SERVICE_UNAVAILABLE`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "OUTCOME_UNKNOWN",
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/parties/{id}:verifyIdentity": {
      "post": {
        "operationId": "party.verifyIdentity",
        "summary": "Verify a party's identity",
        "description": "Gets the party's identity check in flight, with its link, or starts a new one. Answers 200 either way. Partner credentials start a check, and a merchant credential gets 403 `FORBIDDEN`. A party whose newest check is `approved` answers 409 `PARTY_ALREADY_VERIFIED`, unless `name_check_status` is `mismatch` or `unavailable`. `hosted_link` appears only in this response, so call this again to get the link again. Safe to repeat. `IDENTITY_VERIFICATION_UNAVAILABLE` can follow a check that started without a link, and calling again starts a new check. After repeated failures, calling again answers `IDENTITY_VERIFICATION_UNAVAILABLE` without starting one, with `Retry-After` saying when one can start, up to a day later.\n\nCredentials: `partner`\n\nPermission: `identity-verifications:create`",
        "tags": [
          "party"
        ],
        "x-credentials": [
          "partner"
        ],
        "x-permission": "identity-verifications:create",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The identity_verification, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/IdentityVerificationFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`PARTY_ALREADY_VERIFIED`: This party's newest check passed, so another can't be started.\n\n`PARTY_NAME_REQUIRED`: The party needs a first and last name before a check can start.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "PARTY_ALREADY_VERIFIED",
              "PARTY_NAME_REQUIRED"
            ]
          },
          "422": {
            "description": "`PARTY_NOT_INDIVIDUAL`: Only an individual party can verify their identity.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "PARTY_NOT_INDIVIDUAL"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`IDENTITY_VERIFICATION_UNAVAILABLE`: Identity verification isn't available right now.\n\n`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDENTITY_VERIFICATION_UNAVAILABLE",
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/partners/{id}/merchants": {
      "get": {
        "operationId": "merchant.list",
        "summary": "List merchants",
        "description": "Lists a partner's merchants, newest first. Merchant credentials have no list, since `merchants:list` is a partner permission: a merchant credential reads its merchant through `owner` on `GET /api-keys/current`.\n\nCredentials: `partner`\n\nPermission: `merchants:list`",
        "tags": [
          "merchant"
        ],
        "x-credentials": [
          "partner"
        ],
        "x-permission": "merchants:list",
        "x-views": [
          "full"
        ],
        "x-pagination": "cursor",
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of merchant, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/MerchantFull"
                      }
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      },
      "post": {
        "operationId": "merchant.create",
        "summary": "Create a merchant",
        "description": "Creates a merchant under a partner. A website belongs to one merchant across all partners, so `MERCHANT_ALREADY_EXISTS` confirms that some merchant holds it, and names none. `consent` records the person's acceptance of the agreements every merchant accepts with the create. Leave it out to record each later through `agreement_acceptance`. The `CONSENT_AGREEMENT_*` codes name the agreement in `details`. A retry with the same key answers the merchant the first one created, and records no consent again.\n\nCredentials: `partner`\n\nPermission: `merchants:create`",
        "tags": [
          "merchant"
        ],
        "x-credentials": [
          "partner"
        ],
        "x-permission": "merchants:create",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "1 to 255 printable ASCII characters with no spaces, quotes or backslashes, in double quotes as the IETF draft defines, or without them. We recommend a UUID. Make one for each thing you mean to happen once and store it before you send the request, so a retry after a crash sends the same key. Keys are scoped to your account and the endpoint, not to a token, so a new token or a rotated secret doesn't affect a retry. A partner and its merchant are separate accounts, so the same key sent with each credential starts two requests. Keys are kept for at least 7 days. After that, the same key starts a new request.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 257,
              "pattern": "^(?:([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})|\"([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})\")$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "brand_name",
                  "website_url",
                  "category_code"
                ],
                "properties": {
                  "brand_name": {
                    "minLength": 1,
                    "maxLength": 255,
                    "type": "string"
                  },
                  "website_url": {
                    "format": "uri",
                    "pattern": "^https://",
                    "maxLength": 255,
                    "type": "string"
                  },
                  "category_code": {
                    "pattern": "^[0-9]{4}$",
                    "type": "string",
                    "description": "An ISO 18245 merchant category code: four digits, `0742` for veterinary services."
                  },
                  "country": {
                    "pattern": "^[A-Z]{2}$",
                    "type": "string"
                  },
                  "account_owners": {
                    "maxItems": 1,
                    "description": "At most one, who becomes the primary owner.",
                    "type": "array",
                    "items": {
                      "additionalProperties": false,
                      "type": "object",
                      "required": [
                        "full_name",
                        "email"
                      ],
                      "properties": {
                        "full_name": {
                          "minLength": 1,
                          "maxLength": 255,
                          "type": "string"
                        },
                        "email": {
                          "format": "email",
                          "maxLength": 255,
                          "type": "string",
                          "pattern": "^[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])?)*$"
                        },
                        "phone": {
                          "anyOf": [
                            {
                              "pattern": "^\\+[1-9]\\d{1,14}$",
                              "type": "string",
                              "minLength": 8
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "job_title": {
                          "anyOf": [
                            {
                              "maxLength": 100,
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      }
                    }
                  },
                  "consent": {
                    "$ref": "#/components/schemas/Consent",
                    "description": "The person accepts the agreements every merchant accepts: `merchant_terms`, `privacy_notice`, `data_processing_addendum`, `prohibited_use_policy`, `pricing_plan`, `third_party_services` and `banking_partner_authorization`. `agreements` must hold the current version of each, and nothing else: list agreements for them. Optional. Send it to record the person's acceptance with the create, or accept later through `agreement_acceptance`."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The merchant, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Location": {
                "description": "The URL of the created resource.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/MerchantFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`CONSENT_ACCEPTED_AT_INVALID`: accepted_at is before the agreement took effect, too far in the future or too old.\n\n`CONSENT_AGREEMENT_DUPLICATE`: Consent names the same agreement more than once.\n\n`CONSENT_AGREEMENT_MISSING`: Consent is missing an agreement this operation requires.\n\n`CONSENT_AGREEMENT_NOT_REQUIRED`: Consent names an agreement this operation doesn't require.\n\n`CONSENT_AGREEMENT_STALE`: Consent names an agreement version that isn't current.\n\n`CONSENT_NOT_ACCEPTED`: `is_accepted` must be `true`, stating that the person accepted.\n\n`IDEMPOTENCY_KEY_REQUIRED`: This endpoint requires an Idempotency-Key header.\n\n`UNKNOWN_AGREEMENT`: This names no agreement.\n\n`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "CONSENT_ACCEPTED_AT_INVALID",
              "CONSENT_AGREEMENT_DUPLICATE",
              "CONSENT_AGREEMENT_MISSING",
              "CONSENT_AGREEMENT_NOT_REQUIRED",
              "CONSENT_AGREEMENT_STALE",
              "CONSENT_NOT_ACCEPTED",
              "IDEMPOTENCY_KEY_REQUIRED",
              "UNKNOWN_AGREEMENT",
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`IDEMPOTENCY_IN_PROGRESS`: An earlier request with this Idempotency-Key hasn't finished. If this persists, contact support.\n\n`MERCHANT_ALREADY_EXISTS`: A merchant already holds this website.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_IN_PROGRESS",
              "MERCHANT_ALREADY_EXISTS"
            ]
          },
          "422": {
            "description": "`IDEMPOTENCY_KEY_REUSED`: This Idempotency-Key was used with a different request.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_KEY_REUSED"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/partners/{id}/webhook-endpoints": {
      "get": {
        "operationId": "webhook_endpoint.listForPartner",
        "summary": "List a partner's webhook endpoints",
        "description": "Lists a partner's webhook endpoints. A partner can have one. The Webhooks guide says which endpoint receives each event.\n\nCredentials: `partner`\n\nPermission: `partner-webhook-endpoints:list`",
        "tags": [
          "webhook_endpoint"
        ],
        "x-credentials": [
          "partner"
        ],
        "x-permission": "partner-webhook-endpoints:list",
        "x-views": [
          "full"
        ],
        "x-pagination": "cursor",
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of webhook_endpoint, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookEndpointFull"
                      }
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      },
      "post": {
        "operationId": "webhook_endpoint.createForPartner",
        "summary": "Create a partner's webhook endpoint",
        "description": "Creates a partner's webhook endpoint, which is always signed. A partner can have one. The response carries `signing_secret`, which isn't shown again. A retry with the same key answers the endpoint the first one created, without `signing_secret`: `:rotateSecret` issues a new one. A request sent once can be answered the same way, if a dropped connection lost its first answer.\n\nCredentials: `partner`\n\nPermission: `partner-webhook-endpoints:create`",
        "tags": [
          "webhook_endpoint"
        ],
        "x-credentials": [
          "partner"
        ],
        "x-permission": "partner-webhook-endpoints:create",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "1 to 255 printable ASCII characters with no spaces, quotes or backslashes, in double quotes as the IETF draft defines, or without them. We recommend a UUID. Make one for each thing you mean to happen once and store it before you send the request, so a retry after a crash sends the same key. Keys are scoped to your account and the endpoint, not to a token, so a new token or a rotated secret doesn't affect a retry. A partner and its merchant are separate accounts, so the same key sent with each credential starts two requests. Keys are kept for at least 7 days. After that, the same key starts a new request.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 257,
              "pattern": "^(?:([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})|\"([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})\")$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "format": "uri",
                    "pattern": "^https://",
                    "maxLength": 2048,
                    "type": "string",
                    "description": "An absolute HTTPS URL."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The webhook_endpoint, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Location": {
                "description": "The URL of the created resource.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/WebhookEndpointFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`IDEMPOTENCY_KEY_REQUIRED`: This endpoint requires an Idempotency-Key header.\n\n`VALIDATION_FAILED`: The request is malformed or failed validation.\n\n`WEBHOOK_URL_INVALID`: The URL must be an absolute HTTPS URL.\n\n`WEBHOOK_URL_NOT_PUBLIC`: The URL's host must resolve to public addresses only.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_KEY_REQUIRED",
              "VALIDATION_FAILED",
              "WEBHOOK_URL_INVALID",
              "WEBHOOK_URL_NOT_PUBLIC"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`IDEMPOTENCY_IN_PROGRESS`: An earlier request with this Idempotency-Key hasn't finished. If this persists, contact support.\n\n`PARTNER_WEBHOOK_ENDPOINT_EXISTS`: This partner already has a webhook endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_IN_PROGRESS",
              "PARTNER_WEBHOOK_ENDPOINT_EXISTS"
            ]
          },
          "422": {
            "description": "`IDEMPOTENCY_KEY_REUSED`: This Idempotency-Key was used with a different request.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_KEY_REUSED"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.\n\n`WEBHOOK_URL_UNVERIFIABLE`: The URL's host can't be resolved right now. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE",
              "WEBHOOK_URL_UNVERIFIABLE"
            ]
          }
        }
      }
    },
    "/payment-links/{id}": {
      "get": {
        "operationId": "payment_link.get",
        "summary": "Read a payment link",
        "description": "Reads a payment link. `checkout` and `qr_code` come back on purpose, for printing or resending. Treat `checkout` and `qr_code` as secrets. The page shows the merchant's name and branding, the amount and the statement descriptor, and it can tell whether an email belongs to a returning customer. Anyone holding the URL can pay, and on a single-use link can start or take over the checkout. No merchant webhook covers a link's payment transactions, so poll its `transactions` link for them: `GET /merchants/{merchant_id}/transactions?payment_link_id={id}`, with `is_test=true` for a test link.\n\nCredentials: `partner`, `merchant`\n\nPermission: `payment-links:get`",
        "tags": [
          "payment_link"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "payment-links:get",
        "x-views": [
          "full",
          "summary"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full",
                "summary"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The payment_link, in the full or summary view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/PaymentLinkFull"
                        },
                        {
                          "$ref": "#/components/schemas/PaymentLinkSummary"
                        }
                      ]
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/payouts/{id}": {
      "get": {
        "operationId": "payout.get",
        "summary": "Read a payout",
        "description": "Reads one payout. A payout that fails while being sent answers 404 and leaves its merchant's list until Quidkey staff resolve it, when it returns under the same `id`, and that holds when a transaction's `payout` link points at it. Part or all of its money may have moved by then.\n\nCredentials: `partner`, `merchant`\n\nPermission: `payouts:get`",
        "tags": [
          "payout"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "payouts:get",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The payout, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/PayoutFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/transactions/{id}": {
      "get": {
        "operationId": "transaction.get",
        "summary": "Read a transaction",
        "description": "Reads a payment transaction, a refund or a reversal, live or test, including a payment transaction whose customer has not acted yet.\n\nCredentials: `partner`, `merchant`\n\nPermission: `transactions:get`",
        "tags": [
          "transaction"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "transactions:get",
        "x-views": [
          "full",
          "summary"
        ],
        "x-includes": [
          {
            "field": "merchant",
            "view": "full",
            "is_default": false
          },
          {
            "field": "customer_details",
            "view": "full",
            "is_default": false
          },
          {
            "field": "parent_transaction",
            "view": "full",
            "is_default": false
          },
          {
            "field": "payout",
            "view": "full",
            "is_default": false
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "include",
            "in": "query",
            "required": false,
            "description": "Link fields to hydrate into `entities`, comma-separated. Sending it replaces the default, which is nothing.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "merchant",
                  "customer_details",
                  "parent_transaction",
                  "payout"
                ]
              }
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full",
                "summary"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The transaction, in the full or summary view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/TransactionFull"
                        },
                        {
                          "$ref": "#/components/schemas/TransactionSummary"
                        }
                      ]
                    },
                    "entities": {
                      "additionalProperties": {
                        "anyOf": [
                          {
                            "$ref": "#/components/schemas/CustomerDetailsFull"
                          },
                          {
                            "$ref": "#/components/schemas/MerchantFull"
                          },
                          {
                            "$ref": "#/components/schemas/PayoutFull"
                          },
                          {
                            "$ref": "#/components/schemas/TransactionFull"
                          }
                        ]
                      },
                      "description": "Included linked resources, keyed by URI.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/transactions/{id}/customer-details": {
      "get": {
        "operationId": "transaction.getCustomerDetails",
        "summary": "Read a payment transaction's customer details",
        "description": "Reads who is paying, as held on this payment transaction. The details are set when it's created and can differ from the person's other payment transactions. A refund or a reversal has no customer details, so this answers 404 on one.\n\nCredentials: `partner`, `merchant`\n\nPermission: `transactions:get`",
        "tags": [
          "transaction"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "transactions:get",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The customer_details, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/CustomerDetailsFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/transactions/{id}/refundable-amount": {
      "get": {
        "operationId": "transaction.getRefundableAmount",
        "summary": "Read the refundable amount",
        "description": "Reads the most a new refund of this payment transaction may ask for now. Execution is bounded by what the customer actually paid, so a refund of an underpaid payment transaction can still stop with `REFUND_EXCEEDS_RECEIVED`. A payment transaction whose customer hasn't acted yet reads zero, and creating a refund of it answers 409.\n\nCredentials: `partner`, `merchant`\n\nPermission: `refundable-amounts:get`",
        "tags": [
          "transaction"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "refundable-amounts:get",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The refundable_amount, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/RefundableAmountFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "422": {
            "description": "`NOT_A_PAYMENT`: This isn't a payment transaction.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_A_PAYMENT"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/transactions/{id}/refunds": {
      "get": {
        "operationId": "transaction.listRefunds",
        "summary": "List a payment transaction's refunds",
        "description": "Lists the refunds of the payment transaction with this ID.\n\nCredentials: `partner`, `merchant`\n\nPermission: `refunds:list`",
        "tags": [
          "transaction"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "refunds:list",
        "x-views": [
          "summary"
        ],
        "x-pagination": "cursor",
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "An opaque cursor from `next_cursor`, valid with the filters it was issued for.",
            "schema": {
              "minLength": 1,
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The page size.",
            "schema": {
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of transaction, in the summary view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included",
                    "pagination"
                  ],
                  "properties": {
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TransactionSummary"
                      }
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/CursorPagination"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      },
      "post": {
        "operationId": "transaction.createRefund",
        "summary": "Create a refund",
        "description": "Creates a refund of the payment transaction with this ID, one at a time per payment transaction. The caller chooses whether money moves through `execution`, and there's no default. A payment transaction whose customer hasn't acted yet answers 409 `TRANSACTION_NOT_REFUNDABLE`. `PAYMENT_BUSY` means another request is working on this payment transaction. After that or a 503, send the same request again with the same key. Poll `GET /transactions/{refund_id}` to follow it, since no webhook covers refunds today. A held or blocked refund that shouldn't go ahead is cancelled by Quidkey support.\n\nCredentials: `partner`, `merchant`\n\nPermission: `refunds:create`",
        "tags": [
          "transaction"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "refunds:create",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "1 to 255 printable ASCII characters with no spaces, quotes or backslashes, in double quotes as the IETF draft defines, or without them. We recommend a UUID. Make one for each thing you mean to happen once and store it before you send the request, so a retry after a crash sends the same key. Keys are scoped to your account and the endpoint, not to a token, so a new token or a rotated secret doesn't affect a retry. A partner and its merchant are separate accounts, so the same key sent with each credential starts two requests. Keys are kept for at least 7 days. After that, the same key starts a new request.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 257,
              "pattern": "^(?:([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})|\"([\\x21\\x23-\\x5B\\x5D-\\x7E]{1,255})\")$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "amount",
                  "execution"
                ],
                "properties": {
                  "amount": {
                    "type": "object",
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/Money"
                      },
                      {
                        "type": "object",
                        "required": [
                          "value"
                        ],
                        "properties": {
                          "value": {
                            "minimum": 1,
                            "maximum": 9007199254740991,
                            "type": "integer"
                          }
                        }
                      }
                    ],
                    "description": "What the customer gets back, in the payment transaction's currency. Decimals are refused, and more than the refundable amount answers `REFUND_AMOUNT_EXCEEDED`."
                  },
                  "execution": {
                    "type": "string",
                    "enum": [
                      "automatic",
                      "manual"
                    ],
                    "description": "Whether the refund moves money by itself. There is no default.\n\n- `automatic`: Quidkey moves the money as soon as it can, with no further call.\n- `manual`: The refund is held until `:executeRefund`, and a held refund blocks further refunds of that payment transaction until it is executed, or cancelled by Quidkey support."
                  },
                  "reason": {
                    "maxLength": 255,
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The transaction, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Location": {
                "description": "The URL of the created resource.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/TransactionFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`IDEMPOTENCY_KEY_REQUIRED`: This endpoint requires an Idempotency-Key header.\n\n`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_KEY_REQUIRED",
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`IDEMPOTENCY_IN_PROGRESS`: An earlier request with this Idempotency-Key hasn't finished. If this persists, contact support.\n\n`PAYMENT_BUSY`: Another request is working on this payment transaction. Send the same request again.\n\n`PAYOUT_CURRENCY_NOT_DECIDED`: This payment transaction's payout currency hasn't been decided yet.\n\n`REFUND_ACCOUNT_NOT_CONFIGURED`: This merchant has no refund account set up for this payment transaction.\n\n`REFUND_IN_PROGRESS`: A refund of this payment transaction is already in progress.\n\n`TRANSACTION_NOT_REFUNDABLE`: This payment transaction can't be refunded in its current state.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_IN_PROGRESS",
              "PAYMENT_BUSY",
              "PAYOUT_CURRENCY_NOT_DECIDED",
              "REFUND_ACCOUNT_NOT_CONFIGURED",
              "REFUND_IN_PROGRESS",
              "TRANSACTION_NOT_REFUNDABLE"
            ]
          },
          "422": {
            "description": "`IDEMPOTENCY_KEY_REUSED`: This Idempotency-Key was used with a different request.\n\n`NOT_A_PAYMENT`: This isn't a payment transaction.\n\n`REFUND_ACCOUNT_NOT_PAYMENT_SOURCE`: The customer's account for the refund isn't the one the payment transaction came from.\n\n`REFUND_AMOUNT_EXCEEDED`: The amount is more than can be refunded on this payment transaction.\n\n`REFUND_CURRENCY_MISMATCH`: A refund's amount has to be in the payment transaction's currency.\n\n`REFUND_MANAGED_BY_PLATFORM`: This payment transaction's refunds are paid from the merchant's platform. execution: manual can prepare one.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "IDEMPOTENCY_KEY_REUSED",
              "NOT_A_PAYMENT",
              "REFUND_ACCOUNT_NOT_PAYMENT_SOURCE",
              "REFUND_AMOUNT_EXCEEDED",
              "REFUND_CURRENCY_MISMATCH",
              "REFUND_MANAGED_BY_PLATFORM"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`PAYMENT_PROVIDER_UNAVAILABLE`: The payment provider isn't available. Send the same request again.\n\n`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/IdempotentReplayed"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "PAYMENT_PROVIDER_UNAVAILABLE",
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/transactions/{id}:executeRefund": {
      "post": {
        "operationId": "transaction.executeRefund",
        "summary": "Execute a refund",
        "description": "Moves the money for a held refund, on the refund's ID. Safe to repeat: a refund already `processing` or `completed` answers 200. With `required_actions`, it goes on by itself once they clear. Running out of time doesn't stop the refund: if this request runs out of time first, it answers 503 `OUTCOME_UNKNOWN` and the refund goes on, so read it, or send `:executeRefund` again, to see where it stands. Poll `GET /transactions/{refund_id}` to follow it, since no webhook covers refunds today. A held or blocked refund that shouldn't go ahead is cancelled by Quidkey support.\n\nCredentials: `partner`, `merchant`\n\nPermission: `refunds:execute`",
        "tags": [
          "transaction"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "refunds:execute",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The transaction, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/TransactionFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`REFUND_BUSY`: Another request is working on this refund. Send the same request again.\n\n`REFUND_NEEDS_PLATFORM_SESSION`: This refund is paid when a refund started in the merchant's platform arrives.\n\n`REFUND_NOT_PENDING`: The refund has failed or was cancelled.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "REFUND_BUSY",
              "REFUND_NEEDS_PLATFORM_SESSION",
              "REFUND_NOT_PENDING"
            ]
          },
          "422": {
            "description": "`NOT_A_REFUND`: This transaction isn't a refund.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_A_REFUND"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "502": {
            "description": "`BAD_GATEWAY`: A dependency failed.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "BAD_GATEWAY"
            ]
          },
          "503": {
            "description": "`OUTCOME_UNKNOWN`: The request may have taken effect. Read the resource before trying again.\n\n`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter",
                "description": "How many seconds to wait before retrying `SERVICE_UNAVAILABLE`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "OUTCOME_UNKNOWN",
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/transactions/{id}:issueCheckout": {
      "post": {
        "operationId": "transaction.issueCheckout",
        "summary": "Issue a checkout",
        "description": "Answers with the one-time `checkout` for a pending payment transaction. It never rotates a live token, so a customer already on the page is not stranded, and past expiry it issues a new one. Safe to repeat. Only the owner of the payment transaction can do this: the partner that created it, while the merchant is still with that partner, and otherwise the merchant. For any other caller, and on a payment transaction from a payment link or an e-commerce platform, it answers 404.\n\nCredentials: `partner`, `merchant`\n\nPermission: `transactions:issue-checkout`",
        "tags": [
          "transaction"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": "transactions:issue-checkout",
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The transaction, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/TransactionFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`TRANSACTION_NOT_PENDING`: The payment transaction isn't pending.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "TRANSACTION_NOT_PENDING"
            ]
          },
          "422": {
            "description": "`NOT_A_PAYMENT`: This isn't a payment transaction.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_A_PAYMENT"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    },
    "/webhook-endpoints/{id}": {
      "get": {
        "operationId": "webhook_endpoint.get",
        "summary": "Read a webhook endpoint",
        "description": "Reads one webhook endpoint. The permission follows the endpoint's owner. A partner's credential reads the partner's own endpoint and none of its merchants', and a merchant's credential reads its own and not its partner's. The Webhooks guide says which endpoint receives each event.\n\nCredentials: `partner`, `merchant`\n\nPermission: `partner-webhook-endpoints:get` for a partner's, `webhook-endpoints:get` for a merchant's",
        "tags": [
          "webhook_endpoint"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": {
          "partner": "partner-webhook-endpoints:get",
          "merchant": "webhook-endpoints:get"
        },
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "The representation to answer with.",
            "schema": {
              "type": "string",
              "enum": [
                "full"
              ],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The webhook_endpoint, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/WebhookEndpointFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      },
      "patch": {
        "operationId": "webhook_endpoint.update",
        "summary": "Update a webhook endpoint",
        "description": "Updates a webhook endpoint. The permission follows the endpoint's owner. Turning on `is_signed` for an endpoint with no secret issues one in `signing_secret`, which isn't shown again; an endpoint that had one keeps it. On a partner's endpoint, `is_signed` or `is_default` answers 400 `VALIDATION_FAILED` naming the field.\n\nCredentials: `partner`, `merchant`\n\nPermission: `partner-webhook-endpoints:update` for a partner's, `webhook-endpoints:update` for a merchant's",
        "tags": [
          "webhook_endpoint"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": {
          "partner": "partner-webhook-endpoints:update",
          "merchant": "webhook-endpoints:update"
        },
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "minProperties": 1,
                "additionalProperties": false,
                "type": "object",
                "properties": {
                  "url": {
                    "format": "uri",
                    "pattern": "^https://",
                    "maxLength": 2048,
                    "type": "string",
                    "description": "An absolute HTTPS URL."
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "inactive"
                    ],
                    "description": "`active` can receive events, and `inactive` receives none, except a delivery Quidkey staff resend."
                  },
                  "is_signed": {
                    "description": "Whether deliveries are signed. On a merchant's endpoint only.",
                    "type": "boolean"
                  },
                  "is_default": {
                    "description": "On a merchant's endpoint only. `true` needs an `active` endpoint, and clears any other default the merchant has. `false` clears it.",
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The webhook_endpoint, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/WebhookEndpointFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.\n\n`WEBHOOK_URL_INVALID`: The URL must be an absolute HTTPS URL.\n\n`WEBHOOK_URL_NOT_PUBLIC`: The URL's host must resolve to public addresses only.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED",
              "WEBHOOK_URL_INVALID",
              "WEBHOOK_URL_NOT_PUBLIC"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`WEBHOOK_ENDPOINT_NOT_ACTIVE`: Only an active webhook endpoint can be the default.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "WEBHOOK_ENDPOINT_NOT_ACTIVE"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`OUTCOME_UNKNOWN`: The request may have taken effect. Read the resource before trying again.\n\n`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.\n\n`WEBHOOK_URL_UNVERIFIABLE`: The URL's host can't be resolved right now. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter",
                "description": "How many seconds to wait before retrying `SERVICE_UNAVAILABLE`, `WEBHOOK_URL_UNVERIFIABLE`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "OUTCOME_UNKNOWN",
              "SERVICE_UNAVAILABLE",
              "WEBHOOK_URL_UNVERIFIABLE"
            ]
          }
        }
      }
    },
    "/webhook-endpoints/{id}:rotateSecret": {
      "post": {
        "operationId": "webhook_endpoint.rotateSecret",
        "summary": "Rotate a webhook endpoint's signing secret",
        "description": "Replaces the signing secret at once, with no overlap, and answers the new one in `signing_secret`, which isn't shown again. Each call replaces it again, so this isn't safe to repeat. The permission follows the endpoint's owner.\n\nCredentials: `partner`, `merchant`\n\nPermission: `partner-webhook-endpoints:rotate-secret` for a partner's, `webhook-endpoints:rotate-secret` for a merchant's",
        "tags": [
          "webhook_endpoint"
        ],
        "x-credentials": [
          "partner",
          "merchant"
        ],
        "x-permission": {
          "partner": "partner-webhook-endpoints:rotate-secret",
          "merchant": "webhook-endpoints:rotate-secret"
        },
        "x-views": [
          "full"
        ],
        "x-includes": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The webhook_endpoint, in the full view.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "result",
                    "entities",
                    "not_included"
                  ],
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/WebhookEndpointFull"
                    },
                    "entities": {
                      "additionalProperties": false,
                      "description": "Nothing can be included here.",
                      "type": "object",
                      "properties": {}
                    },
                    "not_included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotIncludedEntry"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`VALIDATION_FAILED`: The request is malformed or failed validation.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "VALIDATION_FAILED"
            ]
          },
          "401": {
            "description": "`UNAUTHENTICATED`: A valid bearer token is required.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "UNAUTHENTICATED"
            ]
          },
          "403": {
            "description": "`FORBIDDEN`: This credential doesn't have permission for this endpoint.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "FORBIDDEN"
            ]
          },
          "404": {
            "description": "`NOT_FOUND`: Not found.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_FOUND"
            ]
          },
          "406": {
            "description": "`NOT_ACCEPTABLE`: This endpoint doesn't offer the format in Accept.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "NOT_ACCEPTABLE"
            ]
          },
          "409": {
            "description": "`WEBHOOK_ENDPOINT_NOT_SIGNED`: This webhook endpoint isn't signed, so it has no secret to rotate.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "WEBHOOK_ENDPOINT_NOT_SIGNED"
            ]
          },
          "429": {
            "description": "`RATE_LIMITED`: Too many requests.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "RATE_LIMITED"
            ]
          },
          "500": {
            "description": "`INTERNAL_ERROR`: Something went wrong on our side.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "INTERNAL_ERROR"
            ]
          },
          "503": {
            "description": "`OUTCOME_UNKNOWN`: The request may have taken effect. Read the resource before trying again.\n\n`SERVICE_UNAVAILABLE`: The service is busy. Try again shortly.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "$ref": "#/components/headers/RetryAfter",
                "description": "How many seconds to wait before retrying `SERVICE_UNAVAILABLE`."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "x-error-codes": [
              "OUTCOME_UNKNOWN",
              "SERVICE_UNAVAILABLE"
            ]
          }
        }
      }
    }
  },
  "webhooks": {
    "merchant.active": {
      "post": {
        "summary": "Merchant active",
        "description": "A merchant went live, or Quidkey reinstated one that had. Sent to the partner's endpoint only, while the merchant is still with that partner.",
        "security": [],
        "parameters": [
          {
            "name": "X-Signature",
            "in": "header",
            "required": false,
            "description": "`t=TIMESTAMP,v1=SIGNATURE`, where `SIGNATURE` is a hex HMAC-SHA256 of the timestamp, a full stop and the raw request body, keyed by the whole `signing_secret` of the endpoint it's sent to, or on a merchant's Default webhook by that webhook's own `whsec_` secret. Absent on an endpoint registered with `is_signed: false`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Timestamp",
            "in": "header",
            "required": true,
            "description": "The `t` value, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Client-Id",
            "in": "header",
            "required": true,
            "description": "On a transaction's event, the `client_id` of the merchant the transaction is for. On a merchant's event, the partner's.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantActiveEventDocument"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx status acknowledges the event. Answer quickly, and do the work afterwards."
          }
        }
      }
    },
    "merchant.pending": {
      "post": {
        "summary": "Merchant pending",
        "description": "Quidkey reinstated a merchant that hadn't gone live. Sent to the partner's endpoint only, while the merchant is still with that partner.",
        "security": [],
        "parameters": [
          {
            "name": "X-Signature",
            "in": "header",
            "required": false,
            "description": "`t=TIMESTAMP,v1=SIGNATURE`, where `SIGNATURE` is a hex HMAC-SHA256 of the timestamp, a full stop and the raw request body, keyed by the whole `signing_secret` of the endpoint it's sent to, or on a merchant's Default webhook by that webhook's own `whsec_` secret. Absent on an endpoint registered with `is_signed: false`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Timestamp",
            "in": "header",
            "required": true,
            "description": "The `t` value, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Client-Id",
            "in": "header",
            "required": true,
            "description": "On a transaction's event, the `client_id` of the merchant the transaction is for. On a merchant's event, the partner's.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantPendingEventDocument"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx status acknowledges the event. Answer quickly, and do the work afterwards."
          }
        }
      }
    },
    "merchant.suspended": {
      "post": {
        "summary": "Merchant suspended",
        "description": "Quidkey suspended a merchant, or changed a suspended merchant's status, as activating it does. Sent to the partner's endpoint only, while the merchant is still with that partner.",
        "security": [],
        "parameters": [
          {
            "name": "X-Signature",
            "in": "header",
            "required": false,
            "description": "`t=TIMESTAMP,v1=SIGNATURE`, where `SIGNATURE` is a hex HMAC-SHA256 of the timestamp, a full stop and the raw request body, keyed by the whole `signing_secret` of the endpoint it's sent to, or on a merchant's Default webhook by that webhook's own `whsec_` secret. Absent on an endpoint registered with `is_signed: false`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Timestamp",
            "in": "header",
            "required": true,
            "description": "The `t` value, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Client-Id",
            "in": "header",
            "required": true,
            "description": "On a transaction's event, the `client_id` of the merchant the transaction is for. On a merchant's event, the partner's.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantSuspendedEventDocument"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx status acknowledges the event. Answer quickly, and do the work afterwards."
          }
        }
      }
    },
    "transaction.payment.cancelled": {
      "post": {
        "summary": "Payment transaction cancelled",
        "description": "A payment transaction stopped before moving money: the customer or Quidkey cancelled it.",
        "security": [],
        "parameters": [
          {
            "name": "X-Signature",
            "in": "header",
            "required": false,
            "description": "`t=TIMESTAMP,v1=SIGNATURE`, where `SIGNATURE` is a hex HMAC-SHA256 of the timestamp, a full stop and the raw request body, keyed by the whole `signing_secret` of the endpoint it's sent to, or on a merchant's Default webhook by that webhook's own `whsec_` secret. Absent on an endpoint registered with `is_signed: false`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Timestamp",
            "in": "header",
            "required": true,
            "description": "The `t` value, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Client-Id",
            "in": "header",
            "required": true,
            "description": "On a transaction's event, the `client_id` of the merchant the transaction is for. On a merchant's event, the partner's.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransactionPaymentCancelledEventDocument"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx status acknowledges the event. Answer quickly, and do the work afterwards."
          }
        }
      }
    },
    "transaction.payment.completed": {
      "post": {
        "summary": "Payment transaction completed",
        "description": "The customer's bank accepted a direct payment transaction, and the provider reported it finished, which can be days before the money arrives. Fulfil the order. The bank can still take it back, which sends `transaction.reversal.completed`.",
        "security": [],
        "parameters": [
          {
            "name": "X-Signature",
            "in": "header",
            "required": false,
            "description": "`t=TIMESTAMP,v1=SIGNATURE`, where `SIGNATURE` is a hex HMAC-SHA256 of the timestamp, a full stop and the raw request body, keyed by the whole `signing_secret` of the endpoint it's sent to, or on a merchant's Default webhook by that webhook's own `whsec_` secret. Absent on an endpoint registered with `is_signed: false`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Timestamp",
            "in": "header",
            "required": true,
            "description": "The `t` value, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Client-Id",
            "in": "header",
            "required": true,
            "description": "On a transaction's event, the `client_id` of the merchant the transaction is for. On a merchant's event, the partner's.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransactionPaymentCompletedEventDocument"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx status acknowledges the event. Answer quickly, and do the work afterwards."
          }
        }
      }
    },
    "transaction.payment.failed": {
      "post": {
        "summary": "Payment transaction failed",
        "description": "A payment transaction failed, and nothing further will happen to it. Its `failure` says why. It's safe to try the order again.",
        "security": [],
        "parameters": [
          {
            "name": "X-Signature",
            "in": "header",
            "required": false,
            "description": "`t=TIMESTAMP,v1=SIGNATURE`, where `SIGNATURE` is a hex HMAC-SHA256 of the timestamp, a full stop and the raw request body, keyed by the whole `signing_secret` of the endpoint it's sent to, or on a merchant's Default webhook by that webhook's own `whsec_` secret. Absent on an endpoint registered with `is_signed: false`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Timestamp",
            "in": "header",
            "required": true,
            "description": "The `t` value, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Client-Id",
            "in": "header",
            "required": true,
            "description": "On a transaction's event, the `client_id` of the merchant the transaction is for. On a merchant's event, the partner's.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransactionPaymentFailedEventDocument"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx status acknowledges the event. Answer quickly, and do the work afterwards."
          }
        }
      }
    },
    "transaction.payment.processing": {
      "post": {
        "summary": "Payment transaction processing",
        "description": "The customer's bank accepted a payment transaction through a virtual account, and its money is on its way. The money hasn't landed, and no event follows when the payment transaction completes. Fulfil the order. The bank can still take it back, which sends `transaction.reversal.completed`.",
        "security": [],
        "parameters": [
          {
            "name": "X-Signature",
            "in": "header",
            "required": false,
            "description": "`t=TIMESTAMP,v1=SIGNATURE`, where `SIGNATURE` is a hex HMAC-SHA256 of the timestamp, a full stop and the raw request body, keyed by the whole `signing_secret` of the endpoint it's sent to, or on a merchant's Default webhook by that webhook's own `whsec_` secret. Absent on an endpoint registered with `is_signed: false`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Timestamp",
            "in": "header",
            "required": true,
            "description": "The `t` value, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Client-Id",
            "in": "header",
            "required": true,
            "description": "On a transaction's event, the `client_id` of the merchant the transaction is for. On a merchant's event, the partner's.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransactionPaymentProcessingEventDocument"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx status acknowledges the event. Answer quickly, and do the work afterwards."
          }
        }
      }
    },
    "transaction.payment.unresolved": {
      "post": {
        "summary": "Payment transaction unresolved",
        "description": "A payment transaction ended in an error after reaching its provider, so its outcome isn't known. Don't charge again for the order until it resolves: `transaction.payment.processing` or `transaction.payment.completed` can still follow, or `transaction.payment.failed` once Quidkey confirms.",
        "security": [],
        "parameters": [
          {
            "name": "X-Signature",
            "in": "header",
            "required": false,
            "description": "`t=TIMESTAMP,v1=SIGNATURE`, where `SIGNATURE` is a hex HMAC-SHA256 of the timestamp, a full stop and the raw request body, keyed by the whole `signing_secret` of the endpoint it's sent to, or on a merchant's Default webhook by that webhook's own `whsec_` secret. Absent on an endpoint registered with `is_signed: false`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Timestamp",
            "in": "header",
            "required": true,
            "description": "The `t` value, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Client-Id",
            "in": "header",
            "required": true,
            "description": "On a transaction's event, the `client_id` of the merchant the transaction is for. On a merchant's event, the partner's.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransactionPaymentUnresolvedEventDocument"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx status acknowledges the event. Answer quickly, and do the work afterwards."
          }
        }
      }
    },
    "transaction.reversal.cancelled": {
      "post": {
        "summary": "Reversal cancelled",
        "description": "Quidkey corrected a reversal's status to `cancelled`. The subject is the reversal, whose `parent_transaction` is the payment transaction.",
        "security": [],
        "parameters": [
          {
            "name": "X-Signature",
            "in": "header",
            "required": false,
            "description": "`t=TIMESTAMP,v1=SIGNATURE`, where `SIGNATURE` is a hex HMAC-SHA256 of the timestamp, a full stop and the raw request body, keyed by the whole `signing_secret` of the endpoint it's sent to, or on a merchant's Default webhook by that webhook's own `whsec_` secret. Absent on an endpoint registered with `is_signed: false`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Timestamp",
            "in": "header",
            "required": true,
            "description": "The `t` value, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Client-Id",
            "in": "header",
            "required": true,
            "description": "On a transaction's event, the `client_id` of the merchant the transaction is for. On a merchant's event, the partner's.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransactionReversalCancelledEventDocument"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx status acknowledges the event. Answer quickly, and do the work afterwards."
          }
        }
      }
    },
    "transaction.reversal.completed": {
      "post": {
        "summary": "Reversal completed",
        "description": "The customer's bank took a payment transaction back. The subject is the reversal, whose `parent_transaction` is the payment transaction.",
        "security": [],
        "parameters": [
          {
            "name": "X-Signature",
            "in": "header",
            "required": false,
            "description": "`t=TIMESTAMP,v1=SIGNATURE`, where `SIGNATURE` is a hex HMAC-SHA256 of the timestamp, a full stop and the raw request body, keyed by the whole `signing_secret` of the endpoint it's sent to, or on a merchant's Default webhook by that webhook's own `whsec_` secret. Absent on an endpoint registered with `is_signed: false`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Timestamp",
            "in": "header",
            "required": true,
            "description": "The `t` value, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Client-Id",
            "in": "header",
            "required": true,
            "description": "On a transaction's event, the `client_id` of the merchant the transaction is for. On a merchant's event, the partner's.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransactionReversalCompletedEventDocument"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx status acknowledges the event. Answer quickly, and do the work afterwards."
          }
        }
      }
    },
    "transaction.reversal.failed": {
      "post": {
        "summary": "Reversal failed",
        "description": "Quidkey corrected a reversal's status to `failed`. The subject is the reversal, whose `parent_transaction` is the payment transaction.",
        "security": [],
        "parameters": [
          {
            "name": "X-Signature",
            "in": "header",
            "required": false,
            "description": "`t=TIMESTAMP,v1=SIGNATURE`, where `SIGNATURE` is a hex HMAC-SHA256 of the timestamp, a full stop and the raw request body, keyed by the whole `signing_secret` of the endpoint it's sent to, or on a merchant's Default webhook by that webhook's own `whsec_` secret. Absent on an endpoint registered with `is_signed: false`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Timestamp",
            "in": "header",
            "required": true,
            "description": "The `t` value, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Client-Id",
            "in": "header",
            "required": true,
            "description": "On a transaction's event, the `client_id` of the merchant the transaction is for. On a merchant's event, the partner's.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransactionReversalFailedEventDocument"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx status acknowledges the event. Answer quickly, and do the work afterwards."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      },
      "basic": {
        "type": "http",
        "scheme": "basic"
      }
    },
    "headers": {
      "RequestId": {
        "description": "Identifies this request. Quote it to support.",
        "schema": {
          "type": "string"
        }
      },
      "RetryAfter": {
        "description": "How many seconds to wait before retrying.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "IdempotentReplayed": {
        "description": "`true` on a retry that answers with the first attempt's outcome.",
        "schema": {
          "type": "string",
          "enum": [
            "true"
          ]
        }
      }
    },
    "schemas": {
      "AccessToken": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "access_token",
          "token_type",
          "expires_in"
        ],
        "properties": {
          "access_token": {
            "description": "Send this as `Authorization: Bearer <token>`.",
            "type": "string"
          },
          "token_type": {
            "const": "Bearer",
            "type": "string"
          },
          "expires_in": {
            "minimum": 1,
            "description": "The number of seconds until the token expires.",
            "type": "integer"
          }
        }
      },
      "AccountOwnerCollectionLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "collection",
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "account_owner",
          "kind": "collection",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "AccountOwnerFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "full_name",
          "email",
          "phone",
          "job_title",
          "is_primary",
          "merchant"
        ],
        "properties": {
          "_type": {
            "const": "account_owner",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "full_name": {
            "type": "string"
          },
          "email": {
            "format": "email",
            "maxLength": 320,
            "type": "string"
          },
          "phone": {
            "anyOf": [
              {
                "pattern": "^\\+[1-9]\\d{1,14}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`null` when none is held."
          },
          "job_title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "is_primary": {
            "type": "boolean",
            "description": "Whether this is the owner given when the merchant was created. A merchant created without one has no primary owner."
          },
          "merchant": {
            "$ref": "#/components/schemas/MerchantLink"
          }
        }
      },
      "Address": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "line1",
          "city",
          "country",
          "postal_code",
          "line2",
          "region"
        ],
        "properties": {
          "line1": {
            "minLength": 1,
            "type": "string"
          },
          "city": {
            "minLength": 1,
            "type": "string"
          },
          "country": {
            "pattern": "^[A-Z]{2}$",
            "type": "string"
          },
          "postal_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "line2": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Holds the apartment as well, where one was given."
          },
          "region": {
            "anyOf": [
              {
                "pattern": "^[A-Z]{2}-[A-Z0-9]{1,3}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO 3166-2, of this address's country. `null` where none is held, and for a country with no subdivisions Quidkey knows of, such as `GB-LND`."
          }
        }
      },
      "AddressInput": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "line1",
          "city",
          "country",
          "postal_code"
        ],
        "properties": {
          "line1": {
            "minLength": 1,
            "type": "string"
          },
          "city": {
            "minLength": 1,
            "type": "string"
          },
          "country": {
            "pattern": "^[A-Z]{2}$",
            "type": "string"
          },
          "postal_code": {
            "type": "string",
            "description": "Empty in a country without postal codes, such as AE or HK."
          },
          "line2": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "region": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "pattern": "^[A-Z]{2}-[A-Z0-9]{1,3}$",
                    "type": "string"
                  },
                  {
                    "pattern": "^(US|CA|AU|NZ)-",
                    "type": "string"
                  }
                ],
                "description": "ISO 3166-2, of this address's country, which has to be one of US, CA, AU, NZ. Another region answers `REGION_NOT_SUPPORTED`."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "AgreementAcceptanceCollectionLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "collection",
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "agreement_acceptance",
          "kind": "collection",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "AgreementAcceptanceFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "merchant",
          "agreement",
          "bank_account",
          "accepted_at"
        ],
        "properties": {
          "_type": {
            "const": "agreement_acceptance",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "merchant": {
            "$ref": "#/components/schemas/MerchantLink"
          },
          "agreement": {
            "$ref": "#/components/schemas/AgreementLink",
            "description": "The version accepted, which stays readable once superseded."
          },
          "bank_account": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BankAccountLink"
              },
              {
                "type": "null"
              }
            ],
            "description": "The account a `bank_debit_authorization` authorises debits from. `null` for any other agreement."
          },
          "accepted_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
            "type": "string",
            "description": "When the person accepted: the time the caller attested to, or, for an acceptance in Quidkey's own flows such as signup, when Quidkey recorded it."
          }
        }
      },
      "AgreementFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "kind",
          "title",
          "effective_date",
          "document_url"
        ],
        "properties": {
          "_type": {
            "const": "agreement",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "merchant_terms",
              "privacy_notice",
              "data_processing_addendum",
              "prohibited_use_policy",
              "pricing_plan",
              "third_party_services",
              "banking_partner_authorization",
              "bank_debit_authorization",
              "nacha_acknowledgment",
              "payto_merchant_terms",
              "ach_authorization",
              "payto_customer_service_agreement",
              "customer_privacy_policy"
            ],
            "description": "Which document this is. A merchant accepts each of these except `ach_authorization`, `payto_customer_service_agreement` and `customer_privacy_policy`, which a customer accepts at checkout."
          },
          "title": {
            "type": "string",
            "description": "A name for this kind of agreement. The document can title itself differently."
          },
          "effective_date": {
            "format": "date",
            "type": "string",
            "description": "The date this version carries: its own stated date, or the month of its source. It can be before the version was published. Two versions can share a date, and the current version's can be in the future, as a version is current from when it's published. `banking_partner_authorization` is the banking partner's own document, which states no date, so this is the date Quidkey holds for it."
          },
          "document_url": {
            "format": "uri",
            "type": "string",
            "description": "Where the document is hosted. Show or link it, and quote the wording you showed in the consent's `wording`. Quidkey publishes a change to a document's text as a new version. `banking_partner_authorization` is on the banking partner's own site, and can change there with no new version. `nacha_acknowledgment` is a template, where `{merchant_legal_name}` stands for the merchant's legal name."
          }
        }
      },
      "AgreementLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type",
          "id"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "agreement",
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "agreement",
          "kind": "resource",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "AgreementRequestLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "minLength": 1,
            "maxLength": 100,
            "type": "string"
          },
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "agreement",
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "agreement",
          "kind": "request",
          "is_published": true
        }
      },
      "AnyLink": {
        "anyOf": [
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "_link",
              "_type",
              "id"
            ],
            "properties": {
              "_link": {
                "pattern": "^/",
                "type": "string"
              },
              "_type": {
                "type": "string"
              },
              "id": {
                "type": "string"
              }
            }
          },
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "_type",
              "id"
            ],
            "properties": {
              "_type": {
                "type": "string"
              },
              "id": {
                "type": "string"
              }
            }
          }
        ],
        "x-link-target": {
          "resource": "any",
          "kind": "any",
          "is_published": true
        }
      },
      "ApiKeyFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "owner"
        ],
        "properties": {
          "_type": {
            "const": "api_key",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "owner": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UnpublishedPartnerLink"
              },
              {
                "$ref": "#/components/schemas/MerchantLink"
              }
            ],
            "description": "The account that holds this credential."
          }
        }
      },
      "BalanceFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "bank_account",
          "amount",
          "retrieved_at"
        ],
        "properties": {
          "_type": {
            "const": "balance",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "bank_account": {
            "$ref": "#/components/schemas/BankAccountLink"
          },
          "amount": {
            "anyOf": [
              {
                "type": "object",
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "object",
                    "required": [
                      "value"
                    ],
                    "properties": {
                      "value": {
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991,
                        "type": "integer"
                      }
                    }
                  }
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "The balance the provider reports. `null` means Quidkey couldn't get a figure from the provider, and never zero."
          },
          "retrieved_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When Quidkey had the provider's answer. `null` when `amount` is `null`."
          }
        }
      },
      "BalanceSubResourceLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type",
          "id"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "balance",
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "balance",
          "kind": "singleton",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "BankAccountCollectionLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "collection",
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "bank_account",
          "kind": "collection",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "BankAccountFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "merchant",
          "status",
          "account_type",
          "account_roles",
          "currency",
          "country",
          "account_holder_name",
          "bic",
          "sort_code",
          "routing_number",
          "bsb",
          "ownership_status",
          "ownership_verified_at",
          "masked_identifier",
          "payment_schemes",
          "balance"
        ],
        "properties": {
          "_type": {
            "const": "bank_account",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "merchant": {
            "$ref": "#/components/schemas/MerchantLink"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive"
            ],
            "description": "`active` can be used in its roles. That alone doesn't mean a payout will reach it: see `ownership_status`, and Quidkey registers a new `owned` account with the providers that pay it without waiting for them, so a payout to one that hasn't registered fails. `inactive` is final, and a new account is the way back."
          },
          "account_type": {
            "type": "string",
            "enum": [
              "owned",
              "virtual"
            ],
            "description": "`owned` is the merchant's own account elsewhere. `virtual` is held for the merchant by Quidkey."
          },
          "account_roles": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "payment",
                "payout",
                "refund"
              ]
            },
            "description": "What this account can be used for, which isn't that it's in use. For each currency Quidkey keeps at most one route for live payment transactions and one for payouts, each naming one account, and only that account is used. `payment`: a route can send payment transactions here. `payout`: a route can send payouts here, which only an `owned` account can have. `refund`: funds refunds, and holds what's retained from payouts for them. An account added by a bank link is `payout` only."
          },
          "currency": {
            "pattern": "^[A-Z]{3}$",
            "type": "string",
            "description": "A route sends this account money only in this currency. A payment transaction through a virtual account with no `payout` account in its own currency is converted, as the merchant's `home_currency` says."
          },
          "country": {
            "anyOf": [
              {
                "pattern": "^[A-Z]{2}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The account's country. `null` when none is held."
          },
          "account_holder_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "bic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Identifies a bank, not an account."
          },
          "sort_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "routing_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "bsb": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "ownership_status": {
            "type": "string",
            "enum": [
              "pending",
              "verified",
              "not_applicable"
            ],
            "description": "`pending`: this `owned` account is `pending` until Quidkey verifies it's the merchant's. While Quidkey's verification hold is on, a payout to it waits and a live payment transaction into it is refused, with `LIVE_PAYMENTS_NOT_ALLOWED`. A merchant can go live with one, and uploads a statement for it in Quidkey's Console, as this API takes none. `verified`: Quidkey takes the account as the merchant's. `not_applicable`: a `virtual` account, which Quidkey opens itself."
          },
          "ownership_verified_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When Quidkey took the account as verified. Set once."
          },
          "masked_identifier": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The end of the account's number behind `****`, or of its other identifier on an account with no number. With its spaces and punctuation gone, it shows at most the last 4 characters and at most half of it. It helps tell accounts apart, though two can share one. `null` where that leaves 4 characters or fewer, or where Quidkey holds none. The number itself is never returned."
          },
          "payment_schemes": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "additionalProperties": false,
              "type": "object",
              "required": [
                "_type",
                "id",
                "is_active"
              ],
              "properties": {
                "_type": {
                  "const": "payment_scheme",
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "is_active": {
                  "type": "boolean"
                }
              },
              "x-link-target": {
                "resource": "payment_scheme",
                "kind": "resource",
                "is_published": false
              }
            },
            "description": "`id` is the scheme's stable code, such as `faster_payments`. `is_active` says whether Quidkey offers this scheme for a payment transaction routed to this account. A false doesn't by itself refuse a payment transaction, and it says nothing while the account is `inactive`. It has no part in how a payout reaches the account. Empty where none is attached, as on an account added by a bank link."
          },
          "balance": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BalanceSubResourceLink"
              },
              {
                "type": "null"
              }
            ],
            "description": "Set on an active `virtual` account, and `null` otherwise."
          }
        }
      },
      "BankAccountLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type",
          "id"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "bank_account",
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "bank_account",
          "kind": "resource",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "BankAccountRequestLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "minLength": 1,
            "maxLength": 100,
            "type": "string"
          },
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "bank_account",
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "bank_account",
          "kind": "request",
          "is_published": true
        }
      },
      "BankFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "name",
          "logo_url",
          "country"
        ],
        "properties": {
          "_type": {
            "const": "bank",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string"
          },
          "logo_url": {
            "anyOf": [
              {
                "format": "uri",
                "pattern": "^https://",
                "maxLength": 2048,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`null` where Quidkey holds no logo for the bank."
          },
          "country": {
            "pattern": "^[A-Z]{2}$",
            "type": "string",
            "description": "The bank's country, ISO 3166-1 alpha-2."
          }
        }
      },
      "BankRequestLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "minLength": 1,
            "maxLength": 100,
            "type": "string"
          },
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "bank",
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "bank",
          "kind": "request",
          "is_published": true
        }
      },
      "CapabilityCollectionLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "collection",
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "capability",
          "kind": "collection",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "CapabilityFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "category",
          "markets",
          "description",
          "status",
          "required_actions",
          "required_agreements",
          "merchant"
        ],
        "properties": {
          "_type": {
            "const": "capability",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string",
            "enum": [
              "pay_by_bank_uk_eu",
              "pay_by_bank_us",
              "payto_au",
              "virtual_accounts"
            ],
            "description": "Which capability this is. Unique only within its merchant, since every merchant has the same set. A new value comes with notice."
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "category": {
            "type": "string",
            "enum": [
              "payments",
              "payouts_and_refunds"
            ]
          },
          "markets": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "uk",
                "eu",
                "us",
                "au"
              ]
            }
          },
          "description": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "unavailable",
              "not_ready",
              "ready",
              "in_review",
              "active"
            ],
            "description": "Where it stands.\n\n- `unavailable`: Not offered to this merchant.\n- `not_ready`: Something is missing, and `required_actions` says what.\n- `ready`: It can be requested.\n- `in_review`: With a provider or Quidkey: requested, being set up, or done while the merchant isn't `active`, suspended included.\n- `active`: Done, and the merchant is `active`, so it can be used. A live payment transaction can still be refused, as `merchant.status` says of an `active` merchant."
          },
          "required_actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RequiredAction"
            },
            "description": "What holds it back: what's missing while it's `not_ready`, including what `onboarding` also reports, and Quidkey's part while it's `in_review`. Empty otherwise. It uses the codes on `onboarding`'s `required_actions`, and these.\n\n- `LEGAL_ENTITY_INCOMPLETE`: Actor `api`. The legal entity is missing the details this capability needs, which `fields` names.\n- `LEGAL_ENTITY_COMPLETION_PENDING`: Actor `quidkey`. The legal entity is missing details this capability needs that the legal entity's fields don't hold, so Quidkey has to complete them.\n- `PARTY_REQUIRED`: Actor `api`. Add the owner or director this capability needs.\n- `MERCHANT_WEBSITE_REQUIRED`: Actor `api`. Set the merchant's `website_url`.\n- `MERCHANT_CATEGORY_NOT_ACCEPTED`: Actor `api`. This capability doesn't accept the merchant's `category_code`.\n- `BANK_ACCOUNT_REQUIRED`: Actor `api`. Add an active `owned` account with the role `payout`.\n- `AGREEMENT_ACCEPTANCE_REQUIRED`: Actor `api`. `target` is the agreement version an `agreement_acceptance` must name.\n- `CAPABILITY_REQUEST_REQUIRED`: Actor `api`. `target` is the `virtual_accounts` capability, which has to be requested first.\n- `ONBOARDING_INCOMPLETE`: Actor `api`. It waits on Quidkey's sign-off of the merchant, and the merchant's onboarding has steps left before Quidkey reviews it. `target` is the onboarding, whose `required_actions` lists them.\n- `QUIDKEY_REVIEW_PENDING`: Actor `quidkey`. It waits on Quidkey's review and sign-off of the merchant, whose onboarding is with Quidkey, as `onboarding` follows.\n- `QUIDKEY_SETUP_PENDING`: Actor `quidkey`. Quidkey is completing setup it needs: before it can be requested, or once it has been.\n- `QUIDKEY_ACTIVATION_PENDING`: Actor `quidkey`. It is done, and Quidkey has yet to put the merchant live or to reinstate it."
          },
          "required_agreements": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgreementLink"
            },
            "description": "The current version of each agreement it requires, accepted or not. What an `agreement_acceptance` must name."
          },
          "merchant": {
            "$ref": "#/components/schemas/MerchantLink"
          }
        }
      },
      "CheckoutAuthorization": {
        "description": "How the customer authorizes the payment transaction, and what that needs.",
        "additionalProperties": false,
        "type": "object",
        "required": [
          "method",
          "success_url",
          "failure_url"
        ],
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "checkout"
            ],
            "description": "The customer authorizes the payment transaction themselves, at their bank, and comes back to `success_url` or `failure_url`."
          },
          "success_url": {
            "format": "uri",
            "pattern": "^https://",
            "maxLength": 2048,
            "type": "string"
          },
          "failure_url": {
            "format": "uri",
            "pattern": "^https://",
            "maxLength": 2048,
            "type": "string"
          },
          "locale": {
            "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{1,8})*$",
            "type": "string",
            "default": "en"
          },
          "bank": {
            "$ref": "#/components/schemas/BankRequestLink",
            "description": "The bank the customer chose on your own page, from `GET /merchants/{id}/banks` for this payment transaction's `customer_details.country`, currency and `is_test`. The checkout opens with it chosen, for the customer to confirm. Any other bank answers `BANK_NOT_AVAILABLE`."
          }
        }
      },
      "Consent": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "is_accepted",
          "accepted_at",
          "accepted_by",
          "accepted_ip",
          "wording",
          "locale",
          "agreements"
        ],
        "properties": {
          "is_accepted": {
            "const": true,
            "type": "boolean"
          },
          "accepted_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$",
            "type": "string",
            "description": "When the person accepted. Before the agreement took effect, more than 5 minutes in the future or more than 30 days old is refused, with `CONSENT_ACCEPTED_AT_INVALID`."
          },
          "accepted_by": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "full_name",
              "email"
            ],
            "properties": {
              "full_name": {
                "minLength": 1,
                "maxLength": 200,
                "pattern": "^[^\\x00-\\x1F\\x7F]*$",
                "description": "On one line, with no control character.",
                "type": "string"
              },
              "email": {
                "format": "email",
                "maxLength": 320,
                "type": "string",
                "pattern": "^[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])?)*$"
              }
            }
          },
          "accepted_ip": {
            "anyOf": [
              {
                "format": "ipv4",
                "type": "string"
              },
              {
                "format": "ipv6",
                "type": "string"
              }
            ]
          },
          "wording": {
            "minLength": 1,
            "maxLength": 10000,
            "pattern": "^[^\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]*$",
            "description": "The exact text the person saw, with no control character but a line break or a tab.",
            "type": "string"
          },
          "locale": {
            "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{1,8})*$",
            "type": "string",
            "maxLength": 35
          },
          "agreements": {
            "minItems": 1,
            "maxItems": 7,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgreementRequestLink"
            }
          }
        }
      },
      "CountryFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "name",
          "has_onboarding_rules",
          "phone_dial_code",
          "address_fields",
          "regions",
          "field_rules",
          "legal_structures",
          "payment_schemes"
        ],
        "properties": {
          "_type": {
            "const": "country",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string"
          },
          "has_onboarding_rules": {
            "type": "boolean",
            "description": "Whether Quidkey holds onboarding rules for merchants in this country. A merchant or legal entity naming a country where it's `false` isn't refused for that, and where it's `true`, `legal_structures` and `field_rules` can still be empty."
          },
          "phone_dial_code": {
            "anyOf": [
              {
                "pattern": "^[0-9]{1,4}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The international dialling code, without the plus. Phone numbers are sent in E.164 regardless."
          },
          "address_fields": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "line1",
                "line2",
                "city",
                "region",
                "postal_code",
                "country"
              ]
            },
            "description": "The fields of an `Address` Quidkey collects in this country. Collecting isn't requiring: an address needs `line1`, `city`, `postal_code` and `country`, with `postal_code` empty where the country has none, and can leave out `line2` or `region` wherever they're listed."
          },
          "regions": {
            "type": "array",
            "items": {
              "additionalProperties": false,
              "type": "object",
              "required": [
                "code",
                "name",
                "short_name"
              ],
              "properties": {
                "code": {
                  "pattern": "^[A-Z]{2}-[A-Z0-9]{1,3}$",
                  "type": "string",
                  "description": "The ISO 3166-2 code."
                },
                "name": {
                  "type": "string"
                },
                "short_name": {
                  "type": "string"
                }
              }
            },
            "description": "The values `region` can take on an `Address`. Empty where the API holds no list."
          },
          "field_rules": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "postal_code",
              "registration_number",
              "vat_number",
              "tax_id"
            ],
            "properties": {
              "postal_code": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/FieldRule"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "registration_number": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/FieldRule"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "vat_number": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/FieldRule"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "tax_id": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/FieldRule"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "legal_structures": {
            "type": "array",
            "items": {
              "additionalProperties": false,
              "type": "object",
              "required": [
                "code",
                "name",
                "fields"
              ],
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "limited_liability_company",
                    "private_limited_company",
                    "public_limited_company",
                    "general_partnership",
                    "limited_liability_partnership",
                    "limited_partnership",
                    "limited_liability_entrepreneurial_company",
                    "joint_stock_company",
                    "single_member_llc",
                    "multi_member_llc",
                    "private_partnership",
                    "private_corporation",
                    "public_company"
                  ],
                  "description": "The value of `legal_structure` on a legal entity."
                },
                "name": {
                  "type": "string"
                },
                "fields": {
                  "type": "array",
                  "items": {
                    "additionalProperties": false,
                    "type": "object",
                    "required": [
                      "field",
                      "is_required"
                    ],
                    "properties": {
                      "field": {
                        "type": "string",
                        "enum": [
                          "registration_number",
                          "vat_number",
                          "tax_id"
                        ]
                      },
                      "is_required": {
                        "type": "boolean"
                      }
                    }
                  },
                  "description": "The legal entity fields this structure uses. `is_required` means the merchant needs this field to finish onboarding. A create only refuses a missing `registration_number`, so a field marked required can be supplied later."
                }
              }
            },
            "description": "The legal structures Quidkey lists for this country. A create takes any `legal_structure`, listed here or not."
          },
          "payment_schemes": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "additionalProperties": false,
              "type": "object",
              "required": [
                "_type",
                "id",
                "is_default"
              ],
              "properties": {
                "_type": {
                  "const": "payment_scheme",
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "is_default": {
                  "type": "boolean"
                }
              },
              "x-link-target": {
                "resource": "payment_scheme",
                "kind": "resource",
                "is_published": false
              }
            },
            "description": "The payment schemes active in this country, the default first, which is what a bank account here can take. `id` is the scheme's stable code, such as `faster_payments`. Empty where there are none."
          }
        }
      },
      "CursorPagination": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "type",
          "limit",
          "next_cursor",
          "has_more"
        ],
        "properties": {
          "type": {
            "const": "cursor",
            "type": "string"
          },
          "limit": {
            "minimum": 1,
            "maximum": 100,
            "type": "integer"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "has_more": {
            "type": "boolean"
          }
        }
      },
      "CustomerDetailsFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "full_name",
          "email",
          "phone",
          "country",
          "billing_address",
          "transaction"
        ],
        "properties": {
          "_type": {
            "const": "customer_details",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "full_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "As given when the payment transaction was created. `null` when none is held."
          },
          "email": {
            "anyOf": [
              {
                "format": "email",
                "maxLength": 320,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "As given when the payment transaction was created. `null` when none is held."
          },
          "phone": {
            "anyOf": [
              {
                "pattern": "^\\+[1-9]\\d{1,14}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "As given when the payment transaction was created. `null` when none is held."
          },
          "country": {
            "pattern": "^[A-Z]{2}$",
            "type": "string"
          },
          "billing_address": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Address"
              },
              {
                "type": "null"
              }
            ],
            "description": "As held on the payment transaction, which can be set later."
          },
          "transaction": {
            "$ref": "#/components/schemas/TransactionLink",
            "description": "The payment transaction."
          }
        }
      },
      "CustomerDetailsSubResourceLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type",
          "id"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "customer_details",
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "customer_details",
          "kind": "singleton",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "EarlierMerchantEventObject": {
        "description": "The merchant's status in the earlier format, as the Webhooks guide describes it.",
        "additionalProperties": false,
        "type": "object",
        "required": [
          "merchant_id",
          "activation_status",
          "suspended",
          "changed_at"
        ],
        "properties": {
          "merchant_id": {
            "type": "string",
            "description": "The ID `result.subject.id` holds."
          },
          "activation_status": {
            "type": "string",
            "enum": [
              "active",
              "inactive"
            ]
          },
          "suspended": {
            "type": "boolean"
          },
          "changed_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
            "type": "string"
          }
        }
      },
      "EarlierTransactionEventObject": {
        "description": "The transaction in the earlier format, as the Webhooks guide describes it.",
        "additionalProperties": false,
        "type": "object",
        "required": [
          "id",
          "amount",
          "currency",
          "status",
          "test",
          "sandbox",
          "metadata"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The ID `GET /transactions/{id}` reads, as `result.subject.id`."
          },
          "amount": {
            "type": "string",
            "description": "A string of minor units."
          },
          "currency": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "The transaction's status in the earlier format's own vocabulary, which isn't the API's."
          },
          "test": {
            "type": "boolean"
          },
          "sandbox": {
            "type": "boolean",
            "description": "The same as `test`."
          },
          "metadata": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "order_id",
              "payment_token"
            ],
            "properties": {
              "order_id": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "payment_token": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "bank_name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "fees": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "total_fees",
              "fees_currency",
              "fees_breakdown"
            ],
            "properties": {
              "total_fees": {
                "type": "string",
                "description": "A string of minor units."
              },
              "fees_currency": {
                "type": "string"
              },
              "fees_breakdown": {
                "type": "array",
                "items": {
                  "additionalProperties": false,
                  "type": "object",
                  "required": [
                    "id",
                    "type",
                    "amount",
                    "tax_amount",
                    "currency",
                    "rate_type",
                    "rate_value",
                    "notes"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "percentage",
                        "fixed"
                      ]
                    },
                    "amount": {
                      "type": "string",
                      "description": "The whole fee taken, a string of minor units, including any tax charged on top of it."
                    },
                    "tax_amount": {
                      "type": "string",
                      "description": "The tax charged on top of the fee and included in `amount`, a string of minor units: `\"0\"` when no tax applies."
                    },
                    "currency": {
                      "type": "string"
                    },
                    "rate_type": {
                      "type": "string"
                    },
                    "rate_value": {
                      "type": "string",
                      "description": "A decimal string: the percentage on a `percentage` fee, the amount in major units on a `fixed` one."
                    },
                    "notes": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "rewards": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "extra_rewards",
              "description"
            ],
            "properties": {
              "extra_rewards": {
                "type": "number"
              },
              "total_rewards": {
                "type": "number"
              },
              "description": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "failure": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "code",
              "message",
              "retryable"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "Why the payment transaction failed, in lower case. New codes can appear, so read one you don't recognise as `unknown`."
              },
              "message": {
                "type": "string",
                "description": "Written for the customer."
              },
              "retryable": {
                "anyOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "payer": {
            "anyOf": [
              {
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "id",
                  "releasable",
                  "releasable_max_amount",
                  "authority"
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "releasable": {
                    "type": "boolean"
                  },
                  "releasable_max_amount": {
                    "anyOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "authority": {
                    "additionalProperties": false,
                    "type": "object",
                    "required": [
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "payto_agreement",
                          "saved_account"
                        ]
                      }
                    }
                  }
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "Sent only to the owning partner's endpoint, on every event. `null` until an identified customer has authorized the payment transaction."
          },
          "unresolved": {
            "type": "boolean",
            "description": "Sent only to the owning partner's endpoint, on every event. `true` on a `failed` event whose payment transaction ended in an error after reaching its provider and may still complete."
          }
        }
      },
      "Error": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "code",
              "message",
              "details",
              "retryable",
              "request_id"
            ],
            "properties": {
              "code": {
                "description": "Branch on this. New codes can appear.",
                "type": "string"
              },
              "message": {
                "description": "For people. It can change.",
                "type": "string"
              },
              "details": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ErrorDetail"
                }
              },
              "retryable": {
                "description": "Whether sending the same request again unchanged, after a wait, can succeed with nothing else changing.",
                "type": "boolean"
              },
              "request_id": {
                "description": "Quote this to support.",
                "type": "string"
              }
            }
          }
        }
      },
      "ErrorDetail": {
        "anyOf": [
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "field",
              "message"
            ],
            "properties": {
              "field": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          },
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "required_actions",
              "message"
            ],
            "properties": {
              "required_actions": {
                "description": "The `required_actions` codes holding this back.",
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "message": {
                "type": "string"
              }
            }
          },
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "available_percent",
              "message"
            ],
            "properties": {
              "available_percent": {
                "$ref": "#/components/schemas/Percent"
              },
              "message": {
                "type": "string"
              }
            }
          },
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "agreement",
              "message"
            ],
            "properties": {
              "agreement": {
                "$ref": "#/components/schemas/AgreementLink"
              },
              "message": {
                "type": "string"
              }
            }
          },
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "agreement",
              "current_agreement",
              "message"
            ],
            "properties": {
              "agreement": {
                "$ref": "#/components/schemas/AgreementLink"
              },
              "current_agreement": {
                "$ref": "#/components/schemas/AgreementLink"
              },
              "message": {
                "type": "string"
              }
            }
          },
          {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "legal_entity",
              "message"
            ],
            "properties": {
              "legal_entity": {
                "$ref": "#/components/schemas/LegalEntityLink"
              },
              "message": {
                "type": "string"
              }
            }
          }
        ]
      },
      "ExchangeRate": {
        "description": "1 unit of from_currency converts to rate units of to_currency.",
        "additionalProperties": false,
        "type": "object",
        "required": [
          "rate",
          "from_currency",
          "to_currency"
        ],
        "properties": {
          "rate": {
            "pattern": "^\\d+(\\.\\d+)?$",
            "description": "How many units of `to_currency` one unit of `from_currency` converts to, as a decimal string.",
            "type": "string"
          },
          "from_currency": {
            "pattern": "^[A-Z]{3}$",
            "type": "string"
          },
          "to_currency": {
            "pattern": "^[A-Z]{3}$",
            "type": "string"
          }
        }
      },
      "Failure": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "description": "Public and stable, and listed on the field that holds it. New codes can appear, so handle any you don't recognise.",
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "Fees": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "total",
          "items"
        ],
        "properties": {
          "total": {
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "object",
                "required": [
                  "value"
                ],
                "properties": {
                  "value": {
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "type": "integer"
                  }
                }
              }
            ],
            "description": "Fees in the customer's currency, or on a refund the refund account's."
          },
          "items": {
            "type": "array",
            "items": {
              "additionalProperties": false,
              "type": "object",
              "required": [
                "type",
                "amount",
                "tax_amount",
                "rate",
                "status",
                "settled_at"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "percentage",
                    "fixed"
                  ]
                },
                "amount": {
                  "type": "object",
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Money"
                    },
                    {
                      "type": "object",
                      "required": [
                        "value"
                      ],
                      "properties": {
                        "value": {
                          "minimum": 0,
                          "maximum": 9007199254740991,
                          "type": "integer"
                        }
                      }
                    }
                  ]
                },
                "tax_amount": {
                  "type": "object",
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Money"
                    },
                    {
                      "type": "object",
                      "required": [
                        "value"
                      ],
                      "properties": {
                        "value": {
                          "minimum": 0,
                          "maximum": 9007199254740991,
                          "type": "integer"
                        }
                      }
                    }
                  ],
                  "description": "The tax included in `amount`."
                },
                "rate": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Rate"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "A fraction. `null` on a fixed fee."
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "invoiced",
                    "settled",
                    "failed"
                  ]
                },
                "settled_at": {
                  "anyOf": [
                    {
                      "format": "date-time",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "FieldRule": {
        "description": "How Quidkey asks for a field in this country. A missing part is `null`. A create holds a `tax_id` to its `pattern` once its separators are out, and an Australian one to its checksum as well. It doesn't check `registration_number` or `vat_number` against these, and onboarding can, so send them without separators: they're kept as sent. A `postal_code` isn't checked against these at create.",
        "additionalProperties": false,
        "type": "object",
        "required": [
          "label",
          "min_length",
          "max_length",
          "pattern",
          "placeholder"
        ],
        "properties": {
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "min_length": {
            "anyOf": [
              {
                "minimum": 0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "max_length": {
            "anyOf": [
              {
                "minimum": 0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "pattern": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "An ECMA-262 regular expression."
          },
          "placeholder": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "How a person would write the value, which can carry separators `pattern` leaves out."
          }
        }
      },
      "HostedLink": {
        "description": "A page a person opens, on HTTPS in production. Its URL can carry a token, so treat it as a secret.",
        "additionalProperties": false,
        "type": "object",
        "required": [
          "url",
          "expires_at"
        ],
        "properties": {
          "url": {
            "format": "uri",
            "type": "string"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "IdentityVerificationFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "status",
          "name_check_status",
          "failure",
          "party",
          "link_expires_at"
        ],
        "properties": {
          "_type": {
            "const": "identity_verification",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "created",
              "in_progress",
              "processing",
              "in_review",
              "approved",
              "declined",
              "abandoned",
              "expired",
              "failed"
            ],
            "description": "Where this attempt stands.\n\n- `created`: Started, with no step of it finished. The person may have opened the link.\n- `in_progress`: A step is under way, which may be the person's or the check's own.\n- `processing`: A step has finished, and the check is working on it. The person may have more to do after it.\n- `in_review`: Parked for a manual decision, which doesn't change this attempt. Starting another check replaces it, which spends a paid check.\n- `approved`: The check passed. It proves a person and a document, and not that they're this party, which `name_check_status` says. The party's `verification_status` is Quidkey's own decision, and doesn't move with it.\n- `declined`: The check declined the person.\n- `abandoned`: The person didn't finish.\n- `expired`: The link lapsed with a step still under way. A `POST` replaces this attempt with a new one, which spends a paid check, even if that step was the check's own and still working, and what the step finds is dropped.\n- `failed`: The check couldn't be completed on our side."
          },
          "name_check_status": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "pending",
                  "match",
                  "mismatch",
                  "unavailable"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether the name on the verified document matched the party, as the party stood when it was judged. Changing the party's name doesn't judge it again. `null` unless `status` is `approved`. A check can read `approved` and `mismatch` together, and Quidkey's review deals with that.\n\n- `pending`: Not judged yet.\n- `match`: The names matched.\n- `mismatch`: The names didn't match. Another check can be started.\n- `unavailable`: It couldn't be judged, because no name could be read from the document or none is held for the party. Another check can be started."
          },
          "failure": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Failure"
              },
              {
                "type": "null"
              }
            ],
            "description": "`null` unless `status` is `declined` or `failed`.\n\n- `IDENTITY_CHECK_DECLINED`: The check declined the person. `status` is `declined`.\n- `IDENTITY_CHECK_FAILED`: The check couldn't be completed on our side. `status` is `failed`."
          },
          "party": {
            "$ref": "#/components/schemas/PartyLink"
          },
          "hosted_link": {
            "$ref": "#/components/schemas/OneTimeHostedLink"
          },
          "link_expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the link stops working, if one was issued. An attempt the person has finished keeps the time it had. `null` when none is held, and such an attempt never reads `expired`."
          }
        }
      },
      "LegalEntityCollectionLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "collection",
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "legal_entity",
          "kind": "collection",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "LegalEntityFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "type",
          "verification_status",
          "legal_name",
          "registration_number",
          "vat_number",
          "tax_id",
          "legal_structure",
          "country_of_incorporation",
          "incorporation_date",
          "registered_address",
          "operating_address",
          "contact_full_name",
          "contact_email",
          "contact_phone",
          "annual_revenue",
          "employee_count_band",
          "first_name",
          "last_name",
          "email",
          "phone",
          "date_of_birth",
          "country_of_citizenship",
          "residential_address",
          "merchants",
          "parties"
        ],
        "properties": {
          "_type": {
            "const": "legal_entity",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "company",
              "individual"
            ],
            "description": "Can't change. It selects which of the other fields apply, and the rest are `null`."
          },
          "verification_status": {
            "type": "string",
            "enum": [
              "pending_verification",
              "more_information_required",
              "verified",
              "rejected"
            ],
            "description": "Quidkey's own decision, apart from any identity check. It stays as decided when the details change afterwards.\n\n- `pending_verification`: Quidkey has no decision standing, because it hasn't made one or took one back. Onboarding needs one party verified, so other parties can stay at this.\n- `more_information_required`: Quidkey needs something from the merchant.\n- `verified`: Quidkey verified it, as its details stood then.\n- `rejected`: Quidkey turned it down."
          },
          "legal_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "registration_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "vat_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "tax_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "legal_structure": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "limited_liability_company",
                  "private_limited_company",
                  "public_limited_company",
                  "general_partnership",
                  "limited_liability_partnership",
                  "limited_partnership",
                  "limited_liability_entrepreneurial_company",
                  "joint_stock_company",
                  "single_member_llc",
                  "multi_member_llc",
                  "private_partnership",
                  "private_corporation",
                  "public_company"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "country_of_incorporation": {
            "anyOf": [
              {
                "pattern": "^[A-Z]{2}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "incorporation_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "registered_address": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Address"
              },
              {
                "type": "null"
              }
            ]
          },
          "operating_address": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Address"
              },
              {
                "type": "null"
              }
            ]
          },
          "contact_full_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "contact_email": {
            "anyOf": [
              {
                "format": "email",
                "maxLength": 320,
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "contact_phone": {
            "anyOf": [
              {
                "pattern": "^\\+[1-9]\\d{1,14}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "annual_revenue": {
            "anyOf": [
              {
                "type": "object",
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "object",
                    "required": [
                      "value"
                    ],
                    "properties": {
                      "value": {
                        "minimum": 0,
                        "maximum": 9007199254740991,
                        "type": "integer"
                      }
                    }
                  }
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "As the merchant stated it, which Quidkey doesn't check, and always a whole number of major units. `null` when none is held."
          },
          "employee_count_band": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "small",
                  "medium",
                  "large",
                  "enterprise"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "first_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "anyOf": [
              {
                "format": "email",
                "maxLength": 320,
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "phone": {
            "anyOf": [
              {
                "pattern": "^\\+[1-9]\\d{1,14}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "date_of_birth": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "country_of_citizenship": {
            "anyOf": [
              {
                "pattern": "^[A-Z]{2}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "residential_address": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Address"
              },
              {
                "type": "null"
              }
            ]
          },
          "merchants": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MerchantLink"
            },
            "description": "The merchants it's under that this credential can read, oldest first, and at most 20."
          },
          "parties": {
            "$ref": "#/components/schemas/PartyCollectionLink"
          }
        }
      },
      "LegalEntityLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type",
          "id"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "legal_entity",
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "legal_entity",
          "kind": "resource",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "MerchantActiveEvent": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "id",
          "type",
          "created_at",
          "subject"
        ],
        "properties": {
          "_type": {
            "const": "event",
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Unique to the event, and kept by a resend of a delivery of it, so de-duplicate on it. Sending a state again, as Quidkey staff can, raises a new event with a new `id`, so handle each state of a subject once."
          },
          "type": {
            "const": "merchant.active",
            "type": "string",
            "description": "What happened: the subject's type and status, as reading the subject answered them when the event was raised."
          },
          "created_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
            "type": "string",
            "description": "When the event was raised."
          },
          "subject": {
            "$ref": "#/components/schemas/MerchantLink",
            "description": "What the event is about. Read it for where it stands now at the path its `id` gives, never at a URL taken from the body."
          }
        }
      },
      "MerchantActiveEventDocument": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "result",
          "entities",
          "not_included",
          "id",
          "object",
          "created",
          "type",
          "data"
        ],
        "properties": {
          "result": {
            "$ref": "#/components/schemas/MerchantActiveEvent"
          },
          "entities": {
            "additionalProperties": false,
            "description": "Nothing can be included here.",
            "type": "object",
            "properties": {}
          },
          "not_included": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotIncludedEntry"
            }
          },
          "id": {
            "type": "string",
            "description": "The earlier format's ID, unique to the event. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "object": {
            "const": "event",
            "type": "string",
            "description": "Always `event`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "created": {
            "type": "integer",
            "description": "`result.created_at` in Unix seconds. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "type": {
            "type": "string",
            "enum": [
              "quidkey.merchant.status_changed"
            ],
            "description": "The earlier format's event type. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "data": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/EarlierMerchantEventObject"
              }
            },
            "description": "What the event is about. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          }
        }
      },
      "MerchantFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "partner",
          "brand_name",
          "website_url",
          "category_code",
          "country",
          "status",
          "home_currency",
          "is_multi_account_allowed",
          "account_owners",
          "onboarding",
          "legal_entities",
          "payment_links",
          "agreement_acceptances",
          "bank_accounts",
          "capabilities",
          "webhook_endpoints",
          "transactions",
          "payouts"
        ],
        "properties": {
          "_type": {
            "const": "merchant",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "partner": {
            "$ref": "#/components/schemas/UnpublishedPartnerLink"
          },
          "brand_name": {
            "type": "string"
          },
          "website_url": {
            "anyOf": [
              {
                "format": "uri",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Unique across all merchants. Sent as absolute HTTPS. One set outside this API can read `http://`. `null` when none is held."
          },
          "category_code": {
            "type": "string"
          },
          "country": {
            "anyOf": [
              {
                "pattern": "^[A-Z]{2}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`null` when none is held."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "active",
              "suspended"
            ],
            "description": "Where the merchant stands with Quidkey.\n\n- `pending`: Not live yet: it takes no live payment transactions. Read `onboarding` for what is outstanding.\n- `active`: Live. A live payment transaction can still be refused: after 12 months with none, until Quidkey has reviewed the merchant, or while the account it would land in awaits verification.\n- `suspended`: Quidkey has paused it, whether or not it had gone live: no live payment transaction, refund or payout starts. Reinstating it answers `pending` or `active`. Why isn't shared."
          },
          "home_currency": {
            "anyOf": [
              {
                "pattern": "^[A-Z]{3}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "What a payment transaction through a virtual account is converted into and paid out in when the merchant has no payout account in the transaction's own currency. A direct payment transaction is never converted. It's set from the merchant's first payout account, where that currency can be held, and only Quidkey can change it. `null` while it has none, and a merchant can't go live without one."
          },
          "is_multi_account_allowed": {
            "type": "boolean",
            "description": "Whether another `owned` account can be added while one is active. Linking a bank account isn't limited by it. It can't be set through this API."
          },
          "account_owners": {
            "$ref": "#/components/schemas/AccountOwnerCollectionLink"
          },
          "onboarding": {
            "$ref": "#/components/schemas/OnboardingSubResourceLink"
          },
          "legal_entities": {
            "$ref": "#/components/schemas/LegalEntityCollectionLink"
          },
          "payment_links": {
            "$ref": "#/components/schemas/PaymentLinkCollectionLink"
          },
          "agreement_acceptances": {
            "$ref": "#/components/schemas/AgreementAcceptanceCollectionLink"
          },
          "bank_accounts": {
            "$ref": "#/components/schemas/BankAccountCollectionLink"
          },
          "capabilities": {
            "$ref": "#/components/schemas/CapabilityCollectionLink"
          },
          "webhook_endpoints": {
            "$ref": "#/components/schemas/WebhookEndpointCollectionLink",
            "description": "A partner's credential can't follow this link, and answers 403."
          },
          "transactions": {
            "$ref": "#/components/schemas/TransactionCollectionLink"
          },
          "payouts": {
            "$ref": "#/components/schemas/PayoutCollectionLink"
          }
        }
      },
      "MerchantLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type",
          "id"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "merchant",
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "merchant",
          "kind": "resource",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "MerchantPendingEvent": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "id",
          "type",
          "created_at",
          "subject"
        ],
        "properties": {
          "_type": {
            "const": "event",
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Unique to the event, and kept by a resend of a delivery of it, so de-duplicate on it. Sending a state again, as Quidkey staff can, raises a new event with a new `id`, so handle each state of a subject once."
          },
          "type": {
            "const": "merchant.pending",
            "type": "string",
            "description": "What happened: the subject's type and status, as reading the subject answered them when the event was raised."
          },
          "created_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
            "type": "string",
            "description": "When the event was raised."
          },
          "subject": {
            "$ref": "#/components/schemas/MerchantLink",
            "description": "What the event is about. Read it for where it stands now at the path its `id` gives, never at a URL taken from the body."
          }
        }
      },
      "MerchantPendingEventDocument": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "result",
          "entities",
          "not_included",
          "id",
          "object",
          "created",
          "type",
          "data"
        ],
        "properties": {
          "result": {
            "$ref": "#/components/schemas/MerchantPendingEvent"
          },
          "entities": {
            "additionalProperties": false,
            "description": "Nothing can be included here.",
            "type": "object",
            "properties": {}
          },
          "not_included": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotIncludedEntry"
            }
          },
          "id": {
            "type": "string",
            "description": "The earlier format's ID, unique to the event. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "object": {
            "const": "event",
            "type": "string",
            "description": "Always `event`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "created": {
            "type": "integer",
            "description": "`result.created_at` in Unix seconds. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "type": {
            "type": "string",
            "enum": [
              "quidkey.merchant.status_changed"
            ],
            "description": "The earlier format's event type. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "data": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/EarlierMerchantEventObject"
              }
            },
            "description": "What the event is about. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          }
        }
      },
      "MerchantSuspendedEvent": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "id",
          "type",
          "created_at",
          "subject"
        ],
        "properties": {
          "_type": {
            "const": "event",
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Unique to the event, and kept by a resend of a delivery of it, so de-duplicate on it. Sending a state again, as Quidkey staff can, raises a new event with a new `id`, so handle each state of a subject once."
          },
          "type": {
            "const": "merchant.suspended",
            "type": "string",
            "description": "What happened: the subject's type and status, as reading the subject answered them when the event was raised."
          },
          "created_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
            "type": "string",
            "description": "When the event was raised."
          },
          "subject": {
            "$ref": "#/components/schemas/MerchantLink",
            "description": "What the event is about. Read it for where it stands now at the path its `id` gives, never at a URL taken from the body."
          }
        }
      },
      "MerchantSuspendedEventDocument": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "result",
          "entities",
          "not_included",
          "id",
          "object",
          "created",
          "type",
          "data"
        ],
        "properties": {
          "result": {
            "$ref": "#/components/schemas/MerchantSuspendedEvent"
          },
          "entities": {
            "additionalProperties": false,
            "description": "Nothing can be included here.",
            "type": "object",
            "properties": {}
          },
          "not_included": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotIncludedEntry"
            }
          },
          "id": {
            "type": "string",
            "description": "The earlier format's ID, unique to the event. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "object": {
            "const": "event",
            "type": "string",
            "description": "Always `event`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "created": {
            "type": "integer",
            "description": "`result.created_at` in Unix seconds. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "type": {
            "type": "string",
            "enum": [
              "quidkey.merchant.status_changed"
            ],
            "description": "The earlier format's event type. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "data": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/EarlierMerchantEventObject"
              }
            },
            "description": "What the event is about. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          }
        }
      },
      "Money": {
        "description": "An amount of money. Decimal values are refused, not rounded.",
        "additionalProperties": false,
        "type": "object",
        "required": [
          "value",
          "currency"
        ],
        "properties": {
          "value": {
            "description": "In the currency's ISO 4217 minor units, so GBP 45.00 is 4500.",
            "type": "integer"
          },
          "currency": {
            "pattern": "^[A-Z]{3}$",
            "type": "string"
          }
        }
      },
      "NotIncludedEntry": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "link",
          "reason"
        ],
        "properties": {
          "link": {
            "$ref": "#/components/schemas/AnyLink"
          },
          "reason": {
            "type": "string",
            "enum": [
              "no_permission",
              "not_published"
            ],
            "description": "Why this link has no entity.\n\n- `no_permission`: This credential can't read it. Fetching it answers 403, or 404 where a 403 would reveal that it exists.\n- `not_published`: The API doesn't show it: a type it doesn't publish, or a record it doesn't show on a type it does, such as a failed payout. Fetching it, where it has a URI, answers 404."
          }
        }
      },
      "OAuthError": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "error",
          "error_description"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "invalid_request",
              "invalid_client",
              "server_error",
              "temporarily_unavailable"
            ]
          },
          "error_description": {
            "type": "string"
          }
        }
      },
      "OnboardingFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "submitted_at",
          "status",
          "tasks",
          "required_actions",
          "merchant",
          "capabilities"
        ],
        "properties": {
          "_type": {
            "const": "onboarding",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "submitted_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "setting_up",
              "in_review",
              "action_required",
              "live"
            ],
            "description": "Where the onboarding stands.\n\n- `setting_up`: Details are still being filled in, and nothing is with Quidkey yet.\n- `in_review`: With Quidkey, and nothing is needed from you.\n- `action_required`: With Quidkey, and a task is waiting on you again.\n- `live`: Activated and not suspended, and for a company, enrolled for `virtual_accounts` too."
          },
          "tasks": {
            "type": "array",
            "items": {
              "additionalProperties": false,
              "type": "object",
              "required": [
                "key",
                "status"
              ],
              "properties": {
                "key": {
                  "type": "string",
                  "enum": [
                    "legal_entity",
                    "parties",
                    "identity_verifications",
                    "bank_accounts",
                    "submission"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "blocked",
                    "not_started",
                    "action_required",
                    "ready",
                    "completed"
                  ]
                }
              }
            },
            "description": "`parties` and `identity_verifications` are absent for an individual."
          },
          "required_actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RequiredAction"
            },
            "description": "What's needed next, apart from each capability's own actions. It doesn't ask for a capability to be requested: read `capabilities` for where each stands.\n\n- `LEGAL_ENTITY_REQUIRED`: Actor `api`. Create the merchant's legal entity.\n- `LEGAL_ENTITY_INCOMPLETE`: Actor `api`. The legal entity is missing the details `fields` names.\n- `LEGAL_ENTITY_MORE_INFORMATION_REQUIRED`: Actor `api`. Quidkey needs more information about the legal entity.\n- `LEGAL_ENTITY_REJECTED`: Actor `api`. Quidkey turned the legal entity down, which hands it back to the merchant.\n- `PARTY_REQUIRED`: Actor `api`. `target` is the legal entity, which needs a party it has no record of yet: a director, or a person holding 25% or more.\n- `PARTY_INCOMPLETE`: Actor `api`. The party is missing the details `fields` names. There is one action per party, for each party this merchant can read: one that's another merchant's legal entity is `SHARED_PARTY_PENDING`'s.\n- `PARTY_MORE_INFORMATION_REQUIRED`: Actor `api`. Quidkey needs more information about the party in `target`, whatever it has decided of the others. It appears while Quidkey has verified no party: it verifies at least one itself, and an approved identity check doesn't do that.\n- `PARTY_REJECTED`: Actor `api`. Quidkey turned down every party this merchant can read, the one in `target` among them. The merchant needs at least one party Quidkey verifies, which an approved identity check isn't.\n- `SHARED_PARTY_PENDING`: Actor `quidkey`. A party of this merchant is also another merchant's legal entity, which can't be read through this merchant, and Quidkey has to settle it before the step it holds can go on. It has no `target` and no `fields`, and appears once whatever the number of such parties.\n- `CORPORATE_SHAREHOLDER_OWNERS_REQUIRED`: Actor `person`. A company the business register lists as a shareholder needs saying who, if anyone, holds 25% or more through it. Someone signed in to Console answers it, and this API can't.\n- `DIRECTOR_IDENTITY_NOT_STARTED`: Actor `api`. No identity check is open for a party with the `director` role, so start one. `target` is the party someone in Console chose for the check, where someone did, and `null` otherwise. Absent while no party this merchant can read could be checked for it. A party that's another merchant's legal entity isn't readable through this merchant, so no identity-check code is published for it.\n- `OWNER_IDENTITY_NOT_STARTED`: Actor `api`. No identity check is open for a person holding 25% or more, whatever their role, so start one. `target` is the party someone in Console chose for the check, where someone did, and `null` otherwise. Absent while no party this merchant can read could be checked for it. A party that's another merchant's legal entity isn't readable through this merchant, so no identity-check code is published for it.\n- `PARTY_IDENTITY_NOT_VERIFIED`: Actor `person`. The identity check of the party in `target` is under way, and may be waiting on the person: it reads `created`, `in_progress` or `processing`. `hosted_link` is `null`. A party has one check under way at a time, so calling `:verifyIdentity` on it answers with the one running rather than start another. Where the legal entity is under more than one merchant, that check can be another merchant's, which this merchant can't read.\n- `PARTY_IDENTITY_IN_REVIEW`: Actor `quidkey`. The identity check of the party in `target` reads `in_review`, parked for Quidkey's review, and nothing is needed from you. Starting another check replaces it, and spends a paid check.\n- `PARTY_IDENTITY_CHECK_FAILED`: Actor `api`. The identity check of the party in `target` ended without passing: it was declined or abandoned, couldn't be completed, or its link expired. Start another, which spends a paid check.\n- `PARTY_INVITATION_WAITING`: Actor `person`. The person invited in `target` hasn't given their details yet. `target` is an invitation, with no `_link`.\n- `PARTY_INVITATION_EXPIRED`: Actor `person`. The invitation in `target` lapsed before it was answered, and the person is still needed: invite them again in Console. `target` is an invitation, with no `_link`.\n- `BANK_ACCOUNT_REQUIRED`: Actor `api`. Add an active `owned` account with the role `payout`.\n- `AGREEMENT_ACCEPTANCE_REQUIRED`: Actor `api`. The merchant hasn't accepted the agreement in `target`, its current version. Record the person's acceptance through `agreement_acceptance`. Quidkey won't sign the merchant off until every one is accepted. A merchant Quidkey has signed off isn't asked.\n- `BANK_DEBIT_AUTHORIZATION_REQUIRED`: Actor `api`. The merchant hasn't authorised debits from the active `owned` account in `target`. Record the person's `bank_debit_authorization` through `agreement_acceptance`, naming the account. Quidkey won't sign the merchant off until every account has one. A merchant Quidkey has signed off isn't asked.\n- `ONBOARDING_SUBMISSION_REQUIRED`: Actor `person`. Someone at the merchant signs in and submits on the page in `hosted_link`, which carries no merchant and opens on the signed-in user's current merchant. `hosted_link` is `null` where there's no such page to give.\n- `QUIDKEY_REVIEW_PENDING`: Actor `quidkey`. The onboarding is with Quidkey, which verifies the legal entity and at least one party itself, then signs the merchant off. An approved identity check doesn't verify a party.\n- `ACCOUNTS_BEING_SET_UP`: Actor `quidkey`. Quidkey is setting up the merchant's accounts.\n- `QUIDKEY_ACTIVATION_PENDING`: Actor `quidkey`. Quidkey has signed the merchant off, and has yet to put it live or to reinstate it, or, for a company, `virtual_accounts` has yet to be enrolled: read it for what it waits on."
          },
          "merchant": {
            "$ref": "#/components/schemas/MerchantLink"
          },
          "capabilities": {
            "$ref": "#/components/schemas/CapabilityCollectionLink"
          }
        }
      },
      "OnboardingSubResourceLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type",
          "id"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "onboarding",
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "onboarding",
          "kind": "singleton",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "OneTimeHostedLink": {
        "description": "A page a person opens, on HTTPS in production. Its URL can carry a token, so treat it as a secret.",
        "additionalProperties": false,
        "type": "object",
        "required": [
          "url",
          "expires_at"
        ],
        "properties": {
          "url": {
            "format": "uri",
            "type": "string"
          },
          "expires_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "x-one-time-secret": true
      },
      "Order": {
        "description": "The caller's order. Not unique: a reusable link puts it on every payment transaction.",
        "additionalProperties": false,
        "type": "object",
        "required": [
          "order_id"
        ],
        "properties": {
          "order_id": {
            "minLength": 1,
            "type": "string"
          }
        }
      },
      "PartyCollectionLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "collection",
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "party",
          "kind": "collection",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "PartyFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "type",
          "party_roles",
          "ownership_percent",
          "verification_status",
          "first_name",
          "last_name",
          "email",
          "phone",
          "date_of_birth",
          "country_of_citizenship",
          "residential_address",
          "legal_name",
          "registration_number",
          "legal_structure",
          "country_of_incorporation",
          "incorporation_date",
          "registered_address",
          "contact_full_name",
          "contact_email",
          "contact_phone",
          "legal_entity"
        ],
        "properties": {
          "_type": {
            "const": "party",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "individual",
              "company"
            ],
            "description": "Can't change. It selects which of the other fields apply, and the rest are `null`."
          },
          "party_roles": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "owner",
                "director",
                "executive",
                "representative"
              ]
            },
            "description": "A person who is a `director`, or who holds 25% or more whatever their role, can fill an identity check onboarding asks for. A company can fill none. Each once, in no order to rely on. Empty when no role listed here is held."
          },
          "ownership_percent": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Percent"
              },
              {
                "type": "null"
              }
            ],
            "description": "From `\"0.00\"` to `\"100.00\"`, to two decimal places, which a person can hold through a company. `null` when none is held, which onboarding reports."
          },
          "verification_status": {
            "type": "string",
            "enum": [
              "pending_verification",
              "more_information_required",
              "verified",
              "rejected"
            ],
            "description": "Quidkey's own decision, apart from any identity check. It stays as decided when the details change afterwards.\n\n- `pending_verification`: Quidkey has no decision standing, because it hasn't made one or took one back. Onboarding needs one party verified, so other parties can stay at this.\n- `more_information_required`: Quidkey needs something from the merchant.\n- `verified`: Quidkey verified it, as its details stood then.\n- `rejected`: Quidkey turned it down."
          },
          "first_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "anyOf": [
              {
                "format": "email",
                "maxLength": 320,
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "phone": {
            "anyOf": [
              {
                "pattern": "^\\+[1-9]\\d{1,14}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "date_of_birth": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "country_of_citizenship": {
            "anyOf": [
              {
                "pattern": "^[A-Z]{2}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "residential_address": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Address"
              },
              {
                "type": "null"
              }
            ]
          },
          "legal_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "registration_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "legal_structure": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "limited_liability_company",
                  "private_limited_company",
                  "public_limited_company",
                  "general_partnership",
                  "limited_liability_partnership",
                  "limited_partnership",
                  "limited_liability_entrepreneurial_company",
                  "joint_stock_company",
                  "single_member_llc",
                  "multi_member_llc",
                  "private_partnership",
                  "private_corporation",
                  "public_company"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "country_of_incorporation": {
            "anyOf": [
              {
                "pattern": "^[A-Z]{2}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "incorporation_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "registered_address": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Address"
              },
              {
                "type": "null"
              }
            ]
          },
          "contact_full_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "contact_email": {
            "anyOf": [
              {
                "format": "email",
                "maxLength": 320,
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "contact_phone": {
            "anyOf": [
              {
                "pattern": "^\\+[1-9]\\d{1,14}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "legal_entity": {
            "$ref": "#/components/schemas/LegalEntityLink"
          }
        }
      },
      "PartyLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type",
          "id"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "party",
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "party",
          "kind": "resource",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "PaymentLinkCollectionLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "collection",
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "payment_link",
          "kind": "collection",
          "is_published": true,
          "views": [
            "full",
            "summary"
          ]
        }
      },
      "PaymentLinkFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "merchant",
          "type",
          "is_test",
          "status",
          "amount",
          "order",
          "statement_descriptor",
          "locale",
          "success_url",
          "failure_url",
          "expires_at",
          "checkout",
          "qr_code",
          "view_count",
          "first_viewed_at",
          "transactions"
        ],
        "properties": {
          "_type": {
            "const": "payment_link",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "merchant": {
            "$ref": "#/components/schemas/MerchantLink"
          },
          "type": {
            "type": "string",
            "enum": [
              "single_use",
              "reusable"
            ]
          },
          "is_test": {
            "type": "boolean",
            "description": "Whether the payment transactions this link takes are test ones."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "used",
              "expired"
            ],
            "description": "Whether the link is open. This is about the link alone, not its merchant.\n\n- `active`: Not used, and not past `expires_at`. A payment transaction through a live link is still refused while the merchant cannot take live payment transactions. A single-use link whose payment transaction failed and was later corrected to a success can still read this, so read `transactions` before resending one.\n- `used`: A single-use link that took a payment transaction, and takes no more. A reusable link never reads this. The payment transaction may still be in progress or fail later, and nothing marks which attempt spent the link, so read `transactions` for how it went.\n- `expired`: Past `expires_at`. A payment transaction started before then can still finish."
          },
          "amount": {
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "object",
                "required": [
                  "value"
                ],
                "properties": {
                  "value": {
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "type": "integer"
                  }
                }
              }
            ]
          },
          "order": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Order"
              },
              {
                "type": "null"
              }
            ],
            "description": "The caller's order, copied to every payment transaction the link takes. `null` where none was given."
          },
          "statement_descriptor": {
            "anyOf": [
              {
                "minLength": 1,
                "maxLength": 18,
                "description": "Becomes alphanumeric on the way to the bank. On a payment transaction through a virtual account, the customer's statement shows Quidkey's reconciliation reference instead.",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`null` when none is held."
          },
          "locale": {
            "anyOf": [
              {
                "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{1,8})*$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`null` when none is held."
          },
          "success_url": {
            "anyOf": [
              {
                "format": "uri",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`null` when none is held."
          },
          "failure_url": {
            "anyOf": [
              {
                "format": "uri",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`null` when none is held."
          },
          "expires_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
            "type": "string"
          },
          "checkout": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/HostedLink"
              },
              {
                "type": "null"
              }
            ],
            "description": "The page that takes payment, readable again for printing or resending. `null` on a `used` or `expired` link. On an `active` link, `null` means the page can't be issued again: create a new link."
          },
          "qr_code": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/HostedLink"
              },
              {
                "type": "null"
              }
            ],
            "description": "The QR of `checkout.url`, usable in a plain `<img>`. `null` under the same conditions as `checkout`."
          },
          "view_count": {
            "minimum": 0,
            "type": "integer",
            "description": "How many times the page was opened while the link was `active`. A QR fetch doesn't count."
          },
          "first_viewed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`null` until the page is first opened while the link is `active`. A QR fetch doesn't count."
          },
          "transactions": {
            "$ref": "#/components/schemas/TransactionCollectionLink",
            "description": "Every attempt through the link, including abandoned and cancelled ones. A single-use link can hold several. A test link's collection reads test records."
          }
        }
      },
      "PaymentLinkSummary": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "merchant",
          "type",
          "is_test",
          "status",
          "amount",
          "order",
          "statement_descriptor",
          "expires_at",
          "view_count",
          "first_viewed_at",
          "transactions"
        ],
        "properties": {
          "_type": {
            "const": "payment_link",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "summary",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "merchant": {
            "$ref": "#/components/schemas/MerchantLink"
          },
          "type": {
            "type": "string",
            "enum": [
              "single_use",
              "reusable"
            ]
          },
          "is_test": {
            "type": "boolean",
            "description": "Whether the payment transactions this link takes are test ones."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "used",
              "expired"
            ],
            "description": "Whether the link is open. This is about the link alone, not its merchant.\n\n- `active`: Not used, and not past `expires_at`. A payment transaction through a live link is still refused while the merchant cannot take live payment transactions. A single-use link whose payment transaction failed and was later corrected to a success can still read this, so read `transactions` before resending one.\n- `used`: A single-use link that took a payment transaction, and takes no more. A reusable link never reads this. The payment transaction may still be in progress or fail later, and nothing marks which attempt spent the link, so read `transactions` for how it went.\n- `expired`: Past `expires_at`. A payment transaction started before then can still finish."
          },
          "amount": {
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "object",
                "required": [
                  "value"
                ],
                "properties": {
                  "value": {
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "type": "integer"
                  }
                }
              }
            ]
          },
          "order": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Order"
              },
              {
                "type": "null"
              }
            ],
            "description": "The caller's order, copied to every payment transaction the link takes. `null` where none was given."
          },
          "statement_descriptor": {
            "anyOf": [
              {
                "minLength": 1,
                "maxLength": 18,
                "description": "Becomes alphanumeric on the way to the bank. On a payment transaction through a virtual account, the customer's statement shows Quidkey's reconciliation reference instead.",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`null` when none is held."
          },
          "expires_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
            "type": "string"
          },
          "view_count": {
            "minimum": 0,
            "type": "integer",
            "description": "How many times the page was opened while the link was `active`. A QR fetch doesn't count."
          },
          "first_viewed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`null` until the page is first opened while the link is `active`. A QR fetch doesn't count."
          },
          "transactions": {
            "$ref": "#/components/schemas/TransactionCollectionLink",
            "description": "Every attempt through the link, including abandoned and cancelled ones. A single-use link can hold several. A test link's collection reads test records."
          }
        }
      },
      "PayoutCollectionLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "collection",
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "payout",
          "kind": "collection",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "PayoutFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "merchant",
          "status",
          "origin",
          "amount",
          "gross_amount",
          "fee_amount",
          "net_amount",
          "refund_retained_amount",
          "refund_retention_rate",
          "bank_reference",
          "transaction_count",
          "transactions",
          "sent_at"
        ],
        "properties": {
          "_type": {
            "const": "payout",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "merchant": {
            "$ref": "#/components/schemas/MerchantLink"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "sent"
            ],
            "description": "Where the payout stands.\n\n- `pending`: Created and not yet sent, including a payout held by a pause on the merchant or its account. One paused partway may already have moved its `refund_retained_amount`.\n- `processing`: Sending has started. It stays here if sending is interrupted, until Quidkey staff reconcile it, and part or all of the money may already have moved.\n- `sent`: The provider accepted the transfer. That doesn't confirm the money arrived: a transfer that later bounces comes back as a credit on the account and doesn't change this."
          },
          "origin": {
            "type": "string",
            "enum": [
              "scheduled",
              "manual"
            ],
            "description": "`scheduled`: made by the merchant's schedule. `manual`: made by Quidkey staff."
          },
          "amount": {
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "object",
                "required": [
                  "value"
                ],
                "properties": {
                  "value": {
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "type": "integer"
                  }
                }
              }
            ],
            "description": "What the merchant receives: `net_amount` minus `refund_retained_amount`."
          },
          "gross_amount": {
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "object",
                "required": [
                  "value"
                ],
                "properties": {
                  "value": {
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "type": "integer"
                  }
                }
              }
            ],
            "description": "The covered transactions before fees, in the payout currency: `net_amount` plus `fee_amount`."
          },
          "fee_amount": {
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "object",
                "required": [
                  "value"
                ],
                "properties": {
                  "value": {
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "type": "integer"
                  }
                }
              }
            ],
            "description": "Quidkey's fees on those transactions, including any tax on them."
          },
          "net_amount": {
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "object",
                "required": [
                  "value"
                ],
                "properties": {
                  "value": {
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "type": "integer"
                  }
                }
              }
            ],
            "description": "After fees, before anything is retained."
          },
          "refund_retained_amount": {
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "object",
                "required": [
                  "value"
                ],
                "properties": {
                  "value": {
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "type": "integer"
                  }
                }
              }
            ],
            "description": "Moved, or to be moved, to the merchant's refund account instead of being paid out."
          },
          "refund_retention_rate": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Rate"
              },
              {
                "type": "null"
              }
            ],
            "description": "The rate this payout used. `null` when none is held."
          },
          "bank_reference": {
            "type": "string",
            "description": "The reference the transfer is sent under. Banks don't always show it."
          },
          "transaction_count": {
            "minimum": 0,
            "type": "integer"
          },
          "transactions": {
            "$ref": "#/components/schemas/TransactionCollectionLink"
          },
          "sent_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the provider accepted the transfer. Not when it arrived. `null` until sent."
          }
        }
      },
      "PayoutLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type",
          "id"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "payout",
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "payout",
          "kind": "resource",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "Percent": {
        "pattern": "^\\d+(\\.\\d+)?$",
        "description": "A percentage as a decimal string: `\"25.00\"` is 25%.",
        "type": "string"
      },
      "Points": {
        "pattern": "^\\d{1,8}(\\.\\d{1,2})?$",
        "description": "Points as a decimal string, from `\"0\"` to `\"99999999.99\"` with at most 2 decimal places. A response always has 2: `\"12.50\"`. Not money.",
        "type": "string"
      },
      "Rate": {
        "pattern": "^\\d+(\\.\\d{1,8})?$",
        "description": "A fraction as a decimal string, with at most 8 decimal places: `\"0.0500\"` is 5%.",
        "type": "string"
      },
      "ReceivableCurrenciesFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "merchant",
          "currencies",
          "test_currencies"
        ],
        "properties": {
          "_type": {
            "const": "receivable_currencies",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "merchant": {
            "$ref": "#/components/schemas/MerchantLink"
          },
          "currencies": {
            "type": "array",
            "items": {
              "pattern": "^[A-Z]{3}$",
              "type": "string"
            },
            "description": "The currencies routed to an active account. A live payment transaction in one can still be refused: while `status` isn't `active`, after dormancy, or while the receiving account awaits verification."
          },
          "test_currencies": {
            "type": "array",
            "items": {
              "pattern": "^[A-Z]{3}$",
              "type": "string"
            },
            "description": "The currencies routed to an active account for test payment transactions. That account may be one the bank account list leaves out."
          }
        }
      },
      "RefundableAmountFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "transaction",
          "amount"
        ],
        "properties": {
          "_type": {
            "const": "refundable_amount",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "transaction": {
            "$ref": "#/components/schemas/TransactionLink",
            "description": "The payment transaction."
          },
          "amount": {
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "object",
                "required": [
                  "value"
                ],
                "properties": {
                  "value": {
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "type": "integer"
                  }
                }
              }
            ],
            "description": "The most a new refund may ask for now, in the customer's currency. It says what a request may ask for, not what's certain to be paid."
          }
        }
      },
      "RequiredAction": {
        "description": "Something that has to happen before a resource can move on.",
        "additionalProperties": false,
        "type": "object",
        "required": [
          "code",
          "message",
          "actor",
          "target",
          "fields",
          "hosted_link"
        ],
        "properties": {
          "code": {
            "description": "Public and stable, and listed on the field that holds it. New codes can appear, so handle any you don't recognise.",
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "actor": {
            "type": "string",
            "enum": [
              "api",
              "person",
              "quidkey"
            ],
            "description": "Who resolves it. `api`: your integration makes the API call the code names. `person`: someone acts, in Console or on the page in `hosted_link`. `quidkey`: there's nothing for you to do, because Quidkey retries it or its staff handle it."
          },
          "target": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AnyLink"
              },
              {
                "type": "null"
              }
            ]
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The public fields of `target` it's about, with dotted paths into an address, such as `registered_address.city`. `[]` unless the code names fields."
          },
          "hosted_link": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/HostedLink"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "Rewards": {
        "description": "Points shown to the customer.",
        "additionalProperties": false,
        "type": "object",
        "required": [
          "extra_rewards",
          "total_rewards",
          "description"
        ],
        "properties": {
          "extra_rewards": {
            "$ref": "#/components/schemas/Points"
          },
          "total_rewards": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Points"
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "RewardsInput": {
        "description": "Points shown to the customer.",
        "additionalProperties": false,
        "type": "object",
        "required": [
          "extra_rewards"
        ],
        "properties": {
          "extra_rewards": {
            "$ref": "#/components/schemas/Points"
          },
          "total_rewards": {
            "$ref": "#/components/schemas/Points"
          },
          "description": {
            "maxLength": 255,
            "type": "string"
          }
        }
      },
      "Simulation": {
        "description": "Chooses how a test payment transaction ends. USD only. It isn't read back.",
        "minProperties": 1,
        "additionalProperties": false,
        "type": "object",
        "properties": {
          "payment_outcome": {
            "type": "string",
            "enum": [
              "paid",
              "on_hold_daily_limit",
              "cancelled_for_fraud_risk",
              "cancelled_for_balance_check",
              "failed_insufficient_funds",
              "reversed_insufficient_funds",
              "failed_customer_dispute",
              "reversed_customer_dispute",
              "failed_closed_bank_account",
              "reversed_closed_bank_account"
            ]
          },
          "customer_outcome": {
            "type": "string",
            "enum": [
              "verified",
              "rejected",
              "in_review"
            ]
          },
          "bank_link_outcome": {
            "type": "string",
            "enum": [
              "active",
              "rejected"
            ]
          }
        }
      },
      "TokenRequest": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "grant_type"
        ],
        "properties": {
          "grant_type": {
            "const": "client_credentials",
            "type": "string"
          },
          "client_id": {
            "type": "string",
            "description": "The `id` of the `api_key`. Leave it out when it's sent in HTTP Basic."
          },
          "client_secret": {
            "minLength": 1,
            "maxLength": 256,
            "description": "The credential's secret. Leave it out when it's sent in HTTP Basic.",
            "type": "string"
          }
        }
      },
      "TransactionCollectionLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "collection",
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "transaction",
          "kind": "collection",
          "is_published": true,
          "views": [
            "full",
            "summary"
          ]
        }
      },
      "TransactionFailure": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "code",
          "message",
          "retryable"
        ],
        "properties": {
          "code": {
            "description": "Public and stable, and listed on the field that holds it. New codes can appear, so handle any you don't recognise.",
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "retryable": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether the same payment transaction could succeed if the customer tried again. `null` when neither the bank nor Quidkey gave an indication."
          }
        }
      },
      "TransactionFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "type",
          "is_test",
          "transaction_number",
          "status",
          "reason",
          "failure",
          "required_actions",
          "amount",
          "payout_amount",
          "exchange_rate",
          "fees",
          "routing",
          "refund_status",
          "can_refund",
          "order",
          "rewards",
          "reported_statement_descriptor",
          "platform",
          "merchant",
          "customer_details",
          "parent_transaction",
          "refunds",
          "reversals",
          "payout"
        ],
        "properties": {
          "_type": {
            "const": "transaction",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "payment",
              "refund",
              "reversal"
            ]
          },
          "is_test": {
            "type": "boolean",
            "description": "Whether this is a test payment transaction, or a refund or reversal of one."
          },
          "transaction_number": {
            "type": "string",
            "description": "A short reference, the same in Console and the API. Quote it to support."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "completed",
              "failed",
              "cancelled",
              "unresolved"
            ],
            "description": "Where this money movement is in its lifecycle. No status confirms that money has arrived, `completed` included.\n\n- `pending`: Nothing has moved. On a payment transaction, the customer hasn't finished or the provider hasn't answered, and `:issueCheckout` may revive it. On a refund, it's held until `:executeRefund`, waiting on `required_actions` or on its payment transaction converting, or waiting on Quidkey with `required_actions: []`.\n- `processing`: Accepted and moving. On a payment transaction this includes money that hasn't landed. A refund can carry `required_actions` here, when something stopped it on the way.\n- `completed`: Finished. On a payment transaction, the provider reported success, which can be days before the money arrives, or on a virtual account the merchant's payout finished. On a refund, the payment to the customer's account went out. A reversal is always `completed`.\n- `failed`: It didn't happen, and nothing further will. Safe to try the order again.\n- `cancelled`: Stopped before moving money. On a payment transaction, the customer or Quidkey cancelled it.\n- `unresolved`: The outcome isn't known, and a later `completed` can still apply, so don't charge again for this order until it resolves. A payment transaction becomes `processing` or `completed`, or `failed` once Quidkey confirms."
          },
          "reason": {
            "anyOf": [
              {
                "maxLength": 255,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The caller's reason, on a refund. `null` otherwise."
          },
          "failure": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TransactionFailure"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why a payment transaction failed: `null` unless its `status` is `failed`, and on a refund and a reversal. `message` is what the customer is told of the code.\n\n- `INSUFFICIENT_FUNDS`: The customer's account didn't hold enough.\n- `ACCOUNT_CLOSED`: The customer's account is closed.\n- `ACCOUNT_BLOCKED`: The customer's account can't be debited.\n- `AGREEMENT_INACTIVE`: The payment agreement wasn't approved, or is no longer active.\n- `DECLINED`: The bank declined, with no more specific reason.\n- `UNKNOWN`: No reason the customer can act on is recorded. It can become a more specific code if the bank reports one later."
          },
          "required_actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RequiredAction"
            },
            "description": "What has to happen before this can move on, and `[]` when nothing's needed. A `pending` refund with `[]` is waiting on Quidkey. `hosted_link` is `null` here, since resolution links are sent from Console.\n\n- `REFUND_NOT_EXECUTED`: Actor `api`. The refund is held, and `:executeRefund` on it moves the money.\n- `REFUND_NEEDS_PLATFORM_SESSION`: Actor `person`. Someone starts the refund in the merchant's platform.\n- `BILLING_ADDRESS_REQUIRED`: Actor `person`. Someone supplies it in Console, or sends a resolution link from there.\n- `CUSTOMER_BANK_ACCOUNT_REQUIRED`: Actor `person`. Someone supplies it in Console, or sends a resolution link from there.\n- `CUSTOMER_EMAIL_REQUIRED`: Actor `person`. Someone supplies it in Console, or sends a resolution link from there.\n- `ACCOUNT_HOLDER_NAME_REQUIRED`: Actor `person`. Someone sends a resolution link from Console.\n- `REFUND_BALANCE_TOO_LOW`: Actor `person`. Someone tops up the refund account, and it's retried hourly.\n- `REFUND_EXCEEDS_RECEIVED`: Actor `quidkey`. The refund is more than the customer actually paid, and Quidkey staff handle it.\n- `PAYMENT_IN_TRANSIT`: Actor `quidkey`. It goes on by itself once the payment transaction converts.\n- `PAYMENT_PROVIDER_UNAVAILABLE`: Actor `quidkey`. It's retried hourly.\n- `CUSTOMER_BANK_ACCOUNT_NEEDS_CONFIRMING`: Actor `quidkey`. Quidkey staff confirm the account.\n- `PAYEE_NOT_ACCEPTED`: Actor `quidkey`. The provider didn't accept the customer as a payee, and Quidkey staff handle it.\n- `CUSTOMER_BANK_DETAILS_UNUSABLE`: Actor `quidkey`. The customer's bank details can't be used, and Quidkey staff handle it.\n- `MERCHANT_NOT_SET_UP_FOR_REFUNDS`: Actor `quidkey`. Quidkey staff set the merchant up for refunds.\n- `PROCESSING_ERROR`: Actor `quidkey`. Anything else, which Quidkey staff handle."
          },
          "amount": {
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "object",
                "required": [
                  "value"
                ],
                "properties": {
                  "value": {
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "type": "integer"
                  }
                }
              }
            ],
            "description": "Always the customer's side, in the customer's currency: what they were charged, what they get back, or what the bank took back."
          },
          "payout_amount": {
            "anyOf": [
              {
                "type": "object",
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "object",
                    "required": [
                      "value"
                    ],
                    "properties": {
                      "value": {
                        "minimum": 0,
                        "maximum": 9007199254740991,
                        "type": "integer"
                      }
                    }
                  }
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "What this payment transaction adds to the merchant's payouts, after fees and any conversion. `null` unless a payment transaction is `processing` or `completed`."
          },
          "exchange_rate": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ExchangeRate"
              },
              {
                "type": "null"
              }
            ],
            "description": "Explains the amounts, which are authoritative: don't recompute them from it. `null` until converted, and when no conversion ran."
          },
          "fees": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Fees"
              },
              {
                "type": "null"
              }
            ],
            "description": "The fees. `null` when there are none, and on a `failed`, `cancelled` or `unresolved` payment transaction."
          },
          "routing": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "virtual_account",
                  "direct"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether the money passes through a virtual account Quidkey runs for the merchant."
          },
          "refund_status": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "refunding",
                  "refunding_blocked",
                  "refunding_failed",
                  "partially_refunded",
                  "fully_refunded"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "How far refunds of this payment transaction have got. None of these confirms that money has arrived. A list has no `required_actions`, so a single read gives them.\n\n- `refunding`: A refund is under way, held until `:executeRefund`, or waiting on Quidkey with `required_actions: []`.\n- `refunding_blocked`: A refund has `required_actions` other than `REFUND_NOT_EXECUTED`, or is waiting for a refund started in the merchant's platform.\n- `refunding_failed`: The latest refund outcome is a failure.\n- `partially_refunded`: Some of it has been refunded.\n- `fully_refunded`: All of it has been refunded.\n- `null`: No refunds, or the type is not `payment`."
          },
          "can_refund": {
            "type": "boolean",
            "description": "Whether a refund that moves money can be created now. `false` on a payment transaction whose refunds are paid from the merchant's platform, where `execution: manual` can still prepare one."
          },
          "order": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Order"
              },
              {
                "type": "null"
              }
            ],
            "description": "The caller's order. `null` where none was given."
          },
          "rewards": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Rewards"
              },
              {
                "type": "null"
              }
            ],
            "description": "What the payment transaction was created with. `null` on a payment transaction given none, and on a refund and a reversal."
          },
          "reported_statement_descriptor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "What the provider reported as sent. `null` when not reported."
          },
          "platform": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "api",
                  "payment_link",
                  "shopify",
                  "woocommerce"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "How the payment transaction came. `null` on a refund and a reversal, whose `parent_transaction` has it."
          },
          "merchant": {
            "$ref": "#/components/schemas/MerchantLink"
          },
          "customer_details": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CustomerDetailsSubResourceLink"
              },
              {
                "type": "null"
              }
            ],
            "description": "A link on a payment transaction. `null` on a refund and a reversal, whose parent payment transaction has it."
          },
          "checkout": {
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/HostedLink"
              },
              {
                "type": "object",
                "required": [
                  "expires_at"
                ],
                "properties": {
                  "expires_at": {
                    "format": "date-time",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                    "type": "string"
                  }
                }
              }
            ],
            "description": "The hosted payment page. Appears only on the responses to create and `:issueCheckout`, and never on a replayed create.",
            "x-one-time-secret": true
          },
          "parent_transaction": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TransactionLink"
              },
              {
                "type": "null"
              }
            ],
            "description": "The payment transaction, on a refund or a reversal."
          },
          "refunds": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TransactionCollectionLink"
              },
              {
                "type": "null"
              }
            ],
            "description": "The payment transaction's refunds. `null` on a refund and a reversal."
          },
          "reversals": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TransactionLink"
            },
            "description": "At most one today."
          },
          "payout": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PayoutLink"
              },
              {
                "type": "null"
              }
            ],
            "description": "The payout that carries this. `null` until batched, and on a test transaction. A payout that fails while being sent answers 404 until Quidkey staff resolve it, and part or all of its money may have moved by then."
          }
        }
      },
      "TransactionLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type",
          "id"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "transaction",
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "transaction",
          "kind": "resource",
          "is_published": true,
          "views": [
            "full",
            "summary"
          ]
        }
      },
      "TransactionPaymentCancelledEvent": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "id",
          "type",
          "created_at",
          "subject"
        ],
        "properties": {
          "_type": {
            "const": "event",
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Unique to the event, and kept by a resend of a delivery of it, so de-duplicate on it. Sending a state again, as Quidkey staff can, raises a new event with a new `id`, so handle each state of a subject once."
          },
          "type": {
            "const": "transaction.payment.cancelled",
            "type": "string",
            "description": "What happened: the subject's type and status, as reading the subject answered them when the event was raised."
          },
          "created_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
            "type": "string",
            "description": "When the event was raised."
          },
          "subject": {
            "$ref": "#/components/schemas/TransactionLink",
            "description": "What the event is about. Read it for where it stands now at the path its `id` gives, never at a URL taken from the body."
          }
        }
      },
      "TransactionPaymentCancelledEventDocument": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "result",
          "entities",
          "not_included",
          "id",
          "object",
          "created",
          "type",
          "data"
        ],
        "properties": {
          "result": {
            "$ref": "#/components/schemas/TransactionPaymentCancelledEvent"
          },
          "entities": {
            "additionalProperties": false,
            "description": "Nothing can be included here.",
            "type": "object",
            "properties": {}
          },
          "not_included": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotIncludedEntry"
            }
          },
          "id": {
            "type": "string",
            "description": "The earlier format's ID, which every event of one transaction shares, so it isn't `result.id`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "object": {
            "const": "event",
            "type": "string",
            "description": "Always `event`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "created": {
            "type": "integer",
            "description": "`result.created_at` in Unix seconds. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "type": {
            "type": "string",
            "enum": [
              "quidkey.payment_request.pending",
              "quidkey.payment_request.succeeded",
              "quidkey.payment_request.failed",
              "quidkey.payment_request.canceled",
              "quidkey.payment_request.reversed"
            ],
            "description": "The earlier format's event type. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "data": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/EarlierTransactionEventObject"
              }
            },
            "description": "What the event is about. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          }
        }
      },
      "TransactionPaymentCompletedEvent": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "id",
          "type",
          "created_at",
          "subject"
        ],
        "properties": {
          "_type": {
            "const": "event",
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Unique to the event, and kept by a resend of a delivery of it, so de-duplicate on it. Sending a state again, as Quidkey staff can, raises a new event with a new `id`, so handle each state of a subject once."
          },
          "type": {
            "const": "transaction.payment.completed",
            "type": "string",
            "description": "What happened: the subject's type and status, as reading the subject answered them when the event was raised."
          },
          "created_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
            "type": "string",
            "description": "When the event was raised."
          },
          "subject": {
            "$ref": "#/components/schemas/TransactionLink",
            "description": "What the event is about. Read it for where it stands now at the path its `id` gives, never at a URL taken from the body."
          }
        }
      },
      "TransactionPaymentCompletedEventDocument": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "result",
          "entities",
          "not_included",
          "id",
          "object",
          "created",
          "type",
          "data"
        ],
        "properties": {
          "result": {
            "$ref": "#/components/schemas/TransactionPaymentCompletedEvent"
          },
          "entities": {
            "additionalProperties": false,
            "description": "Nothing can be included here.",
            "type": "object",
            "properties": {}
          },
          "not_included": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotIncludedEntry"
            }
          },
          "id": {
            "type": "string",
            "description": "The earlier format's ID, which every event of one transaction shares, so it isn't `result.id`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "object": {
            "const": "event",
            "type": "string",
            "description": "Always `event`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "created": {
            "type": "integer",
            "description": "`result.created_at` in Unix seconds. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "type": {
            "type": "string",
            "enum": [
              "quidkey.payment_request.pending",
              "quidkey.payment_request.succeeded",
              "quidkey.payment_request.failed",
              "quidkey.payment_request.canceled",
              "quidkey.payment_request.reversed"
            ],
            "description": "The earlier format's event type. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "data": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/EarlierTransactionEventObject"
              }
            },
            "description": "What the event is about. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          }
        }
      },
      "TransactionPaymentFailedEvent": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "id",
          "type",
          "created_at",
          "subject"
        ],
        "properties": {
          "_type": {
            "const": "event",
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Unique to the event, and kept by a resend of a delivery of it, so de-duplicate on it. Sending a state again, as Quidkey staff can, raises a new event with a new `id`, so handle each state of a subject once."
          },
          "type": {
            "const": "transaction.payment.failed",
            "type": "string",
            "description": "What happened: the subject's type and status, as reading the subject answered them when the event was raised."
          },
          "created_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
            "type": "string",
            "description": "When the event was raised."
          },
          "subject": {
            "$ref": "#/components/schemas/TransactionLink",
            "description": "What the event is about. Read it for where it stands now at the path its `id` gives, never at a URL taken from the body."
          }
        }
      },
      "TransactionPaymentFailedEventDocument": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "result",
          "entities",
          "not_included",
          "id",
          "object",
          "created",
          "type",
          "data"
        ],
        "properties": {
          "result": {
            "$ref": "#/components/schemas/TransactionPaymentFailedEvent"
          },
          "entities": {
            "additionalProperties": false,
            "description": "Nothing can be included here.",
            "type": "object",
            "properties": {}
          },
          "not_included": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotIncludedEntry"
            }
          },
          "id": {
            "type": "string",
            "description": "The earlier format's ID, which every event of one transaction shares, so it isn't `result.id`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "object": {
            "const": "event",
            "type": "string",
            "description": "Always `event`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "created": {
            "type": "integer",
            "description": "`result.created_at` in Unix seconds. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "type": {
            "type": "string",
            "enum": [
              "quidkey.payment_request.pending",
              "quidkey.payment_request.succeeded",
              "quidkey.payment_request.failed",
              "quidkey.payment_request.canceled",
              "quidkey.payment_request.reversed"
            ],
            "description": "The earlier format's event type. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "data": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/EarlierTransactionEventObject"
              }
            },
            "description": "What the event is about. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          }
        }
      },
      "TransactionPaymentProcessingEvent": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "id",
          "type",
          "created_at",
          "subject"
        ],
        "properties": {
          "_type": {
            "const": "event",
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Unique to the event, and kept by a resend of a delivery of it, so de-duplicate on it. Sending a state again, as Quidkey staff can, raises a new event with a new `id`, so handle each state of a subject once."
          },
          "type": {
            "const": "transaction.payment.processing",
            "type": "string",
            "description": "What happened: the subject's type and status, as reading the subject answered them when the event was raised."
          },
          "created_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
            "type": "string",
            "description": "When the event was raised."
          },
          "subject": {
            "$ref": "#/components/schemas/TransactionLink",
            "description": "What the event is about. Read it for where it stands now at the path its `id` gives, never at a URL taken from the body."
          }
        }
      },
      "TransactionPaymentProcessingEventDocument": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "result",
          "entities",
          "not_included",
          "id",
          "object",
          "created",
          "type",
          "data"
        ],
        "properties": {
          "result": {
            "$ref": "#/components/schemas/TransactionPaymentProcessingEvent"
          },
          "entities": {
            "additionalProperties": false,
            "description": "Nothing can be included here.",
            "type": "object",
            "properties": {}
          },
          "not_included": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotIncludedEntry"
            }
          },
          "id": {
            "type": "string",
            "description": "The earlier format's ID, which every event of one transaction shares, so it isn't `result.id`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "object": {
            "const": "event",
            "type": "string",
            "description": "Always `event`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "created": {
            "type": "integer",
            "description": "`result.created_at` in Unix seconds. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "type": {
            "type": "string",
            "enum": [
              "quidkey.payment_request.pending",
              "quidkey.payment_request.succeeded",
              "quidkey.payment_request.failed",
              "quidkey.payment_request.canceled",
              "quidkey.payment_request.reversed"
            ],
            "description": "The earlier format's event type. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "data": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/EarlierTransactionEventObject"
              }
            },
            "description": "What the event is about. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          }
        }
      },
      "TransactionPaymentUnresolvedEvent": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "id",
          "type",
          "created_at",
          "subject"
        ],
        "properties": {
          "_type": {
            "const": "event",
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Unique to the event, and kept by a resend of a delivery of it, so de-duplicate on it. Sending a state again, as Quidkey staff can, raises a new event with a new `id`, so handle each state of a subject once."
          },
          "type": {
            "const": "transaction.payment.unresolved",
            "type": "string",
            "description": "What happened: the subject's type and status, as reading the subject answered them when the event was raised."
          },
          "created_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
            "type": "string",
            "description": "When the event was raised."
          },
          "subject": {
            "$ref": "#/components/schemas/TransactionLink",
            "description": "What the event is about. Read it for where it stands now at the path its `id` gives, never at a URL taken from the body."
          }
        }
      },
      "TransactionPaymentUnresolvedEventDocument": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "result",
          "entities",
          "not_included",
          "id",
          "object",
          "created",
          "type",
          "data"
        ],
        "properties": {
          "result": {
            "$ref": "#/components/schemas/TransactionPaymentUnresolvedEvent"
          },
          "entities": {
            "additionalProperties": false,
            "description": "Nothing can be included here.",
            "type": "object",
            "properties": {}
          },
          "not_included": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotIncludedEntry"
            }
          },
          "id": {
            "type": "string",
            "description": "The earlier format's ID, which every event of one transaction shares, so it isn't `result.id`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "object": {
            "const": "event",
            "type": "string",
            "description": "Always `event`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "created": {
            "type": "integer",
            "description": "`result.created_at` in Unix seconds. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "type": {
            "type": "string",
            "enum": [
              "quidkey.payment_request.pending",
              "quidkey.payment_request.succeeded",
              "quidkey.payment_request.failed",
              "quidkey.payment_request.canceled",
              "quidkey.payment_request.reversed"
            ],
            "description": "The earlier format's event type. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "data": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/EarlierTransactionEventObject"
              }
            },
            "description": "What the event is about. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          }
        }
      },
      "TransactionReversalCancelledEvent": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "id",
          "type",
          "created_at",
          "subject"
        ],
        "properties": {
          "_type": {
            "const": "event",
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Unique to the event, and kept by a resend of a delivery of it, so de-duplicate on it. Sending a state again, as Quidkey staff can, raises a new event with a new `id`, so handle each state of a subject once."
          },
          "type": {
            "const": "transaction.reversal.cancelled",
            "type": "string",
            "description": "What happened: the subject's type and status, as reading the subject answered them when the event was raised."
          },
          "created_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
            "type": "string",
            "description": "When the event was raised."
          },
          "subject": {
            "$ref": "#/components/schemas/TransactionLink",
            "description": "What the event is about. Read it for where it stands now at the path its `id` gives, never at a URL taken from the body."
          }
        }
      },
      "TransactionReversalCancelledEventDocument": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "result",
          "entities",
          "not_included",
          "id",
          "object",
          "created",
          "type",
          "data"
        ],
        "properties": {
          "result": {
            "$ref": "#/components/schemas/TransactionReversalCancelledEvent"
          },
          "entities": {
            "additionalProperties": false,
            "description": "Nothing can be included here.",
            "type": "object",
            "properties": {}
          },
          "not_included": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotIncludedEntry"
            }
          },
          "id": {
            "type": "string",
            "description": "The earlier format's ID, which every event of one transaction shares, so it isn't `result.id`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "object": {
            "const": "event",
            "type": "string",
            "description": "Always `event`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "created": {
            "type": "integer",
            "description": "`result.created_at` in Unix seconds. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "type": {
            "type": "string",
            "enum": [
              "quidkey.payment_request.pending",
              "quidkey.payment_request.succeeded",
              "quidkey.payment_request.failed",
              "quidkey.payment_request.canceled",
              "quidkey.payment_request.reversed"
            ],
            "description": "The earlier format's event type. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "data": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/EarlierTransactionEventObject"
              }
            },
            "description": "What the event is about. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          }
        }
      },
      "TransactionReversalCompletedEvent": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "id",
          "type",
          "created_at",
          "subject"
        ],
        "properties": {
          "_type": {
            "const": "event",
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Unique to the event, and kept by a resend of a delivery of it, so de-duplicate on it. Sending a state again, as Quidkey staff can, raises a new event with a new `id`, so handle each state of a subject once."
          },
          "type": {
            "const": "transaction.reversal.completed",
            "type": "string",
            "description": "What happened: the subject's type and status, as reading the subject answered them when the event was raised."
          },
          "created_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
            "type": "string",
            "description": "When the event was raised."
          },
          "subject": {
            "$ref": "#/components/schemas/TransactionLink",
            "description": "What the event is about. Read it for where it stands now at the path its `id` gives, never at a URL taken from the body."
          }
        }
      },
      "TransactionReversalCompletedEventDocument": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "result",
          "entities",
          "not_included",
          "id",
          "object",
          "created",
          "type",
          "data"
        ],
        "properties": {
          "result": {
            "$ref": "#/components/schemas/TransactionReversalCompletedEvent"
          },
          "entities": {
            "additionalProperties": false,
            "description": "Nothing can be included here.",
            "type": "object",
            "properties": {}
          },
          "not_included": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotIncludedEntry"
            }
          },
          "id": {
            "type": "string",
            "description": "The earlier format's ID, which every event of one transaction shares, so it isn't `result.id`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "object": {
            "const": "event",
            "type": "string",
            "description": "Always `event`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "created": {
            "type": "integer",
            "description": "`result.created_at` in Unix seconds. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "type": {
            "type": "string",
            "enum": [
              "quidkey.payment_request.pending",
              "quidkey.payment_request.succeeded",
              "quidkey.payment_request.failed",
              "quidkey.payment_request.canceled",
              "quidkey.payment_request.reversed"
            ],
            "description": "The earlier format's event type. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "data": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/EarlierTransactionEventObject"
              }
            },
            "description": "What the event is about. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          }
        }
      },
      "TransactionReversalFailedEvent": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "id",
          "type",
          "created_at",
          "subject"
        ],
        "properties": {
          "_type": {
            "const": "event",
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Unique to the event, and kept by a resend of a delivery of it, so de-duplicate on it. Sending a state again, as Quidkey staff can, raises a new event with a new `id`, so handle each state of a subject once."
          },
          "type": {
            "const": "transaction.reversal.failed",
            "type": "string",
            "description": "What happened: the subject's type and status, as reading the subject answered them when the event was raised."
          },
          "created_at": {
            "format": "date-time",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
            "type": "string",
            "description": "When the event was raised."
          },
          "subject": {
            "$ref": "#/components/schemas/TransactionLink",
            "description": "What the event is about. Read it for where it stands now at the path its `id` gives, never at a URL taken from the body."
          }
        }
      },
      "TransactionReversalFailedEventDocument": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "result",
          "entities",
          "not_included",
          "id",
          "object",
          "created",
          "type",
          "data"
        ],
        "properties": {
          "result": {
            "$ref": "#/components/schemas/TransactionReversalFailedEvent"
          },
          "entities": {
            "additionalProperties": false,
            "description": "Nothing can be included here.",
            "type": "object",
            "properties": {}
          },
          "not_included": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotIncludedEntry"
            }
          },
          "id": {
            "type": "string",
            "description": "The earlier format's ID, which every event of one transaction shares, so it isn't `result.id`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "object": {
            "const": "event",
            "type": "string",
            "description": "Always `event`. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "created": {
            "type": "integer",
            "description": "`result.created_at` in Unix seconds. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "type": {
            "type": "string",
            "enum": [
              "quidkey.payment_request.pending",
              "quidkey.payment_request.succeeded",
              "quidkey.payment_request.failed",
              "quidkey.payment_request.canceled",
              "quidkey.payment_request.reversed"
            ],
            "description": "The earlier format's event type. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          },
          "data": {
            "additionalProperties": false,
            "type": "object",
            "required": [
              "object"
            ],
            "properties": {
              "object": {
                "$ref": "#/components/schemas/EarlierTransactionEventObject"
              }
            },
            "description": "What the event is about. Integrations built on the earlier event format read it, and every event carries it. New integrations read `result`.",
            "deprecated": true
          }
        }
      },
      "TransactionSummary": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "type",
          "is_test",
          "transaction_number",
          "status",
          "amount",
          "payout_amount",
          "exchange_rate",
          "routing",
          "refund_status",
          "can_refund",
          "order",
          "platform",
          "merchant",
          "customer_details",
          "payout"
        ],
        "properties": {
          "_type": {
            "const": "transaction",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "summary",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "payment",
              "refund",
              "reversal"
            ]
          },
          "is_test": {
            "type": "boolean",
            "description": "Whether this is a test payment transaction, or a refund or reversal of one."
          },
          "transaction_number": {
            "type": "string",
            "description": "A short reference, the same in Console and the API. Quote it to support."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "processing",
              "completed",
              "failed",
              "cancelled",
              "unresolved"
            ],
            "description": "Where this money movement is in its lifecycle. No status confirms that money has arrived, `completed` included.\n\n- `pending`: Nothing has moved. On a payment transaction, the customer hasn't finished or the provider hasn't answered, and `:issueCheckout` may revive it. On a refund, it's held until `:executeRefund`, waiting on `required_actions` or on its payment transaction converting, or waiting on Quidkey with `required_actions: []`.\n- `processing`: Accepted and moving. On a payment transaction this includes money that hasn't landed. A refund can carry `required_actions` here, when something stopped it on the way.\n- `completed`: Finished. On a payment transaction, the provider reported success, which can be days before the money arrives, or on a virtual account the merchant's payout finished. On a refund, the payment to the customer's account went out. A reversal is always `completed`.\n- `failed`: It didn't happen, and nothing further will. Safe to try the order again.\n- `cancelled`: Stopped before moving money. On a payment transaction, the customer or Quidkey cancelled it.\n- `unresolved`: The outcome isn't known, and a later `completed` can still apply, so don't charge again for this order until it resolves. A payment transaction becomes `processing` or `completed`, or `failed` once Quidkey confirms."
          },
          "amount": {
            "type": "object",
            "allOf": [
              {
                "$ref": "#/components/schemas/Money"
              },
              {
                "type": "object",
                "required": [
                  "value"
                ],
                "properties": {
                  "value": {
                    "minimum": 0,
                    "maximum": 9007199254740991,
                    "type": "integer"
                  }
                }
              }
            ],
            "description": "Always the customer's side, in the customer's currency: what they were charged, what they get back, or what the bank took back."
          },
          "payout_amount": {
            "anyOf": [
              {
                "type": "object",
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Money"
                  },
                  {
                    "type": "object",
                    "required": [
                      "value"
                    ],
                    "properties": {
                      "value": {
                        "minimum": 0,
                        "maximum": 9007199254740991,
                        "type": "integer"
                      }
                    }
                  }
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "What this payment transaction adds to the merchant's payouts, after fees and any conversion. `null` unless a payment transaction is `processing` or `completed`."
          },
          "exchange_rate": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ExchangeRate"
              },
              {
                "type": "null"
              }
            ],
            "description": "Explains the amounts, which are authoritative: don't recompute them from it. `null` until converted, and when no conversion ran."
          },
          "routing": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "virtual_account",
                  "direct"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether the money passes through a virtual account Quidkey runs for the merchant."
          },
          "refund_status": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "refunding",
                  "refunding_blocked",
                  "refunding_failed",
                  "partially_refunded",
                  "fully_refunded"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "How far refunds of this payment transaction have got. None of these confirms that money has arrived. A list has no `required_actions`, so a single read gives them.\n\n- `refunding`: A refund is under way, held until `:executeRefund`, or waiting on Quidkey with `required_actions: []`.\n- `refunding_blocked`: A refund has `required_actions` other than `REFUND_NOT_EXECUTED`, or is waiting for a refund started in the merchant's platform.\n- `refunding_failed`: The latest refund outcome is a failure.\n- `partially_refunded`: Some of it has been refunded.\n- `fully_refunded`: All of it has been refunded.\n- `null`: No refunds, or the type is not `payment`."
          },
          "can_refund": {
            "type": "boolean",
            "description": "Whether a refund that moves money can be created now. `false` on a payment transaction whose refunds are paid from the merchant's platform, where `execution: manual` can still prepare one."
          },
          "order": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Order"
              },
              {
                "type": "null"
              }
            ],
            "description": "The caller's order. `null` where none was given."
          },
          "platform": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "api",
                  "payment_link",
                  "shopify",
                  "woocommerce"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "How the payment transaction came. `null` on a refund and a reversal, whose `parent_transaction` has it."
          },
          "merchant": {
            "$ref": "#/components/schemas/MerchantLink"
          },
          "customer_details": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CustomerDetailsSubResourceLink"
              },
              {
                "type": "null"
              }
            ],
            "description": "A link on a payment transaction. `null` on a refund and a reversal, whose parent payment transaction has it."
          },
          "payout": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PayoutLink"
              },
              {
                "type": "null"
              }
            ],
            "description": "The payout that carries this. `null` until batched, and on a test transaction. A payout that fails while being sent answers 404 until Quidkey staff resolve it, and part or all of its money may have moved by then."
          }
        }
      },
      "UnpublishedPartnerLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "id"
        ],
        "properties": {
          "_type": {
            "const": "partner",
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "partner",
          "kind": "resource",
          "is_published": false
        }
      },
      "WebhookEndpointCollectionLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_link",
          "_type"
        ],
        "properties": {
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "collection",
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "webhook_endpoint",
          "kind": "collection",
          "is_published": true,
          "views": [
            "full"
          ]
        }
      },
      "WebhookEndpointFull": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "_type",
          "_uri",
          "_view",
          "id",
          "created_at",
          "updated_at",
          "owner",
          "name",
          "url",
          "is_signed",
          "status",
          "is_default"
        ],
        "properties": {
          "_type": {
            "const": "webhook_endpoint",
            "type": "string"
          },
          "_uri": {
            "pattern": "^/",
            "description": "The canonical URI, relative to the version root.",
            "type": "string"
          },
          "_view": {
            "const": "full",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "owner": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/UnpublishedPartnerLink"
              },
              {
                "$ref": "#/components/schemas/MerchantLink"
              }
            ]
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Unique per merchant, and can't change. `null` on a partner's endpoint."
          },
          "url": {
            "format": "uri",
            "type": "string",
            "description": "Where events are sent, as it was registered, with any credentials or token in it, so treat it as a secret. This API only takes HTTPS, and an endpoint registered another way can hold plain HTTP."
          },
          "is_signed": {
            "type": "boolean",
            "description": "Whether deliveries are signed. A delivery to a signed endpoint is either signed or not sent: if the secret can't be read, the delivery fails. Always `true` on a partner's endpoint."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive"
            ],
            "description": "`active` can receive events, and `inactive` receives none, except a delivery Quidkey staff resend."
          },
          "is_default": {
            "type": "boolean",
            "description": "Whether this is the merchant's default endpoint, of which it has at most one. An `inactive` default stays `true` and is skipped. The Webhooks guide says where events go. Always `false` on a partner's endpoint."
          },
          "signing_secret": {
            "description": "The signing secret. It appears only in the response that issues it, and is never shown again.",
            "type": "string",
            "x-one-time-secret": true
          }
        }
      },
      "WebhookEndpointRequestLink": {
        "additionalProperties": false,
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "_link": {
            "pattern": "^/",
            "type": "string"
          },
          "_type": {
            "const": "webhook_endpoint",
            "type": "string"
          }
        },
        "x-link-target": {
          "resource": "webhook_endpoint",
          "kind": "request",
          "is_published": true
        }
      }
    }
  }
}
