squarefi-bff-api-module 1.36.51 → 1.36.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,7 @@ export interface paths {
12
12
  };
13
13
  /**
14
14
  * List API keys
15
- * @description Returns a list of all API keys for the authenticated user.
15
+ * @description Returns the API keys of every wallet where the caller is `owner` or `admin` (other memberships are skipped).
16
16
  *
17
17
  * **Authentication**: Bearer token and x-tenant-id header required
18
18
  *
@@ -63,7 +63,7 @@ export interface paths {
63
63
  put?: never;
64
64
  /**
65
65
  * Create API key
66
- * @description Creates a new API key for the authenticated user.
66
+ * @description Creates a new API key for `wallet_id`. The caller must be `owner` or `admin` of that wallet.
67
67
  *
68
68
  * **Authentication**: Bearer token and x-tenant-id header required
69
69
  *
@@ -138,6 +138,13 @@ export interface paths {
138
138
  };
139
139
  content?: never;
140
140
  };
141
+ /** @description Caller is not owner/admin of the wallet */
142
+ 403: {
143
+ headers: {
144
+ [name: string]: unknown;
145
+ };
146
+ content?: never;
147
+ };
141
148
  };
142
149
  };
143
150
  delete?: never;
@@ -299,7 +306,7 @@ export interface paths {
299
306
  };
300
307
  /**
301
308
  * List webhooks
302
- * @description Returns a list of all webhook URLs configured for the user's wallets.
309
+ * @description Returns the webhooks of every wallet where the caller is `owner` or `admin`; a `wallet_id` filter outside that set answers 403.
303
310
  *
304
311
  * Webhook URLs receive notifications about card transactions (authorizations, clearings, OTP).
305
312
  *
@@ -409,10 +416,10 @@ export interface paths {
409
416
  * "otp": null,
410
417
  * "cardholder": {
411
418
  * "id": "uuid",
412
- * "first_name": "Paul",
413
- * "last_name": "Kashuba",
419
+ * "first_name": "Jane",
420
+ * "last_name": "Doe",
414
421
  * "phone": "+15551234567",
415
- * "email": "p.kashuba@gmail.com",
422
+ * "email": "jane.doe@example.com",
416
423
  * "kyc_level": "basic"
417
424
  * },
418
425
  * "sub_account": {
@@ -577,7 +584,7 @@ export interface paths {
577
584
  /** Format: uuid */
578
585
  id?: string;
579
586
  /** @enum {string} */
580
- status?: "completed" | "failed";
587
+ status?: "pending" | "processing" | "completed" | "failed";
581
588
  error_message?: string | null;
582
589
  /** Format: date-time */
583
590
  created_at?: string;
@@ -765,8 +772,8 @@ export interface paths {
765
772
  "application/json": {
766
773
  /** @example true */
767
774
  success?: boolean;
768
- /** @example Webhook deleted successfully */
769
- message?: string;
775
+ /** @example null */
776
+ data?: Record<string, never> | null;
770
777
  };
771
778
  };
772
779
  };
@@ -1136,6 +1143,15 @@ export interface paths {
1136
1143
  };
1137
1144
  };
1138
1145
  };
1146
+ /** @description Validation error (missing name/type, invalid fields) or wallet not found */
1147
+ 400: {
1148
+ headers: {
1149
+ [name: string]: unknown;
1150
+ };
1151
+ content: {
1152
+ "application/json": components["schemas"]["ErrorResponse"];
1153
+ };
1154
+ };
1139
1155
  /** @description Access denied */
