{
  "openapi": "3.1.0",
  "info": {
    "title": "intents.fi API",
    "version": "0 (dev)",
    "description": "Non-custodial cross-chain intent meta-aggregator: quotes from NEAR Intents 1Click, Across, Relay, deBridge and Mayan, ranked, with execution plans and order tracking. Amounts are integer strings in base units; assets are CAIP-19."
  },
  "servers": [
    {
      "url": "https://api.intents.fi"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An intents.fi API key: `Authorization: Bearer ik_live_…`"
      }
    },
    "schemas": {
      "WebhookTestResult": {
        "type": "object",
        "properties": {
          "delivered": {
            "type": "boolean",
            "description": "The endpoint answered with a 2xx."
          },
          "responseStatus": {
            "type": [
              "integer",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why there was no answer: DNS, TLS, a timeout."
          },
          "durationMs": {
            "type": "integer"
          },
          "eventId": {
            "type": "string",
            "description": "`evt_test_…`"
          },
          "eventType": {
            "type": "string",
            "enum": [
              "webhook.test",
              "invoice.processing",
              "invoice.underpaid",
              "invoice.paid",
              "invoice.expired",
              "invoice.canceled",
              "invoice.needs_review"
            ]
          },
          "requestBody": {
            "type": "string",
            "description": "The exact body that was signed and sent."
          },
          "responseBody": {
            "type": [
              "string",
              "null"
            ],
            "description": "What the endpoint answered, truncated to 2 KB."
          }
        },
        "required": [
          "delivered",
          "responseStatus",
          "error",
          "durationMs",
          "eventId",
          "eventType",
          "requestBody",
          "responseBody"
        ]
      },
      "MerchantReferredBy": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "displayName": {
            "type": "string"
          }
        },
        "required": [
          "displayName"
        ],
        "description": "Who referred this merchant (affiliate D10): `{displayName}`, or null. Store plugins show it as \"Referred by {displayName}\"; it never changes the fee."
      },
      "BrandingInput": {
        "type": "object",
        "properties": {
          "displayName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "supportEmail": {
            "type": "string",
            "maxLength": 320,
            "format": "email"
          },
          "logoUrl": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2048,
            "format": "uri"
          },
          "accent": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$"
          },
          "background": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$"
          },
          "text": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$"
          },
          "mutedText": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$"
          },
          "surface": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$"
          },
          "buttonBackground": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$"
          },
          "buttonText": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$"
          },
          "radius": {
            "type": "integer",
            "minimum": 0,
            "maximum": 24
          },
          "font": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "string",
                    "enum": [
                      "default"
                    ]
                  }
                },
                "required": [
                  "source"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "string",
                    "enum": [
                      "google"
                    ]
                  },
                  "family": {
                    "type": "string",
                    "enum": [
                      "Newsreader",
                      "Source Serif 4",
                      "Literata",
                      "Lora",
                      "Merriweather",
                      "EB Garamond",
                      "Fraunces",
                      "Inter",
                      "IBM Plex Sans",
                      "Work Sans",
                      "Manrope",
                      "DM Sans",
                      "Nunito Sans",
                      "Rubik",
                      "Space Grotesk"
                    ]
                  }
                },
                "required": [
                  "source",
                  "family"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "string",
                    "enum": [
                      "upload"
                    ]
                  },
                  "family": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri"
                  }
                },
                "required": [
                  "source",
                  "family",
                  "url"
                ]
              }
            ]
          },
          "copy": {
            "$ref": "#/components/schemas/CopyOverrides"
          },
          "theme": {
            "type": "string",
            "enum": [
              "light"
            ]
          }
        },
        "additionalProperties": false
      },
      "CopyOverrides": {
        "type": "object",
        "properties": {
          "connectWallet": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40
          },
          "payAnotherWay": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "getAddress": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "paidTitle": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40
          },
          "successMessage": {
            "type": "string",
            "minLength": 1,
            "maxLength": 280
          },
          "returnButton": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          }
        },
        "additionalProperties": false
      },
      "CheckoutDomain": {
        "type": "object",
        "properties": {
          "host": {
            "type": "string"
          },
          "merchantId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active"
            ]
          }
        },
        "required": [
          "host",
          "merchantId",
          "status"
        ]
      },
      "AgentPaymentRequired": {
        "type": "object",
        "properties": {
          "x402Version": {
            "type": "number",
            "enum": [
              1
            ]
          },
          "error": {
            "type": "string"
          },
          "resource": {
            "type": "string",
            "description": "This endpoint: POST to it again to pay"
          },
          "invoice": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "amount": {
                "type": "string"
              },
              "currency": {
                "type": "string"
              },
              "merchant": {
                "type": "string"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "expiresAt": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "status",
              "amount",
              "currency",
              "merchant",
              "description",
              "expiresAt"
            ]
          },
          "accepts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "scheme": {
                  "type": "string",
                  "enum": [
                    "intents-deposit"
                  ]
                },
                "network": {
                  "type": "string",
                  "description": "CAIP-2 chain ID of the asset"
                },
                "asset": {
                  "type": "string",
                  "description": "CAIP-19 asset ID; send this back as `asset`"
                },
                "symbol": {
                  "type": "string"
                },
                "decimals": {
                  "type": "integer"
                },
                "chain": {
                  "type": "string",
                  "description": "The chain's display name"
                },
                "maxAmountRequired": {
                  "type": "string",
                  "description": "Indicative all-in amount in base units. The binding amount comes with the deposit address."
                },
                "amountInUsd": {
                  "type": "string"
                },
                "modes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "wallet",
                      "transfer"
                    ]
                  }
                },
                "maxTimeoutSeconds": {
                  "type": "integer",
                  "description": "How long this indicative quote is cached"
                }
              },
              "required": [
                "scheme",
                "network",
                "asset",
                "symbol",
                "decimals",
                "chain",
                "maxAmountRequired",
                "amountInUsd",
                "modes",
                "maxTimeoutSeconds"
              ]
            }
          },
          "next": {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "POST"
                ]
              },
              "url": {
                "type": "string"
              },
              "body": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "instructions": {
                "type": "string"
              }
            },
            "required": [
              "method",
              "url",
              "body",
              "instructions"
            ]
          }
        },
        "required": [
          "x402Version",
          "error",
          "resource",
          "invoice",
          "accepts",
          "next"
        ]
      },
      "DashboardMe": {
        "type": "object",
        "properties": {
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "pendingEmail": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "email",
              "pendingEmail"
            ]
          },
          "account": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "products": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "signupProduct": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "checkout",
                  "route",
                  null
                ]
              }
            },
            "required": [
              "id",
              "name",
              "products",
              "signupProduct"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "admin",
              "developer",
              "viewer"
            ]
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "memberships": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "accountId": {
                  "type": "string"
                },
                "accountName": {
                  "type": "string"
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "owner",
                    "admin",
                    "developer",
                    "viewer"
                  ]
                }
              },
              "required": [
                "accountId",
                "accountName",
                "role"
              ]
            }
          }
        },
        "required": [
          "user",
          "account",
          "role",
          "permissions",
          "memberships"
        ]
      },
      "PlatformError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "details": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "DashboardTeam": {
        "type": "object",
        "properties": {
          "members": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "userId": {
                  "type": "string"
                },
                "email": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "owner",
                    "admin",
                    "developer",
                    "viewer"
                  ]
                },
                "joinedAt": {
                  "type": "string"
                }
              },
              "required": [
                "userId",
                "email",
                "role",
                "joinedAt"
              ]
            }
          },
          "invites": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "owner",
                    "admin",
                    "developer",
                    "viewer"
                  ]
                },
                "expiresAt": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "email",
                "role",
                "expiresAt",
                "createdAt"
              ]
            }
          }
        },
        "required": [
          "members",
          "invites"
        ]
      },
      "NotificationSettings": {
        "type": "object",
        "properties": {
          "notifyEmail": {
            "type": [
              "string",
              "null"
            ]
          },
          "preferences": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "default": {
                  "type": "string",
                  "enum": [
                    "on",
                    "off",
                    "always"
                  ]
                },
                "phase": {
                  "type": "string"
                },
                "enabled": {
                  "type": "boolean"
                },
                "locked": {
                  "type": "boolean"
                }
              },
              "required": [
                "kind",
                "label",
                "default",
                "phase",
                "enabled",
                "locked"
              ]
            }
          }
        },
        "required": [
          "notifyEmail",
          "preferences"
        ]
      },
      "AccountKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "secret",
              "publishable"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "prefix",
          "kind",
          "mode",
          "createdAt",
          "revokedAt"
        ]
      },
      "DashboardWebhookEndpoint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "failing"
            ]
          },
          "consecutiveFailures": {
            "type": "integer"
          },
          "lastDeliveryAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "url",
          "mode",
          "events",
          "status",
          "consecutiveFailures",
          "lastDeliveryAt",
          "createdAt"
        ]
      },
      "DashboardWebhookDeliveryDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DashboardWebhookDelivery"
          },
          {
            "type": "object",
            "properties": {
              "requestBody": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "responseBody": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "attemptedAt": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "resentFrom": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "requestBody",
              "responseBody",
              "attemptedAt",
              "resentFrom"
            ]
          }
        ]
      },
      "DashboardWebhookDelivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "endpointId": {
            "type": "string"
          },
          "eventId": {
            "type": "string"
          },
          "eventType": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "attempt": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "delivered",
              "failed",
              "pending"
            ]
          },
          "responseStatus": {
            "type": [
              "integer",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "durationMs": {
            "type": [
              "integer",
              "null"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "nextAttemptAt": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "endpointId",
          "eventId",
          "eventType",
          "mode",
          "attempt",
          "status",
          "responseStatus",
          "error",
          "durationMs",
          "createdAt",
          "nextAttemptAt"
        ]
      },
      "BusinessDetails": {
        "type": "object",
        "properties": {
          "businessName": {
            "type": "string"
          },
          "website": {
            "type": [
              "string",
              "null"
            ]
          },
          "sellsOn": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "instagram",
                "telegram",
                "discord",
                "x",
                "whatsapp",
                "in_person",
                "other"
              ]
            }
          },
          "country": {
            "type": "string",
            "description": "ISO-3166 alpha-2"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending_review",
              "active",
              "restricted",
              "closed"
            ]
          },
          "countryEditable": {
            "type": "boolean",
            "description": "Only while in review; after that, support changes the country"
          },
          "detailsEditable": {
            "type": "boolean",
            "description": "Website and where you sell; false once restricted or closed"
          },
          "changeNeedsReview": {
            "type": "boolean",
            "description": "True when a changed website or `sellsOn` would send the merchant back to review"
          },
          "affiliate": {
            "allOf": [
              {
                "$ref": "#/components/schemas/MerchantReferredBy"
              },
              {
                "description": "D10: \"Referred by {displayName}\", or null. It never changes the merchant's fee."
              }
            ]
          }
        },
        "required": [
          "businessName",
          "website",
          "sellsOn",
          "country",
          "status",
          "countryEditable",
          "detailsEditable",
          "changeNeedsReview",
          "affiliate"
        ]
      },
      "SignupAttribution": {
        "type": "object",
        "properties": {
          "ref": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "`ref` that reached /auth/callback"
          },
          "sub": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64
          },
          "pinv": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 128,
            "description": "Agency invite (phase 2)"
          },
          "ifiRef": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 256,
            "description": "The `ifi_ref` cookie"
          },
          "ifiVid": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 64,
            "description": "The `ifi_vid` cookie"
          },
          "deviceId": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 128,
            "description": "The dashboard device cookie"
          }
        }
      },
      "SetupStatus": {
        "type": "object",
        "properties": {
          "state": {
            "$ref": "#/components/schemas/SetupState"
          },
          "merchant": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending_review",
                  "active",
                  "restricted",
                  "closed"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "status"
            ]
          },
          "testPayment": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "invoiceId": {
                "type": "string"
              },
              "amount": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "createdAt": {
                "type": "string"
              },
              "reached": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "created",
                    "chose_token",
                    "detected",
                    "confirming",
                    "paid"
                  ]
                }
              }
            },
            "required": [
              "invoiceId",
              "amount",
              "status",
              "createdAt",
              "reached"
            ]
          },
          "goLive": {
            "$ref": "#/components/schemas/GoLive"
          },
          "connection": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "platform": {
                "type": "string"
              },
              "site": {
                "type": "string"
              },
              "mode": {
                "type": "string",
                "enum": [
                  "test",
                  "live"
                ]
              },
              "webhooks": {
                "type": "boolean",
                "description": "The plugin registered its webhook endpoint"
              },
              "createdAt": {
                "type": "string"
              }
            },
            "required": [
              "platform",
              "site",
              "mode",
              "webhooks",
              "createdAt"
            ],
            "description": "The latest store connected with plugin Connect"
          },
          "testWallet": {
            "type": "object",
            "properties": {
              "asset": {
                "type": "string"
              },
              "address": {
                "type": "string"
              },
              "label": {
                "type": "string"
              }
            },
            "required": [
              "asset",
              "address",
              "label"
            ]
          }
        },
        "required": [
          "state",
          "merchant",
          "testPayment",
          "goLive",
          "connection",
          "testWallet"
        ]
      },
      "SetupState": {
        "type": "object",
        "properties": {
          "step": {
            "type": "string",
            "enum": [
              "business",
              "how-you-sell",
              "platform",
              "test-payment",
              "done"
            ]
          },
          "path": {
            "type": "string",
            "enum": [
              "link",
              "button",
              "woocommerce",
              "whmcs",
              "prestashop",
              "magento",
              "opencart",
              "api",
              "widget",
              "agent"
            ]
          },
          "answer": {
            "type": "string",
            "enum": [
              "link",
              "website",
              "developer"
            ]
          },
          "platform": {
            "type": "string"
          },
          "skipped": {
            "type": "boolean"
          },
          "completedAt": {
            "type": "string"
          }
        }
      },
      "GoLive": {
        "type": "object",
        "properties": {
          "emailVerified": {
            "type": "boolean"
          },
          "payoutWallet": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "asset": {
                "type": "string"
              },
              "address": {
                "type": "string"
              }
            },
            "required": [
              "asset",
              "address"
            ]
          },
          "reviewStatus": {
            "type": "string",
            "enum": [
              "pending_review",
              "active",
              "restricted",
              "closed"
            ]
          },
          "unlocked": {
            "type": "boolean"
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "email",
                "payout_wallet",
                "review"
              ]
            }
          }
        },
        "required": [
          "emailVerified",
          "payoutWallet",
          "reviewStatus",
          "unlocked",
          "missing"
        ]
      },
      "ConnectRequest": {
        "type": "object",
        "properties": {
          "platform": {
            "type": "string",
            "enum": [
              "woocommerce",
              "whmcs",
              "prestashop",
              "opencart",
              "magento"
            ]
          },
          "platformLabel": {
            "type": "string"
          },
          "site": {
            "type": "string",
            "description": "`shop.example.com`, for the consent screen"
          },
          "siteUrl": {
            "type": "string"
          },
          "returnUrl": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          },
          "partner": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "platform",
          "platformLabel",
          "site",
          "siteUrl",
          "returnUrl",
          "mode",
          "partner"
        ]
      },
      "ConnectToken": {
        "type": "object",
        "properties": {
          "secret_key": {
            "type": "string",
            "description": "`ik_test_…` or `ik_live_…`, shown only here"
          },
          "publishable_key": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          },
          "account": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ]
          },
          "merchant": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending_review",
                  "active",
                  "restricted",
                  "closed"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "status"
            ]
          },
          "connection": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "platform": {
                "type": "string",
                "enum": [
                  "woocommerce",
                  "whmcs",
                  "prestashop",
                  "opencart",
                  "magento"
                ]
              },
              "site": {
                "type": "string"
              },
              "mode": {
                "type": "string",
                "enum": [
                  "test",
                  "live"
                ]
              }
            },
            "required": [
              "id",
              "platform",
              "site",
              "mode"
            ]
          }
        },
        "required": [
          "secret_key",
          "publishable_key",
          "mode",
          "account",
          "merchant",
          "connection"
        ]
      },
      "Connection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "platform": {
            "type": "string",
            "enum": [
              "woocommerce",
              "whmcs",
              "prestashop",
              "opencart",
              "magento"
            ]
          },
          "platformLabel": {
            "type": "string"
          },
          "site": {
            "type": "string"
          },
          "siteUrl": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          },
          "partner": {
            "type": [
              "string",
              "null"
            ]
          },
          "keyPrefix": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "platform",
          "platformLabel",
          "site",
          "siteUrl",
          "mode",
          "partner",
          "keyPrefix",
          "createdAt",
          "revokedAt"
        ]
      },
      "SettlementOverview": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "coolingPeriodHours": {
            "type": "number"
          },
          "current": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "asset": {
                  "type": "string"
                },
                "address": {
                  "type": "string"
                },
                "isDefault": {
                  "type": "boolean"
                },
                "effectiveAt": {
                  "type": "string"
                }
              },
              "required": [
                "asset",
                "address",
                "isDefault",
                "effectiveAt"
              ]
            }
          },
          "pending": {
            "$ref": "#/components/schemas/SettlementChange"
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SettlementChange"
            }
          }
        },
        "required": [
          "mode",
          "coolingPeriodHours",
          "current",
          "pending",
          "history"
        ]
      },
      "SettlementChange": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "asset": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "makeDefault": {
            "type": "boolean"
          },
          "previousAddress": {
            "type": [
              "string",
              "null"
            ]
          },
          "previousDefaultAsset": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "effective",
              "canceled"
            ]
          },
          "requestedBy": {
            "type": "string"
          },
          "requestedAt": {
            "type": "string"
          },
          "effectiveAt": {
            "type": "string"
          },
          "canceledAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "canceledVia": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "dashboard",
              "email",
              null
            ]
          }
        },
        "required": [
          "id",
          "mode",
          "asset",
          "address",
          "makeDefault",
          "previousAddress",
          "previousDefaultAsset",
          "state",
          "requestedBy",
          "requestedAt",
          "effectiveAt",
          "canceledAt",
          "canceledVia"
        ]
      },
      "PaymentLink": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "amount": {
            "type": "string",
            "description": "The price of a fixed link. On a custom link, the amount the page starts with, inside the bounds."
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "amountType": {
            "type": "string",
            "enum": [
              "fixed",
              "custom"
            ],
            "description": "`fixed`: the merchant's price. `custom`: the customer chooses the amount, between `minAmount` and `maxAmount` (a tip jar, a donation, pay what you want)."
          },
          "minAmount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Custom links: the least a customer may pay. Null on a fixed link."
          },
          "maxAmount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Custom links: the most a customer may pay. Null on a fixed link."
          },
          "suggestedAmounts": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Custom links: up to 4 one-tap amounts, ascending. Empty on a fixed link."
          },
          "description": {
            "type": "string"
          },
          "allowQuantity": {
            "type": "boolean"
          },
          "maxQuantity": {
            "type": "integer"
          },
          "successUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "active": {
            "type": "boolean"
          },
          "invoicesCount": {
            "type": "integer"
          },
          "url": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "mode",
          "amount",
          "currency",
          "amountType",
          "minAmount",
          "maxAmount",
          "suggestedAmounts",
          "description",
          "allowQuantity",
          "maxQuantity",
          "successUrl",
          "active",
          "invoicesCount",
          "url",
          "createdAt"
        ]
      },
      "PublicPaymentLink": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "amount": {
            "type": "string",
            "description": "The price of a fixed link. On a custom link, the amount the page starts with, inside the bounds."
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "amountType": {
            "type": "string",
            "enum": [
              "fixed",
              "custom"
            ],
            "description": "`fixed`: the merchant's price. `custom`: the customer chooses the amount, between `minAmount` and `maxAmount` (a tip jar, a donation, pay what you want)."
          },
          "minAmount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Custom links: the least a customer may pay. Null on a fixed link."
          },
          "maxAmount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Custom links: the most a customer may pay. Null on a fixed link."
          },
          "suggestedAmounts": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Custom links: up to 4 one-tap amounts, ascending. Empty on a fixed link."
          },
          "description": {
            "type": "string"
          },
          "allowQuantity": {
            "type": "boolean"
          },
          "maxQuantity": {
            "type": "integer"
          },
          "merchant": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "logoUrl": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "accent": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "logoUrl",
              "accent"
            ]
          }
        },
        "required": [
          "id",
          "mode",
          "amount",
          "currency",
          "amountType",
          "minAmount",
          "maxAmount",
          "suggestedAmounts",
          "description",
          "allowQuantity",
          "maxQuantity",
          "merchant"
        ]
      },
      "PaymentLinkInvoice": {
        "type": "object",
        "properties": {
          "invoiceId": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "clientSecret": {
            "type": [
              "string",
              "null"
            ]
          },
          "amount": {
            "type": "string"
          },
          "quantity": {
            "type": "integer"
          },
          "expiresAt": {
            "type": "string"
          }
        },
        "required": [
          "invoiceId",
          "url",
          "clientSecret",
          "amount",
          "quantity",
          "expiresAt"
        ]
      },
      "AffiliateProfile": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "example": "lukeblog"
          },
          "previousCode": {
            "type": [
              "string",
              "null"
            ],
            "description": "Still resolves after a change"
          },
          "codeChangeable": {
            "type": "boolean",
            "description": "False once the code was changed (once only)"
          },
          "link": {
            "type": "string",
            "format": "uri",
            "example": "https://intents.fi/?ref=lukeblog"
          },
          "displayName": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "creator",
              "agency",
              "community",
              "developer",
              "other"
            ]
          },
          "website": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "suspended",
              "closed"
            ]
          },
          "shareBps": {
            "type": "integer",
            "description": "Basis points of the Intents fee; 2500 = 25%"
          },
          "windowMonths": {
            "type": [
              "integer",
              "null"
            ],
            "exclusiveMinimum": 0,
            "description": "Months of commission per merchant from its first live payment; null = lifetime"
          },
          "payoutWallet": {
            "$ref": "#/components/schemas/AffiliatePayoutWallet"
          },
          "notify": {
            "$ref": "#/components/schemas/AffiliateNotify"
          },
          "termsVersion": {
            "type": "string"
          },
          "termsAcceptedAt": {
            "type": "string",
            "example": "2026-11-26T12:00:00.000Z"
          },
          "createdAt": {
            "type": "string",
            "example": "2026-11-26T12:00:00.000Z"
          }
        },
        "required": [
          "code",
          "previousCode",
          "codeChangeable",
          "link",
          "displayName",
          "type",
          "website",
          "status",
          "shareBps",
          "windowMonths",
          "payoutWallet",
          "notify",
          "termsVersion",
          "termsAcceptedAt",
          "createdAt"
        ]
      },
      "AffiliatePayoutWallet": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "asset": {
            "type": "string",
            "enum": [
              "USDC"
            ]
          },
          "chain": {
            "type": "string",
            "enum": [
              "base",
              "arbitrum",
              "optimism",
              "polygon",
              "ethereum"
            ]
          },
          "addressMasked": {
            "type": "string",
            "example": "0x12ab…cdef"
          },
          "changedAt": {
            "type": "string",
            "example": "2026-11-26T12:00:00.000Z"
          }
        },
        "required": [
          "asset",
          "chain",
          "addressMasked",
          "changedAt"
        ]
      },
      "AffiliateNotify": {
        "type": "object",
        "properties": {
          "merchantSignedUp": {
            "type": "boolean"
          },
          "merchantLive": {
            "type": "boolean"
          },
          "monthlyStatement": {
            "type": "boolean"
          }
        },
        "required": [
          "merchantSignedUp",
          "merchantLive",
          "monthlyStatement"
        ]
      },
      "AffiliateSignup": {
        "type": "object",
        "properties": {
          "displayName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "type": {
            "type": "string",
            "enum": [
              "creator",
              "agency",
              "community",
              "developer",
              "other"
            ]
          },
          "website": {
            "type": "string",
            "maxLength": 300
          },
          "termsVersion": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40,
            "description": "The terms accepted: 2026-11-26"
          }
        },
        "required": [
          "displayName",
          "type",
          "termsVersion"
        ]
      },
      "AffiliatePatch": {
        "type": "object",
        "properties": {
          "displayName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "website": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 300
          },
          "type": {
            "type": "string",
            "enum": [
              "creator",
              "agency",
              "community",
              "developer",
              "other"
            ]
          },
          "code": {
            "type": "string",
            "pattern": "^[a-z0-9-]{6,16}$",
            "example": "lukeblog",
            "description": "Changeable once; the old code keeps resolving"
          },
          "notify": {
            "type": "object",
            "properties": {
              "merchantSignedUp": {
                "type": "boolean"
              },
              "merchantLive": {
                "type": "boolean"
              },
              "monthlyStatement": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "AffiliateOverview": {
        "type": "object",
        "properties": {
          "totals": {
            "type": "object",
            "properties": {
              "earned": {
                "type": "string",
                "pattern": "^-?\\d+\\.\\d{2}$",
                "example": "412.30",
                "description": "Everything not reversed: pending + payable + paid (+ held)"
              },
              "pending": {
                "type": "string",
                "pattern": "^-?\\d+\\.\\d{2}$",
                "example": "412.30",
                "description": "In the 30-day hold"
              },
              "payable": {
                "type": "string",
                "pattern": "^-?\\d+\\.\\d{2}$",
                "example": "412.30",
                "description": "Available: goes out in the next payout run"
              },
              "paid": {
                "type": "string",
                "pattern": "^-?\\d+\\.\\d{2}$",
                "example": "412.30",
                "description": "Paid out"
              }
            },
            "required": [
              "earned",
              "pending",
              "payable",
              "paid"
            ]
          },
          "nextPayout": {
            "type": "object",
            "properties": {
              "date": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "example": "2026-12-05",
                "description": "The next 5th"
              },
              "estimatedUsd": {
                "type": "string",
                "pattern": "^-?\\d+\\.\\d{2}$",
                "example": "412.30"
              },
              "chain": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "base",
                  "arbitrum",
                  "optimism",
                  "polygon",
                  "ethereum",
                  null
                ],
                "description": "Null when no wallet is set"
              },
              "eligible": {
                "type": "boolean"
              },
              "reason": {
                "type": "string",
                "enum": [
                  "below_minimum",
                  "no_wallet",
                  "wallet_just_changed",
                  "suspended"
                ],
                "description": "Present when `eligible` is false"
              }
            },
            "required": [
              "date",
              "estimatedUsd",
              "chain",
              "eligible"
            ]
          },
          "funnel": {
            "type": "object",
            "properties": {
              "clicks": {
                "type": "integer",
                "minimum": 0
              },
              "signups": {
                "type": "integer",
                "minimum": 0
              },
              "testPaid": {
                "type": "integer",
                "minimum": 0
              },
              "live": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": [
              "clicks",
              "signups",
              "testPaid",
              "live"
            ]
          },
          "series": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                  "example": "2026-12-05"
                },
                "commissionUsd": {
                  "type": "string",
                  "pattern": "^-?\\d+\\.\\d{2}$",
                  "example": "412.30"
                },
                "volumeUsd": {
                  "type": "string",
                  "pattern": "^-?\\d+\\.\\d{2}$",
                  "example": "412.30"
                }
              },
              "required": [
                "date",
                "commissionUsd",
                "volumeUsd"
              ]
            }
          }
        },
        "required": [
          "totals",
          "nextPayout",
          "funnel",
          "series"
        ]
      },
      "ReferredMerchant": {
        "type": "object",
        "properties": {
          "merchantRef": {
            "type": "string",
            "pattern": "^\\d+$",
            "description": "The merchant's number in this affiliate's signup order (the n of `Merchant #n`), never the merchant id; the `merchant` filter value"
          },
          "merchantLabel": {
            "type": "string",
            "example": "s***p.com",
            "description": "Masked (`s***p.com`, `Merchant #14`), or the business name for an invite"
          },
          "masked": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "enum": [
              "link",
              "cookie",
              "visit",
              "plugin",
              "invite",
              "manual"
            ]
          },
          "subId": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "signed_up",
              "testing",
              "live",
              "inactive",
              "window_ended"
            ]
          },
          "signedUpAt": {
            "type": "string",
            "example": "2026-11-26T12:00:00.000Z"
          },
          "liveAt": {
            "type": [
              "string",
              "null"
            ],
            "example": "2026-11-26T12:00:00.000Z",
            "description": "First live paid invoice"
          },
          "volume30d": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "example": "412.30"
          },
          "volumeTotal": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "example": "412.30"
          },
          "earnedTotal": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "example": "412.30"
          },
          "pending": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "example": "412.30"
          },
          "windowEndsAt": {
            "type": [
              "string",
              "null"
            ],
            "example": "2026-11-26T12:00:00.000Z",
            "description": "Null before going live, or for lifetime"
          }
        },
        "required": [
          "merchantRef",
          "merchantLabel",
          "masked",
          "source",
          "subId",
          "status",
          "signedUpAt",
          "liveAt",
          "volume30d",
          "volumeTotal",
          "earnedTotal",
          "pending",
          "windowEndsAt"
        ]
      },
      "AffiliateCommission": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The commission row (afc_), not the invoice"
          },
          "createdAt": {
            "type": "string",
            "example": "2026-11-26T12:00:00.000Z",
            "description": "When the payment was credited"
          },
          "merchantRef": {
            "type": "string"
          },
          "merchantLabel": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "payment",
              "adjustment"
            ],
            "description": "An adjustment nets a reversal after payout"
          },
          "volumeUsd": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?\\d+\\.\\d{2}$",
            "example": "412.30",
            "description": "Payment amount; null for an adjustment"
          },
          "feeUsd": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^-?\\d+\\.\\d{2,6}$",
            "example": "0.005000",
            "description": "The Intents fee on the payment"
          },
          "commissionUsd": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2,6}$",
            "example": "0.005000",
            "description": "Exact; negative for an adjustment"
          },
          "capped": {
            "type": "boolean",
            "description": "The fee we kept capped the commission (D3)"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "payable",
              "paid",
              "reversed",
              "held"
            ]
          },
          "payableAt": {
            "type": [
              "string",
              "null"
            ],
            "example": "2026-11-26T12:00:00.000Z"
          },
          "reversedReason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "createdAt",
          "merchantRef",
          "merchantLabel",
          "kind",
          "volumeUsd",
          "feeUsd",
          "commissionUsd",
          "capped",
          "status",
          "payableAt",
          "reversedReason"
        ]
      },
      "AffiliateLink": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "subId": {
            "type": "string"
          },
          "targetPath": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "example": "https://intents.fi/pricing?ref=lukeblog&sub=nov-post"
          },
          "clicks": {
            "type": "integer",
            "minimum": 0
          },
          "signups": {
            "type": "integer",
            "minimum": 0
          },
          "live": {
            "type": "integer",
            "minimum": 0
          },
          "earned": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "example": "412.30"
          },
          "createdAt": {
            "type": "string",
            "example": "2026-11-26T12:00:00.000Z"
          }
        },
        "required": [
          "id",
          "name",
          "subId",
          "targetPath",
          "url",
          "clicks",
          "signups",
          "live",
          "earned",
          "createdAt"
        ]
      },
      "AffiliateLinkCreate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "subId": {
            "type": "string",
            "pattern": "^[a-z0-9_-]{1,64}$",
            "example": "nov-post"
          },
          "targetPath": {
            "type": "string",
            "maxLength": 512,
            "pattern": "^\\/(?!\\/)",
            "description": "Default `/`"
          }
        },
        "required": [
          "name",
          "subId"
        ]
      },
      "AffiliatePayoutWalletChange": {
        "type": "object",
        "properties": {
          "chain": {
            "type": "string",
            "enum": [
              "base",
              "arbitrum",
              "optimism",
              "polygon",
              "ethereum"
            ]
          },
          "address": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "description": "Checksummed when mixed case; not an exchange deposit address"
          },
          "stepUpCode": {
            "type": "string",
            "description": "Required for every change after the first (purpose `affiliate_payout_wallet`)"
          }
        },
        "required": [
          "chain",
          "address"
        ]
      },
      "AffiliatePayout": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "period": {
            "type": "string",
            "pattern": "^\\d{4}-(0[1-9]|1[0-2])$",
            "example": "2026-12"
          },
          "amountUsd": {
            "type": "string",
            "pattern": "^-?\\d+\\.\\d{2}$",
            "example": "412.30"
          },
          "chain": {
            "type": "string",
            "enum": [
              "base",
              "arbitrum",
              "optimism",
              "polygon",
              "ethereum"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "sent",
              "confirmed",
              "failed"
            ]
          },
          "txHash": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^0x[0-9a-fA-F]{64}$"
          },
          "txUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "Block explorer link"
          },
          "createdAt": {
            "type": "string",
            "example": "2026-11-26T12:00:00.000Z"
          },
          "sentAt": {
            "type": [
              "string",
              "null"
            ],
            "example": "2026-11-26T12:00:00.000Z"
          }
        },
        "required": [
          "id",
          "period",
          "amountUsd",
          "chain",
          "status",
          "txHash",
          "txUrl",
          "createdAt",
          "sentAt"
        ]
      },
      "RefResolve": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean",
            "description": "An active affiliate's code or previous code"
          },
          "displayName": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "valid",
          "displayName"
        ]
      },
      "BrandingView": {
        "type": "object",
        "properties": {
          "merchantName": {
            "type": "string"
          },
          "branding": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "required": [
          "merchantName",
          "branding"
        ]
      },
      "MerchantDomain": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "domain": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "verified",
              "misconfigured"
            ]
          },
          "records": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "CNAME",
                    "A",
                    "TXT"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                },
                "purpose": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "name",
                "value",
                "purpose"
              ]
            }
          },
          "lastChecked": {
            "type": [
              "string",
              "null"
            ]
          },
          "verifiedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "domain",
          "status",
          "records",
          "lastChecked",
          "verifiedAt",
          "createdAt"
        ]
      },
      "FeeStatement": {
        "type": "object",
        "properties": {
          "month": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "asset": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "decimals": {
                  "type": "integer"
                },
                "invoices": {
                  "type": "integer"
                },
                "gross": {
                  "type": "string"
                },
                "fee": {
                  "type": "string"
                },
                "net": {
                  "type": "string"
                },
                "grossUsd": {
                  "type": "string"
                },
                "feeUsd": {
                  "type": "string"
                },
                "netUsd": {
                  "type": "string"
                }
              },
              "required": [
                "asset",
                "label",
                "decimals",
                "invoices",
                "gross",
                "fee",
                "net",
                "grossUsd",
                "feeUsd",
                "netUsd"
              ]
            }
          },
          "totals": {
            "type": "object",
            "properties": {
              "invoices": {
                "type": "integer"
              },
              "grossUsd": {
                "type": "string"
              },
              "feeUsd": {
                "type": "string"
              },
              "netUsd": {
                "type": "string"
              }
            },
            "required": [
              "invoices",
              "grossUsd",
              "feeUsd",
              "netUsd"
            ]
          }
        },
        "required": [
          "month",
          "mode",
          "from",
          "to",
          "lines",
          "totals"
        ]
      },
      "RouteStatus": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "operational",
              "degraded",
              "no_data"
            ],
            "description": "`no_data` when nothing was routed in the window; `degraded` when any protocol with enough traffic to judge is below the success or quote-error bar; `operational` otherwise."
          },
          "window": {
            "type": "string",
            "enum": [
              "24h",
              "7d"
            ]
          },
          "generatedAt": {
            "type": "string"
          },
          "since": {
            "type": "string"
          },
          "protocols": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "provider": {
                  "type": "string",
                  "enum": [
                    "near-1click",
                    "across",
                    "relay",
                    "debridge",
                    "mayan",
                    "uniswapx",
                    "lifi"
                  ]
                },
                "orders": {
                  "type": "object",
                  "properties": {
                    "completed": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "refunded": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "failed": {
                      "type": "integer",
                      "minimum": 0
                    }
                  },
                  "required": [
                    "completed",
                    "refunded",
                    "failed"
                  ]
                },
                "successRate": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "minimum": 0,
                  "maximum": 1,
                  "description": "completed / (completed + refunded + failed)"
                },
                "quotes": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Quotes the protocol returned"
                },
                "quoteErrors": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Quote requests that failed for a reason on the protocol's side (error, timeout, rate limit)"
                },
                "quoteErrorRate": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "minimum": 0,
                  "maximum": 1,
                  "description": "A share between 0 and 1, or null when there is nothing to divide by"
                },
                "wins": {
                  "type": "integer",
                  "minimum": 0,
                  "description": "Quote sets where this protocol ranked first"
                },
                "p50LatencyMs": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "minimum": 0
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "operational",
                    "degraded",
                    "no_data"
                  ]
                }
              },
              "required": [
                "provider",
                "orders",
                "successRate",
                "quotes",
                "quoteErrors",
                "quoteErrorRate",
                "wins",
                "p50LatencyMs",
                "state"
              ]
            }
          },
          "vsNearIntents": {
            "type": "object",
            "properties": {
              "compared": {
                "type": "integer",
                "minimum": 0,
                "description": "Quote sets in which NEAR Intents also quoted, so the two can be compared"
              },
              "medianImprovementBps": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Median of how much better intents.fi's best quote was than NEAR Intents' own, in basis points of the NEAR quote. 0 when NEAR Intents was the best; positive when another protocol beat it."
              },
              "betterShare": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0,
                "maximum": 1,
                "description": "Share of compared quote sets where another protocol beat NEAR Intents"
              },
              "nearUnavailable": {
                "type": "integer",
                "minimum": 0,
                "description": "Quote sets that intents.fi served and NEAR Intents alone could not"
              }
            },
            "required": [
              "compared",
              "medianImprovementBps",
              "betterShare",
              "nearUnavailable"
            ]
          },
          "failovers": {
            "type": "object",
            "properties": {
              "count": {
                "type": "integer",
                "minimum": 0
              },
              "recent": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "at": {
                      "type": "string",
                      "description": "ISO 8601"
                    },
                    "failed": {
                      "type": "string",
                      "enum": [
                        "near-1click",
                        "across",
                        "relay",
                        "debridge",
                        "mayan",
                        "uniswapx",
                        "lifi"
                      ],
                      "description": "The protocol whose quote failed"
                    },
                    "code": {
                      "type": "string",
                      "description": "The normalized error code it failed with"
                    },
                    "servedBy": {
                      "type": "string",
                      "enum": [
                        "near-1click",
                        "across",
                        "relay",
                        "debridge",
                        "mayan",
                        "uniswapx",
                        "lifi"
                      ],
                      "description": "The protocol that served the request instead"
                    },
                    "fromChain": {
                      "type": "string",
                      "description": "CAIP-2"
                    },
                    "toChain": {
                      "type": "string",
                      "description": "CAIP-2"
                    }
                  },
                  "required": [
                    "at",
                    "failed",
                    "code",
                    "servedBy",
                    "fromChain",
                    "toChain"
                  ]
                },
                "description": "The latest events, newest first"
              }
            },
            "required": [
              "count",
              "recent"
            ]
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "provider": {
                  "type": "string",
                  "enum": [
                    "near-1click",
                    "across",
                    "relay",
                    "debridge",
                    "mayan",
                    "uniswapx",
                    "lifi"
                  ]
                },
                "days": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "date": {
                        "type": "string",
                        "description": "A UTC day, YYYY-MM-DD"
                      },
                      "state": {
                        "type": "string",
                        "enum": [
                          "operational",
                          "degraded",
                          "no_data"
                        ],
                        "description": "The protocol's state over that whole day, judged by the same bar as `protocols[].state`. `no_data` when nothing was routed that day or the day was not recorded: never inferred."
                      }
                    },
                    "required": [
                      "date",
                      "state"
                    ]
                  },
                  "description": "The last 90 complete UTC days, oldest first"
                }
              },
              "required": [
                "provider",
                "days"
              ]
            },
            "description": "The 90-day bars: one entry per protocol that has any recorded day, from a daily rollup. Empty until the first day is recorded. The same in both windows."
          }
        },
        "required": [
          "state",
          "window",
          "generatedAt",
          "since",
          "protocols",
          "vsNearIntents",
          "failovers",
          "history"
        ]
      }
    },
    "parameters": {}
  },
  "paths": {
    "/health": {
      "get": {
        "responses": {
          "200": {
            "description": "Service is up",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok"
                      ]
                    },
                    "version": {
                      "type": "string"
                    },
                    "time": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "status",
                    "version",
                    "time"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/health/migrations": {
      "get": {
        "responses": {
          "200": {
            "description": "The database has applied every migration this deploy expects",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok",
                        "pending",
                        "unknown"
                      ]
                    },
                    "version": {
                      "type": "string"
                    },
                    "pending": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "status",
                    "version",
                    "pending"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Migrations are pending, or the migration history can't be read",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok",
                        "pending",
                        "unknown"
                      ]
                    },
                    "version": {
                      "type": "string"
                    },
                    "pending": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "status",
                    "version",
                    "pending"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/health/config": {
      "get": {
        "responses": {
          "200": {
            "description": "Every secret production needs is set",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok",
                        "incomplete"
                      ]
                    },
                    "version": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "status",
                    "version",
                    "missing"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "A production secret is missing; `missing` names it",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok",
                        "incomplete"
                      ]
                    },
                    "version": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "status",
                    "version",
                    "missing"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/quotes": {
      "post": {
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tradeType": {
                    "type": "string",
                    "enum": [
                      "EXACT_INPUT",
                      "EXACT_OUTPUT"
                    ],
                    "default": "EXACT_INPUT"
                  },
                  "from": {
                    "type": "object",
                    "properties": {
                      "asset": {
                        "type": "string",
                        "minLength": 1
                      },
                      "amount": {
                        "type": "string",
                        "pattern": "^(0|[1-9]\\d*)$"
                      }
                    },
                    "required": [
                      "asset"
                    ]
                  },
                  "to": {
                    "type": "object",
                    "properties": {
                      "asset": {
                        "type": "string",
                        "minLength": 1
                      },
                      "amount": {
                        "type": "string",
                        "pattern": "^(0|[1-9]\\d*)$"
                      }
                    },
                    "required": [
                      "asset"
                    ]
                  },
                  "sender": {
                    "type": "string",
                    "minLength": 1
                  },
                  "recipient": {
                    "type": "string",
                    "minLength": 1
                  },
                  "refundTo": {
                    "type": "string",
                    "minLength": 1
                  },
                  "slippageBps": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000
                      },
                      {
                        "type": "string",
                        "enum": [
                          "auto"
                        ]
                      }
                    ],
                    "default": 50
                  },
                  "providers": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "near-1click",
                        "across",
                        "relay",
                        "debridge",
                        "mayan",
                        "uniswapx",
                        "lifi"
                      ]
                    }
                  },
                  "excludeProviders": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "near-1click",
                        "across",
                        "relay",
                        "debridge",
                        "mayan",
                        "uniswapx",
                        "lifi"
                      ]
                    },
                    "default": []
                  },
                  "rank": {
                    "type": "string",
                    "enum": [
                      "output",
                      "speed",
                      "balanced"
                    ],
                    "default": "balanced"
                  },
                  "executionModes": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "transaction",
                        "deposit_address",
                        "signature"
                      ]
                    },
                    "minItems": 1,
                    "default": [
                      "transaction",
                      "deposit_address",
                      "signature"
                    ]
                  },
                  "timeoutMs": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "default": 2500
                  }
                },
                "required": [
                  "from",
                  "to",
                  "sender",
                  "recipient"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ranked quotes from every provider that answered in time",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "quoteSetId": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "type": "string"
                    },
                    "best": {
                      "type": "string"
                    },
                    "quotes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "provider": {
                            "type": "string",
                            "enum": [
                              "near-1click",
                              "across",
                              "relay",
                              "debridge",
                              "mayan",
                              "uniswapx",
                              "lifi"
                            ]
                          },
                          "route": {
                            "type": "string"
                          },
                          "tradeType": {
                            "type": "string",
                            "enum": [
                              "EXACT_INPUT",
                              "EXACT_OUTPUT"
                            ]
                          },
                          "input": {
                            "type": "object",
                            "properties": {
                              "asset": {
                                "type": "string"
                              },
                              "amount": {
                                "type": "string",
                                "pattern": "^(0|[1-9]\\d*)$"
                              },
                              "amountMax": {
                                "type": "string",
                                "pattern": "^(0|[1-9]\\d*)$"
                              },
                              "amountUsd": {
                                "type": "string",
                                "pattern": "^-?\\d+(\\.\\d+)?$"
                              }
                            },
                            "required": [
                              "asset",
                              "amount"
                            ]
                          },
                          "output": {
                            "type": "object",
                            "properties": {
                              "asset": {
                                "type": "string"
                              },
                              "amountExpected": {
                                "type": "string",
                                "pattern": "^(0|[1-9]\\d*)$"
                              },
                              "amountMin": {
                                "type": "string",
                                "pattern": "^(0|[1-9]\\d*)$"
                              },
                              "amountUsd": {
                                "type": "string",
                                "pattern": "^-?\\d+(\\.\\d+)?$"
                              }
                            },
                            "required": [
                              "asset",
                              "amountExpected",
                              "amountMin"
                            ]
                          },
                          "fees": {
                            "type": "object",
                            "properties": {
                              "totalUsd": {
                                "type": "string",
                                "pattern": "^-?\\d+(\\.\\d+)?$"
                              },
                              "items": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "enum": [
                                        "protocol",
                                        "relayer",
                                        "gas_destination",
                                        "lp",
                                        "operating_expense",
                                        "fixed_native",
                                        "integrator",
                                        "platform",
                                        "provider_platform"
                                      ]
                                    },
                                    "asset": {
                                      "type": "string"
                                    },
                                    "amount": {
                                      "type": "string",
                                      "pattern": "^-?(0|[1-9]\\d*)$"
                                    },
                                    "amountUsd": {
                                      "type": "string",
                                      "pattern": "^-?\\d+(\\.\\d+)?$"
                                    },
                                    "bps": {
                                      "type": "number"
                                    },
                                    "paidIn": {
                                      "type": "string",
                                      "enum": [
                                        "input",
                                        "output",
                                        "native"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "asset",
                                    "amount",
                                    "paidIn"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "items"
                            ]
                          },
                          "originGas": {
                            "type": "object",
                            "properties": {
                              "asset": {
                                "type": "string"
                              },
                              "amount": {
                                "type": "string",
                                "pattern": "^(0|[1-9]\\d*)$"
                              },
                              "amountUsd": {
                                "type": "string",
                                "pattern": "^-?\\d+(\\.\\d+)?$"
                              }
                            },
                            "required": [
                              "asset",
                              "amount"
                            ]
                          },
                          "etaSeconds": {
                            "type": "number",
                            "minimum": 0
                          },
                          "expiresAt": {
                            "type": "string"
                          },
                          "executionMode": {
                            "type": "string",
                            "enum": [
                              "transaction",
                              "deposit_address",
                              "signature"
                            ]
                          },
                          "requiresApproval": {
                            "type": "boolean"
                          },
                          "score": {
                            "type": "number"
                          },
                          "warnings": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "id",
                          "provider",
                          "tradeType",
                          "input",
                          "output",
                          "fees",
                          "etaSeconds",
                          "expiresAt",
                          "executionMode",
                          "requiresApproval",
                          "score",
                          "warnings"
                        ]
                      }
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "provider": {
                            "type": "string",
                            "enum": [
                              "near-1click",
                              "across",
                              "relay",
                              "debridge",
                              "mayan",
                              "uniswapx",
                              "lifi"
                            ]
                          },
                          "code": {
                            "type": "string",
                            "enum": [
                              "INVALID_REQUEST",
                              "UNSUPPORTED_ASSET",
                              "NO_ROUTE",
                              "QUOTE_EXPIRED",
                              "QUOTE_DRIFT",
                              "UNTRUSTED_EXECUTION_TARGET",
                              "PROVIDER_ERROR",
                              "PROVIDER_TIMEOUT",
                              "RATE_LIMITED",
                              "UNAUTHORIZED",
                              "NOT_FOUND",
                              "ADDRESS_BLOCKED",
                              "INVOICE_NOT_OPEN",
                              "INVOICE_EXPIRED",
                              "TRANSFER_MODE_UNAVAILABLE",
                              "SETTLEMENT_ASSET_UNSUPPORTED",
                              "NO_ROUTE_FOR_ASSET",
                              "AMOUNT_OUT_OF_RANGE",
                              "MERCHANT_RESTRICTED",
                              "SETTLEMENT_CHANGE_PENDING",
                              "SETTLEMENT_REQUIRED",
                              "LIVE_MODE_LOCKED",
                              "ALREADY_ONBOARDED",
                              "PRICE_UNAVAILABLE",
                              "SESSION_REQUIRED",
                              "FORBIDDEN",
                              "EMAIL_CHANGED",
                              "TEST_MODE_ONLY",
                              "CONNECT_CODE_INVALID",
                              "STEP_UP_REQUIRED",
                              "AFFILIATE_EXISTS",
                              "AFFILIATE_REQUIRED",
                              "AFFILIATE_CODE_TAKEN",
                              "AFFILIATE_CODE_LOCKED",
                              "AFFILIATE_LINK_EXISTS",
                              "AFFILIATE_SUSPENDED",
                              "AFFILIATE_CLOSED",
                              "AFFILIATE_CLOSE_BLOCKED",
                              "NOT_IMPLEMENTED",
                              "INTERNAL_ERROR"
                            ]
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "provider",
                          "code",
                          "message"
                        ]
                      }
                    }
                  },
                  "required": [
                    "quoteSetId",
                    "expiresAt",
                    "best",
                    "quotes",
                    "errors"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/chains": {
      "get": {
        "responses": {
          "200": {
            "description": "Supported chains",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "alias": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "vm": {
                        "type": "string",
                        "enum": [
                          "evm",
                          "svm",
                          "bvm",
                          "tvm",
                          "near",
                          "tonvm",
                          "hypevm",
                          "other"
                        ]
                      },
                      "nativeAsset": {
                        "type": "string"
                      },
                      "providers": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "near-1click",
                            "across",
                            "relay",
                            "debridge",
                            "mayan",
                            "uniswapx",
                            "lifi"
                          ]
                        }
                      }
                    },
                    "required": [
                      "id",
                      "alias",
                      "name",
                      "vm",
                      "nativeAsset",
                      "providers"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v0/assets": {
      "get": {
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "chain",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "q",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            },
            "required": false,
            "name": "limit",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Assets routable by at least one provider. Look up by address; symbols are display-only.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "chain": {
                        "type": "string"
                      },
                      "symbol": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "decimals": {
                        "type": "integer"
                      },
                      "logoUrl": {
                        "type": "string"
                      },
                      "priceUsd": {
                        "type": "string"
                      },
                      "providers": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "near-1click",
                            "across",
                            "relay",
                            "debridge",
                            "mayan",
                            "uniswapx",
                            "lifi"
                          ]
                        }
                      }
                    },
                    "required": [
                      "id",
                      "chain",
                      "symbol",
                      "decimals",
                      "providers"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders": {
      "post": {
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "quoteId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "driftToleranceBps": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000,
                    "default": 15
                  }
                },
                "required": [
                  "quoteId"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing order for this quote",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orderId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "awaiting_user",
                        "submitted",
                        "pending_deposit",
                        "processing",
                        "completed",
                        "refunded",
                        "failed",
                        "expired"
                      ]
                    },
                    "quote": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "provider": {
                          "type": "string",
                          "enum": [
                            "near-1click",
                            "across",
                            "relay",
                            "debridge",
                            "mayan",
                            "uniswapx",
                            "lifi"
                          ]
                        },
                        "route": {
                          "type": "string"
                        },
                        "tradeType": {
                          "type": "string",
                          "enum": [
                            "EXACT_INPUT",
                            "EXACT_OUTPUT"
                          ]
                        },
                        "input": {
                          "type": "object",
                          "properties": {
                            "asset": {
                              "type": "string"
                            },
                            "amount": {
                              "type": "string",
                              "pattern": "^(0|[1-9]\\d*)$"
                            },
                            "amountMax": {
                              "type": "string",
                              "pattern": "^(0|[1-9]\\d*)$"
                            },
                            "amountUsd": {
                              "type": "string",
                              "pattern": "^-?\\d+(\\.\\d+)?$"
                            }
                          },
                          "required": [
                            "asset",
                            "amount"
                          ]
                        },
                        "output": {
                          "type": "object",
                          "properties": {
                            "asset": {
                              "type": "string"
                            },
                            "amountExpected": {
                              "type": "string",
                              "pattern": "^(0|[1-9]\\d*)$"
                            },
                            "amountMin": {
                              "type": "string",
                              "pattern": "^(0|[1-9]\\d*)$"
                            },
                            "amountUsd": {
                              "type": "string",
                              "pattern": "^-?\\d+(\\.\\d+)?$"
                            }
                          },
                          "required": [
                            "asset",
                            "amountExpected",
                            "amountMin"
                          ]
                        },
                        "fees": {
                          "type": "object",
                          "properties": {
                            "totalUsd": {
                              "type": "string",
                              "pattern": "^-?\\d+(\\.\\d+)?$"
                            },
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "protocol",
                                      "relayer",
                                      "gas_destination",
                                      "lp",
                                      "operating_expense",
                                      "fixed_native",
                                      "integrator",
                                      "platform",
                                      "provider_platform"
                                    ]
                                  },
                                  "asset": {
                                    "type": "string"
                                  },
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^-?(0|[1-9]\\d*)$"
                                  },
                                  "amountUsd": {
                                    "type": "string",
                                    "pattern": "^-?\\d+(\\.\\d+)?$"
                                  },
                                  "bps": {
                                    "type": "number"
                                  },
                                  "paidIn": {
                                    "type": "string",
                                    "enum": [
                                      "input",
                                      "output",
                                      "native"
                                    ]
                                  }
                                },
                                "required": [
                                  "type",
                                  "asset",
                                  "amount",
                                  "paidIn"
                                ]
                              }
                            }
                          },
                          "required": [
                            "items"
                          ]
                        },
                        "originGas": {
                          "type": "object",
                          "properties": {
                            "asset": {
                              "type": "string"
                            },
                            "amount": {
                              "type": "string",
                              "pattern": "^(0|[1-9]\\d*)$"
                            },
                            "amountUsd": {
                              "type": "string",
                              "pattern": "^-?\\d+(\\.\\d+)?$"
                            }
                          },
                          "required": [
                            "asset",
                            "amount"
                          ]
                        },
                        "etaSeconds": {
                          "type": "number",
                          "minimum": 0
                        },
                        "expiresAt": {
                          "type": "string"
                        },
                        "executionMode": {
                          "type": "string",
                          "enum": [
                            "transaction",
                            "deposit_address",
                            "signature"
                          ]
                        },
                        "requiresApproval": {
                          "type": "boolean"
                        },
                        "score": {
                          "type": "number"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "id",
                        "provider",
                        "tradeType",
                        "input",
                        "output",
                        "fees",
                        "etaSeconds",
                        "expiresAt",
                        "executionMode",
                        "requiresApproval",
                        "score",
                        "warnings"
                      ]
                    },
                    "execution": {
                      "type": "object",
                      "properties": {
                        "steps": {
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "evm_tx"
                                    ]
                                  },
                                  "purpose": {
                                    "type": "string",
                                    "enum": [
                                      "approve",
                                      "deposit",
                                      "swap"
                                    ]
                                  },
                                  "chainId": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0
                                  },
                                  "tx": {
                                    "type": "object",
                                    "properties": {
                                      "to": {
                                        "type": "string"
                                      },
                                      "data": {
                                        "type": "string"
                                      },
                                      "value": {
                                        "type": "string",
                                        "pattern": "^(0|[1-9]\\d*)$"
                                      },
                                      "gas": {
                                        "type": "string",
                                        "pattern": "^(0|[1-9]\\d*)$"
                                      }
                                    },
                                    "required": [
                                      "to",
                                      "data",
                                      "value"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind",
                                  "purpose",
                                  "chainId",
                                  "tx"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "svm_tx"
                                    ]
                                  },
                                  "purpose": {
                                    "type": "string",
                                    "enum": [
                                      "deposit",
                                      "swap"
                                    ]
                                  },
                                  "serializedTx": {
                                    "type": "string"
                                  },
                                  "instructions": {},
                                  "lookupTables": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "required": [
                                  "kind",
                                  "purpose"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "tvm_tx"
                                    ]
                                  },
                                  "purpose": {
                                    "type": "string",
                                    "enum": [
                                      "approve",
                                      "deposit"
                                    ]
                                  },
                                  "contract": {
                                    "type": "string"
                                  },
                                  "owner": {
                                    "type": "string"
                                  },
                                  "data": {
                                    "type": "string"
                                  },
                                  "callValue": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9]\\d*)$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "purpose",
                                  "contract",
                                  "owner",
                                  "data",
                                  "callValue"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "transfer"
                                    ]
                                  },
                                  "chain": {
                                    "type": "string"
                                  },
                                  "asset": {
                                    "type": "string"
                                  },
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9]\\d*)$"
                                  },
                                  "to": {
                                    "type": "string"
                                  },
                                  "memo": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "chain",
                                  "asset",
                                  "amount",
                                  "to"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "eip712_sign"
                                    ]
                                  },
                                  "typedData": {},
                                  "submit": {
                                    "type": "object",
                                    "properties": {
                                      "endpoint": {
                                        "type": "string",
                                        "enum": [
                                          "/v0/orders/{id}/submit"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "endpoint"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind",
                                  "submit"
                                ]
                              }
                            ]
                          }
                        },
                        "expiresAt": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "steps",
                        "expiresAt"
                      ]
                    }
                  },
                  "required": [
                    "orderId",
                    "status",
                    "quote",
                    "execution"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Order created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orderId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "awaiting_user",
                        "submitted",
                        "pending_deposit",
                        "processing",
                        "completed",
                        "refunded",
                        "failed",
                        "expired"
                      ]
                    },
                    "quote": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "provider": {
                          "type": "string",
                          "enum": [
                            "near-1click",
                            "across",
                            "relay",
                            "debridge",
                            "mayan",
                            "uniswapx",
                            "lifi"
                          ]
                        },
                        "route": {
                          "type": "string"
                        },
                        "tradeType": {
                          "type": "string",
                          "enum": [
                            "EXACT_INPUT",
                            "EXACT_OUTPUT"
                          ]
                        },
                        "input": {
                          "type": "object",
                          "properties": {
                            "asset": {
                              "type": "string"
                            },
                            "amount": {
                              "type": "string",
                              "pattern": "^(0|[1-9]\\d*)$"
                            },
                            "amountMax": {
                              "type": "string",
                              "pattern": "^(0|[1-9]\\d*)$"
                            },
                            "amountUsd": {
                              "type": "string",
                              "pattern": "^-?\\d+(\\.\\d+)?$"
                            }
                          },
                          "required": [
                            "asset",
                            "amount"
                          ]
                        },
                        "output": {
                          "type": "object",
                          "properties": {
                            "asset": {
                              "type": "string"
                            },
                            "amountExpected": {
                              "type": "string",
                              "pattern": "^(0|[1-9]\\d*)$"
                            },
                            "amountMin": {
                              "type": "string",
                              "pattern": "^(0|[1-9]\\d*)$"
                            },
                            "amountUsd": {
                              "type": "string",
                              "pattern": "^-?\\d+(\\.\\d+)?$"
                            }
                          },
                          "required": [
                            "asset",
                            "amountExpected",
                            "amountMin"
                          ]
                        },
                        "fees": {
                          "type": "object",
                          "properties": {
                            "totalUsd": {
                              "type": "string",
                              "pattern": "^-?\\d+(\\.\\d+)?$"
                            },
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "protocol",
                                      "relayer",
                                      "gas_destination",
                                      "lp",
                                      "operating_expense",
                                      "fixed_native",
                                      "integrator",
                                      "platform",
                                      "provider_platform"
                                    ]
                                  },
                                  "asset": {
                                    "type": "string"
                                  },
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^-?(0|[1-9]\\d*)$"
                                  },
                                  "amountUsd": {
                                    "type": "string",
                                    "pattern": "^-?\\d+(\\.\\d+)?$"
                                  },
                                  "bps": {
                                    "type": "number"
                                  },
                                  "paidIn": {
                                    "type": "string",
                                    "enum": [
                                      "input",
                                      "output",
                                      "native"
                                    ]
                                  }
                                },
                                "required": [
                                  "type",
                                  "asset",
                                  "amount",
                                  "paidIn"
                                ]
                              }
                            }
                          },
                          "required": [
                            "items"
                          ]
                        },
                        "originGas": {
                          "type": "object",
                          "properties": {
                            "asset": {
                              "type": "string"
                            },
                            "amount": {
                              "type": "string",
                              "pattern": "^(0|[1-9]\\d*)$"
                            },
                            "amountUsd": {
                              "type": "string",
                              "pattern": "^-?\\d+(\\.\\d+)?$"
                            }
                          },
                          "required": [
                            "asset",
                            "amount"
                          ]
                        },
                        "etaSeconds": {
                          "type": "number",
                          "minimum": 0
                        },
                        "expiresAt": {
                          "type": "string"
                        },
                        "executionMode": {
                          "type": "string",
                          "enum": [
                            "transaction",
                            "deposit_address",
                            "signature"
                          ]
                        },
                        "requiresApproval": {
                          "type": "boolean"
                        },
                        "score": {
                          "type": "number"
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "id",
                        "provider",
                        "tradeType",
                        "input",
                        "output",
                        "fees",
                        "etaSeconds",
                        "expiresAt",
                        "executionMode",
                        "requiresApproval",
                        "score",
                        "warnings"
                      ]
                    },
                    "execution": {
                      "type": "object",
                      "properties": {
                        "steps": {
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "evm_tx"
                                    ]
                                  },
                                  "purpose": {
                                    "type": "string",
                                    "enum": [
                                      "approve",
                                      "deposit",
                                      "swap"
                                    ]
                                  },
                                  "chainId": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0
                                  },
                                  "tx": {
                                    "type": "object",
                                    "properties": {
                                      "to": {
                                        "type": "string"
                                      },
                                      "data": {
                                        "type": "string"
                                      },
                                      "value": {
                                        "type": "string",
                                        "pattern": "^(0|[1-9]\\d*)$"
                                      },
                                      "gas": {
                                        "type": "string",
                                        "pattern": "^(0|[1-9]\\d*)$"
                                      }
                                    },
                                    "required": [
                                      "to",
                                      "data",
                                      "value"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind",
                                  "purpose",
                                  "chainId",
                                  "tx"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "svm_tx"
                                    ]
                                  },
                                  "purpose": {
                                    "type": "string",
                                    "enum": [
                                      "deposit",
                                      "swap"
                                    ]
                                  },
                                  "serializedTx": {
                                    "type": "string"
                                  },
                                  "instructions": {},
                                  "lookupTables": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "required": [
                                  "kind",
                                  "purpose"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "tvm_tx"
                                    ]
                                  },
                                  "purpose": {
                                    "type": "string",
                                    "enum": [
                                      "approve",
                                      "deposit"
                                    ]
                                  },
                                  "contract": {
                                    "type": "string"
                                  },
                                  "owner": {
                                    "type": "string"
                                  },
                                  "data": {
                                    "type": "string"
                                  },
                                  "callValue": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9]\\d*)$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "purpose",
                                  "contract",
                                  "owner",
                                  "data",
                                  "callValue"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "transfer"
                                    ]
                                  },
                                  "chain": {
                                    "type": "string"
                                  },
                                  "asset": {
                                    "type": "string"
                                  },
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9]\\d*)$"
                                  },
                                  "to": {
                                    "type": "string"
                                  },
                                  "memo": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "chain",
                                  "asset",
                                  "amount",
                                  "to"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "eip712_sign"
                                    ]
                                  },
                                  "typedData": {},
                                  "submit": {
                                    "type": "object",
                                    "properties": {
                                      "endpoint": {
                                        "type": "string",
                                        "enum": [
                                          "/v0/orders/{id}/submit"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "endpoint"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind",
                                  "submit"
                                ]
                              }
                            ]
                          }
                        },
                        "expiresAt": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "steps",
                        "expiresAt"
                      ]
                    }
                  },
                  "required": [
                    "orderId",
                    "status",
                    "quote",
                    "execution"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders/{id}/submit": {
      "post": {
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "txHash": {
                    "type": "string",
                    "minLength": 1
                  },
                  "signature": {
                    "type": "string",
                    "minLength": 1
                  },
                  "chain": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Submission recorded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orderId": {
                      "type": "string"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "awaiting_user",
                        "submitted",
                        "pending_deposit",
                        "processing",
                        "completed",
                        "refunded",
                        "failed",
                        "expired"
                      ]
                    },
                    "providerStatus": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "input": {
                      "type": "object",
                      "properties": {
                        "asset": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "asset",
                        "amount"
                      ]
                    },
                    "output": {
                      "type": "object",
                      "properties": {
                        "asset": {
                          "type": "string"
                        },
                        "amountExpected": {
                          "type": "string"
                        },
                        "amountMin": {
                          "type": "string"
                        },
                        "amountActual": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "asset",
                        "amountExpected",
                        "amountMin",
                        "amountActual"
                      ]
                    },
                    "txs": {
                      "type": "object",
                      "properties": {
                        "origin": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "destination": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "refund": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "origin",
                        "destination",
                        "refund"
                      ]
                    },
                    "failReason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "updatedAt": {
                      "type": "string"
                    },
                    "completedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "orderId",
                    "provider",
                    "status",
                    "providerStatus",
                    "input",
                    "output",
                    "txs",
                    "failReason",
                    "createdAt",
                    "updatedAt",
                    "completedAt"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders/{id}": {
      "get": {
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Order status (refreshed from the provider when stale)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orderId": {
                      "type": "string"
                    },
                    "provider": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "awaiting_user",
                        "submitted",
                        "pending_deposit",
                        "processing",
                        "completed",
                        "refunded",
                        "failed",
                        "expired"
                      ]
                    },
                    "providerStatus": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "input": {
                      "type": "object",
                      "properties": {
                        "asset": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "asset",
                        "amount"
                      ]
                    },
                    "output": {
                      "type": "object",
                      "properties": {
                        "asset": {
                          "type": "string"
                        },
                        "amountExpected": {
                          "type": "string"
                        },
                        "amountMin": {
                          "type": "string"
                        },
                        "amountActual": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "asset",
                        "amountExpected",
                        "amountMin",
                        "amountActual"
                      ]
                    },
                    "txs": {
                      "type": "object",
                      "properties": {
                        "origin": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "destination": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "refund": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "origin",
                        "destination",
                        "refund"
                      ]
                    },
                    "failReason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "updatedAt": {
                      "type": "string"
                    },
                    "completedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "orderId",
                    "provider",
                    "status",
                    "providerStatus",
                    "input",
                    "output",
                    "txs",
                    "failReason",
                    "createdAt",
                    "updatedAt",
                    "completedAt"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/webhooks": {
      "post": {
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "order.updated",
                        "invoice.processing",
                        "invoice.underpaid",
                        "invoice.paid",
                        "invoice.expired",
                        "invoice.canceled",
                        "invoice.needs_review"
                      ]
                    },
                    "minItems": 1,
                    "default": [
                      "order.updated"
                    ],
                    "description": "Event types to deliver. Checkout merchants subscribe to `invoice.*`; they never receive `order.updated` for a payment attempt's order (SPEC-checkout §4.4)."
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Webhook registered. The signing secret is returned only here.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "secret": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "url",
                    "events",
                    "createdAt",
                    "secret"
                  ]
                }
              }
            }
          }
        }
      },
      "get": {
        "responses": {
          "200": {
            "description": "Active webhooks",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "url": {
                        "type": "string"
                      },
                      "events": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "createdAt": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "url",
                      "events",
                      "createdAt"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v0/webhooks/{id}/test": {
      "post": {
        "summary": "Send a signed test event to the endpoint now (test keys only)",
        "description": "Delivers one test event, signed with the endpoint's real secret, outside the retry queue. `type` picks the event (default `invoice.paid`): its `data` is a sample test-mode invoice that does not exist, and the envelope carries `sample: true`. `webhook.test` sends a ping with no invoice. Test (`ik_test_`) keys only: a live key gets `TEST_MODE_ONLY`. The response carries the request body and the endpoint's answer (truncated to 2 KB), whatever it was.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "webhook.test",
                      "invoice.processing",
                      "invoice.underpaid",
                      "invoice.paid",
                      "invoice.expired",
                      "invoice.canceled",
                      "invoice.needs_review"
                    ],
                    "description": "Default `invoice.paid`."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent, whether or not the endpoint accepted it: see `delivered`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookTestResult"
                }
              }
            }
          }
        }
      }
    },
    "/v0/webhooks/{id}": {
      "delete": {
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    }
                  },
                  "required": [
                    "deleted"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/fees/balance": {
      "get": {
        "responses": {
          "200": {
            "description": "Partner fee balance: accrued partner share minus payouts sent",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accruedUsd": {
                      "type": "string"
                    },
                    "paidUsd": {
                      "type": "string"
                    },
                    "balanceUsd": {
                      "type": "string"
                    },
                    "nextPayoutAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "accruedUsd",
                    "paidUsd",
                    "balanceUsd",
                    "nextPayoutAt"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/fees/statement": {
      "get": {
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
            },
            "required": true,
            "name": "month",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ],
              "default": "json"
            },
            "required": false,
            "name": "format",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Per-order fee lines for a month, with totals (JSON, or CSV with format=csv)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "month": {
                      "type": "string"
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "orderId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "provider": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "feeAsset": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "feeAmount": {
                            "type": "string"
                          },
                          "feeUsd": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "partnerShareUsd": {
                            "type": "string"
                          },
                          "platformShareUsd": {
                            "type": "string"
                          },
                          "reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "orderId",
                          "provider",
                          "kind",
                          "feeAsset",
                          "feeAmount",
                          "feeUsd",
                          "partnerShareUsd",
                          "platformShareUsd",
                          "reason",
                          "createdAt"
                        ]
                      }
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "feeUsd": {
                          "type": "string"
                        },
                        "partnerShareUsd": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "feeUsd",
                        "partnerShareUsd"
                      ]
                    }
                  },
                  "required": [
                    "month",
                    "lines",
                    "totals"
                  ]
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/v0/invoices": {
      "post": {
        "summary": "Create an invoice",
        "description": "Creates an invoice priced in USD. The customer may pay in any routable token on any routable chain; the merchant receives one settlement asset at its own address (§0).\n\nSettlement is in a USD stablecoin (USDC on base, USDC on arbitrum, USDC on ethereum, USDC on solana, USDC on polygon, USDT on tron, USDT on ethereum, USDT on arbitrum, USDT on bsc), 1:1 with `amount`, or in BTC. A BTC invoice's `amountExpected` is locked from live quotes when it is created (`priceLock`, §5.2); if no reliable price can be had the invoice is refused with `503 PRICE_UNAVAILABLE`.\n\nRe-sending a `reference` in the same mode returns `200` with the invoice that already exists, so a retried create never charges twice. References are scoped by mode: the same `reference` under a test key and a live key makes two separate invoices.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 64,
              "description": "Store plugins: the Affiliate ID from the plugin settings. Links a merchant that nobody referred yet and that has no live payment (affiliate rules); never overwrites and never changes the fee."
            },
            "required": false,
            "description": "Store plugins: the Affiliate ID from the plugin settings. Links a merchant that nobody referred yet and that has no live payment (affiliate rules); never overwrites and never changes the fee.",
            "name": "x-intents-affiliate",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "string",
                    "pattern": "^\\d{1,15}(\\.\\d{1,2})?$",
                    "description": "Price in the invoice currency, e.g. \"49.00\""
                  },
                  "currency": {
                    "type": "string",
                    "enum": [
                      "USD"
                    ],
                    "default": "USD"
                  },
                  "settlement": {
                    "type": "object",
                    "properties": {
                      "asset": {
                        "type": "string",
                        "minLength": 1
                      },
                      "address": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "asset",
                      "address"
                    ],
                    "description": "Choose between the merchant's registered settlement targets. API keys cannot introduce a new address (§8.3)."
                  },
                  "reference": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "The merchant's own ID. Unique per merchant and mode, and the idempotency key."
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "customerEmail": {
                    "type": "string",
                    "maxLength": 320,
                    "format": "email"
                  },
                  "successUrl": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri"
                  },
                  "cancelUrl": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri"
                  },
                  "expiresInSec": {
                    "type": "integer",
                    "minimum": 300,
                    "maximum": 86400,
                    "default": 1800
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 500
                    },
                    "default": {}
                  }
                },
                "required": [
                  "amount"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "An invoice with this `reference` already exists in this mode; it is returned unchanged",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "open",
                        "processing",
                        "underpaid",
                        "paid",
                        "expired",
                        "canceled"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "live",
                        "test"
                      ]
                    },
                    "amount": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "reference": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "customerEmail": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "settlement": {
                      "type": "object",
                      "properties": {
                        "asset": {
                          "type": "string"
                        },
                        "address": {
                          "type": "string"
                        },
                        "amountExpected": {
                          "type": "string"
                        },
                        "amountNet": {
                          "type": "string"
                        },
                        "amountReceived": {
                          "type": "string"
                        },
                        "amountRemaining": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "asset",
                        "address",
                        "amountExpected",
                        "amountNet"
                      ]
                    },
                    "fee": {
                      "type": "object",
                      "properties": {
                        "bps": {
                          "type": "number"
                        },
                        "amount": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "bps",
                        "amount"
                      ]
                    },
                    "priceLock": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "rateUsd": {
                          "type": "string",
                          "description": "USD per settlement coin that the lock implied"
                        },
                        "lockedAt": {
                          "type": "string",
                          "description": "ISO-8601 timestamp"
                        }
                      },
                      "required": [
                        "rateUsd",
                        "lockedAt"
                      ],
                      "description": "§5.2, BTC settlement only: `settlement.amountExpected` was locked from live quotes at this rate. It may be re-locked once while nothing has been paid, if the price moves more than 2%. Null for stablecoin settlement, which is 1:1."
                    },
                    "absorbRouteCost": {
                      "type": "boolean",
                      "description": "§5.1, snapshotted from the merchant when the invoice was created. When true, a USDC or USDT payment is exact-input: the customer pays `amount` 1:1 and the settlement can be up to 1% below `amountExpected`."
                    },
                    "url": {
                      "type": "string"
                    },
                    "successUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cancelUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "metadata": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "overpaid": {
                      "type": "boolean"
                    },
                    "needsReview": {
                      "type": "boolean"
                    },
                    "payer": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "asset": {
                          "type": "string"
                        },
                        "address": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "asset",
                        "address"
                      ]
                    },
                    "txs": {
                      "type": "object",
                      "properties": {
                        "origin": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "settlement": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "refund": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "origin",
                        "settlement",
                        "refund"
                      ]
                    },
                    "channel": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "checkout",
                        "agent",
                        null
                      ],
                      "description": "The surface that took the payment: the paid attempt's channel, else the newest attempt's; null before any attempt."
                    },
                    "attempts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "awaiting_payment",
                              "detected",
                              "underpaid",
                              "confirming",
                              "paid",
                              "refunded",
                              "failed",
                              "expired",
                              "superseded"
                            ],
                            "description": "One of: awaiting_payment, detected, underpaid, confirming, paid, refunded, failed, expired, superseded (§3.2)"
                          },
                          "mode": {
                            "type": "string",
                            "enum": [
                              "wallet",
                              "transfer"
                            ]
                          },
                          "channel": {
                            "type": "string",
                            "enum": [
                              "checkout",
                              "agent"
                            ],
                            "description": "`agent` when the attempt came from `POST /v0/checkout/{id}/agent`; `checkout` for the hosted page, the widget, plugins and headless integrations."
                          },
                          "asset": {
                            "type": "string"
                          },
                          "amountIn": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "description": "ISO-8601 timestamp"
                          },
                          "updatedAt": {
                            "type": "string",
                            "description": "ISO-8601 timestamp"
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "mode",
                          "channel",
                          "asset",
                          "amountIn",
                          "createdAt",
                          "updatedAt"
                        ]
                      }
                    },
                    "expiresAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "paidAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "clientSecret": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Shown once. Null when an existing `reference` made this an idempotent replay: the stored secret is a hash and cannot be re-read."
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "mode",
                    "amount",
                    "currency",
                    "reference",
                    "description",
                    "customerEmail",
                    "settlement",
                    "fee",
                    "priceLock",
                    "absorbRouteCost",
                    "url",
                    "successUrl",
                    "cancelUrl",
                    "metadata",
                    "overpaid",
                    "needsReview",
                    "payer",
                    "txs",
                    "channel",
                    "attempts",
                    "expiresAt",
                    "paidAt",
                    "createdAt",
                    "updatedAt",
                    "clientSecret"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Invoice created. `clientSecret` is shown only here.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "open",
                        "processing",
                        "underpaid",
                        "paid",
                        "expired",
                        "canceled"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "live",
                        "test"
                      ]
                    },
                    "amount": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "reference": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "customerEmail": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "settlement": {
                      "type": "object",
                      "properties": {
                        "asset": {
                          "type": "string"
                        },
                        "address": {
                          "type": "string"
                        },
                        "amountExpected": {
                          "type": "string"
                        },
                        "amountNet": {
                          "type": "string"
                        },
                        "amountReceived": {
                          "type": "string"
                        },
                        "amountRemaining": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "asset",
                        "address",
                        "amountExpected",
                        "amountNet"
                      ]
                    },
                    "fee": {
                      "type": "object",
                      "properties": {
                        "bps": {
                          "type": "number"
                        },
                        "amount": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "bps",
                        "amount"
                      ]
                    },
                    "priceLock": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "rateUsd": {
                          "type": "string",
                          "description": "USD per settlement coin that the lock implied"
                        },
                        "lockedAt": {
                          "type": "string",
                          "description": "ISO-8601 timestamp"
                        }
                      },
                      "required": [
                        "rateUsd",
                        "lockedAt"
                      ],
                      "description": "§5.2, BTC settlement only: `settlement.amountExpected` was locked from live quotes at this rate. It may be re-locked once while nothing has been paid, if the price moves more than 2%. Null for stablecoin settlement, which is 1:1."
                    },
                    "absorbRouteCost": {
                      "type": "boolean",
                      "description": "§5.1, snapshotted from the merchant when the invoice was created. When true, a USDC or USDT payment is exact-input: the customer pays `amount` 1:1 and the settlement can be up to 1% below `amountExpected`."
                    },
                    "url": {
                      "type": "string"
                    },
                    "successUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cancelUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "metadata": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "overpaid": {
                      "type": "boolean"
                    },
                    "needsReview": {
                      "type": "boolean"
                    },
                    "payer": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "asset": {
                          "type": "string"
                        },
                        "address": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "asset",
                        "address"
                      ]
                    },
                    "txs": {
                      "type": "object",
                      "properties": {
                        "origin": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "settlement": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "refund": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "origin",
                        "settlement",
                        "refund"
                      ]
                    },
                    "channel": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "checkout",
                        "agent",
                        null
                      ],
                      "description": "The surface that took the payment: the paid attempt's channel, else the newest attempt's; null before any attempt."
                    },
                    "attempts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "awaiting_payment",
                              "detected",
                              "underpaid",
                              "confirming",
                              "paid",
                              "refunded",
                              "failed",
                              "expired",
                              "superseded"
                            ],
                            "description": "One of: awaiting_payment, detected, underpaid, confirming, paid, refunded, failed, expired, superseded (§3.2)"
                          },
                          "mode": {
                            "type": "string",
                            "enum": [
                              "wallet",
                              "transfer"
                            ]
                          },
                          "channel": {
                            "type": "string",
                            "enum": [
                              "checkout",
                              "agent"
                            ],
                            "description": "`agent` when the attempt came from `POST /v0/checkout/{id}/agent`; `checkout` for the hosted page, the widget, plugins and headless integrations."
                          },
                          "asset": {
                            "type": "string"
                          },
                          "amountIn": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "description": "ISO-8601 timestamp"
                          },
                          "updatedAt": {
                            "type": "string",
                            "description": "ISO-8601 timestamp"
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "mode",
                          "channel",
                          "asset",
                          "amountIn",
                          "createdAt",
                          "updatedAt"
                        ]
                      }
                    },
                    "expiresAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "paidAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "clientSecret": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Shown once. Null when an existing `reference` made this an idempotent replay: the stored secret is a hash and cannot be re-read."
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "mode",
                    "amount",
                    "currency",
                    "reference",
                    "description",
                    "customerEmail",
                    "settlement",
                    "fee",
                    "priceLock",
                    "absorbRouteCost",
                    "url",
                    "successUrl",
                    "cancelUrl",
                    "metadata",
                    "overpaid",
                    "needsReview",
                    "payer",
                    "txs",
                    "channel",
                    "attempts",
                    "expiresAt",
                    "paidAt",
                    "createdAt",
                    "updatedAt",
                    "clientSecret"
                  ]
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List invoices",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "processing",
                "underpaid",
                "paid",
                "expired",
                "canceled"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "description": "The last `id` of the previous page"
            },
            "required": false,
            "description": "The last `id` of the previous page",
            "name": "startingAfter",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Invoices for this key's merchant and mode, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "open",
                              "processing",
                              "underpaid",
                              "paid",
                              "expired",
                              "canceled"
                            ]
                          },
                          "mode": {
                            "type": "string",
                            "enum": [
                              "live",
                              "test"
                            ]
                          },
                          "amount": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "reference": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "customerEmail": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "settlement": {
                            "type": "object",
                            "properties": {
                              "asset": {
                                "type": "string"
                              },
                              "address": {
                                "type": "string"
                              },
                              "amountExpected": {
                                "type": "string"
                              },
                              "amountNet": {
                                "type": "string"
                              },
                              "amountReceived": {
                                "type": "string"
                              },
                              "amountRemaining": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "asset",
                              "address",
                              "amountExpected",
                              "amountNet"
                            ]
                          },
                          "fee": {
                            "type": "object",
                            "properties": {
                              "bps": {
                                "type": "number"
                              },
                              "amount": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "bps",
                              "amount"
                            ]
                          },
                          "priceLock": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "rateUsd": {
                                "type": "string",
                                "description": "USD per settlement coin that the lock implied"
                              },
                              "lockedAt": {
                                "type": "string",
                                "description": "ISO-8601 timestamp"
                              }
                            },
                            "required": [
                              "rateUsd",
                              "lockedAt"
                            ],
                            "description": "§5.2, BTC settlement only: `settlement.amountExpected` was locked from live quotes at this rate. It may be re-locked once while nothing has been paid, if the price moves more than 2%. Null for stablecoin settlement, which is 1:1."
                          },
                          "absorbRouteCost": {
                            "type": "boolean",
                            "description": "§5.1, snapshotted from the merchant when the invoice was created. When true, a USDC or USDT payment is exact-input: the customer pays `amount` 1:1 and the settlement can be up to 1% below `amountExpected`."
                          },
                          "url": {
                            "type": "string"
                          },
                          "successUrl": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "cancelUrl": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "metadata": {
                            "type": "object",
                            "additionalProperties": {}
                          },
                          "overpaid": {
                            "type": "boolean"
                          },
                          "needsReview": {
                            "type": "boolean"
                          },
                          "payer": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "asset": {
                                "type": "string"
                              },
                              "address": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "asset",
                              "address"
                            ]
                          },
                          "txs": {
                            "type": "object",
                            "properties": {
                              "origin": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "settlement": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "refund": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "origin",
                              "settlement",
                              "refund"
                            ]
                          },
                          "channel": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "checkout",
                              "agent",
                              null
                            ],
                            "description": "The surface that took the payment: the paid attempt's channel, else the newest attempt's; null before any attempt."
                          },
                          "attempts": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "status": {
                                  "type": "string",
                                  "enum": [
                                    "awaiting_payment",
                                    "detected",
                                    "underpaid",
                                    "confirming",
                                    "paid",
                                    "refunded",
                                    "failed",
                                    "expired",
                                    "superseded"
                                  ],
                                  "description": "One of: awaiting_payment, detected, underpaid, confirming, paid, refunded, failed, expired, superseded (§3.2)"
                                },
                                "mode": {
                                  "type": "string",
                                  "enum": [
                                    "wallet",
                                    "transfer"
                                  ]
                                },
                                "channel": {
                                  "type": "string",
                                  "enum": [
                                    "checkout",
                                    "agent"
                                  ],
                                  "description": "`agent` when the attempt came from `POST /v0/checkout/{id}/agent`; `checkout` for the hosted page, the widget, plugins and headless integrations."
                                },
                                "asset": {
                                  "type": "string"
                                },
                                "amountIn": {
                                  "type": "string"
                                },
                                "createdAt": {
                                  "type": "string",
                                  "description": "ISO-8601 timestamp"
                                },
                                "updatedAt": {
                                  "type": "string",
                                  "description": "ISO-8601 timestamp"
                                }
                              },
                              "required": [
                                "id",
                                "status",
                                "mode",
                                "channel",
                                "asset",
                                "amountIn",
                                "createdAt",
                                "updatedAt"
                              ]
                            }
                          },
                          "expiresAt": {
                            "type": "string",
                            "description": "ISO-8601 timestamp"
                          },
                          "paidAt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "description": "ISO-8601 timestamp"
                          },
                          "updatedAt": {
                            "type": "string",
                            "description": "ISO-8601 timestamp"
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "mode",
                          "amount",
                          "currency",
                          "reference",
                          "description",
                          "customerEmail",
                          "settlement",
                          "fee",
                          "priceLock",
                          "absorbRouteCost",
                          "url",
                          "successUrl",
                          "cancelUrl",
                          "metadata",
                          "overpaid",
                          "needsReview",
                          "payer",
                          "txs",
                          "channel",
                          "attempts",
                          "expiresAt",
                          "paidAt",
                          "createdAt",
                          "updatedAt"
                        ]
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "hasMore"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/invoices/{id}": {
      "get": {
        "summary": "Fetch an invoice",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The invoice, with its payment attempts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "open",
                        "processing",
                        "underpaid",
                        "paid",
                        "expired",
                        "canceled"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "live",
                        "test"
                      ]
                    },
                    "amount": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "reference": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "customerEmail": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "settlement": {
                      "type": "object",
                      "properties": {
                        "asset": {
                          "type": "string"
                        },
                        "address": {
                          "type": "string"
                        },
                        "amountExpected": {
                          "type": "string"
                        },
                        "amountNet": {
                          "type": "string"
                        },
                        "amountReceived": {
                          "type": "string"
                        },
                        "amountRemaining": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "asset",
                        "address",
                        "amountExpected",
                        "amountNet"
                      ]
                    },
                    "fee": {
                      "type": "object",
                      "properties": {
                        "bps": {
                          "type": "number"
                        },
                        "amount": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "bps",
                        "amount"
                      ]
                    },
                    "priceLock": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "rateUsd": {
                          "type": "string",
                          "description": "USD per settlement coin that the lock implied"
                        },
                        "lockedAt": {
                          "type": "string",
                          "description": "ISO-8601 timestamp"
                        }
                      },
                      "required": [
                        "rateUsd",
                        "lockedAt"
                      ],
                      "description": "§5.2, BTC settlement only: `settlement.amountExpected` was locked from live quotes at this rate. It may be re-locked once while nothing has been paid, if the price moves more than 2%. Null for stablecoin settlement, which is 1:1."
                    },
                    "absorbRouteCost": {
                      "type": "boolean",
                      "description": "§5.1, snapshotted from the merchant when the invoice was created. When true, a USDC or USDT payment is exact-input: the customer pays `amount` 1:1 and the settlement can be up to 1% below `amountExpected`."
                    },
                    "url": {
                      "type": "string"
                    },
                    "successUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cancelUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "metadata": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "overpaid": {
                      "type": "boolean"
                    },
                    "needsReview": {
                      "type": "boolean"
                    },
                    "payer": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "asset": {
                          "type": "string"
                        },
                        "address": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "asset",
                        "address"
                      ]
                    },
                    "txs": {
                      "type": "object",
                      "properties": {
                        "origin": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "settlement": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "refund": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "origin",
                        "settlement",
                        "refund"
                      ]
                    },
                    "channel": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "checkout",
                        "agent",
                        null
                      ],
                      "description": "The surface that took the payment: the paid attempt's channel, else the newest attempt's; null before any attempt."
                    },
                    "attempts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "awaiting_payment",
                              "detected",
                              "underpaid",
                              "confirming",
                              "paid",
                              "refunded",
                              "failed",
                              "expired",
                              "superseded"
                            ],
                            "description": "One of: awaiting_payment, detected, underpaid, confirming, paid, refunded, failed, expired, superseded (§3.2)"
                          },
                          "mode": {
                            "type": "string",
                            "enum": [
                              "wallet",
                              "transfer"
                            ]
                          },
                          "channel": {
                            "type": "string",
                            "enum": [
                              "checkout",
                              "agent"
                            ],
                            "description": "`agent` when the attempt came from `POST /v0/checkout/{id}/agent`; `checkout` for the hosted page, the widget, plugins and headless integrations."
                          },
                          "asset": {
                            "type": "string"
                          },
                          "amountIn": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "description": "ISO-8601 timestamp"
                          },
                          "updatedAt": {
                            "type": "string",
                            "description": "ISO-8601 timestamp"
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "mode",
                          "channel",
                          "asset",
                          "amountIn",
                          "createdAt",
                          "updatedAt"
                        ]
                      }
                    },
                    "expiresAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "paidAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "mode",
                    "amount",
                    "currency",
                    "reference",
                    "description",
                    "customerEmail",
                    "settlement",
                    "fee",
                    "priceLock",
                    "absorbRouteCost",
                    "url",
                    "successUrl",
                    "cancelUrl",
                    "metadata",
                    "overpaid",
                    "needsReview",
                    "payer",
                    "txs",
                    "channel",
                    "attempts",
                    "expiresAt",
                    "paidAt",
                    "createdAt",
                    "updatedAt"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/invoices/{id}/cancel": {
      "post": {
        "summary": "Cancel an invoice",
        "description": "Only while `open` or `underpaid`. An invoice with a payment in flight is never canceled, so no customer pays an invoice we have written off.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The canceled invoice",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "open",
                        "processing",
                        "underpaid",
                        "paid",
                        "expired",
                        "canceled"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "live",
                        "test"
                      ]
                    },
                    "amount": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "reference": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "customerEmail": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "settlement": {
                      "type": "object",
                      "properties": {
                        "asset": {
                          "type": "string"
                        },
                        "address": {
                          "type": "string"
                        },
                        "amountExpected": {
                          "type": "string"
                        },
                        "amountNet": {
                          "type": "string"
                        },
                        "amountReceived": {
                          "type": "string"
                        },
                        "amountRemaining": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "asset",
                        "address",
                        "amountExpected",
                        "amountNet"
                      ]
                    },
                    "fee": {
                      "type": "object",
                      "properties": {
                        "bps": {
                          "type": "number"
                        },
                        "amount": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "bps",
                        "amount"
                      ]
                    },
                    "priceLock": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "rateUsd": {
                          "type": "string",
                          "description": "USD per settlement coin that the lock implied"
                        },
                        "lockedAt": {
                          "type": "string",
                          "description": "ISO-8601 timestamp"
                        }
                      },
                      "required": [
                        "rateUsd",
                        "lockedAt"
                      ],
                      "description": "§5.2, BTC settlement only: `settlement.amountExpected` was locked from live quotes at this rate. It may be re-locked once while nothing has been paid, if the price moves more than 2%. Null for stablecoin settlement, which is 1:1."
                    },
                    "absorbRouteCost": {
                      "type": "boolean",
                      "description": "§5.1, snapshotted from the merchant when the invoice was created. When true, a USDC or USDT payment is exact-input: the customer pays `amount` 1:1 and the settlement can be up to 1% below `amountExpected`."
                    },
                    "url": {
                      "type": "string"
                    },
                    "successUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cancelUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "metadata": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "overpaid": {
                      "type": "boolean"
                    },
                    "needsReview": {
                      "type": "boolean"
                    },
                    "payer": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "asset": {
                          "type": "string"
                        },
                        "address": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "asset",
                        "address"
                      ]
                    },
                    "txs": {
                      "type": "object",
                      "properties": {
                        "origin": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "settlement": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "refund": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "origin",
                        "settlement",
                        "refund"
                      ]
                    },
                    "channel": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "checkout",
                        "agent",
                        null
                      ],
                      "description": "The surface that took the payment: the paid attempt's channel, else the newest attempt's; null before any attempt."
                    },
                    "attempts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "awaiting_payment",
                              "detected",
                              "underpaid",
                              "confirming",
                              "paid",
                              "refunded",
                              "failed",
                              "expired",
                              "superseded"
                            ],
                            "description": "One of: awaiting_payment, detected, underpaid, confirming, paid, refunded, failed, expired, superseded (§3.2)"
                          },
                          "mode": {
                            "type": "string",
                            "enum": [
                              "wallet",
                              "transfer"
                            ]
                          },
                          "channel": {
                            "type": "string",
                            "enum": [
                              "checkout",
                              "agent"
                            ],
                            "description": "`agent` when the attempt came from `POST /v0/checkout/{id}/agent`; `checkout` for the hosted page, the widget, plugins and headless integrations."
                          },
                          "asset": {
                            "type": "string"
                          },
                          "amountIn": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "description": "ISO-8601 timestamp"
                          },
                          "updatedAt": {
                            "type": "string",
                            "description": "ISO-8601 timestamp"
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "mode",
                          "channel",
                          "asset",
                          "amountIn",
                          "createdAt",
                          "updatedAt"
                        ]
                      }
                    },
                    "expiresAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "paidAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "mode",
                    "amount",
                    "currency",
                    "reference",
                    "description",
                    "customerEmail",
                    "settlement",
                    "fee",
                    "priceLock",
                    "absorbRouteCost",
                    "url",
                    "successUrl",
                    "cancelUrl",
                    "metadata",
                    "overpaid",
                    "needsReview",
                    "payer",
                    "txs",
                    "channel",
                    "attempts",
                    "expiresAt",
                    "paidAt",
                    "createdAt",
                    "updatedAt"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/merchant": {
      "get": {
        "summary": "Fetch the merchant profile",
        "responses": {
          "200": {
            "description": "Profile, branding and the settlement targets in effect",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending_review",
                        "active",
                        "restricted",
                        "closed"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "live",
                        "test"
                      ],
                      "description": "The mode of the key that asked"
                    },
                    "fee": {
                      "type": "object",
                      "properties": {
                        "bps": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "bps"
                      ]
                    },
                    "branding": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "absorbRouteCost": {
                      "type": "boolean",
                      "description": "§5.1: when true, a customer paying with USDC or USDT pays exactly the invoice amount and you absorb the route cost, up to 1% (past that, the customer pays it). Applies to invoices created after the change."
                    },
                    "settlement": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "asset": {
                          "type": "string"
                        },
                        "address": {
                          "type": "string"
                        },
                        "isDefault": {
                          "type": "boolean"
                        },
                        "effectiveAt": {
                          "type": "string",
                          "description": "ISO-8601 timestamp"
                        }
                      },
                      "required": [
                        "asset",
                        "address",
                        "isDefault",
                        "effectiveAt"
                      ],
                      "description": "The default settlement target in effect"
                    },
                    "settlements": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "asset": {
                            "type": "string"
                          },
                          "address": {
                            "type": "string"
                          },
                          "isDefault": {
                            "type": "boolean"
                          },
                          "effectiveAt": {
                            "type": "string",
                            "description": "ISO-8601 timestamp"
                          }
                        },
                        "required": [
                          "asset",
                          "address",
                          "isDefault",
                          "effectiveAt"
                        ]
                      }
                    },
                    "affiliate": {
                      "$ref": "#/components/schemas/MerchantReferredBy"
                    },
                    "createdAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "country",
                    "status",
                    "mode",
                    "fee",
                    "branding",
                    "absorbRouteCost",
                    "settlement",
                    "settlements",
                    "affiliate",
                    "createdAt"
                  ]
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Update branding and payment options",
        "description": "Branding, display name and `absorbRouteCost` (§5.1) only. Settlement addresses cannot be changed with an API key: a stolen key must never be able to redirect a payout (§8.3). Change them in the dashboard, where it takes fresh email OTP and 24 hours.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "branding": {
                    "$ref": "#/components/schemas/BrandingInput"
                  },
                  "absorbRouteCost": {
                    "type": "boolean",
                    "description": "§5.1: absorb the route cost on stablecoin payments, up to 1% of the invoice. Applies to invoices created after the change."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated profile",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending_review",
                        "active",
                        "restricted",
                        "closed"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "live",
                        "test"
                      ],
                      "description": "The mode of the key that asked"
                    },
                    "fee": {
                      "type": "object",
                      "properties": {
                        "bps": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "bps"
                      ]
                    },
                    "branding": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "absorbRouteCost": {
                      "type": "boolean",
                      "description": "§5.1: when true, a customer paying with USDC or USDT pays exactly the invoice amount and you absorb the route cost, up to 1% (past that, the customer pays it). Applies to invoices created after the change."
                    },
                    "settlement": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "asset": {
                          "type": "string"
                        },
                        "address": {
                          "type": "string"
                        },
                        "isDefault": {
                          "type": "boolean"
                        },
                        "effectiveAt": {
                          "type": "string",
                          "description": "ISO-8601 timestamp"
                        }
                      },
                      "required": [
                        "asset",
                        "address",
                        "isDefault",
                        "effectiveAt"
                      ],
                      "description": "The default settlement target in effect"
                    },
                    "settlements": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "asset": {
                            "type": "string"
                          },
                          "address": {
                            "type": "string"
                          },
                          "isDefault": {
                            "type": "boolean"
                          },
                          "effectiveAt": {
                            "type": "string",
                            "description": "ISO-8601 timestamp"
                          }
                        },
                        "required": [
                          "asset",
                          "address",
                          "isDefault",
                          "effectiveAt"
                        ]
                      }
                    },
                    "affiliate": {
                      "$ref": "#/components/schemas/MerchantReferredBy"
                    },
                    "createdAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "country",
                    "status",
                    "mode",
                    "fee",
                    "branding",
                    "absorbRouteCost",
                    "settlement",
                    "settlements",
                    "affiliate",
                    "createdAt"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/checkout/domains/{host}": {
      "get": {
        "summary": "Resolve a custom checkout domain",
        "description": "Which merchant a verified custom checkout domain (`pay.merchant.com`) belongs to. The hosted page calls it for any host that is not its own, and serves only that merchant's invoices there. 404 for anything that is not a verified checkout domain, including one still waiting on DNS.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 253
            },
            "required": true,
            "name": "host",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "A verified checkout domain",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutDomain"
                }
              }
            }
          }
        }
      }
    },
    "/v0/checkout/{invoiceId}": {
      "get": {
        "summary": "Fetch the public checkout view",
        "description": "What the payer is shown: the price, the merchant's name and theme, the status and the active attempt. Readable with the invoice ID alone, which carries 22+ characters of randomness, so it never returns the merchant's settlement address or net amount.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "invoiceId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The public view of the invoice",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "open",
                        "processing",
                        "underpaid",
                        "paid",
                        "expired",
                        "canceled"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "live",
                        "test"
                      ]
                    },
                    "amount": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "merchant": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "The merchant's ID. A custom checkout domain serves only its own merchant's invoices."
                        },
                        "name": {
                          "type": "string",
                          "description": "`branding.displayName` if set, else the merchant name"
                        },
                        "logoUrl": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "accent": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "supportEmail": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "logoUrl",
                        "accent",
                        "supportEmail"
                      ]
                    },
                    "branding": {
                      "type": "object",
                      "additionalProperties": {}
                    },
                    "activeAttempt": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "attemptId": {
                          "type": "string"
                        },
                        "orderId": {
                          "type": "string"
                        },
                        "invoiceId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "awaiting_payment",
                            "detected",
                            "underpaid",
                            "confirming",
                            "paid",
                            "refunded",
                            "failed",
                            "expired",
                            "superseded"
                          ]
                        },
                        "invoiceStatus": {
                          "type": "string",
                          "enum": [
                            "open",
                            "processing",
                            "underpaid",
                            "paid",
                            "expired",
                            "canceled"
                          ]
                        },
                        "mode": {
                          "type": "string",
                          "enum": [
                            "wallet",
                            "transfer"
                          ]
                        },
                        "asset": {
                          "type": "string",
                          "minLength": 1,
                          "description": "CAIP-19 asset ID"
                        },
                        "amountIn": {
                          "type": "string",
                          "pattern": "^\\d+$",
                          "description": "Integer amount in the asset's base units"
                        },
                        "payer": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "refundTo": {
                          "type": "string"
                        },
                        "amountReceived": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "pattern": "^\\d+$",
                          "description": "Integer amount in the asset's base units"
                        },
                        "amountRemaining": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "pattern": "^\\d+$",
                          "description": "Integer amount in the asset's base units"
                        },
                        "txs": {
                          "type": "object",
                          "properties": {
                            "origin": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "settlement": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "refund": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "origin",
                            "settlement",
                            "refund"
                          ]
                        },
                        "failReason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "etaSec": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0
                        },
                        "display": {
                          "type": [
                            "object",
                            "null"
                          ],
                          "properties": {
                            "address": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "memo": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "qr": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "amount": {
                              "type": "string"
                            },
                            "amountBaseUnits": {
                              "type": "string",
                              "pattern": "^\\d+$",
                              "description": "Integer amount in the asset's base units"
                            },
                            "decimals": {
                              "type": "integer",
                              "minimum": 0
                            },
                            "symbol": {
                              "type": "string"
                            },
                            "chain": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "address",
                            "memo",
                            "qr",
                            "amount",
                            "amountBaseUnits",
                            "decimals",
                            "symbol",
                            "chain"
                          ]
                        },
                        "createdAt": {
                          "type": "string",
                          "description": "ISO-8601 timestamp"
                        },
                        "updatedAt": {
                          "type": "string",
                          "description": "ISO-8601 timestamp"
                        }
                      },
                      "required": [
                        "attemptId",
                        "orderId",
                        "invoiceId",
                        "status",
                        "invoiceStatus",
                        "mode",
                        "asset",
                        "amountIn",
                        "payer",
                        "refundTo",
                        "amountReceived",
                        "amountRemaining",
                        "txs",
                        "failReason",
                        "etaSec",
                        "display",
                        "createdAt",
                        "updatedAt"
                      ]
                    },
                    "overpaid": {
                      "type": "boolean"
                    },
                    "amountRemaining": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "successUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cancelUrl": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "poweredBy": {
                      "type": "boolean"
                    },
                    "expiresAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "paidAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "mode",
                    "amount",
                    "currency",
                    "description",
                    "merchant",
                    "branding",
                    "activeAttempt",
                    "overpaid",
                    "amountRemaining",
                    "successUrl",
                    "cancelUrl",
                    "poweredBy",
                    "expiresAt",
                    "paidAt",
                    "createdAt"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/checkout/{invoiceId}/options": {
      "get": {
        "summary": "List the assets this invoice can be paid with",
        "description": "The ranked \"pay with\" list. Each row is quoted exact-output through the core aggregator, so `amountIn` is all-in: the invoice plus the cost of delivering it, as one number the customer reads. Route cost is never broken out as gas, bridging or slippage (§5.1).\n\nAssets whose provider minimum exceeds the invoice amount are left out (§5.4), and `modes` lists `transfer` only where a provider returns a deposit address for that asset.\n\nWith no `payer` the list is ten popular assets. With a `payer`, what that address holds of **any** payable asset on its own network joins them (up to 10 more), each with its `balance`; a row whose balance is below `amountIn` has `covers: false` and is listed after the ones the payer can afford. A balance that cannot be read within 800 ms is left out, never waited for (§6.4).\n\n`?assets=` quotes up to 3 named assets on demand instead: the one a customer picked from `GET …/assets`. Those rows are never `recommended`. A payable asset no provider will quote right now comes back in `unavailable`; an asset that cannot pay this invoice at all (outside `GET …/assets`: a Bitcoin or NEAR token, a Mayan-only asset, the settlement asset) is refused with `422 NO_ROUTE_FOR_ASSET` before anything is quoted, as `POST …/attempts` refuses it. Cache misses count against a per-invoice hourly limit (`429 RATE_LIMITED`).\n\nQuotes are indicative and cached per invoice and asset for `ttlSec`; the binding amount comes from `POST /attempts`.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "invoiceId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The payer's address. Balances are read from it on its own VM (§6.4)."
            },
            "required": false,
            "description": "The payer's address. Balances are read from it on its own VM (§6.4).",
            "name": "payer",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Comma-separated CAIP-2 chain IDs, to narrow the list"
            },
            "required": false,
            "description": "Comma-separated CAIP-2 chain IDs, to narrow the list",
            "name": "chains",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024,
              "description": "Up to 3 comma-separated CAIP-19 asset IDs to quote on demand: the asset a customer picked from search, or a short result set (§11.35). Only these are quoted. Cache misses count against a per-invoice hourly limit (`429 RATE_LIMITED`)."
            },
            "required": false,
            "description": "Up to 3 comma-separated CAIP-19 asset IDs to quote on demand: the asset a customer picked from search, or a short result set (§11.35). Only these are quoted. Cache misses count against a per-invoice hourly limit (`429 RATE_LIMITED`).",
            "name": "assets",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked payment options, newest quote first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "options": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "asset": {
                            "type": "string",
                            "minLength": 1,
                            "description": "CAIP-19 asset ID"
                          },
                          "symbol": {
                            "type": "string"
                          },
                          "chain": {
                            "type": "string"
                          },
                          "decimals": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "amountIn": {
                            "type": "string",
                            "pattern": "^\\d+$",
                            "description": "Integer amount in the asset's base units"
                          },
                          "amountInUsd": {
                            "type": "string"
                          },
                          "routeCostUsd": {
                            "type": "string"
                          },
                          "balance": {
                            "type": "string",
                            "pattern": "^\\d+$",
                            "description": "Integer amount in the asset's base units"
                          },
                          "covers": {
                            "type": "boolean",
                            "description": "Whether the payer can afford `amountIn`. True when no `balance` could be read, so an unreadable balance never hides a payable asset."
                          },
                          "modes": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "wallet",
                                "transfer"
                              ]
                            },
                            "minItems": 1
                          },
                          "etaSec": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "recommended": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "asset",
                          "symbol",
                          "chain",
                          "decimals",
                          "amountIn",
                          "amountInUsd",
                          "routeCostUsd",
                          "covers",
                          "modes",
                          "etaSec",
                          "recommended"
                        ]
                      }
                    },
                    "unavailable": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "asset": {
                            "type": "string",
                            "minLength": 1,
                            "description": "CAIP-19 asset ID"
                          },
                          "symbol": {
                            "type": "string"
                          },
                          "chain": {
                            "type": "string"
                          },
                          "decimals": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "balance": {
                            "type": "string",
                            "pattern": "^\\d+$",
                            "description": "Integer amount in the asset's base units"
                          },
                          "minimumUsd": {
                            "type": "string",
                            "description": "Set when the invoice is below the smallest amount this asset's route accepts, in USD (e.g. \"100.00\" for USDT on Tron). Shown as the reason, never offered.",
                            "example": "100.00"
                          }
                        },
                        "required": [
                          "asset",
                          "symbol",
                          "chain"
                        ]
                      },
                      "description": "Assets asked for or held that no route can take for this invoice right now"
                    },
                    "quotedAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "ttlSec": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "description": "How long these indicative quotes are cached"
                    }
                  },
                  "required": [
                    "options",
                    "quotedAt",
                    "ttlSec"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/checkout/{invoiceId}/assets": {
      "get": {
        "summary": "Search every asset this invoice can be paid with",
        "description": "Searches every payable asset in the registry, not just the default list, by symbol, token name, network or contract address. Every word of `q` must match (\"usdc base\").\n\nOnly assets that a provider can route exact-output to the invoice's settlement asset are listed (§11.3). On Bitcoin and NEAR only the native coin is listed.\n\nSearch never quotes a long list. When the whole result set is 3 assets or fewer, each match carries its `option` (or `null`: nothing routes it right now). Otherwise price the one the customer picks with `GET …/options?assets=`.\n\nLimited per invoice: 240 searches an hour (`429 RATE_LIMITED`).",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "invoiceId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "description": "What the customer typed: a symbol, a token name, a network, or a contract address. Every word must match.",
              "example": "usdc base"
            },
            "required": true,
            "description": "What the customer typed: a symbol, a token name, a network, or a contract address. Every word must match.",
            "name": "q",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20,
              "default": 10,
              "example": 10
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,5}$",
              "description": "`nextCursor` from the previous page",
              "example": "10"
            },
            "required": false,
            "description": "`nextCursor` from the previous page",
            "name": "cursor",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The payer's address, so an inline quote can read their balance (§6.4)"
            },
            "required": false,
            "description": "The payer's address, so an inline quote can read their balance (§6.4)",
            "name": "payer",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Matching assets, best match first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "asset": {
                            "type": "string",
                            "minLength": 1,
                            "description": "CAIP-19 asset ID"
                          },
                          "symbol": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "chain": {
                            "type": "string"
                          },
                          "decimals": {
                            "type": "integer",
                            "minimum": 0
                          },
                          "address": {
                            "type": "string"
                          },
                          "option": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "properties": {
                              "asset": {
                                "type": "string",
                                "minLength": 1,
                                "description": "CAIP-19 asset ID"
                              },
                              "symbol": {
                                "type": "string"
                              },
                              "chain": {
                                "type": "string"
                              },
                              "decimals": {
                                "type": "integer",
                                "minimum": 0
                              },
                              "amountIn": {
                                "type": "string",
                                "pattern": "^\\d+$",
                                "description": "Integer amount in the asset's base units"
                              },
                              "amountInUsd": {
                                "type": "string"
                              },
                              "routeCostUsd": {
                                "type": "string"
                              },
                              "balance": {
                                "type": "string",
                                "pattern": "^\\d+$",
                                "description": "Integer amount in the asset's base units"
                              },
                              "covers": {
                                "type": "boolean",
                                "description": "Whether the payer can afford `amountIn`. True when no `balance` could be read, so an unreadable balance never hides a payable asset."
                              },
                              "modes": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "enum": [
                                    "wallet",
                                    "transfer"
                                  ]
                                },
                                "minItems": 1
                              },
                              "etaSec": {
                                "type": "integer",
                                "minimum": 0
                              },
                              "recommended": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "asset",
                              "symbol",
                              "chain",
                              "decimals",
                              "amountIn",
                              "amountInUsd",
                              "routeCostUsd",
                              "covers",
                              "modes",
                              "etaSec",
                              "recommended"
                            ],
                            "description": "The quote, when the whole result set is short enough to be quoted inline (3 or fewer). `null`: quoted, and nothing routes it right now. Absent: not quoted; ask `GET …/options?assets=` when the customer picks it."
                          }
                        },
                        "required": [
                          "asset",
                          "symbol",
                          "chain",
                          "decimals"
                        ]
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "description": "Matches across every page"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "total",
                    "nextCursor"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/checkout/{invoiceId}/attempts": {
      "post": {
        "summary": "Start a payment attempt",
        "description": "Picks one asset and turns it into a core order: an exact-output quote for the invoice's net amount (`amountExpected` less the checkout fee), paying the merchant's settlement address, with the fee charged in route on top (§5.1, §11.53).\n\n`refundTo` is required in `transfer` mode and defaults to `payer` in `wallet` mode (§11.2). It must be valid on the origin chain, because a failed payment is returned there and nowhere else.\n\nCreating an attempt supersedes the invoice's previous active one. The superseded deposit address can still be paid, and if it is, the money still reaches the merchant and is handled as a late payment (§3.2) — which is why the UI shows only the newest address.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "invoiceId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The invoice's `clientSecret`, from `POST /v0/invoices`"
            },
            "required": false,
            "description": "The invoice's `clientSecret`, from `POST /v0/invoices`",
            "name": "x-client-secret",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "asset": {
                        "type": "string",
                        "minLength": 1,
                        "description": "CAIP-19 asset ID"
                      },
                      "mode": {
                        "type": "string",
                        "enum": [
                          "wallet"
                        ]
                      },
                      "payer": {
                        "type": "string",
                        "minLength": 1,
                        "description": "The paying address. Required in `wallet` mode, where it also defaults `refundTo`."
                      },
                      "refundTo": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Where a failed payment is returned, on the origin chain. **Required in `transfer` mode** (§11.2); defaults to `payer` in `wallet` mode."
                      }
                    },
                    "required": [
                      "asset",
                      "mode",
                      "payer"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "asset": {
                        "type": "string",
                        "minLength": 1,
                        "description": "CAIP-19 asset ID"
                      },
                      "mode": {
                        "type": "string",
                        "enum": [
                          "transfer"
                        ]
                      },
                      "payer": {
                        "type": "string",
                        "minLength": 1,
                        "description": "The paying address. Required in `wallet` mode, where it also defaults `refundTo`."
                      },
                      "refundTo": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Where a failed payment is returned, on the origin chain. **Required in `transfer` mode** (§11.2); defaults to `payer` in `wallet` mode."
                      }
                    },
                    "required": [
                      "asset",
                      "mode",
                      "refundTo"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The attempt, with the steps that pay it",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "attemptId": {
                      "type": "string"
                    },
                    "orderId": {
                      "type": "string"
                    },
                    "invoiceId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "awaiting_payment",
                        "detected",
                        "underpaid",
                        "confirming",
                        "paid",
                        "refunded",
                        "failed",
                        "expired",
                        "superseded"
                      ]
                    },
                    "invoiceStatus": {
                      "type": "string",
                      "enum": [
                        "open",
                        "processing",
                        "underpaid",
                        "paid",
                        "expired",
                        "canceled"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "wallet",
                        "transfer"
                      ]
                    },
                    "asset": {
                      "type": "string",
                      "minLength": 1,
                      "description": "CAIP-19 asset ID"
                    },
                    "amountIn": {
                      "type": "string",
                      "pattern": "^\\d+$",
                      "description": "Integer amount in the asset's base units"
                    },
                    "payer": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "refundTo": {
                      "type": "string"
                    },
                    "amountReceived": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "pattern": "^\\d+$",
                      "description": "Integer amount in the asset's base units"
                    },
                    "amountRemaining": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "pattern": "^\\d+$",
                      "description": "Integer amount in the asset's base units"
                    },
                    "txs": {
                      "type": "object",
                      "properties": {
                        "origin": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "settlement": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "refund": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "origin",
                        "settlement",
                        "refund"
                      ]
                    },
                    "failReason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "etaSec": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0
                    },
                    "display": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "address": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "memo": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "qr": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "amount": {
                          "type": "string"
                        },
                        "amountBaseUnits": {
                          "type": "string",
                          "pattern": "^\\d+$",
                          "description": "Integer amount in the asset's base units"
                        },
                        "decimals": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "symbol": {
                          "type": "string"
                        },
                        "chain": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "address",
                        "memo",
                        "qr",
                        "amount",
                        "amountBaseUnits",
                        "decimals",
                        "symbol",
                        "chain"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "execution": {
                      "type": "object",
                      "properties": {
                        "steps": {
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "evm_tx"
                                    ]
                                  },
                                  "purpose": {
                                    "type": "string",
                                    "enum": [
                                      "approve",
                                      "deposit",
                                      "swap"
                                    ]
                                  },
                                  "chainId": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0
                                  },
                                  "tx": {
                                    "type": "object",
                                    "properties": {
                                      "to": {
                                        "type": "string"
                                      },
                                      "data": {
                                        "type": "string"
                                      },
                                      "value": {
                                        "type": "string",
                                        "pattern": "^(0|[1-9]\\d*)$"
                                      },
                                      "gas": {
                                        "type": "string",
                                        "pattern": "^(0|[1-9]\\d*)$"
                                      }
                                    },
                                    "required": [
                                      "to",
                                      "data",
                                      "value"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind",
                                  "purpose",
                                  "chainId",
                                  "tx"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "svm_tx"
                                    ]
                                  },
                                  "purpose": {
                                    "type": "string",
                                    "enum": [
                                      "deposit",
                                      "swap"
                                    ]
                                  },
                                  "serializedTx": {
                                    "type": "string"
                                  },
                                  "instructions": {},
                                  "lookupTables": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "required": [
                                  "kind",
                                  "purpose"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "tvm_tx"
                                    ]
                                  },
                                  "purpose": {
                                    "type": "string",
                                    "enum": [
                                      "approve",
                                      "deposit"
                                    ]
                                  },
                                  "contract": {
                                    "type": "string"
                                  },
                                  "owner": {
                                    "type": "string"
                                  },
                                  "data": {
                                    "type": "string"
                                  },
                                  "callValue": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9]\\d*)$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "purpose",
                                  "contract",
                                  "owner",
                                  "data",
                                  "callValue"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "transfer"
                                    ]
                                  },
                                  "chain": {
                                    "type": "string"
                                  },
                                  "asset": {
                                    "type": "string"
                                  },
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9]\\d*)$"
                                  },
                                  "to": {
                                    "type": "string"
                                  },
                                  "memo": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "chain",
                                  "asset",
                                  "amount",
                                  "to"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "eip712_sign"
                                    ]
                                  },
                                  "typedData": {},
                                  "submit": {
                                    "type": "object",
                                    "properties": {
                                      "endpoint": {
                                        "type": "string",
                                        "enum": [
                                          "/v0/orders/{id}/submit"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "endpoint"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind",
                                  "submit"
                                ]
                              }
                            ]
                          }
                        },
                        "expiresAt": {
                          "type": "string",
                          "description": "ISO-8601 timestamp"
                        }
                      },
                      "required": [
                        "steps",
                        "expiresAt"
                      ]
                    }
                  },
                  "required": [
                    "attemptId",
                    "orderId",
                    "invoiceId",
                    "status",
                    "invoiceStatus",
                    "mode",
                    "asset",
                    "amountIn",
                    "payer",
                    "refundTo",
                    "amountReceived",
                    "amountRemaining",
                    "txs",
                    "failReason",
                    "etaSec",
                    "display",
                    "createdAt",
                    "updatedAt",
                    "execution"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/checkout/{invoiceId}/agent": {
      "post": {
        "summary": "Pay an invoice as an agent, with no UI",
        "description": "For software that pays on someone's behalf (§12 C3). Call it with **no body** and it answers `402 Payment Required`, x402-style: the invoice, and in `accepts[]` every asset it can be paid with and the indicative all-in amount for each. Nothing is created.\n\nCall it again with `{ \"asset\", \"mode\": \"transfer\", \"refundTo\" }` and it creates a payment attempt, exactly like `POST …/attempts`, tagged `channel: \"agent\"`. The response carries the deposit address and the binding amount in `display`. Send exactly that amount, then poll `GET …/attempts/{id}` until `invoiceStatus` is `paid`. The merchant gets the same webhooks as for any other payment.\n\nNo client secret is needed: the invoice ID is the capability, as it is for the hosted page (§11.10), and the same per-invoice and per-IP attempt limits apply.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "invoiceId",
            "in": "path"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "asset": {
                        "type": "string",
                        "minLength": 1,
                        "description": "CAIP-19 asset ID"
                      },
                      "mode": {
                        "type": "string",
                        "enum": [
                          "wallet"
                        ]
                      },
                      "payer": {
                        "type": "string",
                        "minLength": 1,
                        "description": "The paying address. Required in `wallet` mode, where it also defaults `refundTo`."
                      },
                      "refundTo": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Where a failed payment is returned, on the origin chain. **Required in `transfer` mode** (§11.2); defaults to `payer` in `wallet` mode."
                      }
                    },
                    "required": [
                      "asset",
                      "mode",
                      "payer"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "asset": {
                        "type": "string",
                        "minLength": 1,
                        "description": "CAIP-19 asset ID"
                      },
                      "mode": {
                        "type": "string",
                        "enum": [
                          "transfer"
                        ]
                      },
                      "payer": {
                        "type": "string",
                        "minLength": 1,
                        "description": "The paying address. Required in `wallet` mode, where it also defaults `refundTo`."
                      },
                      "refundTo": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Where a failed payment is returned, on the origin chain. **Required in `transfer` mode** (§11.2); defaults to `payer` in `wallet` mode."
                      }
                    },
                    "required": [
                      "asset",
                      "mode",
                      "refundTo"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The attempt, with the deposit address (transfer) or the steps (wallet)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "attemptId": {
                      "type": "string"
                    },
                    "orderId": {
                      "type": "string"
                    },
                    "invoiceId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "awaiting_payment",
                        "detected",
                        "underpaid",
                        "confirming",
                        "paid",
                        "refunded",
                        "failed",
                        "expired",
                        "superseded"
                      ]
                    },
                    "invoiceStatus": {
                      "type": "string",
                      "enum": [
                        "open",
                        "processing",
                        "underpaid",
                        "paid",
                        "expired",
                        "canceled"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "wallet",
                        "transfer"
                      ]
                    },
                    "asset": {
                      "type": "string",
                      "minLength": 1,
                      "description": "CAIP-19 asset ID"
                    },
                    "amountIn": {
                      "type": "string",
                      "pattern": "^\\d+$",
                      "description": "Integer amount in the asset's base units"
                    },
                    "payer": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "refundTo": {
                      "type": "string"
                    },
                    "amountReceived": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "pattern": "^\\d+$",
                      "description": "Integer amount in the asset's base units"
                    },
                    "amountRemaining": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "pattern": "^\\d+$",
                      "description": "Integer amount in the asset's base units"
                    },
                    "txs": {
                      "type": "object",
                      "properties": {
                        "origin": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "settlement": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "refund": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "origin",
                        "settlement",
                        "refund"
                      ]
                    },
                    "failReason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "etaSec": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0
                    },
                    "display": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "address": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "memo": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "qr": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "amount": {
                          "type": "string"
                        },
                        "amountBaseUnits": {
                          "type": "string",
                          "pattern": "^\\d+$",
                          "description": "Integer amount in the asset's base units"
                        },
                        "decimals": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "symbol": {
                          "type": "string"
                        },
                        "chain": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "address",
                        "memo",
                        "qr",
                        "amount",
                        "amountBaseUnits",
                        "decimals",
                        "symbol",
                        "chain"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "execution": {
                      "type": "object",
                      "properties": {
                        "steps": {
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "evm_tx"
                                    ]
                                  },
                                  "purpose": {
                                    "type": "string",
                                    "enum": [
                                      "approve",
                                      "deposit",
                                      "swap"
                                    ]
                                  },
                                  "chainId": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0
                                  },
                                  "tx": {
                                    "type": "object",
                                    "properties": {
                                      "to": {
                                        "type": "string"
                                      },
                                      "data": {
                                        "type": "string"
                                      },
                                      "value": {
                                        "type": "string",
                                        "pattern": "^(0|[1-9]\\d*)$"
                                      },
                                      "gas": {
                                        "type": "string",
                                        "pattern": "^(0|[1-9]\\d*)$"
                                      }
                                    },
                                    "required": [
                                      "to",
                                      "data",
                                      "value"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind",
                                  "purpose",
                                  "chainId",
                                  "tx"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "svm_tx"
                                    ]
                                  },
                                  "purpose": {
                                    "type": "string",
                                    "enum": [
                                      "deposit",
                                      "swap"
                                    ]
                                  },
                                  "serializedTx": {
                                    "type": "string"
                                  },
                                  "instructions": {},
                                  "lookupTables": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "required": [
                                  "kind",
                                  "purpose"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "tvm_tx"
                                    ]
                                  },
                                  "purpose": {
                                    "type": "string",
                                    "enum": [
                                      "approve",
                                      "deposit"
                                    ]
                                  },
                                  "contract": {
                                    "type": "string"
                                  },
                                  "owner": {
                                    "type": "string"
                                  },
                                  "data": {
                                    "type": "string"
                                  },
                                  "callValue": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9]\\d*)$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "purpose",
                                  "contract",
                                  "owner",
                                  "data",
                                  "callValue"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "transfer"
                                    ]
                                  },
                                  "chain": {
                                    "type": "string"
                                  },
                                  "asset": {
                                    "type": "string"
                                  },
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9]\\d*)$"
                                  },
                                  "to": {
                                    "type": "string"
                                  },
                                  "memo": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "chain",
                                  "asset",
                                  "amount",
                                  "to"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "eip712_sign"
                                    ]
                                  },
                                  "typedData": {},
                                  "submit": {
                                    "type": "object",
                                    "properties": {
                                      "endpoint": {
                                        "type": "string",
                                        "enum": [
                                          "/v0/orders/{id}/submit"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "endpoint"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind",
                                  "submit"
                                ]
                              }
                            ]
                          }
                        },
                        "expiresAt": {
                          "type": "string",
                          "description": "ISO-8601 timestamp"
                        }
                      },
                      "required": [
                        "steps",
                        "expiresAt"
                      ]
                    }
                  },
                  "required": [
                    "attemptId",
                    "orderId",
                    "invoiceId",
                    "status",
                    "invoiceStatus",
                    "mode",
                    "asset",
                    "amountIn",
                    "payer",
                    "refundTo",
                    "amountReceived",
                    "amountRemaining",
                    "txs",
                    "failReason",
                    "etaSec",
                    "display",
                    "createdAt",
                    "updatedAt",
                    "execution"
                  ]
                }
              }
            }
          },
          "402": {
            "description": "Payment required: the invoice and what it accepts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPaymentRequired"
                }
              }
            }
          }
        }
      }
    },
    "/v0/checkout/{invoiceId}/attempts/{id}/submit": {
      "post": {
        "summary": "Hand in a transaction hash or signature",
        "description": "Required by the providers that settle from a signature, and a shortcut everywhere else: telling us the hash finds the payment sooner than watching for it.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "invoiceId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "The invoice's `clientSecret`, from `POST /v0/invoices`"
            },
            "required": false,
            "description": "The invoice's `clientSecret`, from `POST /v0/invoices`",
            "name": "x-client-secret",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "txHash": {
                    "type": "string",
                    "minLength": 1
                  },
                  "signature": {
                    "type": "string",
                    "minLength": 1
                  },
                  "chain": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The attempt, with the submission recorded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "attemptId": {
                      "type": "string"
                    },
                    "orderId": {
                      "type": "string"
                    },
                    "invoiceId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "awaiting_payment",
                        "detected",
                        "underpaid",
                        "confirming",
                        "paid",
                        "refunded",
                        "failed",
                        "expired",
                        "superseded"
                      ]
                    },
                    "invoiceStatus": {
                      "type": "string",
                      "enum": [
                        "open",
                        "processing",
                        "underpaid",
                        "paid",
                        "expired",
                        "canceled"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "wallet",
                        "transfer"
                      ]
                    },
                    "asset": {
                      "type": "string",
                      "minLength": 1,
                      "description": "CAIP-19 asset ID"
                    },
                    "amountIn": {
                      "type": "string",
                      "pattern": "^\\d+$",
                      "description": "Integer amount in the asset's base units"
                    },
                    "payer": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "refundTo": {
                      "type": "string"
                    },
                    "amountReceived": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "pattern": "^\\d+$",
                      "description": "Integer amount in the asset's base units"
                    },
                    "amountRemaining": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "pattern": "^\\d+$",
                      "description": "Integer amount in the asset's base units"
                    },
                    "txs": {
                      "type": "object",
                      "properties": {
                        "origin": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "settlement": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "refund": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "origin",
                        "settlement",
                        "refund"
                      ]
                    },
                    "failReason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "etaSec": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0
                    },
                    "display": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "address": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "memo": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "qr": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "amount": {
                          "type": "string"
                        },
                        "amountBaseUnits": {
                          "type": "string",
                          "pattern": "^\\d+$",
                          "description": "Integer amount in the asset's base units"
                        },
                        "decimals": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "symbol": {
                          "type": "string"
                        },
                        "chain": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "address",
                        "memo",
                        "qr",
                        "amount",
                        "amountBaseUnits",
                        "decimals",
                        "symbol",
                        "chain"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    }
                  },
                  "required": [
                    "attemptId",
                    "orderId",
                    "invoiceId",
                    "status",
                    "invoiceStatus",
                    "mode",
                    "asset",
                    "amountIn",
                    "payer",
                    "refundTo",
                    "amountReceived",
                    "amountRemaining",
                    "txs",
                    "failReason",
                    "etaSec",
                    "display",
                    "createdAt",
                    "updatedAt"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/checkout/{invoiceId}/attempts/{id}": {
      "get": {
        "summary": "Fetch a payment attempt",
        "description": "Refreshed from the provider when stale, like core `GET /v0/orders/{id}`. Poll it every 2 s while the page is visible, backing off to 10 s after 5 minutes (§4.5). It carries `invoiceStatus` too, so one poll drives the whole screen.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "invoiceId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The attempt and the invoice status it implies",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "attemptId": {
                      "type": "string"
                    },
                    "orderId": {
                      "type": "string"
                    },
                    "invoiceId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "awaiting_payment",
                        "detected",
                        "underpaid",
                        "confirming",
                        "paid",
                        "refunded",
                        "failed",
                        "expired",
                        "superseded"
                      ]
                    },
                    "invoiceStatus": {
                      "type": "string",
                      "enum": [
                        "open",
                        "processing",
                        "underpaid",
                        "paid",
                        "expired",
                        "canceled"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "wallet",
                        "transfer"
                      ]
                    },
                    "asset": {
                      "type": "string",
                      "minLength": 1,
                      "description": "CAIP-19 asset ID"
                    },
                    "amountIn": {
                      "type": "string",
                      "pattern": "^\\d+$",
                      "description": "Integer amount in the asset's base units"
                    },
                    "payer": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "refundTo": {
                      "type": "string"
                    },
                    "amountReceived": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "pattern": "^\\d+$",
                      "description": "Integer amount in the asset's base units"
                    },
                    "amountRemaining": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "pattern": "^\\d+$",
                      "description": "Integer amount in the asset's base units"
                    },
                    "txs": {
                      "type": "object",
                      "properties": {
                        "origin": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "settlement": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "refund": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "origin",
                        "settlement",
                        "refund"
                      ]
                    },
                    "failReason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "etaSec": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 0
                    },
                    "display": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "properties": {
                        "address": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "memo": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "qr": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "amount": {
                          "type": "string"
                        },
                        "amountBaseUnits": {
                          "type": "string",
                          "pattern": "^\\d+$",
                          "description": "Integer amount in the asset's base units"
                        },
                        "decimals": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "symbol": {
                          "type": "string"
                        },
                        "chain": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "address",
                        "memo",
                        "qr",
                        "amount",
                        "amountBaseUnits",
                        "decimals",
                        "symbol",
                        "chain"
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    },
                    "updatedAt": {
                      "type": "string",
                      "description": "ISO-8601 timestamp"
                    }
                  },
                  "required": [
                    "attemptId",
                    "orderId",
                    "invoiceId",
                    "status",
                    "invoiceStatus",
                    "mode",
                    "asset",
                    "amountIn",
                    "payer",
                    "refundTo",
                    "amountReceived",
                    "amountRemaining",
                    "txs",
                    "failReason",
                    "etaSec",
                    "display",
                    "createdAt",
                    "updatedAt"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/connect/check": {
      "post": {
        "summary": "Check a Connect request before showing it",
        "description": "Validates what a plugin sent to `dashboard.intents.fi/connect`: a known platform, https URLs, a `return_url` on the same origin as `site_url`, a `state` and an S256 `code_challenge`. A refused request is never shown and the browser is never sent to its `return_url`. Needs no authentication and reads nothing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "platform": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "description": "One of woocommerce, whmcs, prestashop, opencart, magento",
                    "example": "woocommerce"
                  },
                  "site_url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "description": "The store, e.g. `https://shop.example.com`",
                    "example": "https://shop.northwood.example"
                  },
                  "return_url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "description": "Where the browser goes back to. Must share `site_url`'s origin.",
                    "example": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return"
                  },
                  "state": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256,
                    "description": "The plugin's own random value, echoed back",
                    "example": "Vb3k9QxR2mT7LpZ4cW8nYaKd"
                  },
                  "code_challenge": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "base64url(SHA-256(code_verifier))",
                    "example": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM"
                  },
                  "code_challenge_method": {
                    "type": "string",
                    "enum": [
                      "S256"
                    ]
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "test",
                      "live"
                    ],
                    "description": "Default `test`"
                  },
                  "partner": {
                    "type": "string",
                    "maxLength": 64,
                    "description": "Agency Partner ID, when present"
                  }
                },
                "required": [
                  "platform",
                  "site_url",
                  "return_url",
                  "state",
                  "code_challenge"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A request the consent screen may show",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectRequest"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST, with `details.field`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/connect/authorize": {
      "post": {
        "summary": "Approve a Connect request (the consent screen's Connect button)",
        "description": "Dashboard session only. Re-checks the request, then issues a single-use code (5 minutes) bound to the site, the return URL and the challenge. `mode: live` is `LIVE_MODE_LOCKED` until the go-live checklist is done. Choose the account with `x-account-id`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "platform": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40,
                    "description": "One of woocommerce, whmcs, prestashop, opencart, magento",
                    "example": "woocommerce"
                  },
                  "site_url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "description": "The store, e.g. `https://shop.example.com`",
                    "example": "https://shop.northwood.example"
                  },
                  "return_url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "description": "Where the browser goes back to. Must share `site_url`'s origin.",
                    "example": "https://shop.northwood.example/wp-admin/admin-post.php?action=intentsfi_connect_return"
                  },
                  "state": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256,
                    "description": "The plugin's own random value, echoed back",
                    "example": "Vb3k9QxR2mT7LpZ4cW8nYaKd"
                  },
                  "code_challenge": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "base64url(SHA-256(code_verifier))",
                    "example": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM"
                  },
                  "code_challenge_method": {
                    "type": "string",
                    "enum": [
                      "S256"
                    ]
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "test",
                      "live"
                    ],
                    "description": "Default `test`"
                  },
                  "partner": {
                    "type": "string",
                    "maxLength": 64,
                    "description": "Agency Partner ID, when present"
                  }
                },
                "required": [
                  "platform",
                  "site_url",
                  "return_url",
                  "state",
                  "code_challenge"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Approved",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "redirectUrl": {
                      "type": "string",
                      "description": "`return_url` with `code` and `state` added"
                    },
                    "expiresAt": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "redirectUrl",
                    "expiresAt"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "description": "No valid dashboard session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "SESSION_REQUIRED for an API key; FORBIDDEN below the role needed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/connect/token": {
      "post": {
        "summary": "Exchange a Connect code for the store's keys (server to server)",
        "description": "Called by the plugin's server, never a browser. The code is spent by the first attempt, right or wrong; presenting a spent code again revokes the connection it made. Returns a secret key named for the site and scoped to the merchant, which can create invoices and register webhooks but never change where the merchant is paid. Test-mode keys unless the code was approved for live after go-live.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256,
                    "example": "<the code from return_url>"
                  },
                  "code_verifier": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256,
                    "example": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
                  },
                  "site_url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048,
                    "description": "The same `site_url` the request named",
                    "example": "https://shop.northwood.example"
                  }
                },
                "required": [
                  "code",
                  "code_verifier",
                  "site_url"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Connected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectToken"
                }
              }
            }
          },
          "400": {
            "description": "CONNECT_CODE_INVALID: unknown, expired, used, wrong verifier or site",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "LIVE_MODE_LOCKED or MERCHANT_RESTRICTED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/connect/revoke": {
      "post": {
        "summary": "Disconnect a store: revoke this key's connection",
        "description": "Authenticated with the connection's own secret key. Revokes its keys and the webhooks they registered, at once.",
        "responses": {
          "200": {
            "description": "Revoked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "revoked": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "connectionId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "revoked",
                    "connectionId"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "The key is not a Connect key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/links/{id}": {
      "get": {
        "summary": "What a payment link sells, for the link page",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicPaymentLink"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/links/{id}/invoices": {
      "post": {
        "summary": "One visit to a payment link: an invoice at the link's price, or the customer's amount",
        "description": "Takes the merchant's publishable key (pk_), or no key: the link ID is its capability, and a link can only create the invoice the merchant priced, or, on a `custom` link, one at an amount the customer chose inside the merchant's bounds. A key must match the link's account and mode. Body (optional JSON, schema `PaymentLinkInvoiceRequest`): `quantity`, `amount` (custom links, required there), `customerEmail`.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "201": {
            "description": "Created; send the customer to `url`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentLinkInvoice"
                }
              }
            }
          },
          "400": {
            "description": "A bad quantity or amount, or a key from the other mode",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Unknown or off",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "422": {
            "description": "AMOUNT_OUT_OF_RANGE: outside the link's minimum and maximum",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "description": "Too many from this IP, or on this custom-amount link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/affiliate/signup": {
      "post": {
        "tags": [
          "Affiliate"
        ],
        "summary": "Become an affiliate: a profile with a generated code",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AffiliateSignup"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AffiliateProfile"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST, with `details.field`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "description": "No valid dashboard session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "SESSION_REQUIRED for an API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "AFFILIATE_EXISTS: this user already has a profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/affiliate/me": {
      "get": {
        "tags": [
          "Affiliate"
        ],
        "summary": "The affiliate's profile, link, share, status and payout wallet (masked)",
        "responses": {
          "200": {
            "description": "Profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AffiliateProfile"
                }
              }
            }
          },
          "401": {
            "description": "No valid dashboard session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "SESSION_REQUIRED for an API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "AFFILIATE_REQUIRED: this user has no affiliate profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Affiliate"
        ],
        "summary": "Edit the display name, website, type, notifications, or change the code once",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AffiliatePatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AffiliateProfile"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST, with `details.field`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "description": "No valid dashboard session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "SESSION_REQUIRED for an API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "AFFILIATE_REQUIRED: this user has no affiliate profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "AFFILIATE_CODE_TAKEN, or AFFILIATE_CODE_LOCKED after one change",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/affiliate/me/close": {
      "post": {
        "tags": [
          "Affiliate"
        ],
        "summary": "Close the affiliate profile; only when nothing is pending, payable or held",
        "description": "Sets `status` to `closed` (a status, not a delete: the audit trail and the code stay reserved). Refused with `AFFILIATE_CLOSE_BLOCKED` while any commission is pending, payable or held, or a payout is pending. Added by Agent B (orchestrator decision, 2026-11-26).",
        "responses": {
          "200": {
            "description": "Closed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AffiliateProfile"
                }
              }
            }
          },
          "401": {
            "description": "No valid dashboard session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "SESSION_REQUIRED for an API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "AFFILIATE_REQUIRED: this user has no affiliate profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "AFFILIATE_CLOSE_BLOCKED: commission is still pending, payable or held",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/affiliate/overview": {
      "get": {
        "tags": [
          "Affiliate"
        ],
        "summary": "Totals, next payout, funnel and daily series",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d",
                "90d",
                "all"
              ],
              "description": "Default `30d`; the funnel and series"
            },
            "required": false,
            "description": "Default `30d`; the funnel and series",
            "name": "range",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Overview",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AffiliateOverview"
                }
              }
            }
          },
          "401": {
            "description": "No valid dashboard session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "SESSION_REQUIRED for an API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "AFFILIATE_REQUIRED: this user has no affiliate profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/affiliate/merchants": {
      "get": {
        "tags": [
          "Affiliate"
        ],
        "summary": "Earnings per referred merchant (masked); JSON or CSV",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "signed_up",
                "testing",
                "live",
                "inactive",
                "window_ended"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "link",
                "cookie",
                "visit",
                "plugin",
                "invite",
                "manual"
              ]
            },
            "required": false,
            "name": "source",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ],
              "description": "`csv` for a download"
            },
            "required": false,
            "description": "`csv` for a download",
            "name": "format",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Merchants",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ReferredMerchant"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "No valid dashboard session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "SESSION_REQUIRED for an API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "AFFILIATE_REQUIRED: this user has no affiliate profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/affiliate/commissions": {
      "get": {
        "tags": [
          "Affiliate"
        ],
        "summary": "The per-payment ledger; JSON or CSV",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "payable",
                "paid",
                "reversed",
                "held"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$",
              "example": "2026-12",
              "description": "Payment month, `YYYY-MM`"
            },
            "required": false,
            "description": "Payment month, `YYYY-MM`",
            "name": "month",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^\\d+$",
              "description": "A `merchantRef` from /v0/affiliate/merchants"
            },
            "required": false,
            "description": "A `merchantRef` from /v0/affiliate/merchants",
            "name": "merchant",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ],
              "description": "`csv` for a download"
            },
            "required": false,
            "description": "`csv` for a download",
            "name": "format",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Commissions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AffiliateCommission"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "No valid dashboard session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "SESSION_REQUIRED for an API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "AFFILIATE_REQUIRED: this user has no affiliate profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/affiliate/links": {
      "get": {
        "tags": [
          "Affiliate"
        ],
        "summary": "Tracked links with clicks, signups, live merchants and earnings each",
        "responses": {
          "200": {
            "description": "Links",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AffiliateLink"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid dashboard session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "SESSION_REQUIRED for an API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "AFFILIATE_REQUIRED: this user has no affiliate profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Affiliate"
        ],
        "summary": "Add a tracked link (a name for a sub-ID and a target page)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AffiliateLinkCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AffiliateLink"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST, with `details.field`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "description": "No valid dashboard session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "SESSION_REQUIRED for an API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "AFFILIATE_REQUIRED: this user has no affiliate profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "AFFILIATE_LINK_EXISTS: that sub-ID is already one of your links",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/affiliate/links/{id}": {
      "delete": {
        "tags": [
          "Affiliate"
        ],
        "summary": "Remove a tracked link (its past clicks still count)",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "204": {
            "description": "Removed"
          },
          "401": {
            "description": "No valid dashboard session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "SESSION_REQUIRED for an API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "AFFILIATE_REQUIRED: this user has no affiliate profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/affiliate/payout-wallet": {
      "put": {
        "tags": [
          "Affiliate"
        ],
        "summary": "Set the USDC payout wallet; a change after the first needs a step-up code",
        "description": "The first wallet takes effect at once. Every later change needs `stepUpCode` (purpose `affiliate_payout_wallet`). A wallet changed less than 24 hours before a payout run is skipped that month.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AffiliatePayoutWalletChange"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AffiliateProfile"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_REQUEST: bad checksum, unsupported chain or a known exchange address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "description": "No valid dashboard session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "SESSION_REQUIRED, STEP_UP_REQUIRED, AFFILIATE_SUSPENDED or AFFILIATE_CLOSED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "AFFILIATE_REQUIRED: this user has no affiliate profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/affiliate/step-up": {
      "post": {
        "tags": [
          "Affiliate"
        ],
        "summary": "Email a fresh code for a payout wallet change (purpose `affiliate_payout_wallet`)",
        "description": "Works without an account (an affiliate is a user's). `POST /v0/dashboard/step-up` with `purpose: affiliate_payout_wallet` issues the same code for a user who is an account member. Send the code as `stepUpCode` on `PUT /v0/affiliate/payout-wallet`. Added by Agent B (2026-11-26).",
        "responses": {
          "200": {
            "description": "A code was emailed to the signed-in user",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "challengeId": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "type": "string",
                      "example": "2026-11-26T12:00:00.000Z"
                    },
                    "sentTo": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "challengeId",
                    "expiresAt",
                    "sentTo"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid dashboard session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "SESSION_REQUIRED for an API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "AFFILIATE_REQUIRED: this user has no affiliate profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED: too many codes this hour",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/affiliate/payouts": {
      "get": {
        "tags": [
          "Affiliate"
        ],
        "summary": "Payout history",
        "responses": {
          "200": {
            "description": "Payouts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AffiliatePayout"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "No valid dashboard session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "SESSION_REQUIRED for an API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "AFFILIATE_REQUIRED: this user has no affiliate profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v0/ref/resolve": {
      "get": {
        "tags": [
          "Affiliate"
        ],
        "summary": "Public: is this an active affiliate code? For the plugin settings field",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 64
            },
            "required": true,
            "name": "code",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Cached for 5 minutes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefResolve"
                }
              }
            }
          }
        }
      }
    },
    "/v0/status": {
      "get": {
        "summary": "Route status",
        "description": "Per-protocol success and quote-error rates, the median improvement of intents.fi's best quote over NEAR Intents alone, recent failover events, and each protocol's state for each of the last 90 UTC days. Public, aggregates only, test mode excluded, recomputed at most once a minute.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "24h",
                "7d"
              ],
              "default": "24h",
              "description": "How far back the figures reach"
            },
            "required": false,
            "description": "How far back the figures reach",
            "name": "window",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "The route status for the window",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteStatus"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "invoice-event": {
      "post": {
        "summary": "Invoice event delivery",
        "description": "Sent to every active endpoint subscribed to the event's type. Signed as `x-intents-signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, t + \".\" + body)>`; verify over the **raw** body. Receivers must tolerate duplicates and out-of-order delivery: treat `data.status` as the truth and `type` as the reason you were woken. A 2xx marks it delivered; anything else is retried with backoff.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "`evt_…`"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "invoice.processing",
                      "invoice.underpaid",
                      "invoice.paid",
                      "invoice.expired",
                      "invoice.canceled",
                      "invoice.needs_review"
                    ]
                  },
                  "createdAt": {
                    "type": "string",
                    "description": "ISO-8601 timestamp"
                  },
                  "late": {
                    "type": "boolean"
                  },
                  "sample": {
                    "type": "boolean",
                    "enum": [
                      true
                    ],
                    "description": "Present (true) only on a test event: `data` is a sample test-mode invoice that does not exist. Never fulfil an order from it."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "open",
                          "processing",
                          "underpaid",
                          "paid",
                          "expired",
                          "canceled"
                        ]
                      },
                      "mode": {
                        "type": "string",
                        "enum": [
                          "live",
                          "test"
                        ]
                      },
                      "amount": {
                        "type": "string"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "reference": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "description": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "customerEmail": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "settlement": {
                        "type": "object",
                        "properties": {
                          "asset": {
                            "type": "string"
                          },
                          "address": {
                            "type": "string"
                          },
                          "amountExpected": {
                            "type": "string"
                          },
                          "amountNet": {
                            "type": "string"
                          },
                          "amountReceived": {
                            "type": "string"
                          },
                          "amountRemaining": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "asset",
                          "address",
                          "amountExpected",
                          "amountNet"
                        ]
                      },
                      "fee": {
                        "type": "object",
                        "properties": {
                          "bps": {
                            "type": "number"
                          },
                          "amount": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "bps",
                          "amount"
                        ]
                      },
                      "priceLock": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "rateUsd": {
                            "type": "string",
                            "description": "USD per settlement coin that the lock implied"
                          },
                          "lockedAt": {
                            "type": "string",
                            "description": "ISO-8601 timestamp"
                          }
                        },
                        "required": [
                          "rateUsd",
                          "lockedAt"
                        ],
                        "description": "§5.2, BTC settlement only: `settlement.amountExpected` was locked from live quotes at this rate. It may be re-locked once while nothing has been paid, if the price moves more than 2%. Null for stablecoin settlement, which is 1:1."
                      },
                      "absorbRouteCost": {
                        "type": "boolean",
                        "description": "§5.1, snapshotted from the merchant when the invoice was created. When true, a USDC or USDT payment is exact-input: the customer pays `amount` 1:1 and the settlement can be up to 1% below `amountExpected`."
                      },
                      "url": {
                        "type": "string"
                      },
                      "successUrl": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "cancelUrl": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "metadata": {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      "overpaid": {
                        "type": "boolean"
                      },
                      "needsReview": {
                        "type": "boolean"
                      },
                      "payer": {
                        "type": [
                          "object",
                          "null"
                        ],
                        "properties": {
                          "asset": {
                            "type": "string"
                          },
                          "address": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "asset",
                          "address"
                        ]
                      },
                      "txs": {
                        "type": "object",
                        "properties": {
                          "origin": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "settlement": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "refund": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "origin",
                          "settlement",
                          "refund"
                        ]
                      },
                      "channel": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "enum": [
                          "checkout",
                          "agent",
                          null
                        ],
                        "description": "The surface that took the payment: the paid attempt's channel, else the newest attempt's; null before any attempt."
                      },
                      "attempts": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "awaiting_payment",
                                "detected",
                                "underpaid",
                                "confirming",
                                "paid",
                                "refunded",
                                "failed",
                                "expired",
                                "superseded"
                              ],
                              "description": "One of: awaiting_payment, detected, underpaid, confirming, paid, refunded, failed, expired, superseded (§3.2)"
                            },
                            "mode": {
                              "type": "string",
                              "enum": [
                                "wallet",
                                "transfer"
                              ]
                            },
                            "channel": {
                              "type": "string",
                              "enum": [
                                "checkout",
                                "agent"
                              ],
                              "description": "`agent` when the attempt came from `POST /v0/checkout/{id}/agent`; `checkout` for the hosted page, the widget, plugins and headless integrations."
                            },
                            "asset": {
                              "type": "string"
                            },
                            "amountIn": {
                              "type": "string"
                            },
                            "createdAt": {
                              "type": "string",
                              "description": "ISO-8601 timestamp"
                            },
                            "updatedAt": {
                              "type": "string",
                              "description": "ISO-8601 timestamp"
                            }
                          },
                          "required": [
                            "id",
                            "status",
                            "mode",
                            "channel",
                            "asset",
                            "amountIn",
                            "createdAt",
                            "updatedAt"
                          ]
                        }
                      },
                      "expiresAt": {
                        "type": "string",
                        "description": "ISO-8601 timestamp"
                      },
                      "paidAt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "createdAt": {
                        "type": "string",
                        "description": "ISO-8601 timestamp"
                      },
                      "updatedAt": {
                        "type": "string",
                        "description": "ISO-8601 timestamp"
                      }
                    },
                    "required": [
                      "id",
                      "status",
                      "mode",
                      "amount",
                      "currency",
                      "reference",
                      "description",
                      "customerEmail",
                      "settlement",
                      "fee",
                      "priceLock",
                      "absorbRouteCost",
                      "url",
                      "successUrl",
                      "cancelUrl",
                      "metadata",
                      "overpaid",
                      "needsReview",
                      "payer",
                      "txs",
                      "channel",
                      "attempts",
                      "expiresAt",
                      "paidAt",
                      "createdAt",
                      "updatedAt"
                    ]
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged. Any 2xx counts; the body is ignored."
          }
        }
      }
    },
    "test-event": {
      "post": {
        "summary": "Test ping delivery (`webhook.test`)",
        "description": "Sent only when asked for, by \"Send test event\" on a live-mode endpoint. It carries no invoice. Signed like every other delivery; answer with a 2xx and otherwise ignore it.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "`evt_test_…`"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "webhook.test"
                    ]
                  },
                  "createdAt": {
                    "type": "string",
                    "description": "ISO-8601 timestamp"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "endpointId": {
                        "type": "string"
                      },
                      "mode": {
                        "type": "string",
                        "enum": [
                          "live",
                          "test"
                        ]
                      },
                      "message": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "endpointId",
                      "mode",
                      "message"
                    ]
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged. Any 2xx counts; the body is ignored."
          }
        }
      }
    }
  }
}