1140
1156
  403: {
1141
1157
  headers: {
@@ -1330,7 +1346,7 @@ export interface paths {
1330
1346
  parameters: {
1331
1347
  query?: {
1332
1348
  counterparty_account_id?: string;
1333
- type?: "ACH" | "SWIFT" | "SEPA" | "CRYPTO_EXTERNAL" | "CRYPTO_INTERNAL" | "CHAPS" | "FPS" | "FEDWIRE";
1349
+ type?: "ACH" | "RTP" | "SWIFT" | "SEPA" | "CRYPTO_EXTERNAL" | "CRYPTO_INTERNAL" | "CHAPS" | "FPS" | "FEDWIRE" | "INTERNAL";
1334
1350
  offset?: number;
1335
1351
  limit?: number;
1336
1352
  };
@@ -1621,7 +1637,7 @@ export interface paths {
1621
1637
  put?: never;
1622
1638
  /**
1623
1639
  * Create destination
1624
- * @description counterparty_account_id in body. User must have access to the account's wallet.
1640
+ * @description counterparty_account_id in body. Caller must be owner or admin of the account's wallet and the wallet's KYC must be APPROVED; other members receive 403.
1625
1641
  *
1626
1642
  * **Banking types**: banking_data required
1627
1643
  * **Crypto types**: crypto_data required
@@ -1641,7 +1657,7 @@ export interface paths {
1641
1657
  /** Format: uuid */
1642
1658
  counterparty_account_id: string;
1643
1659
  /** @enum {string} */
1644
- type: "ACH" | "SWIFT" | "SEPA" | "CRYPTO_EXTERNAL" | "CRYPTO_INTERNAL" | "CHAPS" | "FPS" | "FEDWIRE" | "INTERNAL";
1660
+ type: "ACH" | "RTP" | "SWIFT" | "SEPA" | "CRYPTO_EXTERNAL" | "CRYPTO_INTERNAL" | "CHAPS" | "FPS" | "FEDWIRE" | "INTERNAL";
1645
1661
  nickname?: string;
1646
1662
  banking_data?: Record<string, never>;
1647
1663
  crypto_data?: Record<string, never>;
@@ -1676,6 +1692,15 @@ export interface paths {
1676
1692
  };
1677
1693
  };
1678
1694
  };
1695
+ /** @description Validation error (type-specific payload missing or invalid, target wallet inactive, or the address country contradicts the bank code country — error code BANK_COUNTRY_MISMATCH) */
1696
+ 400: {
1697
+ headers: {
1698
+ [name: string]: unknown;
1699
+ };
1700
+ content: {
1701
+ "application/json": components["schemas"]["ErrorResponse"];
1702
+ };
1703
+ };
1679
1704
  /** @description Access denied */
1680
1705
  403: {
1681
1706
  headers: {
@@ -2037,7 +2062,7 @@ export interface paths {
2037
2062
  patch?: never;
2038
2063
  trace?: never;
2039
2064
  };
2040
- "/frontend/issuing/cards": {
2065
+ "/frontend/invoices/{wallet_id}": {
2041
2066
  parameters: {
2042
2067
  query?: never;
2043
2068
  header?: never;
@@ -2045,41 +2070,33 @@ export interface paths {
2045
2070
  cookie?: never;
2046
2071
  };
2047
2072
  /**
2048
- * List cards
2049
- * @description Retrieves a paginated list of cards for the authenticated user.
2050
- *
2051
- * **Authentication**: Bearer token with x-tenant-id header required
2052
- *
2073
+ * List invoices of a wallet
2074
+ * @description Newest first. `status` also accepts the derived OVERDUE; SENT and PARTIALLY_PAID then exclude their overdue rows, so the filterable statuses partition the list.
2053
2075
  */
2054
2076
  get: {
2055
2077
  parameters: {
2056
2078
  query?: {
2057
- /** @description Filter cards by wallet ID */
2058
- wallet_id?: string;
2059
- /** @description Filter cards by program ID */
2060
- program_id?: string;
2061
- /** @description Only cards drawing from this sub-account. */
2062
- sub_account_id?: string;
2063
- /** @description Filter cards by program sub-account type (prepaid or balance) */
2064
- sub_account_type?: "prepaid" | "balance";
2065
- /** @description Filter cards by status (matches issuing_cards.card_status).
2066
- * Accepts a single value or a comma-separated list, e.g. `status=ACTIVE,FROZEN`.
2067
- * */
2068
- status?: ("ACTIVE" | "INACTIVE" | "FROZEN" | "CANCELED" | "CLOSED" | "BLOCKED" | "FAILED" | "PENDING")[];
2069
- /** @description Filter cards by last 4 digits of the card number (partial, case-insensitive match) */
2070
- last4?: string;
2071
- /** @description Number of items to skip */
2072
- offset?: number;
2073
- /** @description Number of items to return */
2079
+ status?: "DRAFT" | "SENT" | "PARTIALLY_PAID" | "PAID" | "OVERDUE";
2080
+ counterparty_account_id?: string;
2081
+ /** @description Creation date lower bound (inclusive) */
2082
+ from_date?: string;
2083
+ /** @description Creation date upper bound (inclusive) */
2084
+ to_date?: string;
2085
+ /** @description Matches the invoice number, recipient name or notes */
2086
+ search?: string;
2074
2087
  limit?: number;
2088
+ offset?: number;
2075
2089
  };
2076
2090
  header?: never;
2077
- path?: never;
2091
+ path: {
2092
+ /** @description Wallet the invoices belong to */
2093
+ wallet_id: components["parameters"]["InvoiceWalletId"];
2094
+ };
2078
2095
  cookie?: never;
2079
2096
  };
2080
2097
  requestBody?: never;
2081
2098
  responses: {
2082
- /** @description List of cards retrieved successfully */
2099
+ /** @description Page of invoices */
2083
2100
  200: {
2084
2101
  headers: {
2085
2102
  [name: string]: unknown;
@@ -2088,168 +2105,54 @@ export interface paths {
2088
2105
  "application/json": {
2089
2106
  /** @example true */
2090
2107
  success?: boolean;
2091
- data?: components["schemas"]["IssuingCard"][];
2092
- pagination?: {
2093
- offset?: number;
2094
- limit?: number;
2095
- total?: number;
2096
- };
2108
+ data?: components["schemas"]["Invoice"][];
2109
+ pagination?: components["schemas"]["PaginationResponse"];
2097
2110
  };
2098
2111
  };
2099
2112
  };
2100
- /** @description User not authenticated */
2101
- 403: {
2102
- headers: {
2103
- [name: string]: unknown;
2104
- };
2105
- content?: never;
2106
- };
2107
- /** @description Server error */
2108
- 500: {
2109
- headers: {
2110
- [name: string]: unknown;
2111
- };
2112
- content?: never;
2113
- };
2114
2113
  };
2115
2114
  };
2116
2115
  put?: never;
2117
2116
  /**
2118
- * Create card
2119
- * @description Creates a new card. The card account type is automatically determined based on the program configuration:
2120
- * - **Account Card**: If program.sub_account_type = 'balance', requires `sub_account_id`
2121
- * - **Standalone Card**: If program.sub_account_type = 'prepaid', creates standalone card
2122
- *
2123
- * **Authentication**: Bearer token with Authorization header and x-tenant-id header required
2124
- *
2125
- * **Important**:
2126
- * - program_id is always required
2127
- * - The program's sub_account_type determines which additional fields are required
2128
- * - For Account cards: wallet_id is automatically retrieved from the sub-account
2129
- * - For Standalone cards: wallet_id must be provided explicitly
2130
- *
2131
- * **Cardholder is required**: Every card must be associated with a cardholder.
2132
- * Create a cardholder first via `POST /frontend/issuing/cardholders`, then pass the returned `cardholder_id` here.
2117
+ * Create an invoice draft
2118
+ * @description Creates a draft invoice: currency, line items and optionally the
2119
+ * recipient (a counterparty account), a manual invoice number, a due
2120
+ * date and free-form notes. When the number is omitted the backend
2121
+ * generates <prefix>-<n>: the prefix is the first two vowels of the
2122
+ * tenant name, n continues the tenant-wide invoice sequence. The total
2123
+ * is computed from the items. Nothing is emailed until the invoice is
2124
+ * sent. Requires an
2125
+ * administrative role on the wallet.
2133
2126
  *
2134
2127
  */
2135
2128
  post: {
2136
2129
  parameters: {
2137
2130
  query?: never;
2138
2131
  header?: never;
2139
- path?: never;
2132
+ path: {
2133
+ /** @description Wallet the invoices belong to */
2134
+ wallet_id: components["parameters"]["InvoiceWalletId"];
2135
+ };
2140
2136
  cookie?: never;
2141
2137
  };
2142
2138
  requestBody: {
2143
2139
  content: {
2144
2140
  "application/json": {
2145
- /**
2146
- * Format: uuid
2147
- * @description ID of the issuing program (determines card type)
2148
- * @example 987fcdeb-51a2-43d1-9012-345678901234
2149
- */
2150
- program_id: string;
2151
- /**
2152
- * Format: uuid
2153
- * @description ID of the sub-account (required if program.sub_account_type = 'balance')
2154
- * @example ef7f01df-b433-46cc-8d8c-3c318f1711be
2155
- */
2156
- sub_account_id?: string;
2157
- /**
2158
- * Format: uuid
2159
- * @description ID of the wallet (required for prepaid cards)
2160
- * @example 123e4567-e89b-12d3-a456-426614174000
2161
- */
2162
- wallet_id?: string;
2163
- /**
2164
- * Format: uuid
2165
- * @description ID of the cardholder to associate with this card.
2166
- * **Required.** Must be a valid cardholder ID retrieved from `GET /frontend/issuing/cardholders`
2167
- * or created via `POST /frontend/issuing/cardholders`.
2168
- * The cardholder will be automatically registered at the vendor if not already present.
2169
- *
2170
- * @example a1b2c3d4-e5f6-7890-abcd-ef1234567890
2171
- */
2172
- cardholder_id: string;
2173
- /**
2174
- * @description Name for the card
2175
- * @example My Card
2176
- */
2177
- card_name: string;
2178
- /**
2179
- * Format: uuid
2180
- * @description Optional. Binds the card to a wallet member so a scoped `user` role can
2181
- * access ONLY this card (view, sensitive data, transactions, freeze/unfreeze),
2182
- * and nothing else in the wallet. Must be the `user_data.uuid` of an
2183
- * active member of the target wallet; resolved server-side to the card's owner.
2184
- *
2185
- * @example a1b2c3d4-e5f6-7890-abcd-ef1234567890
2186
- */
2187
- assigned_user_data_uuid?: string;
2188
- /**
2189
- * Format: email
2190
- * @deprecated
2191
- * @description **Deprecated.** Use `cardholder_id` instead.
2192
- * Still accepted for backward compatibility but will be removed in a future version.
2193
- *
2194
- * @example user@example.com
2195
- */
2196
- email?: string;
2197
- /**
2198
- * @deprecated
2199
- * @description **Deprecated.** Use `cardholder_id` instead.
2200
- * Still accepted for backward compatibility but will be removed in a future version.
2201
- *
2202
- * @example +1234567890
2203
- */
2204
- mobile?: string;
2205
- /**
2206
- * @deprecated
2207
- * @description **Deprecated.** Use `cardholder_id` instead.
2208
- * Still accepted for backward compatibility but will be removed in a future version.
2209
- *
2210
- */
2211
- vendor_user_id?: string;
2212
- /**
2213
- * @description TOTAL wallet debit asked for at issuance: the issuing fee is subtracted and
2214
- * the remainder lands on the card's sub-account. Accepted only on group tariffs
2215
- * that already mandate an initial top-up (`initial_topup_usd > 0`); otherwise the
2216
- * group amount stands. Requires `currency_id`.
2217
- *
2218
- * @example 100
2219
- */
2220
- initial_topup?: number;
2221
- /**
2222
- * Format: uuid
2223
- * @description Wallet currency to debit for the issuing fee / initial top-up.
2224
- * **Required whenever the group tariff carries a fee or a top-up** — the request
2225
- * is refused with 400 otherwise.
2226
- *
2227
- */
2228
- currency_id?: string;
2229
- /**
2230
- * Format: uuid
2231
- * @description Client-generated idempotency key. A replay with the same value returns the
2232
- * already-created card (same wallet) instead of issuing/charging again; a value
2233
- * already used by another request is refused with 409. Globally unique.
2234
- *
2235
- */
2236
- request_id?: string;
2141
+ /** Format: uuid */
2142
+ counterparty_account_id?: string;
2143
+ invoice_number?: string;
2144
+ /** Format: uuid */
2145
+ currency_id: string;
2146
+ /** Format: date */
2147
+ due_date?: string;
2148
+ description?: string;
2149
+ items: components["schemas"]["InvoiceItemInput"][];
2237
2150
  };
2238
2151
  };
2239
2152
  };
2240
2153
  responses: {
2241
- /** @description Card created successfully. `data` is the same fully-decorated card shape as
2242
- * `GET /frontend/issuing/cards/{card_id}` — including `data.id` and
2243
- * `data.sub_account_id` (the sub-account the card spends from; for prepaid cards it
2244
- * is provisioned by this call).
2245
- *
2246
- * When the group tariff carried an issuing fee / initial top-up, `data` additionally
2247
- * reports the money outcome: `initial_topup_status` is `completed` when the top-up
2248
- * landed (or there was none to land), `topup_skipped` when no sub-account could
2249
- * receive it (nothing debited), and `topup_failed` when the top-up transfer failed —
2250
- * the card exists either way; `initial_topup_error` carries the failure reason.
2251
- * */
2252
- 201: {
2154
+ /** @description Draft created */
2155
+ 200: {
2253
2156
  headers: {
2254
2157
  [name: string]: unknown;
2255
2158
  };
@@ -2257,81 +2160,37 @@ export interface paths {
2257
2160
  "application/json": {
2258
2161
  /** @example true */
2259
2162
  success?: boolean;
2260
- data?: components["schemas"]["IssuingCard"] & {
2261
- /**
2262
- * @description Outcome of the issuance-time initial top-up. Present only when the tariff charged at issuance.
2263
- * @enum {string}
2264
- */
2265
- initial_topup_status?: "completed" | "topup_failed" | "topup_skipped";
2266
- /** @description Reason the initial top-up was skipped or failed. Present only when initial_topup_status is not `completed`. */
2267
- initial_topup_error?: string;
2163
+ data?: components["schemas"]["Invoice"] & {
2164
+ items?: components["schemas"]["InvoiceItem"][];
2268
2165
  };
2269
- /** @example Card created successfully */
2270
- message?: string;
2271
2166
  };
2272
2167
  };
2273
2168
  };
2274
- /** @description Bad Request - One of the following:
2275
- * - Missing program_id
2276
- * - Missing required fields based on program type
2277
- * - Unsupported program type
2278
- * */
2169
+ /** @description Validation error */
2279
2170
  400: {
2280
2171
  headers: {
2281
2172
  [name: string]: unknown;
2282
2173
  };
2283
2174
  content: {
2284
- "application/json": {
2285
- /** @example false */
2286
- success?: boolean;
2287
- error?: string;
2288
- };
2289
- };
2290
- };
2291
- /** @description Forbidden - One of the following:
2292
- * - Sub-account not found
2293
- * - Wallet not found or access denied
2294
- * - Program not available for this tenant
2295
- * - Program vendor ID is not configured
2296
- * */
2297
- 403: {
2298
- headers: {
2299
- [name: string]: unknown;
2300
- };
2301
- content: {
2302
- "application/json": {
2303
- /** @example false */
2304
- success?: boolean;
2305
- error?: string;
2306
- };
2175
+ "application/json": components["schemas"]["ErrorResponse"];
2307
2176
  };
2308
2177
  };
2309
- /** @description Program not found */
2310
- 404: {
2178
+ /** @description Invoice number is already taken in this wallet */
2179
+ 409: {
2311
2180
  headers: {
2312
2181
  [name: string]: unknown;
2313
2182
  };
2314
2183
  content: {
2315
- "application/json": {
2316
- /** @example false */
2317
- success?: boolean;
2318
- /** @example Program not found */
2319
- error?: string;
2320
- };
2184
+ "application/json": components["schemas"]["ErrorResponse"];
2321
2185
  };
2322
2186
  };
2323
- /** @description Internal Server Error */
2324
- 500: {
2187
+ /** @description Rate limit exceeded */
2188
+ 429: {
2325
2189
  headers: {
2326
2190
  [name: string]: unknown;
2327
2191
  };
2328
2192
  content: {
2329
- "application/json": {
2330
- /** @example false */
2331
- success?: boolean;
2332
- /** @example Failed to create card */
2333
- error?: string;
2334
- };
2193
+ "application/json": components["schemas"]["ErrorResponse"];
2335
2194
  };
2336
2195
  };
2337
2196
  };
@@ -2342,7 +2201,7 @@ export interface paths {
2342
2201
  patch?: never;
2343
2202
  trace?: never;
2344
2203
  };
2345
- "/frontend/issuing/cards/{card_id}": {
2204
+ "/frontend/invoices/{wallet_id}/{id}": {
2346
2205
  parameters: {
2347
2206
  query?: never;
2348
2207
  header?: never;
@@ -2350,9 +2209,774 @@ export interface paths {
2350
2209
  cookie?: never;
2351
2210
  };
2352
2211
  /**
2353
- * Get card
2354
- * @description Retrieves detailed information about a specific card.
2355
- *
2212
+ * Get an invoice
2213
+ * @description Invoice details with its line items and linked payments.
2214
+ */
2215
+ get: {
2216
+ parameters: {
2217
+ query?: never;
2218
+ header?: never;
2219
+ path: {
2220
+ /** @description Wallet the invoices belong to */
2221
+ wallet_id: components["parameters"]["InvoiceWalletId"];
2222
+ id: components["parameters"]["InvoiceId"];
2223
+ };
2224
+ cookie?: never;
2225
+ };
2226
+ requestBody?: never;
2227
+ responses: {
2228
+ /** @description Invoice with items and payments */
2229
+ 200: {
2230
+ headers: {
2231
+ [name: string]: unknown;
2232
+ };
2233
+ content: {
2234
+ "application/json": {
2235
+ /** @example true */
2236
+ success?: boolean;
2237
+ data?: components["schemas"]["Invoice"] & {
2238
+ items?: components["schemas"]["InvoiceItem"][];
2239
+ payments?: components["schemas"]["InvoicePayment"][];
2240
+ };
2241
+ };
2242
+ };
2243
+ };
2244
+ /** @description Invoice not found */
2245
+ 404: {
2246
+ headers: {
2247
+ [name: string]: unknown;
2248
+ };
2249
+ content: {
2250
+ "application/json": components["schemas"]["ErrorResponse"];
2251
+ };
2252
+ };
2253
+ };
2254
+ };
2255
+ put?: never;
2256
+ post?: never;
2257
+ /**
2258
+ * Delete an invoice draft
2259
+ * @description Draft-only. A sent invoice cannot be deleted.
2260
+ */
2261
+ delete: {
2262
+ parameters: {
2263
+ query?: never;
2264
+ header?: never;
2265
+ path: {
2266
+ /** @description Wallet the invoices belong to */
2267
+ wallet_id: components["parameters"]["InvoiceWalletId"];
2268
+ id: components["parameters"]["InvoiceId"];
2269
+ };
2270
+ cookie?: never;
2271
+ };
2272
+ requestBody?: never;
2273
+ responses: {
2274
+ /** @description Draft deleted */
2275
+ 200: {
2276
+ headers: {
2277
+ [name: string]: unknown;
2278
+ };
2279
+ content: {
2280
+ "application/json": {
2281
+ /** @example true */
2282
+ success?: boolean;
2283
+ data?: {
2284
+ /** Format: uuid */
2285
+ id?: string;
2286
+ /** @example true */
2287
+ deleted?: boolean;
2288
+ };
2289
+ };
2290
+ };
2291
+ };
2292
+ /** @description Invoice is not a draft anymore */
2293
+ 409: {
2294
+ headers: {
2295
+ [name: string]: unknown;
2296
+ };
2297
+ content: {
2298
+ "application/json": components["schemas"]["ErrorResponse"];
2299
+ };
2300
+ };
2301
+ };
2302
+ };
2303
+ options?: never;
2304
+ head?: never;
2305
+ /**
2306
+ * Edit an invoice draft
2307
+ * @description Draft-only. `items` fully replaces the line list; explicit null clears `counterparty_account_id`, `due_date` or `description`.
2308
+ */
2309
+ patch: {
2310
+ parameters: {
2311
+ query?: never;
2312
+ header?: never;
2313
+ path: {
2314
+ /** @description Wallet the invoices belong to */
2315
+ wallet_id: components["parameters"]["InvoiceWalletId"];
2316
+ id: components["parameters"]["InvoiceId"];
2317
+ };
2318
+ cookie?: never;
2319
+ };
2320
+ requestBody: {
2321
+ content: {
2322
+ "application/json": {
2323
+ /** Format: uuid */
2324
+ counterparty_account_id?: string | null;
2325
+ invoice_number?: string;
2326
+ /** Format: uuid */
2327
+ currency_id?: string;
2328
+ /** Format: date */
2329
+ due_date?: string | null;
2330
+ description?: string | null;
2331
+ items?: components["schemas"]["InvoiceItemInput"][];
2332
+ };
2333
+ };
2334
+ };
2335
+ responses: {
2336
+ /** @description Updated draft */
2337
+ 200: {
2338
+ headers: {
2339
+ [name: string]: unknown;
2340
+ };
2341
+ content: {
2342
+ "application/json": {
2343
+ /** @example true */
2344
+ success?: boolean;
2345
+ data?: components["schemas"]["Invoice"] & {
2346
+ items?: components["schemas"]["InvoiceItem"][];
2347
+ };
2348
+ };
2349
+ };
2350
+ };
2351
+ /** @description Invoice is not editable anymore (already sent) */
2352
+ 409: {
2353
+ headers: {
2354
+ [name: string]: unknown;
2355
+ };
2356
+ content: {
2357
+ "application/json": components["schemas"]["ErrorResponse"];
2358
+ };
2359
+ };
2360
+ };
2361
+ };
2362
+ trace?: never;
2363
+ };
2364
+ "/frontend/invoices/{wallet_id}/{id}/send": {
2365
+ parameters: {
2366
+ query?: never;
2367
+ header?: never;
2368
+ path?: never;
2369
+ cookie?: never;
2370
+ };
2371
+ get?: never;
2372
+ put?: never;
2373
+ /**
2374
+ * Send an invoice
2375
+ * @description Emails the invoice (PDF attached) to the recipient and marks it SENT.
2376
+ * The recipient is the supplied `recipient_email`, or the counterparty
2377
+ * account's email; without either the send is refused. Requires a due
2378
+ * date and at least one line item. Recipient details are snapshotted
2379
+ * onto the invoice — later counterparty edits do not change the issued
2380
+ * document. Re-sending a SENT invoice re-emails it without any state
2381
+ * change.
2382
+ *
2383
+ */
2384
+ post: {
2385
+ parameters: {
2386
+ query?: never;
2387
+ header?: never;
2388
+ path: {
2389
+ /** @description Wallet the invoices belong to */
2390
+ wallet_id: components["parameters"]["InvoiceWalletId"];
2391
+ id: components["parameters"]["InvoiceId"];
2392
+ };
2393
+ cookie?: never;
2394
+ };
2395
+ requestBody?: {
2396
+ content: {
2397
+ "application/json": {
2398
+ /** Format: email */
2399
+ recipient_email?: string;
2400
+ };
2401
+ };
2402
+ };
2403
+ responses: {
2404
+ /** @description Invoice sent */
2405
+ 200: {
2406
+ headers: {
2407
+ [name: string]: unknown;
2408
+ };
2409
+ content: {
2410
+ "application/json": {
2411
+ /** @example true */
2412
+ success?: boolean;
2413
+ data?: components["schemas"]["Invoice"];
2414
+ };
2415
+ };
2416
+ };
2417
+ /** @description Missing recipient email, due date or line items */
2418
+ 400: {
2419
+ headers: {
2420
+ [name: string]: unknown;
2421
+ };
2422
+ content: {
2423
+ "application/json": components["schemas"]["ErrorResponse"];
2424
+ };
2425
+ };
2426
+ /** @description Invoice cannot be sent in its current status */
2427
+ 409: {
2428
+ headers: {
2429
+ [name: string]: unknown;
2430
+ };
2431
+ content: {
2432
+ "application/json": components["schemas"]["ErrorResponse"];
2433
+ };
2434
+ };
2435
+ /** @description The invoice email could not be delivered */
2436
+ 503: {
2437
+ headers: {
2438
+ [name: string]: unknown;
2439
+ };
2440
+ content: {
2441
+ "application/json": components["schemas"]["ErrorResponse"];
2442
+ };
2443
+ };
2444
+ };
2445
+ };
2446
+ delete?: never;
2447
+ options?: never;
2448
+ head?: never;
2449
+ patch?: never;
2450
+ trace?: never;
2451
+ };
2452
+ "/frontend/invoices/{wallet_id}/{id}/pdf": {
2453
+ parameters: {
2454
+ query?: never;
2455
+ header?: never;
2456
+ path?: never;
2457
+ cookie?: never;
2458
+ };
2459
+ /**
2460
+ * Download the invoice PDF
2461
+ * @description Generated on the fly and streamed; nothing is persisted.
2462
+ */
2463
+ get: {
2464
+ parameters: {
2465
+ query?: never;
2466
+ header?: never;
2467
+ path: {
2468
+ /** @description Wallet the invoices belong to */
2469
+ wallet_id: components["parameters"]["InvoiceWalletId"];
2470
+ id: components["parameters"]["InvoiceId"];
2471
+ };
2472
+ cookie?: never;
2473
+ };
2474
+ requestBody?: never;
2475
+ responses: {
2476
+ /** @description PDF file */
2477
+ 200: {
2478
+ headers: {
2479
+ [name: string]: unknown;
2480
+ };
2481
+ content: {
2482
+ "application/pdf": string;
2483
+ };
2484
+ };
2485
+ /** @description Invoice not found */
2486
+ 404: {
2487
+ headers: {
2488
+ [name: string]: unknown;
2489
+ };
2490
+ content: {
2491
+ "application/json": components["schemas"]["ErrorResponse"];
2492
+ };
2493
+ };
2494
+ };
2495
+ };
2496
+ put?: never;
2497
+ post?: never;
2498
+ delete?: never;
2499
+ options?: never;
2500
+ head?: never;
2501
+ patch?: never;
2502
+ trace?: never;
2503
+ };
2504
+ "/frontend/invoices/{wallet_id}/{id}/payments": {
2505
+ parameters: {
2506
+ query?: never;
2507
+ header?: never;
2508
+ path?: never;
2509
+ cookie?: never;
2510
+ };
2511
+ get?: never;
2512
+ put?: never;
2513
+ /**
2514
+ * Link an incoming order as a payment
2515
+ * @description Manually links a settled incoming (deposit) order of the wallet to the
2516
+ * invoice. The order must have credited the invoice currency and must
2517
+ * not be linked to any other invoice; it always counts with its full
2518
+ * credited amount. The invoice moves to PARTIALLY_PAID or PAID depending
2519
+ * on the covered total.
2520
+ *
2521
+ */
2522
+ post: {
2523
+ parameters: {
2524
+ query?: never;
2525
+ header?: never;
2526
+ path: {
2527
+ /** @description Wallet the invoices belong to */
2528
+ wallet_id: components["parameters"]["InvoiceWalletId"];
2529
+ id: components["parameters"]["InvoiceId"];
2530
+ };
2531
+ cookie?: never;
2532
+ };
2533
+ requestBody: {
2534
+ content: {
2535
+ "application/json": {
2536
+ /**
2537
+ * Format: uuid
2538
+ * @description Order id (the `id` field of the order endpoints)
2539
+ */
2540
+ order_id: string;
2541
+ };
2542
+ };
2543
+ };
2544
+ responses: {
2545
+ /** @description Payment linked; the updated invoice is returned */
2546
+ 200: {
2547
+ headers: {
2548
+ [name: string]: unknown;
2549
+ };
2550
+ content: {
2551
+ "application/json": {
2552
+ /** @example true */
2553
+ success?: boolean;
2554
+ data?: components["schemas"]["Invoice"] & {
2555
+ payment?: components["schemas"]["InvoicePayment"];
2556
+ };
2557
+ };
2558
+ };
2559
+ };
2560
+ /** @description The order cannot be linked (not found, not incoming, not settled, wrong currency, already linked) */
2561
+ 400: {
2562
+ headers: {
2563
+ [name: string]: unknown;
2564
+ };
2565
+ content: {
2566
+ "application/json": components["schemas"]["ErrorResponse"];
2567
+ };
2568
+ };
2569
+ /** @description The invoice is not in a payable status */
2570
+ 409: {
2571
+ headers: {
2572
+ [name: string]: unknown;
2573
+ };
2574
+ content: {
2575
+ "application/json": components["schemas"]["ErrorResponse"];
2576
+ };
2577
+ };
2578
+ };
2579
+ };
2580
+ delete?: never;
2581
+ options?: never;
2582
+ head?: never;
2583
+ patch?: never;
2584
+ trace?: never;
2585
+ };
2586
+ "/frontend/invoices/{wallet_id}/{id}/payments/{payment_id}": {
2587
+ parameters: {
2588
+ query?: never;
2589
+ header?: never;
2590
+ path?: never;
2591
+ cookie?: never;
2592
+ };
2593
+ get?: never;
2594
+ put?: never;
2595
+ post?: never;
2596
+ /**
2597
+ * Unlink a payment from an invoice
2598
+ * @description Removes a manually linked payment (wrong order, wrong invoice). The
2599
+ * order becomes linkable again and the invoice totals are recomputed:
2600
+ * a fully paid invoice moves back to PARTIALLY_PAID, or to SENT once no
2601
+ * payments remain. Requires an administrative role on the wallet.
2602
+ *
2603
+ */
2604
+ delete: {
2605
+ parameters: {
2606
+ query?: never;
2607
+ header?: never;
2608
+ path: {
2609
+ /** @description Wallet the invoices belong to */
2610
+ wallet_id: components["parameters"]["InvoiceWalletId"];
2611
+ id: components["parameters"]["InvoiceId"];
2612
+ /** @description Id of the linked payment (from the invoice details `payments` list) */
2613
+ payment_id: components["parameters"]["InvoicePaymentId"];
2614
+ };
2615
+ cookie?: never;
2616
+ };
2617
+ requestBody?: never;
2618
+ responses: {
2619
+ /** @description Payment unlinked; the updated invoice is returned */
2620
+ 200: {
2621
+ headers: {
2622
+ [name: string]: unknown;
2623
+ };
2624
+ content: {
2625
+ "application/json": {
2626
+ /** @example true */
2627
+ success?: boolean;
2628
+ data?: components["schemas"]["Invoice"];
2629
+ };
2630
+ };
2631
+ };
2632
+ /** @description Invoice or payment not found */
2633
+ 404: {
2634
+ headers: {
2635
+ [name: string]: unknown;
2636
+ };
2637
+ content: {
2638
+ "application/json": components["schemas"]["ErrorResponse"];
2639
+ };
2640
+ };
2641
+ /** @description Another payment operation on this invoice is in progress */
2642
+ 409: {
2643
+ headers: {
2644
+ [name: string]: unknown;
2645
+ };
2646
+ content: {
2647
+ "application/json": components["schemas"]["ErrorResponse"];
2648
+ };
2649
+ };
2650
+ };
2651
+ };
2652
+ options?: never;
2653
+ head?: never;
2654
+ patch?: never;
2655
+ trace?: never;
2656
+ };
2657
+ "/frontend/issuing/cards": {
2658
+ parameters: {
2659
+ query?: never;
2660
+ header?: never;
2661
+ path?: never;
2662
+ cookie?: never;
2663
+ };
2664
+ /**
2665
+ * List cards
2666
+ * @description Retrieves a paginated list of cards for the authenticated user.
2667
+ *
2668
+ * **Authentication**: Bearer token with x-tenant-id header required
2669
+ *
2670
+ */
2671
+ get: {
2672
+ parameters: {
2673
+ query: {
2674
+ /** @description Wallet ID (required) — cards are scoped to this wallet */
2675
+ wallet_id: string;
2676
+ /** @description Filter cards by program ID */
2677
+ program_id?: string;
2678
+ /** @description Only cards drawing from this sub-account. */
2679
+ sub_account_id?: string;
2680
+ /** @description Filter cards by program sub-account type (prepaid or balance) */
2681
+ sub_account_type?: "prepaid" | "balance";
2682
+ /** @description Filter cards by status (matches issuing_cards.card_status).
2683
+ * Accepts a single value or a comma-separated list, e.g. `status=ACTIVE,FROZEN`.
2684
+ * */
2685
+ status?: ("ACTIVE" | "INACTIVE" | "FROZEN" | "CANCELED" | "CLOSED" | "BLOCKED" | "FAILED" | "PENDING")[];
2686
+ /** @description Filter cards by last 4 digits of the card number (partial, case-insensitive match) */
2687
+ last4?: string;
2688
+ /** @description Number of items to skip */
2689
+ offset?: number;
2690
+ /** @description Number of items to return */
2691
+ limit?: number;
2692
+ };
2693
+ header?: never;
2694
+ path?: never;
2695
+ cookie?: never;
2696
+ };
2697
+ requestBody?: never;
2698
+ responses: {
2699
+ /** @description List of cards retrieved successfully */
2700
+ 200: {
2701
+ headers: {
2702
+ [name: string]: unknown;
2703
+ };
2704
+ content: {
2705
+ "application/json": {
2706
+ /** @example true */
2707
+ success?: boolean;
2708
+ data?: components["schemas"]["IssuingCard"][];
2709
+ pagination?: {
2710
+ offset?: number;
2711
+ limit?: number;
2712
+ total?: number;
2713
+ };
2714
+ };
2715
+ };
2716
+ };
2717
+ /** @description User not authenticated */
2718
+ 403: {
2719
+ headers: {
2720
+ [name: string]: unknown;
2721
+ };
2722
+ content?: never;
2723
+ };
2724
+ /** @description Server error */
2725
+ 500: {
2726
+ headers: {
2727
+ [name: string]: unknown;
2728
+ };
2729
+ content?: never;
2730
+ };
2731
+ };
2732
+ };
2733
+ put?: never;
2734
+ /**
2735
+ * Create card
2736
+ * @description Creates a new card. The card account type is automatically determined based on the program configuration:
2737
+ * - **Account Card**: If program.sub_account_type = 'balance', requires `sub_account_id`
2738
+ * - **Standalone Card**: If program.sub_account_type = 'prepaid', creates standalone card
2739
+ *
2740
+ * **Authentication**: Bearer token with Authorization header and x-tenant-id header required
2741
+ *
2742
+ * **Important**:
2743
+ * - program_id is always required
2744
+ * - The program's sub_account_type determines which additional fields are required
2745
+ * - `wallet_id` is always required in the body — the caller must be owner/admin of that wallet;
2746
+ * for balance cards it is additionally re-checked against the sub-account's wallet
2747
+ *
2748
+ * **Cardholder**: every card is issued to an ACTIVE (submitted) cardholder. Pass `cardholder_id`,
2749
+ * or omit it to use the cardholder linked to `assigned_user_data_uuid` (else to the caller) —
2750
+ * 400 `CARDHOLDER_NOT_LINKED` when none is linked. Card creation never registers anyone at the vendor.
2751
+ *
2752
+ */
2753
+ post: {
2754
+ parameters: {
2755
+ query?: never;
2756
+ header?: never;
2757
+ path?: never;
2758
+ cookie?: never;
2759
+ };
2760
+ requestBody: {
2761
+ content: {
2762
+ "application/json": {
2763
+ /**
2764
+ * Format: uuid
2765
+ * @description ID of the issuing program (determines card type)
2766
+ * @example 987fcdeb-51a2-43d1-9012-345678901234
2767
+ */
2768
+ program_id: string;
2769
+ /**
2770
+ * Format: uuid
2771
+ * @description ID of the sub-account (required if program.sub_account_type = 'balance')
2772
+ * @example ef7f01df-b433-46cc-8d8c-3c318f1711be
2773
+ */
2774
+ sub_account_id?: string;
2775
+ /**
2776
+ * Format: uuid
2777
+ * @description ID of the wallet (required)
2778
+ * @example 123e4567-e89b-12d3-a456-426614174000
2779
+ */
2780
+ wallet_id?: string;
2781
+ /**
2782
+ * Format: uuid
2783
+ * @description ID of the cardholder to associate with this card. Optional — when omitted the
2784
+ * cardholder linked to `assigned_user_data_uuid` (else to the caller) is used.
2785
+ * The cardholder must already be ACTIVE (submitted via `POST /frontend/issuing/cardholders/{id}/submit`).
2786
+ *
2787
+ * @example a1b2c3d4-e5f6-7890-abcd-ef1234567890
2788
+ */
2789
+ cardholder_id?: string;
2790
+ /**
2791
+ * @description Name for the card
2792
+ * @example My Card
2793
+ */
2794
+ card_name: string;
2795
+ /**
2796
+ * Format: uuid
2797
+ * @description Optional. Binds the card to a wallet member so a scoped `user` role can
2798
+ * access ONLY this card (view, sensitive data, transactions, freeze/unfreeze),
2799
+ * and nothing else in the wallet. Must be the `user_data.uuid` of an
2800
+ * active member of the target wallet; resolved server-side to the card's owner.
2801
+ *
2802
+ * @example a1b2c3d4-e5f6-7890-abcd-ef1234567890
2803
+ */
2804
+ assigned_user_data_uuid?: string;
2805
+ /**
2806
+ * Format: email
2807
+ * @deprecated
2808
+ * @description **Deprecated.** Use `cardholder_id` instead.
2809
+ * Ignored (a deprecation warning is logged) — contact data comes from the cardholder record.
2810
+ *
2811
+ * @example user@example.com
2812
+ */
2813
+ email?: string;
2814
+ /**
2815
+ * @deprecated
2816
+ * @description **Deprecated.** Use `cardholder_id` instead.
2817
+ * Ignored (a deprecation warning is logged) — contact data comes from the cardholder record.
2818
+ *
2819
+ * @example +1234567890
2820
+ */
2821
+ mobile?: string;
2822
+ /**
2823
+ * @deprecated
2824
+ * @description **Deprecated.** Use `cardholder_id` instead.
2825
+ * Ignored (a deprecation warning is logged) — contact data comes from the cardholder record.
2826
+ *
2827
+ */
2828
+ vendor_user_id?: string;
2829
+ /**
2830
+ * @description TOTAL wallet debit asked for at issuance: the issuing fee is subtracted and
2831
+ * the remainder lands on the card's sub-account. Accepted only on group tariffs
2832
+ * that already mandate an initial top-up (`initial_topup_usd > 0`); otherwise the
2833
+ * group amount stands. Requires `currency_id`.
2834
+ *
2835
+ * @example 100
2836
+ */
2837
+ initial_topup?: number;
2838
+ /**
2839
+ * Format: uuid
2840
+ * @description Wallet currency to debit for the issuing fee / initial top-up.
2841
+ * **Required whenever the group tariff carries a fee or a top-up** — the request
2842
+ * is refused with 400 otherwise.
2843
+ *
2844
+ */
2845
+ currency_id?: string;
2846
+ /**
2847
+ * Format: uuid
2848
+ * @description Client-generated idempotency key. A replay with the same value returns the
2849
+ * already-created card (same wallet) instead of issuing/charging again; a value
2850
+ * already used by another request is refused with 409. Globally unique.
2851
+ *
2852
+ */
2853
+ request_id?: string;
2854
+ };
2855
+ };
2856
+ };
2857
+ responses: {
2858
+ /** @description Card created successfully. `data` is the same fully-decorated card shape as
2859
+ * `GET /frontend/issuing/cards/{card_id}` — including `data.id` and
2860
+ * `data.sub_account_id` (the sub-account the card spends from; for prepaid cards it
2861
+ * is provisioned by this call).
2862
+ *
2863
+ * When the group tariff carried an issuing fee / initial top-up, `data` additionally
2864
+ * reports the money outcome: `initial_topup_status` is `completed` when the top-up
2865
+ * landed (or there was none to land), `topup_skipped` when no sub-account could
2866
+ * receive it (nothing debited), and `topup_failed` when the top-up transfer failed —
2867
+ * the card exists either way; `initial_topup_error` carries the failure reason.
2868
+ * */
2869
+ 201: {
2870
+ headers: {
2871
+ [name: string]: unknown;
2872
+ };
2873
+ content: {
2874
+ "application/json": {
2875
+ /** @example true */
2876
+ success?: boolean;
2877
+ data?: components["schemas"]["IssuingCard"] & {
2878
+ /**
2879
+ * @description Outcome of the issuance-time initial top-up. Present only when the tariff charged at issuance.
2880
+ * @enum {string}
2881
+ */
2882
+ initial_topup_status?: "completed" | "topup_failed" | "topup_skipped";
2883
+ /** @description Reason the initial top-up was skipped or failed. Present only when initial_topup_status is not `completed`. */
2884
+ initial_topup_error?: string;
2885
+ };
2886
+ /** @example Card created successfully */
2887
+ message?: string;
2888
+ };
2889
+ };
2890
+ };
2891
+ /** @description Bad Request - One of the following:
2892
+ * - Missing program_id
2893
+ * - Missing required fields based on program type
2894
+ * - Unsupported program type
2895
+ * */
2896
+ 400: {
2897
+ headers: {
2898
+ [name: string]: unknown;
2899
+ };
2900
+ content: {
2901
+ "application/json": {
2902
+ /** @example false */
2903
+ success?: boolean;
2904
+ error?: string;
2905
+ };
2906
+ };
2907
+ };
2908
+ /** @description Forbidden - One of the following:
2909
+ * - Sub-account not found
2910
+ * - Wallet not found or access denied
2911
+ * - Program not available for this tenant
2912
+ * - Program vendor ID is not configured
2913
+ * */
2914
+ 403: {
2915
+ headers: {
2916
+ [name: string]: unknown;
2917
+ };
2918
+ content: {
2919
+ "application/json": {
2920
+ /** @example false */
2921
+ success?: boolean;
2922
+ error?: string;
2923
+ };
2924
+ };
2925
+ };
2926
+ /** @description Program not found */
2927
+ 404: {
2928
+ headers: {
2929
+ [name: string]: unknown;
2930
+ };
2931
+ content: {
2932
+ "application/json": {
2933
+ /** @example false */
2934
+ success?: boolean;
2935
+ /** @example Program not found */
2936
+ error?: string;
2937
+ };
2938
+ };
2939
+ };
2940
+ /** @description `request_id` was already used by another card request (replay refused) */
2941
+ 409: {
2942
+ headers: {
2943
+ [name: string]: unknown;
2944
+ };
2945
+ content?: never;
2946
+ };
2947
+ /** @description Internal Server Error */
2948
+ 500: {
2949
+ headers: {
2950
+ [name: string]: unknown;
2951
+ };
2952
+ content: {
2953
+ "application/json": {
2954
+ /** @example false */
2955
+ success?: boolean;
2956
+ /** @example Failed to create card */
2957
+ error?: string;
2958
+ };
2959
+ };
2960
+ };
2961
+ };
2962
+ };
2963
+ delete?: never;
2964
+ options?: never;
2965
+ head?: never;
2966
+ patch?: never;
2967
+ trace?: never;
2968
+ };
2969
+ "/frontend/issuing/cards/{card_id}": {
2970
+ parameters: {
2971
+ query?: never;
2972
+ header?: never;
2973
+ path?: never;
2974
+ cookie?: never;
2975
+ };
2976
+ /**
2977
+ * Get card
2978
+ * @description Retrieves detailed information about a specific card.
2979
+ *
2356
2980
  * **Authentication**: Bearer token with x-tenant-id header required
2357
2981
  *
2358
2982
  * **Access Control**: User must have access to the card
@@ -2383,31 +3007,24 @@ export interface paths {
2383
3007
  };
2384
3008
  };
2385
3009
  };
2386
- /** @description Access denied to this card */
3010
+ /** @description Access denied — also returned when the card does not exist or is not visible to the caller */
2387
3011
  403: {
2388
3012
  headers: {
2389
3013
  [name: string]: unknown;
2390
3014
  };
2391
3015
  content?: never;
2392
3016
  };
2393
- /** @description Card not found */
2394
- 404: {
2395
- headers: {
2396
- [name: string]: unknown;
2397
- };
2398
- content?: never;
2399
- };
2400
3017
  };
2401
3018
  };
2402
3019
  put?: never;
2403
3020
  post?: never;
2404
3021
  /**
2405
3022
  * Delete card
2406
- * @description Permanently deletes a card. This action cannot be undone.
3023
+ * @description Closes the card at the vendor and sets its status to `CANCELED`. The record is retained (still listable), the action cannot be undone, and a second call answers 400 (`already deleted`).
2407
3024
  *
2408
3025
  * **Authentication**: Bearer token with x-tenant-id header required
2409
3026
  *
2410
- * **Access Control**: User must have access to the card
3027
+ * **Access Control**: Wallet owner or admin of the card's wallet
2411
3028
  *
2412
3029
  */
2413
3030
  delete: {
@@ -2436,20 +3053,13 @@ export interface paths {
2436
3053
  };
2437
3054
  };
2438
3055
  };
2439
- /** @description Access denied to this card */
3056
+ /** @description Access denied — also returned when the card does not exist or is not visible to the caller */
2440
3057
  403: {
2441
3058
  headers: {
2442
3059
  [name: string]: unknown;
2443
3060
  };
2444
3061
  content?: never;
2445
3062
  };
2446
- /** @description Card not found */
2447
- 404: {
2448
- headers: {
2449
- [name: string]: unknown;
2450
- };
2451
- content?: never;
2452
- };
2453
3063
  };
2454
3064
  };
2455
3065
  options?: never;
@@ -2460,7 +3070,7 @@ export interface paths {
2460
3070
  *
2461
3071
  * **Authentication**: Bearer token with x-tenant-id header required
2462
3072
  *
2463
- * **Access Control**: User must have access to the card
3073
+ * **Access Control**: Wallet owner or admin of the card's wallet
2464
3074
  *
2465
3075
  */
2466
3076
  patch: {
@@ -2482,7 +3092,7 @@ export interface paths {
2482
3092
  */
2483
3093
  card_name?: string;
2484
3094
  /**
2485
- * @description New title/display name
3095
+ * @description Alias of `card_name` (first non-empty of `card_name`, `nick_name`, `title` wins). The card name is the only editable field; an empty body returns the card unchanged
2486
3096
  * @example JOHN DOE
2487
3097
  */
2488
3098
  title?: string;
@@ -2490,7 +3100,7 @@ export interface paths {
2490
3100
  };
2491
3101
  };
2492
3102
  responses: {
2493
- /** @description Card updated successfully */
3103
+ /** @description Card updated — the response carries the bare vendor card wire, not the decorated list shape */
2494
3104
  200: {
2495
3105
  headers: {
2496
3106
  [name: string]: unknown;
@@ -2535,7 +3145,7 @@ export interface paths {
2535
3145
  *
2536
3146
  * **Authentication**: Bearer token with x-tenant-id header required
2537
3147
  *
2538
- * **Access Control**: User must have access to the card
3148
+ * **Access Control**: Wallet owner or admin of the card's wallet, or the scoped `user` role on its own card
2539
3149
  *
2540
3150
  * **Security Notice**: This endpoint returns sensitive card data. Ensure proper security measures are in place.
2541
3151
  *
@@ -2566,28 +3176,21 @@ export interface paths {
2566
3176
  card_number?: string;
2567
3177
  /** @description Card security code */
2568
3178
  cvv?: string;
2569
- /** @description Card expiration month (MM) */
2570
- expiry_month?: string;
2571
- /** @description Card expiration year (YYYY) */
2572
- expiry_year?: string;
3179
+ /** @description Card expiration date (MM/YY) */
3180
+ expiry_date?: string;
3181
+ /** @description Additional security code when the vendor provides one */
3182
+ security_code?: string | null;
2573
3183
  };
2574
3184
  };
2575
3185
  };
2576
3186
  };
2577
- /** @description Access denied to this card */
3187
+ /** @description Access denied — also returned when the card does not exist or is not visible to the caller */
2578
3188
  403: {
2579
3189
  headers: {
2580
3190
  [name: string]: unknown;
2581
3191
  };
2582
3192
  content?: never;
2583
3193
  };
2584
- /** @description Card not found */
2585
- 404: {
2586
- headers: {
2587
- [name: string]: unknown;
2588
- };
2589
- content?: never;
2590
- };
2591
3194
  };
2592
3195
  };
2593
3196
  put?: never;
@@ -2695,7 +3298,7 @@ export interface paths {
2695
3298
  *
2696
3299
  * **Authentication**: Bearer token with x-tenant-id header required
2697
3300
  *
2698
- * **Access Control**: User must have access to the card
3301
+ * **Access Control**: Wallet owner or admin of the card's wallet, or the scoped `user` role on its own card
2699
3302
  *
2700
3303
  */
2701
3304
  put: {
@@ -2720,19 +3323,12 @@ export interface paths {
2720
3323
  /** @example true */
2721
3324
  success?: boolean;
2722
3325
  /** @example Card frozen successfully */
2723
- message?: string;
2724
- };
2725
- };
2726
- };
2727
- /** @description Access denied to this card */
2728
- 403: {
2729
- headers: {
2730
- [name: string]: unknown;
3326
+ message?: string;
3327
+ };
2731
3328
  };
2732
- content?: never;
2733
3329
  };
2734
- /** @description Card not found */
2735
- 404: {
3330
+ /** @description Access denied — also returned when the card does not exist or is not visible to the caller */
3331
+ 403: {
2736
3332
  headers: {
2737
3333
  [name: string]: unknown;
2738
3334
  };
@@ -2761,7 +3357,7 @@ export interface paths {
2761
3357
  *
2762
3358
  * **Authentication**: Bearer token with x-tenant-id header required
2763
3359
  *
2764
- * **Access Control**: User must have access to the card
3360
+ * **Access Control**: Wallet owner or admin of the card's wallet, or the scoped `user` role on its own card
2765
3361
  *
2766
3362
  */
2767
3363
  put: {
@@ -2790,20 +3386,13 @@ export interface paths {
2790
3386
  };
2791
3387
  };
2792
3388
  };
2793
- /** @description Access denied to this card */
3389
+ /** @description Access denied — also returned when the card does not exist or is not visible to the caller */
2794
3390
  403: {
2795
3391
  headers: {
2796
3392
  [name: string]: unknown;
2797
3393
  };
2798
3394
  content?: never;
2799
3395
  };
2800
- /** @description Card not found */
2801
- 404: {
2802
- headers: {
2803
- [name: string]: unknown;
2804
- };
2805
- content?: never;
2806
- };
2807
3396
  };
2808
3397
  };
2809
3398
  post?: never;
@@ -2842,8 +3431,6 @@ export interface paths {
2842
3431
  from_date?: string;
2843
3432
  /** @description End date for filtering transactions */
2844
3433
  to_date?: string;
2845
- /** @description Include top-up transactions from card provider */
2846
- include_topups?: boolean;
2847
3434
  };
2848
3435
  header?: never;
2849
3436
  path: {
@@ -2903,7 +3490,7 @@ export interface paths {
2903
3490
  *
2904
3491
  * **Authentication**: Bearer token with x-tenant-id header required
2905
3492
  *
2906
- * **Access Control**: User must have access to the card
3493
+ * **Access Control**: Wallet owner or admin of the card's wallet
2907
3494
  *
2908
3495
  */
2909
3496
  put: {
@@ -3045,7 +3632,10 @@ export interface paths {
3045
3632
  };
3046
3633
  content?: never;
3047
3634
  };
3048
- /** @description Validation error */
3635
+ /** @description Validation error. Includes `TOPUP_BELOW_MINIMUM` — credited amount is
3636
+ * below the program's `min_topup` threshold (`error.details.min_topup`,
3637
+ * program currency). No order created, wallet not debited.
3638
+ * */
3049
3639
  400: {
3050
3640
  headers: {
3051
3641
  [name: string]: unknown;
@@ -3075,6 +3665,8 @@ export interface paths {
3075
3665
  /** @description Card provider refused the top-up during the pre-flight allowance check
3076
3666
  * (`TOPUP_NOT_ALLOWED` / `TOPUP_AMOUNT_EXCEEDS_VENDOR_LIMIT`). No order
3077
3667
  * was created and the wallet was not debited.
3668
+ * Also returned when the card, sub-account or program is not active
3669
+ * (`CARD_INACTIVE` / `SUB_ACCOUNT_INACTIVE` / `PROGRAM_INACTIVE`).
3078
3670
  * */
3079
3671
  409: {
3080
3672
  headers: {
@@ -3210,17 +3802,15 @@ export interface paths {
3210
3802
  */
3211
3803
  get: {
3212
3804
  parameters: {
3213
- query?: {
3214
- /** @description Filter sub-accounts by wallet ID */
3215
- wallet_id?: string;
3805
+ query: {
3806
+ /** @description Wallet ID (required) — sub-accounts are scoped to this wallet */
3807
+ wallet_id: string;
3216
3808
  /** @description Filter sub-accounts by program ID */
3217
3809
  program_id?: string;
3218
3810
  /** @description Comma-separated sub-account ids to fetch (targeted read through the list shape) */
3219
3811
  ids?: string;
3220
3812
  /** @description Filter sub-accounts by type */
3221
3813
  type?: "balance" | "prepaid";
3222
- /** @description Filter sub-accounts by status */
3223
- status?: "ACTIVE" | "INACTIVE" | "SUSPENDED";
3224
3814
  /** @description Number of items to skip */
3225
3815
  offset?: number;
3226
3816
  /** @description Number of items to return */
@@ -3442,20 +4032,13 @@ export interface paths {
3442
4032
  };
3443
4033
  };
3444
4034
  };
3445
- /** @description Access denied to this sub-account */
4035
+ /** @description Access denied — also returned when the sub-account does not exist or is not visible to the caller */
3446
4036
  403: {
3447
4037
  headers: {
3448
4038
  [name: string]: unknown;
3449
4039
  };
3450
4040
  content?: never;
3451
4041
  };
3452
- /** @description Sub-account not found */
3453
- 404: {
3454
- headers: {
3455
- [name: string]: unknown;
3456
- };
3457
- content?: never;
3458
- };
3459
4042
  };
3460
4043
  };
3461
4044
  put?: never;
@@ -3503,7 +4086,8 @@ export interface paths {
3503
4086
  "application/json": {
3504
4087
  /** @example true */
3505
4088
  success?: boolean;
3506
- data?: components["schemas"]["IssuingSubAccountResource"];
4089
+ /** @description Updated local sub-account row (id, wallet_id, program_id, account_currency, type, status, balance, nick_name, vendor_sub_account_id, vendor_id, created_at, updated_at) */
4090
+ data?: Record<string, never>;
3507
4091
  /** @example Sub-account updated successfully */
3508
4092
  message?: string;
3509
4093
  };
@@ -3516,20 +4100,13 @@ export interface paths {
3516
4100
  };
3517
4101
  content?: never;
3518
4102
  };
3519
- /** @description Access denied to this sub-account */
4103
+ /** @description Access denied — also returned when the sub-account does not exist or is not visible to the caller */
3520
4104
  403: {
3521
4105
  headers: {
3522
4106
  [name: string]: unknown;
3523
4107
  };
3524
4108
  content?: never;
3525
4109
  };
3526
- /** @description Sub-account not found */
3527
- 404: {
3528
- headers: {
3529
- [name: string]: unknown;
3530
- };
3531
- content?: never;
3532
- };
3533
4110
  };
3534
4111
  };
3535
4112
  trace?: never;
@@ -3557,8 +4134,8 @@ export interface paths {
3557
4134
  offset?: number;
3558
4135
  /** @description Number of items to return */
3559
4136
  limit?: number;
3560
- /** @description Filter by transaction type */
3561
- type?: "DEPOSIT" | "WITHDRAWAL" | "CARD_TRANSACTION" | "FEE";
4137
+ /** @description Exact (case-insensitive) match on the transaction status */
4138
+ status?: string;
3562
4139
  /** @description Start date for filtering transactions */
3563
4140
  from_date?: string;
3564
4141
  /** @description End date for filtering transactions */
@@ -3663,7 +4240,7 @@ export interface paths {
3663
4240
  note?: string;
3664
4241
  /**
3665
4242
  * Format: uuid
3666
- * @description Optional specific card ID. If not provided, will use the first card associated with the sub-account
4243
+ * @description Optional audit metadata stored in `meta.card_id` (defaults to the first card of the sub-account). Funds always move through the sub-account top-up — it never changes where the money goes
3667
4244
  * @example 123e4567-e89b-12d3-a456-426614174000
3668
4245
  */
3669
4246
  card_id?: string;
@@ -3708,6 +4285,10 @@ export interface paths {
3708
4285
  * - Missing required fields
3709
4286
  * - Invalid reference_id format
3710
4287
  * - Invalid amount (must be positive number)
4288
+ * - Insufficient wallet balance (`INSUFFICIENT_BALANCE`)
4289
+ * - `TOPUP_BELOW_MINIMUM` — credited amount is below the program's
4290
+ * `min_topup` threshold; `error.details.min_topup` carries the
4291
+ * threshold (program currency). No order created, wallet not debited.
3711
4292
  * */
3712
4293
  400: {
3713
4294
  headers: {
@@ -3715,12 +4296,7 @@ export interface paths {
3715
4296
  };
3716
4297
  content?: never;
3717
4298
  };
3718
- /** @description Forbidden - One of the following:
3719
- * - Access denied to this sub-account
3720
- * - Insufficient wallet balance
3721
- * - Topup not allowed (limits exceeded)
3722
- * - Sub-account is not active
3723
- * */
4299
+ /** @description Access denied to this sub-account */
3724
4300
  403: {
3725
4301
  headers: {
3726
4302
  [name: string]: unknown;
@@ -3737,6 +4313,7 @@ export interface paths {
3737
4313
  /** @description Conflict - the card provider refused the top-up during the pre-flight
3738
4314
  * allowance check (no order was created, the wallet was not debited):
3739
4315
  * - `TOPUP_NOT_ALLOWED` — provider does not allow a top-up for this account
4316
+ * - `SUB_ACCOUNT_INACTIVE` / `PROGRAM_INACTIVE` — the sub-account or its program is not active
3740
4317
  * - `TOPUP_AMOUNT_EXCEEDS_VENDOR_LIMIT` — amount is above the provider's cap
3741
4318
  * */
3742
4319
  409: {
@@ -3858,8 +4435,9 @@ export interface paths {
3858
4435
  /** @description Bad Request - One of the following:
3859
4436
  * - Missing required fields
3860
4437
  * - Invalid amount (must be positive number)
3861
- * - Sub-account not found
3862
- * - Card service withdrawal failed
4438
+ * - Sub-account does not belong to the specified wallet
4439
+ * - Insufficient funds (`INSUFFICIENT_FUNDS`)
4440
+ * - Program has no withdrawal order type configured (`OPERATION_NOT_ALLOWED`)
3863
4441
  * */
3864
4442
  400: {
3865
4443
  headers: {
@@ -3867,11 +4445,7 @@ export interface paths {
3867
4445
  };
3868
4446
  content?: never;
3869
4447
  };
3870
- /** @description Forbidden - One of the following:
3871
- * - Access denied to this sub-account
3872
- * - Sub-account does not belong to the specified wallet
3873
- * - Wallet not found
3874
- * */
4448
+ /** @description Access denied to this sub-account */
3875
4449
  403: {
3876
4450
  headers: {
3877
4451
  [name: string]: unknown;
@@ -3885,10 +4459,17 @@ export interface paths {
3885
4459
  };
3886
4460
  content?: never;
3887
4461
  };
3888
- /** @description Internal Server Error or CRITICAL ERROR
4462
+ /** @description Another operation on this sub-account is in progress (`OPERATION_IN_PROGRESS`) */
4463
+ 409: {
4464
+ headers: {
4465
+ [name: string]: unknown;
4466
+ };
4467
+ content?: never;
4468
+ };
4469
+ /** @description Internal Server Error (including a vendor-side withdrawal failure) or CRITICAL ERROR
3889
4470
  *
3890
4471
  * **CRITICAL**: If the card service withdrawal succeeded but deposit to wallet failed,
3891
- * manual reconciliation is required. The error message will contain "CRITICAL" and the order_uuid.
4472
+ * manual reconciliation is required. The error message starts with "CRITICAL"; the order id is recorded on the order's `info`.
3892
4473
  * */
3893
4474
  500: {
3894
4475
  headers: {
@@ -4089,8 +4670,6 @@ export interface paths {
4089
4670
  * filter would hide it from the listing.
4090
4671
  * */
4091
4672
  wallet_id?: string;
4092
- /** @description Include extra UI fields (icon, card_design, consent_text, etc.) */
4093
- detailed?: boolean;
4094
4673
  };
4095
4674
  header?: never;
4096
4675
  path: {
@@ -4255,9 +4834,9 @@ export interface paths {
4255
4834
  */
4256
4835
  get: {
4257
4836
  parameters: {
4258
- query?: {
4259
- /** @description Filter cardholders by wallet ID */
4260
- wallet_id?: string;
4837
+ query: {
4838
+ /** @description Wallet ID (required) — cardholders are scoped to this wallet */
4839
+ wallet_id: string;
4261
4840
  /** @description Filter cardholders by issuing program ID */
4262
4841
  issuing_program_id?: string;
4263
4842
  /** @description Only cardholders LINKED to this CORE user (`user_data.uuid`, via the link
@@ -4335,7 +4914,7 @@ export interface paths {
4335
4914
  *
4336
4915
  * **Two modes**:
4337
4916
  * - `user_data_id` mode: personal data + KYC documents are seeded from an existing
4338
- * verified user (approved identity/face verification + Sumsub applicant required).
4917
+ * verified user. An approved identity/face verification plus a KYC applicant are required only when the program's KYC level needs document photos; otherwise any active member without a final rejection can be seeded (documents are then uploaded by hand).
4339
4918
  * Manual fields only fill gaps. The Sumsub files are attached to the draft
4340
4919
  * immediately, so step 2 is usually unnecessary in this mode.
4341
4920
  * - Manual mode: `first_name`, `last_name`, `email`, `phone` are required.
@@ -4484,7 +5063,8 @@ export interface paths {
4484
5063
  };
4485
5064
  };
4486
5065
  };
4487
- /** @description Bad Request - Missing required fields */
5066
+ /** @description Bad Request — missing/invalid fields, or a `user_data_id` precondition not met (user not verified, no KYC applicant, or the applicant is unknown to the KYC provider). Code `INVALID_REQUEST`; the message names the failed precondition.
5067
+ * */
4488
5068
  400: {
4489
5069
  headers: {
4490
5070
  [name: string]: unknown;
@@ -4498,7 +5078,7 @@ export interface paths {
4498
5078
  };
4499
5079
  content?: never;
4500
5080
  };
4501
- /** @description Vendor or sub-account not found */
5081
+ /** @description `user_data_id` does not resolve to a user */
4502
5082
  404: {
4503
5083
  headers: {
4504
5084
  [name: string]: unknown;
@@ -4538,6 +5118,14 @@ export interface paths {
4538
5118
  };
4539
5119
  content?: never;
4540
5120
  };
5121
+ /** @description The KYC provider failed while the dossier was being pulled for `user_data_id` (code `EXTERNAL_SERVICE_ERROR`). Retry later; the draft was not created.
5122
+ * */
5123
+ 502: {
5124
+ headers: {
5125
+ [name: string]: unknown;
5126
+ };
5127
+ content?: never;
5128
+ };
4541
5129
  };
4542
5130
  };
4543
5131
  delete?: never;
@@ -4564,9 +5152,9 @@ export interface paths {
4564
5152
  */
4565
5153
  get: {
4566
5154
  parameters: {
4567
- query?: {
4568
- /** @description Wallet ID for access validation */
4569
- wallet_id?: string;
5155
+ query: {
5156
+ /** @description Wallet ID for access validation (required) */
5157
+ wallet_id: string;
4570
5158
  };
4571
5159
  header?: never;
4572
5160
  path: {
@@ -4614,14 +5202,14 @@ export interface paths {
4614
5202
  *
4615
5203
  * **Authentication**: Bearer token with x-tenant-id header required
4616
5204
  *
4617
- * **Access Control**: Cardholder must belong to the user's wallet
5205
+ * **Access Control**: Cardholder must belong to the user's wallet; caller must be owner or admin of that wallet
4618
5206
  *
4619
5207
  */
4620
5208
  delete: {
4621
5209
  parameters: {
4622
- query?: {
4623
- /** @description Wallet ID for access validation */
4624
- wallet_id?: string;
5210
+ query: {
5211
+ /** @description Wallet ID for access validation (required) */
5212
+ wallet_id: string;
4625
5213
  };
4626
5214
  header?: never;
4627
5215
  path: {
@@ -4677,14 +5265,14 @@ export interface paths {
4677
5265
  *
4678
5266
  * **Authentication**: Bearer token with x-tenant-id header required
4679
5267
  *
4680
- * **Access Control**: Cardholder must belong to the user's wallet
5268
+ * **Access Control**: Cardholder must belong to the user's wallet; caller must be owner or admin of that wallet
4681
5269
  *
4682
5270
  */
4683
5271
  patch: {
4684
5272
  parameters: {
4685
- query?: {
4686
- /** @description Wallet ID for access validation */
4687
- wallet_id?: string;
5273
+ query: {
5274
+ /** @description Wallet ID for access validation (required) */
5275
+ wallet_id: string;
4688
5276
  };
4689
5277
  header?: never;
4690
5278
  path: {
@@ -4800,7 +5388,7 @@ export interface paths {
4800
5388
  * - `READY` — an ACTIVE cardholder is linked (`cardholder_id`); create the card directly.
4801
5389
  * - `DRAFT` — a draft is linked (`cardholder_id`); complete `will_require` and submit it.
4802
5390
  * - `CAN_CREATE` — no cardholder yet, but the member clears the `user_data_id`-mode
4803
- * creation gates (approved identity/face verification + KYC applicant).
5391
+ * creation gates (approved identity/face verification + KYC applicant), or the program's KYC level needs no document dossier and the member has no final rejection.
4804
5392
  * - `PENDING` — a verification review is in flight; wait.
4805
5393
  * - `NEEDS_VERIFICATION` — no approved verification or no KYC applicant; the member has
4806
5394
  * to (re)run identity verification.
@@ -4813,13 +5401,17 @@ export interface paths {
4813
5401
  * `PATCH` the field, or re-upload and re-attach the document — then call
4814
5402
  * `POST /cardholders/{cardholder_id}/submit` again. The review restarts on the vendor
4815
5403
  * account the person already has; a fresh cardholder is NOT the way to retry.
5404
+ * - `ISSUER_REVIEW_PENDING` — the cardholder is submitted (`cardholder_id` is set) and the
5405
+ * ISSUER is still reviewing the person. Nothing is wrong and nothing can be done but
5406
+ * wait: re-submitting would only spend another review (the submit endpoint refuses it
5407
+ * with `409 CARDHOLDER_NOT_DRAFT`), and creating a card now is refused with
5408
+ * `400 INVALID_REQUEST` — `KYC review status is "PENDING"`. Show the member as pending
5409
+ * and poll. Only programs whose vendor reviews the person before issuance ever return
5410
+ * this; vendors that issue inline go straight to `READY`.
4816
5411
  * - `REJECTED` — a verification came back with a FINAL rejection; re-running it from the
4817
5412
  * app is not possible (support resets it), so never render a "verify now" action.
4818
5413
  * - `NOT_MEMBER` — the uuid is not an active member of this wallet.
4819
5414
  *
4820
- * A cardholder whose review is still running stays `READY`: re-submitting would only spend
4821
- * another review, and the submit endpoint refuses it with `409 CARDHOLDER_NOT_DRAFT`.
4822
- *
4823
5415
  * **`will_require`**: fields the client should expect to collect BY HAND (same vocabulary
4824
5416
  * as the submit 400 `missing` list, e.g. `address.line1`, `tax_identification_number`,
4825
5417
  * `email or phone`). For `DRAFT` it is the draft's actual leftovers; for `CAN_CREATE` it
@@ -4868,10 +5460,11 @@ export interface paths {
4868
5460
  /** Format: uuid */
4869
5461
  user_data_id: string;
4870
5462
  /** @enum {string} */
4871
- verdict: "READY" | "DRAFT" | "CAN_CREATE" | "PENDING" | "NEEDS_VERIFICATION" | "NEEDS_VERIFICATION_UPGRADE" | "NEEDS_RESUBMIT" | "REJECTED" | "NOT_MEMBER";
5463
+ verdict: "READY" | "DRAFT" | "CAN_CREATE" | "PENDING" | "NEEDS_VERIFICATION" | "NEEDS_VERIFICATION_UPGRADE" | "NEEDS_RESUBMIT" | "ISSUER_REVIEW_PENDING" | "REJECTED" | "NOT_MEMBER";
4872
5464
  /**
4873
5465
  * Format: uuid
4874
- * @description The linked cardholder for READY / DRAFT / NEEDS_RESUBMIT verdicts
5466
+ * @description The linked cardholder for READY / DRAFT / NEEDS_RESUBMIT / ISSUER_REVIEW_PENDING verdicts
5467
+ *
4875
5468
  */
4876
5469
  cardholder_id: string | null;
4877
5470
  /** @description Fields to collect by hand (submit `missing` vocabulary) */
@@ -5337,6 +5930,7 @@ export interface paths {
5337
5930
  };
5338
5931
  /**
5339
5932
  * Initialize Persona KYC session for a wallet
5933
+ * @deprecated
5340
5934
  * @description Creates a Persona inquiry via the Auth API for the specified wallet and
5341
5935
  * returns the hosted Persona URL. The caller's Bearer token is forwarded to
5342
5936
  * the Auth API; access requires the caller to be a member of the wallet
@@ -5463,6 +6057,7 @@ export interface paths {
5463
6057
  };
5464
6058
  /**
5465
6059
  * Resume Persona KYC session for a wallet
6060
+ * @deprecated
5466
6061
  * @description Resumes an existing Persona inquiry via the Auth API for the specified
5467
6062
  * wallet and returns the hosted Persona URL. The caller's Bearer token is
5468
6063
  * forwarded to the Auth API; access requires the caller to be a member of
@@ -5790,8 +6385,200 @@ export interface paths {
5790
6385
  };
5791
6386
  };
5792
6387
  };
5793
- /** @description Validation error (`verification_ref` missing or empty) */
5794
- 400: {
6388
+ /** @description Validation error (`verification_ref` missing or empty) */
6389
+ 400: {
6390
+ headers: {
6391
+ [name: string]: unknown;
6392
+ };
6393
+ content: {
6394
+ "application/json": components["schemas"]["ErrorResponse"];
6395
+ };
6396
+ };
6397
+ /** @description Missing or invalid Bearer token */
6398
+ 401: {
6399
+ headers: {
6400
+ [name: string]: unknown;
6401
+ };
6402
+ content: {
6403
+ "application/json": components["schemas"]["ErrorResponse"];
6404
+ };
6405
+ };
6406
+ /** @description Caller has no access to this wallet */
6407
+ 403: {
6408
+ headers: {
6409
+ [name: string]: unknown;
6410
+ };
6411
+ content: {
6412
+ "application/json": components["schemas"]["ErrorResponse"];
6413
+ };
6414
+ };
6415
+ /** @description No such verification to resume upstream */
6416
+ 404: {
6417
+ headers: {
6418
+ [name: string]: unknown;
6419
+ };
6420
+ content: {
6421
+ "application/json": components["schemas"]["ErrorResponse"];
6422
+ };
6423
+ };
6424
+ /** @description Auth API unavailable, timed out, or returned a malformed payload */
6425
+ 502: {
6426
+ headers: {
6427
+ [name: string]: unknown;
6428
+ };
6429
+ content: {
6430
+ "application/json": components["schemas"]["ErrorResponse"];
6431
+ };
6432
+ };
6433
+ };
6434
+ };
6435
+ delete?: never;
6436
+ options?: never;
6437
+ head?: never;
6438
+ patch?: never;
6439
+ trace?: never;
6440
+ };
6441
+ "/frontend/mass-payouts/{wallet_id}/templates": {
6442
+ parameters: {
6443
+ query?: never;
6444
+ header?: never;
6445
+ path?: never;
6446
+ cookie?: never;
6447
+ };
6448
+ /** List mass payout templates of a wallet */
6449
+ get: {
6450
+ parameters: {
6451
+ query?: {
6452
+ limit?: number;
6453
+ offset?: number;
6454
+ };
6455
+ header?: never;
6456
+ path: {
6457
+ /** @description Source wallet the batches belong to */
6458
+ wallet_id: components["parameters"]["MassPayoutWalletId"];
6459
+ };
6460
+ cookie?: never;
6461
+ };
6462
+ requestBody?: never;
6463
+ responses: {
6464
+ /** @description Page of templates, newest first */
6465
+ 200: {
6466
+ headers: {
6467
+ [name: string]: unknown;
6468
+ };
6469
+ content: {
6470
+ "application/json": {
6471
+ /** @example true */
6472
+ success?: boolean;
6473
+ data?: {
6474
+ items?: components["schemas"]["MassPayoutTemplate"][];
6475
+ total?: number;
6476
+ limit?: number;
6477
+ offset?: number;
6478
+ };
6479
+ };
6480
+ };
6481
+ };
6482
+ };
6483
+ };
6484
+ put?: never;
6485
+ /**
6486
+ * Create a mass payout template
6487
+ * @description Saves a reusable recipient list (name, source currency/virtual account
6488
+ * and rows with amounts, payout currencies and references). Supporting
6489
+ * documents are per-payment and are not part of a template. To start a
6490
+ * batch from a template, read it and create a draft from its rows.
6491
+ *
6492
+ */
6493
+ post: {
6494
+ parameters: {
6495
+ query?: never;
6496
+ header?: never;
6497
+ path: {
6498
+ /** @description Source wallet the batches belong to */
6499
+ wallet_id: components["parameters"]["MassPayoutWalletId"];
6500
+ };
6501
+ cookie?: never;
6502
+ };
6503
+ requestBody: {
6504
+ content: {
6505
+ "application/json": {
6506
+ name: string;
6507
+ /** Format: uuid */
6508
+ currency_id: string;
6509
+ /** Format: uuid */
6510
+ virtual_account_id?: string;
6511
+ items: components["schemas"]["MassPayoutTemplateItemInput"][];
6512
+ };
6513
+ };
6514
+ };
6515
+ responses: {
6516
+ /** @description Template created */
6517
+ 200: {
6518
+ headers: {
6519
+ [name: string]: unknown;
6520
+ };
6521
+ content: {
6522
+ "application/json": {
6523
+ /** @example true */
6524
+ success?: boolean;
6525
+ data?: components["schemas"]["MassPayoutTemplateWithItems"];
6526
+ };
6527
+ };
6528
+ };
6529
+ /** @description Validation error (including the item and template caps) */
6530
+ 400: {
6531
+ headers: {
6532
+ [name: string]: unknown;
6533
+ };
6534
+ content: {
6535
+ "application/json": components["schemas"]["ErrorResponse"];
6536
+ };
6537
+ };
6538
+ };
6539
+ };
6540
+ delete?: never;
6541
+ options?: never;
6542
+ head?: never;
6543
+ patch?: never;
6544
+ trace?: never;
6545
+ };
6546
+ "/frontend/mass-payouts/{wallet_id}/templates/{template_id}": {
6547
+ parameters: {
6548
+ query?: never;
6549
+ header?: never;
6550
+ path?: never;
6551
+ cookie?: never;
6552
+ };
6553
+ /** Get a mass payout template with its rows */
6554
+ get: {
6555
+ parameters: {
6556
+ query?: never;
6557
+ header?: never;
6558
+ path: {
6559
+ /** @description Source wallet the batches belong to */
6560
+ wallet_id: components["parameters"]["MassPayoutWalletId"];
6561
+ template_id: components["parameters"]["MassPayoutTemplateId"];
6562
+ };
6563
+ cookie?: never;
6564
+ };
6565
+ requestBody?: never;
6566
+ responses: {
6567
+ /** @description Template with its recipient rows */
6568
+ 200: {
6569
+ headers: {
6570
+ [name: string]: unknown;
6571
+ };
6572
+ content: {
6573
+ "application/json": {
6574
+ /** @example true */
6575
+ success?: boolean;
6576
+ data?: components["schemas"]["MassPayoutTemplateWithItems"];
6577
+ };
6578
+ };
6579
+ };
6580
+ /** @description Template not found */
6581
+ 404: {
5795
6582
  headers: {
5796
6583
  [name: string]: unknown;
5797
6584
  };
@@ -5799,17 +6586,51 @@ export interface paths {
5799
6586
  "application/json": components["schemas"]["ErrorResponse"];
5800
6587
  };
5801
6588
  };
5802
- /** @description Missing or invalid Bearer token */
5803
- 401: {
6589
+ };
6590
+ };
6591
+ /**
6592
+ * Edit a mass payout template
6593
+ * @description `items` fully replaces the row list; `virtual_account_id: null` clears the template's source account.
6594
+ */
6595
+ put: {
6596
+ parameters: {
6597
+ query?: never;
6598
+ header?: never;
6599
+ path: {
6600
+ /** @description Source wallet the batches belong to */
6601
+ wallet_id: components["parameters"]["MassPayoutWalletId"];
6602
+ template_id: components["parameters"]["MassPayoutTemplateId"];
6603
+ };
6604
+ cookie?: never;
6605
+ };
6606
+ requestBody: {
6607
+ content: {
6608
+ "application/json": {
6609
+ name?: string;
6610
+ /** Format: uuid */
6611
+ currency_id?: string;
6612
+ /** Format: uuid */
6613
+ virtual_account_id?: string | null;
6614
+ items?: components["schemas"]["MassPayoutTemplateItemInput"][];
6615
+ };
6616
+ };
6617
+ };
6618
+ responses: {
6619
+ /** @description Updated template with its rows */
6620
+ 200: {
5804
6621
  headers: {
5805
6622
  [name: string]: unknown;
5806
6623
  };
5807
6624
  content: {
5808
- "application/json": components["schemas"]["ErrorResponse"];
6625
+ "application/json": {
6626
+ /** @example true */
6627
+ success?: boolean;
6628
+ data?: components["schemas"]["MassPayoutTemplateWithItems"];
6629
+ };
5809
6630
  };
5810
6631
  };
5811
- /** @description Caller has no access to this wallet */
5812
- 403: {
6632
+ /** @description Template not found */
6633
+ 404: {
5813
6634
  headers: {
5814
6635
  [name: string]: unknown;
5815
6636
  };
@@ -5817,17 +6638,41 @@ export interface paths {
5817
6638
  "application/json": components["schemas"]["ErrorResponse"];
5818
6639
  };
5819
6640
  };
5820
- /** @description No such verification to resume upstream */
5821
- 404: {
6641
+ };
6642
+ };
6643
+ post?: never;
6644
+ /** Delete a mass payout template */
6645
+ delete: {
6646
+ parameters: {
6647
+ query?: never;
6648
+ header?: never;
6649
+ path: {
6650
+ /** @description Source wallet the batches belong to */
6651
+ wallet_id: components["parameters"]["MassPayoutWalletId"];
6652
+ template_id: components["parameters"]["MassPayoutTemplateId"];
6653
+ };
6654
+ cookie?: never;
6655
+ };
6656
+ requestBody?: never;
6657
+ responses: {
6658
+ /** @description Template deleted */
6659
+ 200: {
5822
6660
  headers: {
5823
6661
  [name: string]: unknown;
5824
6662
  };
5825
6663
  content: {
5826
- "application/json": components["schemas"]["ErrorResponse"];
6664
+ "application/json": {
6665
+ /** @example true */
6666
+ success?: boolean;
6667
+ data?: {
6668
+ /** @example true */
6669
+ deleted?: boolean;
6670
+ };
6671
+ };
5827
6672
  };
5828
6673
  };
5829
- /** @description Auth API unavailable, timed out, or returned a malformed payload */
5830
- 502: {
6674
+ /** @description Template not found */
6675
+ 404: {
5831
6676
  headers: {
5832
6677
  [name: string]: unknown;
5833
6678
  };
@@ -5837,7 +6682,6 @@ export interface paths {
5837
6682
  };
5838
6683
  };
5839
6684
  };
5840
- delete?: never;
5841
6685
  options?: never;
5842
6686
  head?: never;
5843
6687
  patch?: never;
@@ -5854,7 +6698,13 @@ export interface paths {
5854
6698
  get: {
5855
6699
  parameters: {
5856
6700
  query?: {
5857
- status?: "DRAFT" | "PENDING_APPROVAL" | "PROCESSING" | "COMPLETED" | "FAILED" | "CANCELED";
6701
+ status?: "DRAFT" | "PENDING_APPROVAL" | "SCHEDULED" | "PROCESSING" | "COMPLETED" | "FAILED" | "CANCELED";
6702
+ /** @description Case-insensitive substring match against the batch name */
6703
+ name?: string;
6704
+ /** @description Only batches created at or after this moment */
6705
+ date_from?: string;
6706
+ /** @description Only batches created at or before this moment */
6707
+ date_to?: string;
5858
6708
  limit?: number;
5859
6709
  offset?: number;
5860
6710
  };
@@ -5891,11 +6741,16 @@ export interface paths {
5891
6741
  /**
5892
6742
  * Create a mass payout draft
5893
6743
  * @description Creates a batch of payouts to existing counterparty destinations: one
5894
- * source wallet, one currency, up to the tenant's batch-size limit of
5895
- * recipients (default 100). The draft can be freely edited and
5896
- * previewed; nothing moves until it is submitted and approved.
5897
- * `virtual_account_id` is required only when the list contains banking
5898
- * recipients. Requires an administrative role on the source wallet.
6744
+ * source wallet and funding currency, up to the tenant's batch-size limit
6745
+ * of recipients (default 100). Every row states the amount the recipient
6746
+ * receives; a row with a different `to_currency_id` is paid as a
6747
+ * cross-currency transfer converted at execution time. An optional
6748
+ * `scheduled_at` (at least 1 hour and at most 90 days ahead) makes the
6749
+ * batch execute at that moment once approved. The draft can be freely
6750
+ * edited and previewed; nothing moves until it is submitted and
6751
+ * approved. `virtual_account_id` is required only when the list contains
6752
+ * banking recipients. Requires an administrative role on the source
6753
+ * wallet.
5899
6754
  *
5900
6755
  */
5901
6756
  post: {
@@ -5916,6 +6771,11 @@ export interface paths {
5916
6771
  /** Format: uuid */
5917
6772
  virtual_account_id?: string;
5918
6773
  name: string;
6774
+ /**
6775
+ * Format: date-time
6776
+ * @description Requested execution time; omit to execute right after approval
6777
+ */
6778
+ scheduled_at?: string;
5919
6779
  items: components["schemas"]["MassPayoutItemInput"][];
5920
6780
  };
5921
6781
  };
@@ -5934,7 +6794,7 @@ export interface paths {
5934
6794
  };
5935
6795
  };
5936
6796
  };
5937
- /** @description Validation error (including the batch-size limit) */
6797
+ /** @description Validation error (including the batch-size limit and the scheduling horizon) */
5938
6798
  400: {
5939
6799
  headers: {
5940
6800
  [name: string]: unknown;
@@ -5990,7 +6850,7 @@ export interface paths {
5990
6850
  };
5991
6851
  requestBody?: never;
5992
6852
  responses: {
5993
- /** @description Batch details with progress counters and total amount */
6853
+ /** @description Batch details with progress counters and totals */
5994
6854
  200: {
5995
6855
  headers: {
5996
6856
  [name: string]: unknown;
@@ -6016,7 +6876,7 @@ export interface paths {
6016
6876
  };
6017
6877
  /**
6018
6878
  * Edit a mass payout draft
6019
- * @description Draft-only. `items` fully replaces the recipient list; `virtual_account_id: null` clears the source VA.
6879
+ * @description Draft-only. `items` fully replaces the recipient list; `virtual_account_id: null` clears the source VA; `scheduled_at: null` makes the batch execute right after approval.
6020
6880
  */
6021
6881
  put: {
6022
6882
  parameters: {
@@ -6035,6 +6895,8 @@ export interface paths {
6035
6895
  name?: string;
6036
6896
  /** Format: uuid */
6037
6897
  virtual_account_id?: string | null;
6898
+ /** Format: date-time */
6899
+ scheduled_at?: string | null;
6038
6900
  items?: components["schemas"]["MassPayoutItemInput"][];
6039
6901
  };
6040
6902
  };
@@ -6080,11 +6942,12 @@ export interface paths {
6080
6942
  };
6081
6943
  /**
6082
6944
  * List items of a mass payout
6083
- * @description Items in upload order, paginated with limit/offset like the batch list.
6945
+ * @description Items in upload order, paginated with limit/offset like the batch list. The optional status filter narrows the tracker view (e.g. failed rows only).
6084
6946
  */
6085
6947
  get: {
6086
6948
  parameters: {
6087
6949
  query?: {
6950
+ status?: "PENDING" | "PROCESSING" | "COMPLETED" | "FAILED" | "CANCELED";
6088
6951
  limit?: number;
6089
6952
  offset?: number;
6090
6953
  };
@@ -6135,10 +6998,14 @@ export interface paths {
6135
6998
  };
6136
6999
  /**
6137
7000
  * Preview a mass payout
6138
- * @description Dry-run before submitting: validates every recipient, estimates the fee
6139
- * per item through the tenant's pricing, sums the total debit and checks
6140
- * it against the wallet balance. Crypto payouts to on-platform addresses
6141
- * may execute cheaper than estimated (they settle internally).
7001
+ * @description Dry-run before submitting: validates every recipient (the invoice rule
7002
+ * included), estimates the fee per item through the tenant's pricing —
7003
+ * cross-currency rows are quoted at the current rate — and sums the
7004
+ * total debit in the batch source currency against the wallet balance.
7005
+ * Estimates are indicative: execution prices each payout at its own
7006
+ * moment. Crypto payouts always settle on-chain at the estimated fee; to
7007
+ * pay an on-platform wallet without a network fee use an INTERNAL
7008
+ * destination.
6142
7009
  *
6143
7010
  */
6144
7011
  get: {
@@ -6170,12 +7037,15 @@ export interface paths {
6170
7037
  currency_id?: string;
6171
7038
  total_items?: number;
6172
7039
  total_amount?: number;
7040
+ totals_by_currency?: components["schemas"]["MassPayoutCurrencyTotal"][];
6173
7041
  total_fees?: number;
6174
7042
  total_debit?: number;
6175
7043
  balance?: {
6176
7044
  available?: number;
6177
7045
  sufficient?: boolean;
6178
7046
  };
7047
+ /** @description Rows at or above this amount must carry an INVOICE attachment */
7048
+ invoice_threshold?: number;
6179
7049
  valid_count?: number;
6180
7050
  invalid_count?: number;
6181
7051
  items?: {
@@ -6185,7 +7055,14 @@ export interface paths {
6185
7055
  /** Format: uuid */
6186
7056
  destination_id?: string;
6187
7057
  amount?: number;
7058
+ /** Format: uuid */
7059
+ to_currency_id?: string | null;
6188
7060
  fee?: number;
7061
+ /**
7062
+ * Format: uuid
7063
+ * @description Currency the fee is denominated in (cross-currency payouts may be charged in either leg, per the tenant pricing)
7064
+ */
7065
+ fee_currency_id?: string;
6189
7066
  debit_amount?: number;
6190
7067
  result_amount?: number;
6191
7068
  }[];
@@ -6222,8 +7099,12 @@ export interface paths {
6222
7099
  put?: never;
6223
7100
  /**
6224
7101
  * Submit a mass payout for approval
6225
- * @description DRAFT → PENDING_APPROVAL. Refused while any recipient is invalid — the
6226
- * problems are returned in the error details so the rows can be fixed.
7102
+ * @description DRAFT → PENDING_APPROVAL. Refused while any recipient is invalid — a
7103
+ * missing/deleted destination, an unsupported type, a banking row
7104
+ * without a source account, or a row at/above the invoice threshold
7105
+ * without an INVOICE attachment. The problems are returned in the error
7106
+ * details so the rows can be fixed. Wallet members are notified that the
7107
+ * batch awaits approval.
6227
7108
  *
6228
7109
  */
6229
7110
  post: {
@@ -6289,12 +7170,18 @@ export interface paths {
6289
7170
  put?: never;
6290
7171
  /**
6291
7172
  * Approve a mass payout
6292
- * @description PENDING_APPROVAL → PROCESSING and starts the asynchronous execution:
6293
- * every item becomes a regular order (created and approved through the
6294
- * standard order flow, funds are debited per order). Requires an
6295
- * administrative wallet role and a recent second-factor verification — a stale one is rejected
6296
- * with `TWO_FACTOR_REVERIFICATION_REQUIRED`. Execution continues past
6297
- * failed items; progress is visible through the batch counters.
7173
+ * @description PENDING_APPROVAL → PROCESSING (or SCHEDULED for a batch with a future
7174
+ * send date — execution then starts automatically at that moment).
7175
+ * Every item becomes a regular order (created and approved through the
7176
+ * standard order flow, funds are debited per order). The estimated total
7177
+ * debit is checked against the wallet balance first — a batch that
7178
+ * cannot cover all payouts is refused instead of paying only part of the
7179
+ * list. Requires an administrative wallet role. On Clerk-authenticated
7180
+ * tenants a second factor verified within the last 10 minutes is also
7181
+ * required — a stale one is rejected with
7182
+ * `TWO_FACTOR_REVERIFICATION_REQUIRED` (Supabase-authenticated tenants
7183
+ * have no step-up check). Execution continues past failed items;
7184
+ * progress is visible through the batch counters.
6298
7185
  *
6299
7186
  */
6300
7187
  post: {
@@ -6310,7 +7197,7 @@ export interface paths {
6310
7197
  };
6311
7198
  requestBody?: never;
6312
7199
  responses: {
6313
- /** @description Execution started */
7200
+ /** @description Execution started (or scheduled) */
6314
7201
  200: {
6315
7202
  headers: {
6316
7203
  [name: string]: unknown;
@@ -6323,7 +7210,16 @@ export interface paths {
6323
7210
  };
6324
7211
  };
6325
7212
  };
6326
- /** @description Second-factor verification is stale or the caller lacks permission */
7213
+ /** @description Insufficient funds for the estimated total debit, or invalid items */
7214
+ 400: {
7215
+ headers: {
7216
+ [name: string]: unknown;
7217
+ };
7218
+ content: {
7219
+ "application/json": components["schemas"]["ErrorResponse"];
7220
+ };
7221
+ };
7222
+ /** @description Caller lacks an administrative wallet role, or (Clerk tenants) the second-factor verification is stale */
6327
7223
  403: {
6328
7224
  headers: {
6329
7225
  [name: string]: unknown;
@@ -6359,8 +7255,13 @@ export interface paths {
6359
7255
  get?: never;
6360
7256
  put?: never;
6361
7257
  /**
6362
- * Cancel a mass payout
6363
- * @description Allowed from DRAFT and PENDING_APPROVAL. A PROCESSING batch cannot be canceled — payouts are already executing.
7258
+ * Cancel or stop a mass payout
7259
+ * @description Before execution starts (DRAFT, PENDING_APPROVAL, SCHEDULED) the batch
7260
+ * cancels whole — every payment ends CANCELED and nothing moves. A
7261
+ * PROCESSING batch takes a stop request instead: payments already handed
7262
+ * to the payment flow finish, the untouched ones are cancelled, and the
7263
+ * batch finalizes as CANCELED with the paid/failed counters preserved.
7264
+ *
6364
7265
  */
6365
7266
  post: {
6366
7267
  parameters: {
@@ -6375,7 +7276,7 @@ export interface paths {
6375
7276
  };
6376
7277
  requestBody?: never;
6377
7278
  responses: {
6378
- /** @description Batch canceled */
7279
+ /** @description Batch canceled (or the stop was requested) */
6379
7280
  200: {
6380
7281
  headers: {
6381
7282
  [name: string]: unknown;
@@ -6414,8 +7315,9 @@ export interface paths {
6414
7315
  };
6415
7316
  /**
6416
7317
  * Download the mass payout report (CSV)
6417
- * @description Streaming CSV: recipient, amount, item status, the linked order and its
6418
- * current status, and the failure reason for every unsuccessful payout.
7318
+ * @description Streaming CSV: recipient, amount, payout currency, reference, item
7319
+ * status, the linked order and its current status, and the failure
7320
+ * reason for every unsuccessful payout.
6419
7321
  *
6420
7322
  */
6421
7323
  get: {
@@ -6468,7 +7370,7 @@ export interface paths {
6468
7370
  };
6469
7371
  /**
6470
7372
  * Effective notification preferences
6471
- * @description Both dimensions in full with defaults applied — delivery channels (`IN_APP` is always enabled) and notification categories (every category is user-configurable).
7373
+ * @description Both dimensions in full with defaults applied — delivery channels (`IN_APP` is always enabled) and notification categories (every category is user-configurable). The channel list is what exists for the tenant — `TELEGRAM` appears only when the tenant has a Telegram bot configured.
6472
7374
  */
6473
7375
  get: {
6474
7376
  parameters: {
@@ -6500,7 +7402,7 @@ export interface paths {
6500
7402
  };
6501
7403
  /**
6502
7404
  * Update notification preferences
6503
- * @description Bulk upsert of either or both dimensions. Disabling the `IN_APP` channel is rejected with 400 (`INBOX_CHANNEL_LOCKED`). A disabled category mutes push and email for its notifications; the inbox always receives them. Changes apply from the next delivery.
7405
+ * @description Bulk upsert of either or both dimensions. Disabling the `IN_APP` channel is rejected with 400 (`INBOX_CHANNEL_LOCKED`). A disabled category mutes push, email and Telegram for its notifications; the inbox always receives them. Changes apply from the next delivery.
6504
7406
  */
6505
7407
  put: {
6506
7408
  parameters: {
@@ -7019,7 +7921,7 @@ export interface paths {
7019
7921
  };
7020
7922
  };
7021
7923
  };
7022
- /** @description Validation error (insufficient balance, virtual account missing, etc.) */
7924
+ /** @description Validation error — invalid body, pair disabled by the exchange config, or calculated amount too small. Balance is checked only at approve. */
7023
7925
  400: {
7024
7926
  headers: {
7025
7927
  [name: string]: unknown;
@@ -7293,7 +8195,7 @@ export interface paths {
7293
8195
  };
7294
8196
  requestBody: {
7295
8197
  content: {
7296
- "application/json": components["schemas"]["FrontendL2FOrderRequest"];
8198
+ "application/json": components["schemas"]["FrontendFiatWithdrawalRequest"];
7297
8199
  };
7298
8200
  };
7299
8201
  responses: {
@@ -7373,7 +8275,7 @@ export interface paths {
7373
8275
  };
7374
8276
  requestBody: {
7375
8277
  content: {
7376
- "application/json": components["schemas"]["FrontendL2FOrderRequest"];
8278
+ "application/json": components["schemas"]["FrontendFiatWithdrawalRequest"];
7377
8279
  };
7378
8280
  };
7379
8281
  responses: {
@@ -7453,7 +8355,7 @@ export interface paths {
7453
8355
  };
7454
8356
  requestBody: {
7455
8357
  content: {
7456
- "application/json": components["schemas"]["FrontendL2FOrderRequest"];
8358
+ "application/json": components["schemas"]["FrontendFiatWithdrawalRequest"];
7457
8359
  };
7458
8360
  };
7459
8361
  responses: {
@@ -7533,7 +8435,7 @@ export interface paths {
7533
8435
  };
7534
8436
  requestBody: {
7535
8437
  content: {
7536
- "application/json": components["schemas"]["FrontendL2FOrderRequest"];
8438
+ "application/json": components["schemas"]["FrontendFiatWithdrawalRequest"];
7537
8439
  };
7538
8440
  };
7539
8441
  responses: {
@@ -7613,7 +8515,7 @@ export interface paths {
7613
8515
  };
7614
8516
  requestBody: {
7615
8517
  content: {
7616
- "application/json": components["schemas"]["FrontendL2FOrderRequest"];
8518
+ "application/json": components["schemas"]["FrontendFiatWithdrawalRequest"];
7617
8519
  };
7618
8520
  };
7619
8521
  responses: {
@@ -7693,7 +8595,7 @@ export interface paths {
7693
8595
  };
7694
8596
  requestBody: {
7695
8597
  content: {
7696
- "application/json": components["schemas"]["FrontendL2FOrderRequest"];
8598
+ "application/json": components["schemas"]["FrontendFiatWithdrawalRequest"];
7697
8599
  };
7698
8600
  };
7699
8601
  responses: {
@@ -7769,8 +8671,10 @@ export interface paths {
7769
8671
  * (transaction written as `complete`) and triggers its workflow.
7770
8672
  * Exchange orders (EXCHANGE_OMNI) and internal transfers
7771
8673
  * (TRANSFER_INTERNAL / OMNIBUS_INTERNAL_TRANSFER) settle synchronously
7772
- * and land in COMPLETE. An insufficient balance fails the order
7773
- * (FAILED). OTP verification is mandatory and keyed on the order id
8674
+ * and land in COMPLETE. An insufficient balance answers 400
8675
+ * `INSUFFICIENT_FUNDS` and releases the order back to NEW (approve again
8676
+ * after a top-up); FAILED is reached only when a step after the debit
8677
+ * fails. OTP verification is mandatory and keyed on the order id
7774
8678
  * (request the OTP for the order being approved). Orders created with
7775
8679
  * `scheduled_at` move to EXPECTED instead — no funds are debited until
7776
8680
  * execution at the requested time.
@@ -7794,7 +8698,7 @@ export interface paths {
7794
8698
  };
7795
8699
  };
7796
8700
  responses: {
7797
- /** @description Order moved to PROCESSING */
8701
+ /** @description Order approved — PROCESSING for workflow rails, COMPLETE for exchange / internal transfers, EXPECTED for scheduled orders */
7798
8702
  200: {
7799
8703
  headers: {
7800
8704
  [name: string]: unknown;
@@ -7807,7 +8711,34 @@ export interface paths {
7807
8711
  };
7808
8712
  };
7809
8713
  };
7810
- /** @description Order is not in an approvable state */
8714
+ /** @description Insufficient funds (`INSUFFICIENT_FUNDS` — the order is released back to NEW) or validation error */
8715
+ 400: {
8716
+ headers: {
8717
+ [name: string]: unknown;
8718
+ };
8719
+ content: {
8720
+ "application/json": components["schemas"]["ErrorResponse"];
8721
+ };
8722
+ };
8723
+ /** @description Order does not belong to the caller's wallet */
8724
+ 403: {
8725
+ headers: {
8726
+ [name: string]: unknown;
8727
+ };
8728
+ content: {
8729
+ "application/json": components["schemas"]["ErrorResponse"];
8730
+ };
8731
+ };
8732
+ /** @description Order not found */
8733
+ 404: {
8734
+ headers: {
8735
+ [name: string]: unknown;
8736
+ };
8737
+ content: {
8738
+ "application/json": components["schemas"]["ErrorResponse"];
8739
+ };
8740
+ };
8741
+ /** @description Order is not in an approvable state (`INVALID_STATE`), or another lifecycle call holds the order lock (`OPERATION_IN_PROGRESS`) */
7811
8742
  409: {
7812
8743
  headers: {
7813
8744
  [name: string]: unknown;
@@ -7874,7 +8805,25 @@ export interface paths {
7874
8805
  };
7875
8806
  };
7876
8807
  };
7877
- /** @description Order is not in a cancelable state */
8808
+ /** @description Order does not belong to the caller's wallet */
8809
+ 403: {
8810
+ headers: {
8811
+ [name: string]: unknown;
8812
+ };
8813
+ content: {
8814
+ "application/json": components["schemas"]["ErrorResponse"];
8815
+ };
8816
+ };
8817
+ /** @description Order not found */
8818
+ 404: {
8819
+ headers: {
8820
+ [name: string]: unknown;
8821
+ };
8822
+ content: {
8823
+ "application/json": components["schemas"]["ErrorResponse"];
8824
+ };
8825
+ };
8826
+ /** @description Order is not in a cancelable state (`INVALID_STATE`), or another lifecycle call holds the order lock (`OPERATION_IN_PROGRESS`) */
7878
8827
  409: {
7879
8828
  headers: {
7880
8829
  [name: string]: unknown;
@@ -8090,11 +9039,11 @@ export interface paths {
8090
9039
  amount: number;
8091
9040
  from_currency_id: string;
8092
9041
  to_currency_id: string;
8093
- /** @description If `true`, calculates inputs needed to receive the given amount. */
8094
- is_reverse: boolean;
8095
- /** @description If `true`, the network fee is subtracted from `result_amount`. If `false`, the fee is added on top of `from_amount` and the recipient gets the full converted amount. Ignored for reverse calculations. Required so the client always states the fee-allocation mode explicitly — a change of the server-side fallback can never silently alter the calculation.
9042
+ /** @description If `true`, calculates inputs needed to receive the given amount. Defaults to `false`. */
9043
+ is_reverse?: boolean;
9044
+ /** @description If `true`, the network fee is subtracted from `result_amount`. If `false`, the fee is added on top of `from_amount` and the recipient gets the full converted amount. Ignored for reverse calculations. Defaults to `true` when omitted.
8096
9045
  * */
8097
- is_subtract: boolean;
9046
+ is_subtract?: boolean;
8098
9047
  /** @description Destination address (for crypto withdrawals; affects network fee estimation). */
8099
9048
  to_address?: string;
8100
9049
  };
@@ -8283,7 +9232,7 @@ export interface paths {
8283
9232
  };
8284
9233
  /**
8285
9234
  * Get order
8286
- * @description Retrieves a specific order by its numeric ID.
9235
+ * @description Retrieves a specific order by its `id` (UUID; equal to `order_uuid` for orders created by the current flow).
8287
9236
  *
8288
9237
  * **Authentication**: Bearer token with x-tenant-id header required
8289
9238
  *
@@ -8293,7 +9242,7 @@ export interface paths {
8293
9242
  query?: never;
8294
9243
  header?: never;
8295
9244
  path: {
8296
- order_id: number;
9245
+ order_id: string;
8297
9246
  };
8298
9247
  cookie?: never;
8299
9248
  };
@@ -8465,7 +9414,13 @@ export interface paths {
8465
9414
  };
8466
9415
  get?: never;
8467
9416
  put?: never;
8468
- /** Create omnibus crypto transfer */
9417
+ /**
9418
+ * Create omnibus crypto transfer
9419
+ * @description Legacy one-phase alias (frozen). Besides the documented fields the body must
9420
+ * carry `request_id` (idempotency key); `scheduled_at` is ignored.
9421
+ * Prefer `POST /frontend/orders/withdrawal/crypto`.
9422
+ *
9423
+ */
8469
9424
  post: {
8470
9425
  parameters: {
8471
9426
  query?: never;
@@ -8503,7 +9458,13 @@ export interface paths {
8503
9458
  };
8504
9459
  get?: never;
8505
9460
  put?: never;
8506
- /** Create segregated crypto transfer */
9461
+ /**
9462
+ * Create segregated crypto transfer
9463
+ * @description Legacy one-phase alias (frozen). Besides the documented fields the body must
9464
+ * carry `request_id` (idempotency key); `scheduled_at` is ignored.
9465
+ * Prefer `POST /frontend/orders/withdrawal/crypto`.
9466
+ *
9467
+ */
8507
9468
  post: {
8508
9469
  parameters: {
8509
9470
  query?: never;
@@ -8541,8 +9502,9 @@ export interface paths {
8541
9502
  };
8542
9503
  /**
8543
9504
  * List currencies
8544
- * @description Returns currencies (crypto table) with chain relations,
8545
- * filtered by the tenant of the authenticated session.
9505
+ * @description Returns every platform-enabled currency (crypto table) with chain relations,
9506
+ * annotated with `is_tenant_enabled`; pass `enabled_only=true` to keep only
9507
+ * the currencies enabled for the tenant of the authenticated session.
8546
9508
  * Each currency includes an `is_tenant_enabled` flag.
8547
9509
  *
8548
9510
  * **Authentication**: Bearer token + x-tenant-id header
@@ -9164,7 +10126,7 @@ export interface paths {
9164
10126
  };
9165
10127
  /**
9166
10128
  * List virtual accounts
9167
- * @description Retrieves a list of virtual accounts associated with a specific wallet.
10129
+ * @description Retrieves the ACTIVE virtual accounts associated with a specific wallet.
9168
10130
  *
9169
10131
  * **Authentication**: Bearer token with x-tenant-id header required
9170
10132
  *
@@ -9174,7 +10136,7 @@ export interface paths {
9174
10136
  get: {
9175
10137
  parameters: {
9176
10138
  query?: {
9177
- /** @description Number of items to return */
10139
+ /** @description Number of items to return (default 10) */
9178
10140
  limit?: number;
9179
10141
  /** @description Number of items to skip */
9180
10142
  offset?: number;
@@ -9198,11 +10160,7 @@ export interface paths {
9198
10160
  /** @example true */
9199
10161
  success?: boolean;
9200
10162
  data?: components["schemas"]["VirtualAccount"][];
9201
- pagination?: {
9202
- offset?: number;
9203
- limit?: number;
9204
- total?: number;
9205
- };
10163
+ pagination?: components["schemas"]["PaginationResponse"];
9206
10164
  };
9207
10165
  };
9208
10166
  };
@@ -9211,14 +10169,18 @@ export interface paths {
9211
10169
  headers: {
9212
10170
  [name: string]: unknown;
9213
10171
  };
9214
- content?: never;
10172
+ content: {
10173
+ "application/json": components["schemas"]["ErrorResponse"];
10174
+ };
9215
10175
  };
9216
10176
  /** @description Server error */
9217
10177
  500: {
9218
10178
  headers: {
9219
10179
  [name: string]: unknown;
9220
10180
  };
9221
- content?: never;
10181
+ content: {
10182
+ "application/json": components["schemas"]["ErrorResponse"];
10183
+ };
9222
10184
  };
9223
10185
  };
9224
10186
  };
@@ -9264,46 +10226,81 @@ export interface paths {
9264
10226
  "application/json": {
9265
10227
  /** @example true */
9266
10228
  success?: boolean;
9267
- data?: components["schemas"]["VirtualAccount"];
10229
+ data?: components["schemas"]["VirtualAccountCreated"];
9268
10230
  /** @example Virtual account created successfully */
9269
10231
  message?: string;
9270
10232
  };
9271
10233
  };
9272
10234
  };
9273
- /** @description Bad request - missing required parameters */
9274
- 400: {
10235
+ /** @description Accepted — the account is pending activation at the vendor (success envelope, no account yet); re-post the same request to poll */
10236
+ 202: {
9275
10237
  headers: {
9276
10238
  [name: string]: unknown;
9277
10239
  };
9278
10240
  content?: never;
9279
10241
  };
9280
- /** @description Forbidden - KYC verification required or no access */
10242
+ /** @description `INVALID_REQUEST` — missing `va_programs_id` or wallet binding */
10243
+ 400: {
10244
+ headers: {
10245
+ [name: string]: unknown;
10246
+ };
10247
+ content: {
10248
+ "application/json": components["schemas"]["ErrorResponse"];
10249
+ };
10250
+ };
10251
+ /** @description `ACCESS_DENIED` (no access to the wallet or role too low), `FORBIDDEN` (program not allowed for the caller's KYC profile) or `KYC_REQUIREMENTS_NOT_MET` (wallet KYC not approved) */
9281
10252
  403: {
9282
10253
  headers: {
9283
10254
  [name: string]: unknown;
9284
10255
  };
9285
- content?: never;
10256
+ content: {
10257
+ "application/json": components["schemas"]["ErrorResponse"];
10258
+ };
9286
10259
  };
9287
- /** @description Program not found */
10260
+ /** @description `NOT_FOUND` — wallet or program not found */
9288
10261
  404: {
9289
10262
  headers: {
9290
10263
  [name: string]: unknown;
9291
10264
  };
9292
- content?: never;
10265
+ content: {
10266
+ "application/json": components["schemas"]["ErrorResponse"];
10267
+ };
9293
10268
  };
9294
- /** @description Conflict - Virtual account already exists */
10269
+ /** @description `CONFLICT` — an account already occupies this program on the wallet; `error.details` carries the existing `account_id` and `status` */
9295
10270
  409: {
9296
10271
  headers: {
9297
10272
  [name: string]: unknown;
9298
10273
  };
9299
- content?: never;
10274
+ content: {
10275
+ "application/json": components["schemas"]["ErrorResponse"];
10276
+ };
9300
10277
  };
9301
- /** @description Server error */
10278
+ /** @description Rail pre-check failed — `VENDOR_NOT_CONFIGURED`, `RAIL_NOT_CONFIGURED`, `DEPOSITS_DISABLED`, `WALLET_RAIL_NOT_ONBOARDED` or `WALLET_RAIL_NOT_APPROVED` */
10279
+ 422: {
10280
+ headers: {
10281
+ [name: string]: unknown;
10282
+ };
10283
+ content: {
10284
+ "application/json": components["schemas"]["ErrorResponse"];
10285
+ };
10286
+ };
10287
+ /** @description `INTERNAL_ERROR` — generic message; details are only logged server-side */
9302
10288
  500: {
9303
10289
  headers: {
9304
10290
  [name: string]: unknown;
9305
10291
  };
9306
- content?: never;
10292
+ content: {
10293
+ "application/json": components["schemas"]["ErrorResponse"];
10294
+ };
10295
+ };
10296
+ /** @description The program's vendor is retired (Rail.io) or unsupported — no new accounts can be created on it */
10297
+ 501: {
10298
+ headers: {
10299
+ [name: string]: unknown;
10300
+ };
10301
+ content: {
10302
+ "application/json": components["schemas"]["ErrorResponse"];
10303
+ };
9307
10304
  };
9308
10305
  };
9309
10306
  };
@@ -9322,7 +10319,9 @@ export interface paths {
9322
10319
  };
9323
10320
  /**
9324
10321
  * List virtual account programs
9325
- * @description Retrieves a list of available virtual account programs filtered by wallet KYC access.
10322
+ * @description Retrieves the ACTIVE virtual account programs available to the wallet, filtered by
10323
+ * the wallet's KYC rail access (tenants with KYC disabled skip the rail filtering).
10324
+ * Archived and draft programs are never listed.
9326
10325
  *
9327
10326
  * **Authentication**: Bearer token with x-tenant-id header required
9328
10327
  *
@@ -9332,7 +10331,7 @@ export interface paths {
9332
10331
  get: {
9333
10332
  parameters: {
9334
10333
  query?: {
9335
- /** @description Number of items to return */
10334
+ /** @description Number of items to return (default 10) */
9336
10335
  limit?: number;
9337
10336
  /** @description Number of items to skip */
9338
10337
  offset?: number;
@@ -9356,13 +10355,9 @@ export interface paths {
9356
10355
  /** @example true */
9357
10356
  success?: boolean;
9358
10357
  data?: components["schemas"]["VirtualAccountProgram"][];
9359
- pagination?: {
9360
- offset?: number;
9361
- limit?: number;
9362
- total?: number;
9363
- };
10358
+ pagination?: components["schemas"]["PaginationResponse"];
9364
10359
  meta?: {
9365
- /** @description Total programs in database before KYC filtering */
10360
+ /** @description Number of programs visible to this wallet after KYC filtering (equals `pagination.total`) */
9366
10361
  total_count?: number;
9367
10362
  };
9368
10363
  };
@@ -9373,14 +10368,18 @@ export interface paths {
9373
10368
  headers: {
9374
10369
  [name: string]: unknown;
9375
10370
  };
9376
- content?: never;
10371
+ content: {
10372
+ "application/json": components["schemas"]["ErrorResponse"];
10373
+ };
9377
10374
  };
9378
10375
  /** @description Server error */
9379
10376
  500: {
9380
10377
  headers: {
9381
10378
  [name: string]: unknown;
9382
10379
  };
9383
- content?: never;
10380
+ content: {
10381
+ "application/json": components["schemas"]["ErrorResponse"];
10382
+ };
9384
10383
  };
9385
10384
  };
9386
10385
  };
@@ -9402,13 +10401,18 @@ export interface paths {
9402
10401
  /**
9403
10402
  * Get virtual account program
9404
10403
  * @description Retrieves detailed information about a specific virtual account program.
10404
+ * The by-id read is not status-filtered — a non-ACTIVE program is returned
10405
+ * when addressed directly.
9405
10406
  *
9406
10407
  * **Authentication**: Bearer token with x-tenant-id header required
9407
10408
  *
9408
10409
  */
9409
10410
  get: {
9410
10411
  parameters: {
9411
- query?: never;
10412
+ query?: {
10413
+ /** @description Wallet whose KYC entity type decides visibility; without it only universal-rail programs are visible on KYC-enabled tenants */
10414
+ wallet_id?: string;
10415
+ };
9412
10416
  header?: never;
9413
10417
  path: {
9414
10418
  /** @description The program ID */
@@ -9431,7 +10435,7 @@ export interface paths {
9431
10435
  };
9432
10436
  };
9433
10437
  };
9434
- /** @description Program not found */
10438
+ /** @description Program not found, or not allowed for the wallet's KYC rail */
9435
10439
  404: {
9436
10440
  headers: {
9437
10441
  [name: string]: unknown;
@@ -9466,12 +10470,14 @@ export interface paths {
9466
10470
  put?: never;
9467
10471
  /**
9468
10472
  * Sync virtual account
9469
- * @description Fetches the latest bank account details and deposit instructions from the vendor
9470
- * and updates the local record.
10473
+ * @description Refreshes the bank account details and deposit instructions from the vendor
10474
+ * (Brale / Delos / BCB) and updates the local record. Historical Rail.io
10475
+ * (RAIL-B / RAIL-C) accounts cannot be refreshed — their stored requisites are
10476
+ * returned unchanged.
9471
10477
  *
9472
10478
  * **Authentication**: Bearer token with x-tenant-id header required
9473
10479
  *
9474
- * **Access Control**: User must have access to the wallet containing this virtual account
10480
+ * **Access Control**: User must have access to the wallet containing this virtual account; wallet KYC must be APPROVED
9475
10481
  *
9476
10482
  */
9477
10483
  post: {
@@ -9486,7 +10492,7 @@ export interface paths {
9486
10492
  };
9487
10493
  requestBody?: never;
9488
10494
  responses: {
9489
- /** @description Virtual account synced successfully */
10495
+ /** @description Virtual account synced successfully. Same shape as the single-account read, without `crypto_deposit_details` */
9490
10496
  200: {
9491
10497
  headers: {
9492
10498
  [name: string]: unknown;
@@ -9495,7 +10501,7 @@ export interface paths {
9495
10501
  "application/json": {
9496
10502
  /** @example true */
9497
10503
  success?: boolean;
9498
- data?: components["schemas"]["VirtualAccount"];
10504
+ data?: components["schemas"]["VirtualAccountDetail"];
9499
10505
  /** @example Virtual account synced successfully */
9500
10506
  message?: string;
9501
10507
  };
@@ -9508,7 +10514,7 @@ export interface paths {
9508
10514
  };
9509
10515
  content?: never;
9510
10516
  };
9511
- /** @description Access denied */
10517
+ /** @description Access denied, or wallet KYC not approved */
9512
10518
  403: {
9513
10519
  headers: {
9514
10520
  [name: string]: unknown;
@@ -9554,7 +10560,10 @@ export interface paths {
9554
10560
  /**
9555
10561
  * Get virtual account
9556
10562
  * @description Retrieves detailed information about a specific virtual account.
9557
- * Requisites are automatically synced from vendor on every request.
10563
+ * For accounts linked to a vendor (Brale / Delos / BCB) the requisites are refreshed
10564
+ * from the vendor on read unless `skip_sync=true`; a failed refresh falls back to the
10565
+ * cached data (still 200). Accounts without a vendor link and historical Rail.io
10566
+ * accounts return the stored data.
9558
10567
  *
9559
10568
  * **Authentication**: Bearer token with x-tenant-id header required
9560
10569
  *
@@ -9576,7 +10585,7 @@ export interface paths {
9576
10585
  };
9577
10586
  requestBody?: never;
9578
10587
  responses: {
9579
- /** @description Virtual account details retrieved successfully (auto-synced) */
10588
+ /** @description Virtual account details retrieved successfully (requisites refreshed from the vendor when linked) */
9580
10589
  200: {
9581
10590
  headers: {
9582
10591
  [name: string]: unknown;
@@ -9585,7 +10594,7 @@ export interface paths {
9585
10594
  "application/json": {
9586
10595
  /** @example true */
9587
10596
  success?: boolean;
9588
- data?: components["schemas"]["VirtualAccount"];
10597
+ data?: components["schemas"]["VirtualAccountDetail"];
9589
10598
  };
9590
10599
  };
9591
10600
  };
@@ -9594,21 +10603,27 @@ export interface paths {
9594
10603
  headers: {
9595
10604
  [name: string]: unknown;
9596
10605
  };
9597
- content?: never;
10606
+ content: {
10607
+ "application/json": components["schemas"]["ErrorResponse"];
10608
+ };
9598
10609
  };
9599
10610
  /** @description Virtual account not found */
9600
10611
  404: {
9601
10612
  headers: {
9602
10613
  [name: string]: unknown;
9603
10614
  };
9604
- content?: never;
10615
+ content: {
10616
+ "application/json": components["schemas"]["ErrorResponse"];
10617
+ };
9605
10618
  };
9606
10619
  /** @description Server error */
9607
10620
  500: {
9608
10621
  headers: {
9609
10622
  [name: string]: unknown;
9610
10623
  };
9611
- content?: never;
10624
+ content: {
10625
+ "application/json": components["schemas"]["ErrorResponse"];
10626
+ };
9612
10627
  };
9613
10628
  };
9614
10629
  };
@@ -9637,7 +10652,7 @@ export interface paths {
9637
10652
  * - `id` — user_data.id (numeric)
9638
10653
  * - `email` — user_data.email (case-insensitive)
9639
10654
  * - `phone` — user_data.phone
9640
- * - `telegram` — telegram_id from auth_telegram table
10655
+ * - `telegram` — `telegram_user.tg_id`, or a case-insensitive `username` match (leading `@` ignored)
9641
10656
  *
9642
10657
  * **Authentication**: Bearer token with x-tenant-id header required
9643
10658
  *
@@ -9993,6 +11008,9 @@ export interface paths {
9993
11008
  *
9994
11009
  * Each wallet includes `access_role` (owner/admin/user/auditor) and `is_owner` boolean.
9995
11010
  *
11011
+ * Wallets where the caller holds the scoped `user` role are returned as a reduced shell
11012
+ * (`uuid`, `name`, `display_name`, `tenant_id`, `kyc_info`, `created_at` + the role fields) — no `logo_url`.
11013
+ *
9996
11014
  * **Authentication**: Bearer token with x-tenant-id header required
9997
11015
  *
9998
11016
  */
@@ -10038,13 +11056,11 @@ export interface paths {
10038
11056
  */
10039
11057
  display_name?: string;
10040
11058
  /** @description Avatar URL for the wallet */
10041
- logo_url: string | null;
11059
+ logo_url?: string | null;
10042
11060
  /** Format: uuid */
10043
11061
  tenant_id: string;
10044
11062
  /** Format: date-time */
10045
11063
  created_at: string;
10046
- /** Format: date-time */
10047
- updated_at: string;
10048
11064
  /**
10049
11065
  * @description Legacy alias of `access_role`. Kept for backward compatibility —
10050
11066
  * always equals `access_role`. Prefer `access_role` in new code.
@@ -10083,8 +11099,8 @@ export interface paths {
10083
11099
  };
10084
11100
  };
10085
11101
  };
10086
- /** @description User not authenticated */
10087
- 403: {
11102
+ /** @description Missing or invalid bearer token */
11103
+ 401: {
10088
11104
  headers: {
10089
11105
  [name: string]: unknown;
10090
11106
  };
@@ -10174,10 +11190,8 @@ export interface paths {
10174
11190
  tenant_id: string;
10175
11191
  /** Format: date-time */
10176
11192
  created_at: string;
10177
- /** Format: date-time */
10178
- updated_at: string;
10179
- /** @description Mirrors the GET-wallet shape. Always `null` on create
10180
- * (no `kyc_entity` row exists yet).
11193
+ /** @description Mirrors the GET-wallet shape. `null` when the wallet was created
11194
+ * without `kyc_entity_id`; populated with the linked entity otherwise.
10181
11195
  * */
10182
11196
  kyc_info: {
10183
11197
  type: string;
@@ -10240,7 +11254,7 @@ export interface paths {
10240
11254
  *
10241
11255
  * **Authentication**: Bearer token with x-tenant-id header required
10242
11256
  *
10243
- * **Access Control**: Any user with access to the wallet
11257
+ * **Access Control**: Any owner/admin/auditor member of the wallet (the scoped `user` role is rejected with 403); wallet KYC must be APPROVED or HOLD
10244
11258
  *
10245
11259
  */
10246
11260
  get: {
@@ -10403,7 +11417,9 @@ export interface paths {
10403
11417
  *
10404
11418
  * **Authentication**: Bearer token with x-tenant-id header required
10405
11419
  *
10406
- * **Access Control**: User must own the wallet
11420
+ * **Access Control**: Any active wallet member. The scoped `user` role receives a shell-only
11421
+ * response (`uuid`, `name`, `display_name`, `tenant_id`, `kyc_info`, `created_at` + the role fields) —
11422
+ * `logo_url`, `balance`, `fiat_accounts` and the totals are omitted for that role.
10407
11423
  *
10408
11424
  */
10409
11425
  get: {
@@ -10446,8 +11462,6 @@ export interface paths {
10446
11462
  tenant_id: string;
10447
11463
  /** Format: date-time */
10448
11464
  created_at: string;
10449
- /** Format: date-time */
10450
- updated_at: string;
10451
11465
  kyc_info: {
10452
11466
  type: string;
10453
11467
  status: string;
@@ -10576,8 +11590,6 @@ export interface paths {
10576
11590
  tenant_id: string;
10577
11591
  /** Format: date-time */
10578
11592
  created_at: string;
10579
- /** Format: date-time */
10580
- updated_at: string;
10581
11593
  /** @description KYC entity attached to the wallet (joined from `kyc_entity`).
10582
11594
  * `null` when the wallet has no KYC entity yet.
10583
11595
  * */
@@ -10642,7 +11654,7 @@ export interface paths {
10642
11654
  *
10643
11655
  * **Authentication**: Bearer token with x-tenant-id header required
10644
11656
  *
10645
- * **Access Control**: User must own the wallet
11657
+ * **Access Control**: Any owner/admin/auditor member of the wallet (the scoped `user` role is rejected with 403); wallet KYC must be APPROVED or HOLD
10646
11658
  *
10647
11659
  * This is a simplified version of the main wallet endpoint that:
10648
11660
  * - Returns raw balance records without aggregation
@@ -10683,8 +11695,6 @@ export interface paths {
10683
11695
  tenant_id: string;
10684
11696
  /** Format: date-time */
10685
11697
  created_at: string;
10686
- /** Format: date-time */
10687
- updated_at: string;
10688
11698
  /** @description Array of balance records */
10689
11699
  balance: {
10690
11700
  /** Format: uuid */
@@ -10763,7 +11773,7 @@ export interface paths {
10763
11773
  *
10764
11774
  * **Authentication**: Bearer token with x-tenant-id header required
10765
11775
  *
10766
- * **Access Control**: User must own the wallet
11776
+ * **Access Control**: Any owner/admin/auditor member of the wallet (the scoped `user` role is rejected with 403); wallet KYC must be APPROVED or HOLD
10767
11777
  *
10768
11778
  */
10769
11779
  get: {
@@ -10860,7 +11870,7 @@ export interface paths {
10860
11870
  *
10861
11871
  * **Authentication**: Bearer token with x-tenant-id header required
10862
11872
  *
10863
- * **Access Control**: Any user with access to the wallet
11873
+ * **Access Control**: Any owner/admin/auditor member of the wallet (the scoped `user` role is rejected with 403); wallet KYC must be APPROVED or HOLD
10864
11874
  *
10865
11875
  */
10866
11876
  get: {
@@ -10933,7 +11943,7 @@ export interface paths {
10933
11943
  *
10934
11944
  * **Authentication**: Bearer token with x-tenant-id header required
10935
11945
  *
10936
- * **Access Control**: User must own the wallet
11946
+ * **Access Control**: Owner or admin of the wallet; wallet KYC must be APPROVED
10937
11947
  *
10938
11948
  * **Note**: New addresses are always provisioned via Utila. The legacy Processing (Accepta) provider was decommissioned; existing `processing` addresses remain readable.
10939
11949
  *
@@ -10945,8 +11955,8 @@ export interface paths {
10945
11955
  path: {
10946
11956
  /** @description The ID of the wallet */
10947
11957
  wallet_id: string;
10948
- /** @description The blockchain ID (e.g., 'ethereum', 'bitcoin') */
10949
- chain: string;
11958
+ /** @description Numeric chain ID (see `GET /frontend/reference/chains`) */
11959
+ chain: number;
10950
11960
  };
10951
11961
  cookie?: never;
10952
11962
  };
@@ -10962,7 +11972,7 @@ export interface paths {
10962
11972
  };
10963
11973
  };
10964
11974
  responses: {
10965
- /** @description Crypto address created successfully */
11975
+ /** @description Crypto address created — or the existing address for this chain returned (idempotent, always 201) */
10966
11976
  201: {
10967
11977
  headers: {
10968
11978
  [name: string]: unknown;
@@ -11005,13 +12015,6 @@ export interface paths {
11005
12015
  };
11006
12016
  content?: never;
11007
12017
  };
11008
- /** @description Address for this chain already exists */
11009
- 409: {
11010
- headers: {
11011
- [name: string]: unknown;
11012
- };
11013
- content?: never;
11014
- };
11015
12018
  /** @description Server error */
11016
12019
  500: {
11017
12020
  headers: {
@@ -11040,7 +12043,7 @@ export interface paths {
11040
12043
  *
11041
12044
  * **Authentication**: Bearer token with x-tenant-id header required
11042
12045
  *
11043
- * **Access Control**: User must own the wallet
12046
+ * **Access Control**: Any owner/admin/auditor member of the wallet (the scoped `user` role is rejected with 403); wallet KYC must be APPROVED or HOLD
11044
12047
  *
11045
12048
  */
11046
12049
  get: {
@@ -11154,7 +12157,7 @@ export interface paths {
11154
12157
  *
11155
12158
  * **Authentication**: Bearer token with x-tenant-id header required
11156
12159
  *
11157
- * **Access Control**: User must own the wallet
12160
+ * **Access Control**: Any owner/admin/auditor member of the wallet (the scoped `user` role is rejected with 403); wallet KYC must be APPROVED or HOLD
11158
12161
  *
11159
12162
  */
11160
12163
  get: {
@@ -11320,7 +12323,7 @@ export interface paths {
11320
12323
  *
11321
12324
  * **Authentication**: Bearer token with x-tenant-id header required
11322
12325
  *
11323
- * **Access Control**: Any user with access to the wallet can view the user list
12326
+ * **Access Control**: Any owner/admin/auditor member of the wallet (the scoped `user` role is rejected with 403)
11324
12327
  *
11325
12328
  */
11326
12329
  get: {
@@ -11414,14 +12417,14 @@ export interface paths {
11414
12417
  * @description Adds a user to the wallet by their user_data.uuid.
11415
12418
  *
11416
12419
  * **Rules:**
11417
- * - Only the wallet **owner** can add users
12420
+ * - Only the wallet **owner** or an **admin** can add users
11418
12421
  * - Target user must be in the **same tenant**
11419
12422
  * - Target user must **not** be the wallet owner
11420
- * - Allowed roles: `user`, `admin`
12423
+ * - Allowed roles: `auditor`, `user`, `admin`
11421
12424
  *
11422
12425
  * **Authentication**: Bearer token with x-tenant-id header required
11423
12426
  *
11424
- * **Access Control**: Owner only
12427
+ * **Access Control**: Owner or admin of the wallet; wallet KYC must be APPROVED
11425
12428
  *
11426
12429
  */
11427
12430
  post: {
@@ -11476,29 +12479,22 @@ export interface paths {
11476
12479
  };
11477
12480
  };
11478
12481
  };
11479
- /** @description Bad request - missing fields or invalid role */
12482
+ /** @description Bad request - missing fields or invalid role; `CONFLICT` when the user is already a member or is the wallet owner */
11480
12483
  400: {
11481
12484
  headers: {
11482
12485
  [name: string]: unknown;
11483
12486
  };
11484
12487
  content?: never;
11485
12488
  };
11486
- /** @description Only the wallet owner can add users / user not in same tenant */
12489
+ /** @description Caller is not owner/admin of the wallet, wallet KYC not approved, or target user not in the same tenant */
11487
12490
  403: {
11488
12491
  headers: {
11489
12492
  [name: string]: unknown;
11490
12493
  };
11491
12494
  content?: never;
11492
12495
  };
11493
- /** @description Wallet or target user not found */
11494
- 404: {
11495
- headers: {
11496
- [name: string]: unknown;
11497
- };
11498
- content?: never;
11499
- };
11500
- /** @description User is already added to this wallet / cannot add owner */
11501
- 409: {
12496
+ /** @description Wallet or target user not found */
12497
+ 404: {
11502
12498
  headers: {
11503
12499
  [name: string]: unknown;
11504
12500
  };
@@ -11534,11 +12530,11 @@ export interface paths {
11534
12530
  * @description Removes a shared user from the wallet (sets is_active = false).
11535
12531
  *
11536
12532
  * **Rules:**
11537
- * - Only the wallet **owner** can remove users
12533
+ * - Only the wallet **owner** or an **admin** can remove users
11538
12534
  *
11539
12535
  * **Authentication**: Bearer token with x-tenant-id header required
11540
12536
  *
11541
- * **Access Control**: Owner only
12537
+ * **Access Control**: Owner or admin of the wallet; wallet KYC must be APPROVED
11542
12538
  *
11543
12539
  */
11544
12540
  delete: {
@@ -11570,7 +12566,7 @@ export interface paths {
11570
12566
  };
11571
12567
  };
11572
12568
  };
11573
- /** @description Only the wallet owner can remove users */
12569
+ /** @description Caller is not owner/admin of the wallet, or wallet KYC not approved */
11574
12570
  403: {
11575
12571
  headers: {
11576
12572
  [name: string]: unknown;
@@ -11600,12 +12596,12 @@ export interface paths {
11600
12596
  * @description Updates the role of a shared user on this wallet.
11601
12597
  *
11602
12598
  * **Rules:**
11603
- * - Only the wallet **owner** can update roles
11604
- * - Allowed roles: `user`, `admin`
12599
+ * - Only the wallet **owner** or an **admin** can update roles
12600
+ * - Allowed roles: `auditor`, `user`, `admin`
11605
12601
  *
11606
12602
  * **Authentication**: Bearer token with x-tenant-id header required
11607
12603
  *
11608
- * **Access Control**: Owner only
12604
+ * **Access Control**: Owner or admin of the wallet; wallet KYC must be APPROVED
11609
12605
  *
11610
12606
  */
11611
12607
  patch: {
@@ -11647,14 +12643,14 @@ export interface paths {
11647
12643
  };
11648
12644
  };
11649
12645
  };
11650
- /** @description Invalid role */
12646
+ /** @description Invalid role; `CONFLICT` when the target is the wallet owner */
11651
12647
  400: {
11652
12648
  headers: {
11653
12649
  [name: string]: unknown;
11654
12650
  };
11655
12651
  content?: never;
11656
12652
  };
11657
- /** @description Only the wallet owner can update roles */
12653
+ /** @description Caller is not owner/admin of the wallet, or wallet KYC not approved */
11658
12654
  403: {
11659
12655
  headers: {
11660
12656
  [name: string]: unknown;
@@ -11693,12 +12689,12 @@ export interface paths {
11693
12689
  * @description Re-activates a previously deactivated user on this wallet.
11694
12690
  *
11695
12691
  * **Rules:**
11696
- * - Only the wallet **owner** can activate users
12692
+ * - Only the wallet **owner** or an **admin** can activate users
11697
12693
  * - Cannot activate the wallet owner themselves
11698
12694
  *
11699
12695
  * **Authentication**: Bearer token with x-tenant-id header required
11700
12696
  *
11701
- * **Access Control**: Owner only
12697
+ * **Access Control**: Owner or admin of the wallet; wallet KYC must be APPROVED
11702
12698
  *
11703
12699
  */
11704
12700
  post: {
@@ -11730,22 +12726,22 @@ export interface paths {
11730
12726
  };
11731
12727
  };
11732
12728
  };
11733
- /** @description Only the wallet owner can activate users */
11734
- 403: {
12729
+ /** @description Target is the wallet owner (`CONFLICT`) */
12730
+ 400: {
11735
12731
  headers: {
11736
12732
  [name: string]: unknown;
11737
12733
  };
11738
12734
  content?: never;
11739
12735
  };
11740
- /** @description User not found in this wallet */
11741
- 404: {
12736
+ /** @description Caller is not owner/admin of the wallet, or wallet KYC not approved */
12737
+ 403: {
11742
12738
  headers: {
11743
12739
  [name: string]: unknown;
11744
12740
  };
11745
12741
  content?: never;
11746
12742
  };
11747
- /** @description Cannot change active status of the wallet owner */
11748
- 409: {
12743
+ /** @description User not found in this wallet */
12744
+ 404: {
11749
12745
  headers: {
11750
12746
  [name: string]: unknown;
11751
12747
  };
@@ -11781,12 +12777,12 @@ export interface paths {
11781
12777
  * The user record is preserved but the user loses access to the wallet.
11782
12778
  *
11783
12779
  * **Rules:**
11784
- * - Only the wallet **owner** can deactivate users
12780
+ * - Only the wallet **owner** or an **admin** can deactivate users
11785
12781
  * - Cannot deactivate the wallet owner themselves
11786
12782
  *
11787
12783
  * **Authentication**: Bearer token with x-tenant-id header required
11788
12784
  *
11789
- * **Access Control**: Owner only
12785
+ * **Access Control**: Owner or admin of the wallet; wallet KYC must be APPROVED
11790
12786
  *
11791
12787
  */
11792
12788
  post: {
@@ -11818,22 +12814,22 @@ export interface paths {
11818
12814
  };
11819
12815
  };
11820
12816
  };
11821
- /** @description Only the wallet owner can deactivate users */
11822
- 403: {
12817
+ /** @description Target is the wallet owner (`CONFLICT`) */
12818
+ 400: {
11823
12819
  headers: {
11824
12820
  [name: string]: unknown;
11825
12821
  };
11826
12822
  content?: never;
11827
12823
  };
11828
- /** @description User not found in this wallet */
11829
- 404: {
12824
+ /** @description Caller is not owner/admin of the wallet, or wallet KYC not approved */
12825
+ 403: {
11830
12826
  headers: {
11831
12827
  [name: string]: unknown;
11832
12828
  };
11833
12829
  content?: never;
11834
12830
  };
11835
- /** @description Cannot change active status of the wallet owner */
11836
- 409: {
12831
+ /** @description User not found in this wallet */
12832
+ 404: {
11837
12833
  headers: {
11838
12834
  [name: string]: unknown;
11839
12835
  };
@@ -11903,7 +12899,7 @@ export interface paths {
11903
12899
  };
11904
12900
  };
11905
12901
  };
11906
- /** @description Invalid query parameter (offset/limit/is_completed/role) */
12902
+ /** @description Invalid query parameter (non-integer offset/limit, unknown role); any value other than `true`/`1` for `is_completed`/`is_expired` is read as `false` */
11907
12903
  400: {
11908
12904
  headers: {
11909
12905
  [name: string]: unknown;
@@ -12213,7 +13209,7 @@ export type webhooks = Record<string, never>;
12213
13209
  export interface components {
12214
13210
  schemas: {
12215
13211
  /**
12216
- * @description Order type identifier. Must be one of the active values from the `order_types` table. Examples: `EXCHANGE_OMNI` (omnibus exchange), `L2F_SWIFT_OFFRAMP` (SWIFT offramp), `OMNIBUS_CRYPTO_TRANSFER` (crypto withdrawal). Legacy `DEPOSIT_*`, `WITHDRAWAL_*` and `AUTO_CONVERT_CRYPTO` are intentionally excluded.
13212
+ * @description Order type identifier. Must be one of the active values from the `order_types` table. Examples: `EXCHANGE_OMNI` (omnibus exchange), `BRL_WIRE_OFFRAMP` (wire offramp), `OMNIBUS_CRYPTO_TRANSFER` (crypto withdrawal). `L2F_*` ids are historical (rail retired) and cannot be used to create orders. Legacy `DEPOSIT_*`, `WITHDRAWAL_*` and `AUTO_CONVERT_CRYPTO` are intentionally excluded.
12217
13213
  * @example EXCHANGE_OMNI
12218
13214
  * @enum {string}
12219
13215
  */
@@ -12279,9 +13275,13 @@ export interface components {
12279
13275
  ErrorResponse: {
12280
13276
  /** @example false */
12281
13277
  success?: boolean;
13278
+ /** @description Request correlation id — quote it in support requests */
13279
+ correlationId?: string;
12282
13280
  error?: {
12283
13281
  code?: string;
12284
13282
  message?: string;
13283
+ /** @description Structured payload (validation issues, missing fields) when the error carries one */
13284
+ details?: Record<string, never> | null;
12285
13285
  };
12286
13286
  };
12287
13287
  /** @description Counterparty account (beneficiary). Wallet-scoped. */
@@ -12315,7 +13315,7 @@ export interface components {
12315
13315
  /** @description Active destinations belonging to this account. */
12316
13316
  destinations: components["schemas"]["CounterpartyDestination"][];
12317
13317
  };
12318
- /** @description Bank / beneficiary postal address. */
13318
+ /** @description Registered postal address of the BANK (not the beneficiary). On create it is replaced atomically by the bank-directory address when the submitted bank code resolves to a complete one; otherwise the submitted address is kept. */
12319
13319
  CounterpartyBankingAddress: {
12320
13320
  city?: string | null;
12321
13321
  postcode?: string | null;
@@ -12392,7 +13392,7 @@ export interface components {
12392
13392
  * @description Destination / payment rail type
12393
13393
  * @enum {string}
12394
13394
  */
12395
- type: "ACH" | "SWIFT" | "SEPA" | "CRYPTO_EXTERNAL" | "CRYPTO_INTERNAL" | "CHAPS" | "FPS" | "FEDWIRE" | "INTERNAL";
13395
+ type: "ACH" | "RTP" | "SWIFT" | "SEPA" | "CRYPTO_EXTERNAL" | "CRYPTO_INTERNAL" | "CHAPS" | "FPS" | "FEDWIRE" | "INTERNAL";
12396
13396
  /** @description User-friendly alias */
12397
13397
  nickname?: string | null;
12398
13398
  /** Format: date-time */
@@ -12549,6 +13549,8 @@ export interface components {
12549
13549
  card_issuing_fee?: number | null;
12550
13550
  card_monthly_fee?: number | null;
12551
13551
  initial_topup?: number | null;
13552
+ /** @description Minimum top-up amount in program currency, compared against the credited amount (0 = no minimum) */
13553
+ min_topup?: number;
12552
13554
  card_design?: {
12553
13555
  [key: string]: unknown;
12554
13556
  } | null;
@@ -12642,8 +13644,17 @@ export interface components {
12642
13644
  vendor_card_id?: string;
12643
13645
  /** Format: uuid */
12644
13646
  cardholder_id?: string | null;
12645
- /** @description Cardholder record, or null */
12646
- cardholder?: components["schemas"]["IssuingCardholder"] | null;
13647
+ /** @description Cardholder summary, or null */
13648
+ cardholder?: {
13649
+ /** Format: uuid */
13650
+ id?: string;
13651
+ first_name?: string | null;
13652
+ last_name?: string | null;
13653
+ email?: string | null;
13654
+ phone?: string | null;
13655
+ birth_date?: string | null;
13656
+ nationality?: string | null;
13657
+ } | null;
12647
13658
  /** @description user_data.id the card is assigned to; omitted (absent) when the card is not assigned to a member */
12648
13659
  user_data_id?: number;
12649
13660
  /** @description Embedded sub-account summary, or null when no sub-account is linked. Present on the normal (vendor-enriched) response; omitted only in the degraded local-only error mode. */
@@ -12767,8 +13778,6 @@ export interface components {
12767
13778
  /** @description Units of billing currency per unit of transaction currency, so `transaction_amount * conversion_rate ≈ billing_amount`. 1 when the currencies match. */
12768
13779
  conversion_rate?: number;
12769
13780
  failure_reason?: string;
12770
- adjustment_type?: string | null;
12771
- review_status?: string | null;
12772
13781
  has_receipt?: boolean;
12773
13782
  merchant?: components["schemas"]["TransactionMerchant"];
12774
13783
  /** Format: date-time */
@@ -12958,16 +13967,234 @@ export interface components {
12958
13967
  /** @description Error code for programmatic handling */
12959
13968
  code?: string;
12960
13969
  };
12961
- /** @description Virtual bank account */
12962
- VirtualAccount: {
13970
+ /** @description Full currency object embedded on virtual-account reads (from the `crypto` table). */
13971
+ VirtualAccountCurrency: components["schemas"]["CurrencyDetails"] & {
13972
+ is_crypto?: boolean;
13973
+ enabled?: boolean;
13974
+ /** @description Currency type discriminator */
13975
+ type?: string;
13976
+ meta?: {
13977
+ [key: string]: unknown;
13978
+ } | null;
13979
+ };
13980
+ /** @description Compact currency reference joined onto program reads (no `decimal`). */
13981
+ CurrencySummary: {
13982
+ /** Format: uuid */
13983
+ uuid?: string;
13984
+ name?: string;
13985
+ symbol?: string;
13986
+ icon?: string | null;
13987
+ type?: string;
13988
+ };
13989
+ /** @description KYC rail attached to a virtual-account program. Program reads embed the full rail; rails embedded inside virtual-account reads omit `is_deposit_enabled` (internal toggle). */
13990
+ KycRail: {
13991
+ /** Format: uuid */
13992
+ id?: string;
13993
+ name?: string;
13994
+ code?: string | null;
13995
+ vendor_code?: string | null;
13996
+ /** Format: uuid */
13997
+ integration_vendors_id?: string | null;
13998
+ type?: string;
13999
+ /** Format: uuid */
14000
+ tenant_id?: string;
14001
+ /** Format: uuid */
14002
+ countries_group_id?: string | null;
14003
+ is_active?: boolean;
14004
+ is_manual?: boolean;
14005
+ is_submit_available?: boolean;
14006
+ /** @description Present on program reads only — stripped from rails embedded in virtual-account responses */
14007
+ is_deposit_enabled?: boolean;
14008
+ };
14009
+ /** @description Raw virtual-account program row. */
14010
+ VirtualAccountProgramBase: {
14011
+ /** Format: uuid */
14012
+ id?: string;
14013
+ name?: string;
14014
+ description?: string | null;
14015
+ /**
14016
+ * @description Program listings return ACTIVE programs only; the by-id read is not status-filtered
14017
+ * @enum {string}
14018
+ */
14019
+ status?: "DRAFT" | "ACTIVE" | "ARCHIVED";
14020
+ icon?: string | null;
14021
+ code?: string | null;
14022
+ /** @description Vendor-side program identifier */
14023
+ vendor_id?: string | null;
14024
+ /** Format: uuid */
14025
+ tenant_id?: string;
14026
+ /** Format: uuid */
14027
+ account_currency_id?: string;
14028
+ /** Format: uuid */
14029
+ destination_currency_id?: string;
14030
+ /** Format: uuid */
14031
+ kyc_rails_id?: string;
14032
+ /** @description Consent text shown before opening an account on this program */
14033
+ consent_text?: string | null;
14034
+ /** Format: uuid */
14035
+ integration_vendors_id?: string;
14036
+ is_hidden?: boolean;
14037
+ };
14038
+ /** @description Program as returned by the program reads (list and by-id): the raw row hydrated with vendor, currency, order-type and KYC-rail joins. */
14039
+ VirtualAccountProgram: components["schemas"]["VirtualAccountProgramBase"] & {
14040
+ integration_vendor?: {
14041
+ /** Format: uuid */
14042
+ id?: string;
14043
+ name?: string;
14044
+ code?: string;
14045
+ type?: string;
14046
+ } | null;
14047
+ account_currency_details?: components["schemas"]["CurrencySummary"] | null;
14048
+ destination_currency_details?: components["schemas"]["CurrencySummary"] | null;
14049
+ /** @description Order types enabled on the program */
14050
+ virtual_accounts_programs_order_types?: {
14051
+ /** Format: uuid */
14052
+ order_type_id?: string;
14053
+ order_type?: {
14054
+ /** Format: uuid */
14055
+ id?: string;
14056
+ description?: string | null;
14057
+ } | null;
14058
+ }[];
14059
+ kyc_rails?: components["schemas"]["KycRail"] | null;
14060
+ };
14061
+ /** @description Fields shared by every virtual-account read shape. */
14062
+ VirtualAccountBase: {
12963
14063
  /** Format: uuid */
12964
14064
  id?: string;
14065
+ /** Format: date-time */
14066
+ created_at?: string;
12965
14067
  /** Format: uuid */
12966
14068
  wallet_id?: string;
12967
14069
  /** Format: uuid */
12968
14070
  va_programs_id?: string;
12969
- /** @enum {string} */
12970
- status?: "ACTIVE" | "INACTIVE" | "PENDING" | "CANCELED";
14071
+ /**
14072
+ * @description PENDING — awaiting upstream provisioning (re-post create to poll); FAILED — rejected upstream, the program can be re-opened
14073
+ * @enum {string}
14074
+ */
14075
+ status?: "ACTIVE" | "CANCELED" | "FROZEN" | "INACTIVE" | "CLOSED" | "BLOCKED" | "PENDING" | "FAILED";
14076
+ /** @description Settlement destination address (when the program settles to crypto) */
14077
+ destination_address?: string | null;
14078
+ /** Format: uuid */
14079
+ integration_vendor_id?: string;
14080
+ vendor_account_id?: string;
14081
+ /** @description Customer name the account is held under */
14082
+ customer_name?: string | null;
14083
+ /** @description Bank requisites summary derived from deposit_instructions. Empty object when the account has no instructions; null when deposits are disabled on the program's KYC rail. */
14084
+ account_details?: {
14085
+ ach?: {
14086
+ accountNumber?: string;
14087
+ routingNumber?: string;
14088
+ } | null;
14089
+ wire?: {
14090
+ accountNumber?: string;
14091
+ routingNumber?: string;
14092
+ } | null;
14093
+ swift?: {
14094
+ swiftCode?: string;
14095
+ accountNumber?: string;
14096
+ } | null;
14097
+ sepa?: {
14098
+ iban?: string;
14099
+ swiftCode?: string;
14100
+ } | null;
14101
+ ukPayments?: {
14102
+ accountNumber?: string;
14103
+ sortCode?: string;
14104
+ } | null;
14105
+ swiftCode?: string | null;
14106
+ bankName?: string | null;
14107
+ bankAddress?: string | null;
14108
+ beneficiary?: {
14109
+ name?: string;
14110
+ address?: string | null;
14111
+ } | null;
14112
+ } | null;
14113
+ /** @description Deposit requisites (source of truth). Emptied to [] (never null) when deposits are disabled on the program's KYC rail. */
14114
+ deposit_instructions?: {
14115
+ [key: string]: unknown;
14116
+ }[] | null;
14117
+ meta?: Record<string, never> | null;
14118
+ };
14119
+ /** @description Virtual bank account as returned by the list read. Currencies come embedded as full objects; the raw uuids are exposed as `account_currency_id` / `destination_currency_id`. Only ACTIVE accounts are listed. */
14120
+ VirtualAccount: components["schemas"]["VirtualAccountBase"] & {
14121
+ /** @description Account currency as a full currency object (list read only — the single read returns a uuid string here) */
14122
+ account_currency?: components["schemas"]["VirtualAccountCurrency"];
14123
+ /** @description Destination currency as a full currency object (list read only — the single read returns a uuid string here) */
14124
+ destination_currency?: components["schemas"]["VirtualAccountCurrency"];
14125
+ /** Format: uuid */
14126
+ account_currency_id?: string;
14127
+ /** Format: uuid */
14128
+ destination_currency_id?: string;
14129
+ /** @description Owning program: the raw row plus its order types and KYC rail (rail without `is_deposit_enabled`) */
14130
+ virtual_accounts_program?: components["schemas"]["VirtualAccountProgramBase"] & {
14131
+ order_types?: {
14132
+ /** Format: uuid */
14133
+ order_type_id?: string;
14134
+ }[];
14135
+ kyc_rails?: components["schemas"]["KycRail"] | null;
14136
+ };
14137
+ };
14138
+ /** @description Virtual account as returned by the single-account read (also by sync, which omits `crypto_deposit_details`). Superset of the stored row: currencies stay uuid strings, hydrated objects arrive in `account_currency_details` / `destination_currency_details`. */
14139
+ VirtualAccountDetail: components["schemas"]["VirtualAccountBase"] & {
14140
+ /** Format: uuid */
14141
+ account_currency?: string;
14142
+ /** Format: uuid */
14143
+ destination_currency?: string;
14144
+ /** Format: uuid */
14145
+ account_currency_id?: string;
14146
+ /** Format: uuid */
14147
+ destination_currency_id?: string;
14148
+ account_currency_details?: components["schemas"]["VirtualAccountCurrency"] | null;
14149
+ destination_currency_details?: components["schemas"]["VirtualAccountCurrency"] | null;
14150
+ /** @description Always 0 — a virtual account carries no balance of its own */
14151
+ balance?: number;
14152
+ /** @description Always 0 — a virtual account carries no balance of its own */
14153
+ total_balance?: number;
14154
+ /** @description Stablecoin deposit addresses resolved from the account meta (single-account read only; empty array when none) */
14155
+ crypto_deposit_details?: {
14156
+ /** Format: uuid */
14157
+ currency_id?: string;
14158
+ deposit_address?: string;
14159
+ chain_id?: number;
14160
+ }[];
14161
+ /** @description Order type ids enabled on the owning program */
14162
+ order_types?: string[];
14163
+ /** @description Owning program: the raw row plus its order types (no rail embed on this read) */
14164
+ virtual_accounts_program?: components["schemas"]["VirtualAccountProgramBase"] & {
14165
+ order_types?: {
14166
+ /** Format: uuid */
14167
+ order_type_id?: string;
14168
+ }[];
14169
+ };
14170
+ };
14171
+ /** @description Create response shape: the stored account row only. Currencies are uuid strings, the hydrated fields of the list/single reads are absent, and `virtual_accounts_program` carries just the program's KYC rail reference. */
14172
+ VirtualAccountCreated: components["schemas"]["VirtualAccountBase"] & {
14173
+ /** Format: uuid */
14174
+ account_currency?: string;
14175
+ /** Format: uuid */
14176
+ destination_currency?: string;
14177
+ virtual_accounts_program?: {
14178
+ kyc_rails?: {
14179
+ /** Format: uuid */
14180
+ id?: string;
14181
+ is_active?: boolean;
14182
+ } | null;
14183
+ };
14184
+ };
14185
+ /** @description Virtual account as embedded in order responses: the stored row hydrated with currency and vendor details. */
14186
+ OrderVirtualAccount: {
14187
+ /** Format: uuid */
14188
+ id?: string;
14189
+ /** Format: uuid */
14190
+ wallet_id?: string;
14191
+ /** Format: uuid */
14192
+ va_programs_id?: string;
14193
+ /**
14194
+ * @description PENDING — awaiting upstream provisioning (re-post create to poll); FAILED — rejected upstream, the program can be re-opened
14195
+ * @enum {string}
14196
+ */
14197
+ status?: "ACTIVE" | "CANCELED" | "FROZEN" | "INACTIVE" | "CLOSED" | "BLOCKED" | "PENDING" | "FAILED";
12971
14198
  /** Format: uuid */
12972
14199
  account_currency?: string;
12973
14200
  /** Format: uuid */
@@ -12976,19 +14203,19 @@ export interface components {
12976
14203
  destination_address?: string | null;
12977
14204
  /** Format: uuid */
12978
14205
  integration_vendor_id?: string;
12979
- vendor_account_id?: string | null;
14206
+ vendor_account_id?: string;
12980
14207
  /** @description Customer name the account is held under */
12981
14208
  customer_name?: string | null;
12982
- /** @description Bank account details for deposits, derived from deposit_instructions. Returned null when deposits are disabled for the account. */
14209
+ /** @description Bank account details for deposits, derived from deposit_instructions. Returned null when deposits are disabled on the program's KYC rail. */
12983
14210
  account_details?: Record<string, never> | null;
12984
- /** @description Deposit requisites (source of truth). Returned null when deposits are disabled for the account. */
12985
- deposit_instructions?: Record<string, never> | null;
14211
+ /** @description Deposit requisites (source of truth). Emptied to [] (never null) when deposits are disabled on the program's KYC rail. */
14212
+ deposit_instructions?: Record<string, never>[];
12986
14213
  meta?: Record<string, never> | null;
12987
- /** @description Account currency details — present on hydrated reads (e.g. embedded in a single-order response) */
14214
+ /** @description Account currency details */
12988
14215
  account_currency_details?: components["schemas"]["CurrencyDetails"] | null;
12989
- /** @description Destination currency details — present on hydrated reads (e.g. embedded in a single-order response) */
14216
+ /** @description Destination currency details */
12990
14217
  destination_currency_details?: components["schemas"]["CurrencyDetails"] | null;
12991
- /** @description Integration vendor details — present on hydrated reads (e.g. embedded in a single-order response) */
14218
+ /** @description Integration vendor details */
12992
14219
  integration_vendor?: {
12993
14220
  /** Format: uuid */
12994
14221
  id?: string;
@@ -12999,21 +14226,6 @@ export interface components {
12999
14226
  /** Format: date-time */
13000
14227
  created_at?: string;
13001
14228
  };
13002
- /** @description Virtual account program configuration */
13003
- VirtualAccountProgram: {
13004
- /** Format: uuid */
13005
- id?: string;
13006
- name?: string;
13007
- description?: string | null;
13008
- /** @enum {string} */
13009
- status?: "ACTIVE" | "INACTIVE";
13010
- icon?: string | null;
13011
- code?: string | null;
13012
- /** Format: uuid */
13013
- account_currency_id?: string;
13014
- /** Format: uuid */
13015
- destination_currency_id?: string;
13016
- };
13017
14229
  /** @description Currency subset joined onto order and virtual-account reads (from the `crypto` table). */
13018
14230
  CurrencyDetails: {
13019
14231
  /** Format: uuid */
@@ -13024,7 +14236,7 @@ export interface components {
13024
14236
  /** @description Number of minor-unit decimals */
13025
14237
  decimal: number;
13026
14238
  };
13027
- /** @description Public order metadata. The stored `meta` JSONB is reduced server-side to a fixed allowlist of public keys — workflow/provider internals never appear. Every field is optional: presence depends on the order type (crypto transfer, fiat off-ramp, exchange, internal transfer, card top-up, deposit). */
14239
+ /** @description Public order metadata. List and single-read responses reduce the stored `meta` JSONB to a fixed allowlist of public keys; create/approve/cancel responses return the stored meta minus scheduler-internal keys. Every field is optional: presence depends on the order type (crypto transfer, fiat off-ramp, exchange, internal transfer, card top-up, deposit). */
13028
14240
  OrderMeta: {
13029
14241
  /** @description Legacy idempotency key — null on orders created by the current flow */
13030
14242
  request_id?: string | null;
@@ -13214,7 +14426,7 @@ export interface components {
13214
14426
  /** @description Destination currency details (resolved from `to_uuid`) */
13215
14427
  to_currency?: components["schemas"]["CurrencyDetails"];
13216
14428
  /** @description Virtual account referenced by the order (fiat off-ramp/on-ramp), hydrated with currency and vendor details. Absent/null when the order has no `meta.virtual_account_id`. */
13217
- virtual_account?: components["schemas"]["VirtualAccount"] | null;
14429
+ virtual_account?: components["schemas"]["OrderVirtualAccount"] | null;
13218
14430
  /** @description Receiver of the order. Present when the order has a `meta.counterparty_destination_id`; absent otherwise. */
13219
14431
  counterparty_destination?: components["schemas"]["OrderCounterpartyDestination"] | null;
13220
14432
  /** @description Documents attached to the order; empty array when none (or when document loading failed). Returned by GET /frontend/orders/id/{order_id} only; absent from the by-uuid read. */
@@ -13341,7 +14553,7 @@ export interface components {
13341
14553
  /** @description Optional supporting documents persisted with the order. */
13342
14554
  documents?: components["schemas"]["OrderDocumentInput"][];
13343
14555
  };
13344
- FrontendL2FOrderRequest: {
14556
+ FrontendFiatWithdrawalRequest: {
13345
14557
  /**
13346
14558
  * Format: uuid
13347
14559
  * @description Source wallet UUID
@@ -13504,12 +14716,108 @@ export interface components {
13504
14716
  /** Format: uuid */
13505
14717
  wallet_id?: string;
13506
14718
  };
13507
- MassPayout: {
14719
+ Invoice: {
13508
14720
  /** Format: uuid */
13509
14721
  id?: string;
13510
14722
  /** Format: uuid */
13511
14723
  wallet_id?: string;
14724
+ /**
14725
+ * Format: uuid
14726
+ * @description Counterparty account the invoice is addressed to
14727
+ */
14728
+ counterparty_account_id?: string | null;
14729
+ /** @description Unique per wallet; user-supplied or generated as <prefix>-<n>, where the prefix is the first two vowels of the tenant name (INV fallback) */
14730
+ invoice_number?: string;
14731
+ /**
14732
+ * @description OVERDUE is derived — a sent or partially paid invoice past its due date
14733
+ * @enum {string}
14734
+ */
14735
+ status?: "DRAFT" | "SENT" | "PARTIALLY_PAID" | "PAID" | "OVERDUE";
14736
+ /** Format: uuid */
14737
+ currency_id?: string;
14738
+ /** @description Gross (net item amounts + tax) */
14739
+ total_amount?: number;
14740
+ /** @description Sum of the linked payments */
14741
+ paid_amount?: number;
14742
+ /** Format: date */
14743
+ due_date?: string | null;
14744
+ /** Format: date-time */
14745
+ sent_at?: string | null;
14746
+ /** @description Recipient snapshot taken when the invoice was sent */
14747
+ recipient_name?: string | null;
14748
+ recipient_email?: string | null;
14749
+ description?: string | null;
14750
+ /** Format: date-time */
14751
+ created_at?: string;
14752
+ /** Format: date-time */
14753
+ updated_at?: string;
14754
+ };
14755
+ InvoiceItem: {
14756
+ /** Format: uuid */
14757
+ id?: string;
14758
+ /** @description Zero-based display order */
14759
+ position?: number;
14760
+ name?: string;
14761
+ description?: string | null;
14762
+ quantity?: number;
14763
+ unit_price?: number;
14764
+ /** @description Sales tax percent; null = no tax */
14765
+ tax_rate?: number | null;
14766
+ /** @description Net line amount (quantity x unit_price, before tax) */
14767
+ amount?: number;
14768
+ /** @description amount x tax_rate / 100; 0 without tax */
14769
+ tax_amount?: number;
14770
+ /** Format: date-time */
14771
+ created_at?: string;
14772
+ };
14773
+ InvoicePayment: {
14774
+ /** Format: uuid */
14775
+ id?: string;
14776
+ /**
14777
+ * Format: uuid
14778
+ * @description Linked incoming order
14779
+ */
14780
+ order_id?: string;
14781
+ /** @description Full credited amount of the linked order */
14782
+ amount?: number;
14783
+ /** Format: date-time */
14784
+ created_at?: string;
14785
+ };
14786
+ InvoiceItemInput: {
14787
+ name: string;
14788
+ description?: string;
14789
+ quantity: number;
14790
+ unit_price: number;
14791
+ /** @description Optional sales tax percent */
14792
+ tax_rate?: number;
14793
+ };
14794
+ MassPayoutDocument: {
14795
+ /**
14796
+ * Format: uri
14797
+ * @description Public http(s) link to the uploaded file (the file itself is uploaded separately)
14798
+ */
14799
+ url: string;
14800
+ /**
14801
+ * @description Kind of the attachment; INVOICE satisfies the invoice rule for large payouts
14802
+ * @enum {string}
14803
+ */
14804
+ type: "INVOICE" | "DOCUMENT";
14805
+ description?: string;
14806
+ };
14807
+ MassPayoutCurrencyTotal: {
14808
+ /** Format: uuid */
14809
+ currency_id?: string;
14810
+ amount?: number;
14811
+ };
14812
+ MassPayout: {
13512
14813
  /** Format: uuid */
14814
+ id?: string;
14815
+ /** Format: uuid */
14816
+ wallet_id?: string;
14817
+ /**
14818
+ * Format: uuid
14819
+ * @description Source currency the batch is funded in
14820
+ */
13513
14821
  currency_id?: string;
13514
14822
  /**
13515
14823
  * Format: uuid
@@ -13517,12 +14825,30 @@ export interface components {
13517
14825
  */
13518
14826
  virtual_account_id?: string | null;
13519
14827
  name?: string;
13520
- /** @enum {string} */
13521
- status?: "DRAFT" | "PENDING_APPROVAL" | "PROCESSING" | "COMPLETED" | "FAILED" | "CANCELED";
14828
+ /**
14829
+ * @description SCHEDULED = approved with a future send date; execution starts automatically at that moment
14830
+ * @enum {string}
14831
+ */
14832
+ status?: "DRAFT" | "PENDING_APPROVAL" | "SCHEDULED" | "PROCESSING" | "COMPLETED" | "FAILED" | "CANCELED";
14833
+ /**
14834
+ * Format: date-time
14835
+ * @description Requested execution time; null means the batch executes right after approval
14836
+ */
14837
+ scheduled_at?: string | null;
14838
+ /**
14839
+ * Format: date-time
14840
+ * @description Set when a stop was requested for a running batch; payments not yet started will be cancelled
14841
+ */
14842
+ cancel_requested_at?: string | null;
13522
14843
  total_items?: number;
14844
+ /** @description Sum of payout amounts payable in the batch source currency (cross-currency payouts are listed in totals_by_currency instead) */
13523
14845
  total_amount?: number;
14846
+ /** @description Exact recipient totals per payout currency */
14847
+ totals_by_currency?: components["schemas"]["MassPayoutCurrencyTotal"][];
13524
14848
  completed_count?: number;
13525
14849
  failed_count?: number;
14850
+ /** @description Payments cancelled before being attempted (batch cancelled or stopped) */
14851
+ cancelled_count?: number;
13526
14852
  /**
13527
14853
  * Format: uuid
13528
14854
  * @description User id of the wallet member who approved the batch; null until approved
@@ -13541,9 +14867,21 @@ export interface components {
13541
14867
  id?: string;
13542
14868
  /** Format: uuid */
13543
14869
  destination_id?: string;
14870
+ /** @description The amount the recipient receives, in the item's payout currency */
13544
14871
  amount?: number;
13545
- /** @enum {string} */
13546
- status?: "PENDING" | "PROCESSING" | "COMPLETED" | "FAILED";
14872
+ /**
14873
+ * Format: uuid
14874
+ * @description Payout currency of this item; null means the batch source currency
14875
+ */
14876
+ to_currency_id?: string | null;
14877
+ /** @description Payment reference shown on the created order; falls back to the batch name */
14878
+ reference?: string | null;
14879
+ documents?: components["schemas"]["MassPayoutDocument"][];
14880
+ /**
14881
+ * @description CANCELED = never attempted (the batch was cancelled or stopped before this payment)
14882
+ * @enum {string}
14883
+ */
14884
+ status?: "PENDING" | "PROCESSING" | "COMPLETED" | "FAILED" | "CANCELED";
13547
14885
  /**
13548
14886
  * Format: uuid
13549
14887
  * @description The regular order created for this item at execution
@@ -13562,13 +14900,61 @@ export interface components {
13562
14900
  * @description Existing counterparty destination of the source wallet
13563
14901
  */
13564
14902
  destination_id: string;
14903
+ /** @description The amount the recipient receives, in the payout currency of this row */
14904
+ amount: number;
14905
+ /**
14906
+ * Format: uuid
14907
+ * @description Payout currency of this row; omit for the batch source currency. A differing value makes the payout a cross-currency one (the debit is converted at execution time)
14908
+ */
14909
+ to_currency_id?: string;
14910
+ /** @description Optional payment reference for this row */
14911
+ reference?: string;
14912
+ /** @description Supporting documents; an INVOICE attachment is required for rows at or above the invoice threshold */
14913
+ documents?: components["schemas"]["MassPayoutDocument"][];
14914
+ };
14915
+ MassPayoutTemplateItemInput: {
14916
+ /** Format: uuid */
14917
+ destination_id: string;
13565
14918
  amount: number;
14919
+ /** Format: uuid */
14920
+ to_currency_id?: string;
14921
+ reference?: string;
14922
+ };
14923
+ MassPayoutTemplateItem: {
14924
+ /** Format: uuid */
14925
+ id?: string;
14926
+ /** Format: uuid */
14927
+ destination_id?: string;
14928
+ amount?: number;
14929
+ /** Format: uuid */
14930
+ to_currency_id?: string | null;
14931
+ reference?: string | null;
14932
+ position?: number;
14933
+ };
14934
+ MassPayoutTemplate: {
14935
+ /** Format: uuid */
14936
+ id?: string;
14937
+ /** Format: uuid */
14938
+ wallet_id?: string;
14939
+ name?: string;
14940
+ /** Format: uuid */
14941
+ currency_id?: string;
14942
+ /** Format: uuid */
14943
+ virtual_account_id?: string | null;
14944
+ total_items?: number;
14945
+ /** Format: date-time */
14946
+ created_at?: string;
14947
+ /** Format: date-time */
14948
+ updated_at?: string;
14949
+ };
14950
+ MassPayoutTemplateWithItems: components["schemas"]["MassPayoutTemplate"] & {
14951
+ items?: components["schemas"]["MassPayoutTemplateItem"][];
13566
14952
  };
13567
14953
  NotificationView: {
13568
14954
  /** Format: uuid */
13569
14955
  id: string;
13570
14956
  /** @enum {string} */
13571
- type: "DEPOSIT_RECEIVED" | "TRANSFER_RECEIVED" | "ORDER_STATUS_CHANGED" | "KYC_STATUS_CHANGED";
14957
+ type: "DEPOSIT_RECEIVED" | "TRANSFER_RECEIVED" | "ORDER_STATUS_CHANGED" | "KYC_STATUS_CHANGED" | "ANNOUNCEMENT" | "SYSTEM_MESSAGE";
13572
14958
  /** @description Structured fact snapshot; the client renders the presentation. Shape depends on `type`; evolution is additive-only. */
13573
14959
  payload: Record<string, never>;
13574
14960
  /** Format: uuid */
@@ -13580,12 +14966,12 @@ export interface components {
13580
14966
  };
13581
14967
  NotificationPreference: {
13582
14968
  /** @enum {string} */
13583
- channel: "IN_APP" | "PUSH" | "EMAIL";
14969
+ channel: "IN_APP" | "PUSH" | "EMAIL" | "TELEGRAM";
13584
14970
  enabled: boolean;
13585
14971
  };
13586
14972
  NotificationCategoryPreference: {
13587
14973
  /** @enum {string} */
13588
- category: "TRANSACTIONS" | "COMPLIANCE";
14974
+ category: "TRANSACTIONS" | "COMPLIANCE" | "ANNOUNCEMENTS" | "SYSTEM";
13589
14975
  enabled: boolean;
13590
14976
  };
13591
14977
  };
@@ -13598,9 +14984,9 @@ export interface components {
13598
14984
  content: {
13599
14985
  "application/json": {
13600
14986
  error?: {
13601
- /** @example AUTHENTICATION_REQUIRED */
14987
+ /** @example UNAUTHORIZED */
13602
14988
  code?: string;
13603
- /** @example Please login to continue */
14989
+ /** @example Authorization header is missing */
13604
14990
  message?: string;
13605
14991
  };
13606
14992
  };
@@ -13645,9 +15031,15 @@ export interface components {
13645
15031
  * @example e04c0c85-b031-47d7-8541-207b4e83d91a
13646
15032
  */
13647
15033
  TenantId: string;
15034
+ /** @description Wallet the invoices belong to */
15035
+ InvoiceWalletId: string;
15036
+ InvoiceId: string;
15037
+ /** @description Id of the linked payment (from the invoice details `payments` list) */
15038
+ InvoicePaymentId: string;
13648
15039
  /** @description Source wallet the batches belong to */
13649
15040
  MassPayoutWalletId: string;
13650
15041
  MassPayoutId: string;
15042
+ MassPayoutTemplateId: string;
13651
15043
  };
13652
15044
  requestBodies: never;
13653
15045
  headers: never;