# Agent Skills Source: https://docs.machines.cash/agent-skills Install a local Machines MCP configuration for Codex and Claude, including agentic payments. The Machines agent skill package installs a local MCP configuration for Codex and Claude. Use this when you need terminal-based setup or want to configure multiple AI hosts at once. For Claude, the Machines plugin is simpler. For hosted connections without local installs, use MCP Setup. ## Prerequisites * Node.js 18+ * Codex and/or Claude installed locally * A Machines account ## Setup ```bash theme={null} npx @machines-cash/agent-skill install --host both ``` Or install for one host only: ```bash theme={null} npx @machines-cash/agent-skill install --host codex npx @machines-cash/agent-skill install --host claude ``` ```bash theme={null} npx @machines-cash/agent-skill auth login ``` Approve access in your browser. Open Codex or Claude and verify that Machines is connected. ## Commands reference ```bash theme={null} npx @machines-cash/agent-skill install --host both # install for both hosts npx @machines-cash/agent-skill install --host codex # Codex only npx @machines-cash/agent-skill install --host claude # Claude only npx @machines-cash/agent-skill auth login # browser login npx @machines-cash/agent-skill auth login --manual-key # manual login fallback npx @machines-cash/agent-skill doctor # health check ``` ## Example prompts Once installed, try: * `show my balance` * `list my cards` * `search apple airpods pro on amazon` * `buy these apple airpods pro on amazon using my default card` * `check the status of my latest purchase` ## Install location ```text theme={null} ~/.codex/skills/machines-agent-skills ~/.claude/skills/machines-agent-skills ``` ## Troubleshooting | Problem | Fix | | --------------------------- | ------------------------------------------------------------ | | Login window didn't open | Use `--manual-key` flag for manual login | | Not connected after install | Run `doctor` to diagnose the issue | | Still failing | Remove the Machines connection and run install + login again | ## Next steps * Machines CLI -- login, KYC, cards, and deposits from the terminal * Agentic Payments -- one shared search, buy, status, confirm, and 3DS flow * MCP Setup -- hosted MCP connections and account safety * Raw Knowledge File -- add context for better AI responses # Agent Tool Schemas Source: https://docs.machines.cash/agent-tool-schemas Copy-paste JSON Schemas for tools to call the API. ```json api.users.resolve theme={null} { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "required": ["userId"], "properties": { "userId": { "type": "string", "maxLength": 120 }, "walletAddress": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" }, "walletLabel": { "type": "string", "maxLength": 120 } } } ``` ```json api.sessions.create theme={null} { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "required": ["userId","scopes"], "properties": { "userId": { "type": "string" }, "walletAddress": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" }, "scopes": { "type": "array", "items": { "type": "string" }, "minItems": 1 }, "ttlSeconds": { "type": "integer", "minimum": 60, "maximum": 86400 } } } ``` ```json api.cards.create theme={null} { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "properties": { "encryptedName": { "type": "object", "required": ["v","iv","ct"], "properties": { "v": { "type": "integer" }, "iv": { "type": "string" }, "ct": { "type": "string" } }}, "limit": { "type": "object", "required": ["amountCents","frequency"], "properties": { "amountCents": { "type": "integer", "minimum": 1 }, "frequency": { "type": "string", "enum": ["perAuthorization","per24HourPeriod","per7DayPeriod","per30DayPeriod","perYearPeriod","allTime"] } }} } } ``` ```json api.encryption.encrypt theme={null} { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "required": ["value"], "properties": { "value": { "type": "string" } } } ``` ```json api.balances.get theme={null} { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "properties": {} } ``` ```json api.cards.update theme={null} { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "properties": { "status": { "type": "string", "enum": ["active","locked","canceled","not_activated"] }, "limit": { "type": "object", "required": ["amountCents","frequency"], "properties": { "amountCents": { "type": "integer", "minimum": 1 }, "frequency": { "type": "string", "enum": ["perAuthorization","per24HourPeriod","per7DayPeriod","per30DayPeriod","perYearPeriod","allTime"] } }}, "encryptedName": { "type": "object", "required": ["v","iv","ct"], "properties": { "v": { "type": "integer" }, "iv": { "type": "string" }, "ct": { "type": "string" } }} } } ``` ```json api.cards.secrets.get theme={null} { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "required": ["sessionId"], "properties": { "sessionId": { "type": "string" } } } ``` ```json api.cards.secrets.session theme={null} { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "properties": {} } ``` ```json api.deposits.create theme={null} { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "required": ["currency","network"], "properties": { "currency": { "type": "string", "enum": ["usdc","rusd"] }, "network": { "type": "string", "enum": ["base"] }, "amount": { "type": "number", "exclusiveMinimum": 0 } } } ``` ```json api.withdrawals.create theme={null} { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "required": ["amountCents","tokenAddress","recipientAddress","chainId"], "properties": { "amountCents": { "type": "integer", "minimum": 1 }, "tokenAddress": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" }, "recipientAddress": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" }, "chainId": { "type": "integer", "minimum": 1 }, "contractId": { "type": "string" }, "adminAddress": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" } } } ``` Set additionalProperties: false and explicit required to keep agents deterministic. # Agentic Payments Source: https://docs.machines.cash/agentic-payments Search products and place purchases from API, CLI, or MCP using one simple flow. Use Agentic Payments when you want one simple way to shop with Machines. This demo uses our Claude plugin. The same flow works across API, CLI, and MCP: * `search` finds an item or resolves a direct URL * `buy` starts the purchase * `actions` let you confirm, check progress, or submit a 3DS code Current launch default: shopping flows default to Amazon. In the current API, the search route is still named `/agent/v1/browser` for compatibility. ## What you usually need In most cases, nothing beyond the item itself: * a product URL or shopping query * an authenticated Machines session If the user already has an active Machines card and saved billing profile, Machines uses them automatically. ## The shared flow Every purchase returns an `actionId`. That makes the flow portable across surfaces. You can start a purchase in one place and continue it in another: * start in API, check status in CLI * start in MCP, submit 3DS over API * start in CLI, confirm from MCP Possible action states: | Status | Meaning | | ----------------------- | -------------------------------------------------------- | | `awaiting_confirmation` | Machines is waiting for the user to confirm the purchase | | `processing` | The purchase is in progress | | `awaiting_3ds` | A 3DS verification code is required | | `completed` | The purchase finished successfully | | `failed` | The purchase stopped with a terminal error | | `expired` | The action or quote expired before completion | ## Quickstart ### 1. Search for a product The simplest read-only path is a query string: ```bash theme={null} curl -s \ -H 'Authorization: Bearer ' \ 'https://api.machines.cash/agent/v1/browser?q=apple%20airpods%20pro' ``` Structured search requests use `POST /agent/v1/browser`: ```bash theme={null} curl -s \ -X POST \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ https://api.machines.cash/agent/v1/browser \ -d '{ "input": "airpods pro 3", "provider": "amazon", "limit": 3 }' ``` Example response: ```json theme={null} { "status": "resolved", "items": [ { "title": "Apple AirPods Pro", "price": "$249.00", "url": "https://www.amazon.com/dp/B0DGHMNQ5Q", "provider": "amazon" } ], "selectedItem": { "title": "Apple AirPods Pro", "price": "$249.00", "url": "https://www.amazon.com/dp/B0DGHMNQ5Q", "provider": "amazon" }, "next": { "buyInput": { "url": "https://www.amazon.com/dp/B0DGHMNQ5Q", "provider": "amazon" } } } ``` ### 2. Start a purchase Use `POST /agent/v1/buy` to start checkout. If the user already has a Machines card and billing profile, this is usually enough: ```bash theme={null} curl -s \ -X POST \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: ' \ https://api.machines.cash/agent/v1/buy \ -d '{ "url": "https://www.amazon.com/dp/B0DGHMNQ5Q" }' ``` You can also override the saved card selector: ```bash theme={null} curl -s \ -X POST \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: ' \ https://api.machines.cash/agent/v1/buy \ -d '{ "url": "https://www.amazon.com/dp/B0DGHMNQ5Q", "card": "" }' ``` Example response: ```json theme={null} { "actionId": "543720cb-edb5-4651-90bc-7068ce133668", "status": "awaiting_confirmation", "message": "purchase prepared and awaiting user confirmation", "nextStep": { "type": "confirm", "message": "confirm purchase to proceed" }, "item": { "title": "Apple AirPods Pro", "price": "$249.00", "url": "https://www.amazon.com/dp/B0DGHMNQ5Q", "provider": "amazon" } } ``` For Amazon orders, Machines uses the provider checkout path for you. You do not need to manage provider-specific payment steps yourself. ### 3. Check status ```bash theme={null} curl -s \ -H 'Authorization: Bearer ' \ https://api.machines.cash/agent/v1/actions/543720cb-edb5-4651-90bc-7068ce133668 ``` Example response: ```json theme={null} { "actionId": "543720cb-edb5-4651-90bc-7068ce133668", "status": "awaiting_3ds", "message": "3DS verification required. enter the code from your bank", "nextStep": { "type": "enter_3ds_code", "message": "enter the code from your bank" } } ``` ### 4. Confirm if needed If the action is waiting for confirmation: ```bash theme={null} curl -s \ -X POST \ -H 'Authorization: Bearer ' \ https://api.machines.cash/agent/v1/actions/543720cb-edb5-4651-90bc-7068ce133668/confirm ``` 3DS is an extra bank verification step for some purchases. It does not happen on every order, so you only need this step when the action status is `awaiting_3ds`. ```bash theme={null} curl -s \ -X POST \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ https://api.machines.cash/agent/v1/actions/543720cb-edb5-4651-90bc-7068ce133668/3ds \ -d '{ "code": "123456" }' ``` ## CLI The CLI uses the same flow and the same `/agent/v1` routes. ```bash theme={null} machines search "apple airpods pro" machines search "kindle paperwhite" machines search "ninja air fryer" machines buy "https://www.amazon.com/dp/B0DGHMNQ5Q" machines buy "https://www.amazon.com/dp/B0DGHMNQ5Q" --card "" --wait machines agent status 543720cb-edb5-4651-90bc-7068ce133668 machines agent confirm 543720cb-edb5-4651-90bc-7068ce133668 machines agent 3ds 543720cb-edb5-4651-90bc-7068ce133668 --code 123456 ``` `machines search` is the preferred command. `machines browser` still works as a compatibility alias. CLI defaults: * if `--card` is omitted, Machines uses the user's default active card and stored billing profile * `--wait` and `--watch` keep polling until the action pauses or finishes * raw card input is file or stdin only through `--payment-card-file` ## MCP and AI apps Machines MCP uses the same flow. The user does not need to paste billing details or card numbers when their Machines account is already set up. Useful prompts: * `buy these apple airpods pro on amazon using my default card` * `search apple airpods pro on amazon` * `search kindle paperwhite on amazon` * `search ninja air fryer on amazon` * `search anker usb c charger on amazon` * `check the status for action 543720cb-edb5-4651-90bc-7068ce133668` * `confirm my pending purchase` * `submit this 3ds code for my purchase: 123456` If you are calling tools directly, use: * `machines.agent.browser` * `machines.agent.buy` * `machines.agent.action_status` * `machines.agent.action_confirm` * `machines.agent.action_submit_3ds` ## Request fields ### Search request ```json theme={null} { "input": "apple airpods pro", "provider": "amazon", "limit": 3, "locale": "en-US" } ``` ### Buy request ```json theme={null} { "url": "https://www.amazon.com/dp/B0DGHMNQ5Q", "provider": "amazon", "card": "" } ``` Notes: * `card` is a saved-card selector, such as a card label or a last 4 selector * if `card` is omitted, Machines uses the default active card * direct API and CLI flows may also accept a one-time `paymentCard`, but MCP does not ## More example searches ```bash theme={null} machines search "apple airpods pro" machines search "kindle paperwhite" machines search "ninja air fryer" machines search "lego botanical orchid" machines search "anker usb c charger" ``` ## Next steps * Machines CLI for terminal usage * MCP Setup for AI app connections * Consumer API Reference for the broader user API # Agreements Source: https://docs.machines.cash/agreements Display required user agreements after KYC approval. Prerequisite: KYC status is approved . ## Flow ```mermaid theme={null} sequenceDiagram participant Backend as Your Backend participant MachinesAPI as Machines API participant User as User Backend->>MachinesAPI: GET /agreements MachinesAPI-->>Backend: agreements + accepted status Backend->>User: show agreements + links User-->>Backend: accepts all Backend->>MachinesAPI: POST /agreements { accepted: true } MachinesAPI-->>Backend: acceptedAt ``` ## API flows (step-by-step) Endpoint : GET /agreements \ Response : agreements\[] (text + links), accepted , acceptedAt . ```bash theme={null} curl -s \ -H 'Authorization: Bearer ' \ https://dev-api.machines.cash/partner/v1/agreements ``` Render each agreement’s text , and open the links\[].url in a new tab. The user must accept all agreements. Endpoint : POST /agreements \ Body : ```bash theme={null} curl -s \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -d '{"accepted": true}' \ https://dev-api.machines.cash/partner/v1/agreements ``` If KYC is not approved, these endpoints return 409 with invalid\_state . ## What this unlocks After acceptance, the user can create cards, create deposits, and read balances. Those endpoints return 409 until agreements are accepted. # Accept agreements Source: https://docs.machines.cash/api-reference/agreements/accept-agreements consumer-openapi.yaml post /user/v1/agreements Accept agreements When to use this: Record agreement acceptance for an approved user. Required scope: agreements.write. # List agreement status Source: https://docs.machines.cash/api-reference/agreements/list-agreement-status consumer-openapi.yaml get /user/v1/agreements List agreement status When to use this: Read agreements and acceptance state required for account/card access. Required scope: agreements.read. # Bootstrap user API access Source: https://docs.machines.cash/api-reference/auth/bootstrap-user-api-access consumer-openapi.yaml post /user/v1/bootstrap Bootstrap user API access When to use this: First-time programmatic setup: verify wallet signature and return API key + session. Accepted signing messages (exact line order/newlines): 1) Preferred simple: Machines Cash Bootstrap Address:
Nonce: Issued At: Expires At: 2) Legacy: Machines Cash Consumer Agent Bootstrap Address:
Nonce: Issued At: Expires At: Connector: Chain ID: Wallet Label: Required scope: none. # Get balances Source: https://docs.machines.cash/api-reference/balances/get-balances consumer-openapi.yaml get /user/v1/balances Get balances When to use this: Read spending power, pending, and posted balance values. Required scope: balances.read. # Create bill Source: https://docs.machines.cash/api-reference/bills/create-bill consumer-openapi.yaml post /user/v1/bills Create bill When to use this: Create recurring bill record. Required scope: bills.write. Requires `idempotency-key` header. # Delete bill Source: https://docs.machines.cash/api-reference/bills/delete-bill consumer-openapi.yaml delete /user/v1/bills/{billId} Delete bill When to use this: Delete bill record. Required scope: bills.write. Requires `idempotency-key` header. # Get bill calendar Source: https://docs.machines.cash/api-reference/bills/get-bill-calendar consumer-openapi.yaml get /user/v1/bills/calendar Get bill calendar When to use this: Read monthly bill calendar view. Required scope: bills.read. # Get bill suggestions Source: https://docs.machines.cash/api-reference/bills/get-bill-suggestions consumer-openapi.yaml get /user/v1/bills/suggestions Get bill suggestions When to use this: Read suggested bill detections. Required scope: bills.read. # List bills Source: https://docs.machines.cash/api-reference/bills/list-bills consumer-openapi.yaml get /user/v1/bills List bills When to use this: Read tracked recurring bills. Required scope: bills.read. # Update bill Source: https://docs.machines.cash/api-reference/bills/update-bill consumer-openapi.yaml patch /user/v1/bills/{billId} Update bill When to use this: Update bill amount/date/status. Required scope: bills.write. Requires `idempotency-key` header. # Cancel disposable proposal Source: https://docs.machines.cash/api-reference/cards/cancel-disposable-proposal consumer-openapi.yaml delete /user/v1/cards/disposable/{proposalId} Cancel disposable proposal When to use this: Cancel unused pending disposable proposal. Required scope: cards.write. # Create card Source: https://docs.machines.cash/api-reference/cards/create-card consumer-openapi.yaml post /user/v1/cards Create card When to use this: Create a new virtual card with optional limits and metadata. Required scope: cards.write. # Create card memo Source: https://docs.machines.cash/api-reference/cards/create-card-memo consumer-openapi.yaml post /user/v1/cards/{cardId}/memo Create card memo When to use this: Add memo text to a card. Required scope: cards.write. # Create card pin Source: https://docs.machines.cash/api-reference/cards/create-card-pin consumer-openapi.yaml post /user/v1/cards/{cardId}/pin Create card pin When to use this: Set initial card PIN. Required scope: cards.write. # Create card secrets session Source: https://docs.machines.cash/api-reference/cards/create-card-secrets-session consumer-openapi.yaml post /user/v1/cards/secrets/session Create card secrets session When to use this: Create encrypted session material required for card detail reveal. Required scope: cards.secrets.read. # Create disposable card proposal Source: https://docs.machines.cash/api-reference/cards/create-disposable-card-proposal consumer-openapi.yaml post /user/v1/cards/disposable/proposals Create disposable card proposal When to use this: Create one-time spend proposal before execution. Required scope: cards.write. # Delete card memo Source: https://docs.machines.cash/api-reference/cards/delete-card-memo consumer-openapi.yaml delete /user/v1/cards/{cardId}/memo Delete card memo When to use this: Remove memo text from a card. Required scope: cards.write. # Delete card now Source: https://docs.machines.cash/api-reference/cards/delete-card-now consumer-openapi.yaml post /user/v1/cards/{cardId}/delete-now Delete card now When to use this: Immediately delete/deactivate a card. Required scope: cards.write. # Execute disposable proposal Source: https://docs.machines.cash/api-reference/cards/execute-disposable-proposal consumer-openapi.yaml post /user/v1/cards/disposable/execute Execute disposable proposal When to use this: Turn a disposable proposal into a real one-time card. Required scope: cards.write. # Fetch card secrets Source: https://docs.machines.cash/api-reference/cards/fetch-card-secrets consumer-openapi.yaml post /user/v1/cards/{cardId}/secrets Fetch card secrets When to use this: Retrieve encrypted card details (PAN/CVC/expiry) for a card. Required scope: cards.secrets.read. # Get card Source: https://docs.machines.cash/api-reference/cards/get-card consumer-openapi.yaml get /user/v1/cards/{cardId} Get card When to use this: Read details for one card. Required scope: cards.read. # Get card pin Source: https://docs.machines.cash/api-reference/cards/get-card-pin consumer-openapi.yaml get /user/v1/cards/{cardId}/pin Get card pin When to use this: Retrieve card PIN via secure session. Required scope: cards.write. # Get disposable proposal Source: https://docs.machines.cash/api-reference/cards/get-disposable-proposal consumer-openapi.yaml get /user/v1/cards/disposable/{proposalId} Get disposable proposal When to use this: Read proposal status/details before execution. Required scope: cards.read. # Get pin status Source: https://docs.machines.cash/api-reference/cards/get-pin-status consumer-openapi.yaml get /user/v1/cards/{cardId}/pin/status Get pin status When to use this: Check whether card PIN exists before PIN actions. Required scope: cards.read. # List cards Source: https://docs.machines.cash/api-reference/cards/list-cards consumer-openapi.yaml get /user/v1/cards List cards When to use this: Show available cards for account and agent actions. Required scope: cards.read. # List deleted cards Source: https://docs.machines.cash/api-reference/cards/list-deleted-cards consumer-openapi.yaml get /user/v1/cards/deleted List deleted cards When to use this: Read recently deleted cards for audit/recovery context. Required scope: cards.read. # Reorder cards Source: https://docs.machines.cash/api-reference/cards/reorder-cards consumer-openapi.yaml post /user/v1/cards/reorder Reorder cards When to use this: Persist drag-and-drop ordering of card stacks. Required scope: cards.write. # Update card Source: https://docs.machines.cash/api-reference/cards/update-card consumer-openapi.yaml patch /user/v1/cards/{cardId} Update card When to use this: Update card status, limits, or display metadata. Required scope: cards.write. # Update card memo Source: https://docs.machines.cash/api-reference/cards/update-card-memo consumer-openapi.yaml patch /user/v1/cards/{cardId}/memo Update card memo When to use this: Edit existing card memo text. Required scope: cards.write. # Update card pin Source: https://docs.machines.cash/api-reference/cards/update-card-pin consumer-openapi.yaml put /user/v1/cards/{cardId}/pin Update card pin When to use this: Rotate/reset card PIN. Required scope: cards.write. # Create contract Source: https://docs.machines.cash/api-reference/contracts/create-contract consumer-openapi.yaml post /user/v1/contracts Create contract When to use this: Create a new collateral contract for a target chain. Required scope: contracts.write. Requires `idempotency-key` header. # Enable onramp Source: https://docs.machines.cash/api-reference/contracts/enable-onramp consumer-openapi.yaml put /user/v1/contracts/{contractId}/onramp Enable onramp When to use this: Enable fiat onramp rails for a contract. Required scope: contracts.write. Requires `idempotency-key` header. # List contracts Source: https://docs.machines.cash/api-reference/contracts/list-contracts consumer-openapi.yaml get /user/v1/contracts List contracts When to use this: Read collateral contracts and deposit account metadata. Required scope: contracts.read. # Decrypt encrypted values Source: https://docs.machines.cash/api-reference/crypto/decrypt-encrypted-values consumer-openapi.yaml post /user/v1/crypto/decrypt Decrypt encrypted values When to use this: Convert encrypted label fields into readable text for UI/agent output. Required scope: encryption.read. # Encrypt plaintext values Source: https://docs.machines.cash/api-reference/crypto/encrypt-plaintext-values consumer-openapi.yaml post /user/v1/crypto/encrypt Encrypt plaintext values When to use this: Encrypt labels/memos before writing encrypted fields via user routes. Required scope: encryption.write. # Confirm deposit transfer Source: https://docs.machines.cash/api-reference/deposits/confirm-deposit-transfer consumer-openapi.yaml post /user/v1/deposits/{depositId}/transfer Confirm deposit transfer When to use this: Finalize transfer leg for deposit pipeline. Required scope: deposits.write. Requires `idempotency-key` header. # Create deposit Source: https://docs.machines.cash/api-reference/deposits/create-deposit consumer-openapi.yaml post /user/v1/deposits Create deposit When to use this: Create a new deposit intent/address record. Required scope: deposits.write. Requires `idempotency-key` header. # Get deposit Source: https://docs.machines.cash/api-reference/deposits/get-deposit consumer-openapi.yaml get /user/v1/deposits/{depositId} Get deposit When to use this: Read one deposit by id. Required scope: deposits.read. # List deposit assets Source: https://docs.machines.cash/api-reference/deposits/list-deposit-assets consumer-openapi.yaml get /user/v1/deposits/assets List deposit assets When to use this: List supported assets/networks for deposit flow. Required scope: deposits.read. # List deposits Source: https://docs.machines.cash/api-reference/deposits/list-deposits consumer-openapi.yaml get /user/v1/deposits List deposits When to use this: Read all deposits for current account. Required scope: deposits.read. # Poll deposit status Source: https://docs.machines.cash/api-reference/deposits/poll-deposit-status consumer-openapi.yaml post /user/v1/deposits/{depositId}/poll Poll deposit status When to use this: Refresh status after chain/payment activity. Required scope: deposits.write. # Preview deposit quote Source: https://docs.machines.cash/api-reference/deposits/preview-deposit-quote consumer-openapi.yaml post /user/v1/deposits/preview Preview deposit quote When to use this: Preview expected amounts/fees before creating deposit. Required scope: deposits.write. # Refresh deposit Source: https://docs.machines.cash/api-reference/deposits/refresh-deposit consumer-openapi.yaml post /user/v1/deposits/{depositId}/refresh Refresh deposit When to use this: Force re-fetch from provider for current deposit. Required scope: deposits.write. # Save deposit address Source: https://docs.machines.cash/api-reference/deposits/save-deposit-address consumer-openapi.yaml post /user/v1/deposits/{depositId}/save-address Save deposit address When to use this: Save generated address to identity preferences. Required scope: deposits.write. # Create folder Source: https://docs.machines.cash/api-reference/folders/create-folder consumer-openapi.yaml post /user/v1/folders Create folder When to use this: Create card folder/group. Required scope: folders.write. # Delete folder Source: https://docs.machines.cash/api-reference/folders/delete-folder consumer-openapi.yaml delete /user/v1/folders/{folderId} Delete folder When to use this: Delete folder and reassign contained cards. Required scope: folders.write. # List folders Source: https://docs.machines.cash/api-reference/folders/list-folders consumer-openapi.yaml get /user/v1/folders List folders When to use this: Read folder containers for cards. Required scope: folders.read. # Reorder folders Source: https://docs.machines.cash/api-reference/folders/reorder-folders consumer-openapi.yaml post /user/v1/folders/reorder Reorder folders When to use this: Persist folder ordering for account UI. Required scope: folders.write. # Update folder Source: https://docs.machines.cash/api-reference/folders/update-folder consumer-openapi.yaml patch /user/v1/folders/{folderId} Update folder When to use this: Rename/update folder metadata. Required scope: folders.write. # Activate deposit preference Source: https://docs.machines.cash/api-reference/identity/activate-deposit-preference consumer-openapi.yaml post /user/v1/identity/deposit-preferences/activate Activate deposit preference When to use this: Activate preferred deposit method. Required scope: identity.write. # Add wallet Source: https://docs.machines.cash/api-reference/identity/add-wallet consumer-openapi.yaml post /user/v1/identity/wallets Add wallet When to use this: Link a new wallet to account. Required scope: identity.write. # Add wallet (manual) Source: https://docs.machines.cash/api-reference/identity/add-wallet-manual consumer-openapi.yaml post /user/v1/identity/wallets/manual Add wallet (manual) When to use this: Add wallet with manual flow when direct sign path is unavailable. Required scope: identity.write. # Delete alias Source: https://docs.machines.cash/api-reference/identity/delete-alias consumer-openapi.yaml delete /user/v1/identity/aliases/{aliasId} Delete alias When to use this: Delete alias mapping. Required scope: identity.write. # Get deposit preferences Source: https://docs.machines.cash/api-reference/identity/get-deposit-preferences consumer-openapi.yaml get /user/v1/identity/deposit-preferences Get deposit preferences When to use this: Read preferred deposit tokens/networks/order. Required scope: identity.read. # Get usage metrics Source: https://docs.machines.cash/api-reference/identity/get-usage-metrics consumer-openapi.yaml get /user/v1/identity/usage Get usage metrics When to use this: Read account usage counters/limits. Required scope: identity.read. # List deposit aliases Source: https://docs.machines.cash/api-reference/identity/list-deposit-aliases consumer-openapi.yaml get /user/v1/identity/aliases List deposit aliases When to use this: Read aliases and destination mapping. Required scope: identity.read. # List wallets Source: https://docs.machines.cash/api-reference/identity/list-wallets consumer-openapi.yaml get /user/v1/identity/wallets List wallets When to use this: Read linked wallets and labels. Required scope: identity.read. # Raw data key endpoint (blocked) Source: https://docs.machines.cash/api-reference/identity/raw-data-key-endpoint-blocked consumer-openapi.yaml get /user/v1/identity/data-key Raw data key endpoint (blocked) When to use this: This endpoint is intentionally blocked on user surface; use /user/v1/crypto/* instead. Required scope: blocked. This route is blocked on user surface and returns 403. # Remove wallet Source: https://docs.machines.cash/api-reference/identity/remove-wallet consumer-openapi.yaml delete /user/v1/identity/wallets/{address} Remove wallet When to use this: Unlink wallet from account. Required scope: identity.write. # Reorder deposit preferences Source: https://docs.machines.cash/api-reference/identity/reorder-deposit-preferences consumer-openapi.yaml post /user/v1/identity/deposit-preferences/reorder Reorder deposit preferences When to use this: Persist drag-and-drop ordering for deposit preferences. Required scope: identity.write. # Update alias Source: https://docs.machines.cash/api-reference/identity/update-alias consumer-openapi.yaml patch /user/v1/identity/aliases/{aliasId} Update alias When to use this: Edit alias label/destination metadata. Required scope: identity.write. # Update deposit preferences Source: https://docs.machines.cash/api-reference/identity/update-deposit-preferences consumer-openapi.yaml put /user/v1/identity/deposit-preferences Update deposit preferences When to use this: Persist preferred deposit tokens/networks. Required scope: identity.write. # Update wallet label Source: https://docs.machines.cash/api-reference/identity/update-wallet-label consumer-openapi.yaml patch /user/v1/identity/wallets/{address} Update wallet label When to use this: Rename wallet label. Required scope: identity.write. # Create a user API key Source: https://docs.machines.cash/api-reference/keys/create-a-user-api-key consumer-openapi.yaml post /user/v1/keys Create a user API key When to use this: Create an additional key for an external agent or automation. Required scope: keys.write. # List user API keys Source: https://docs.machines.cash/api-reference/keys/list-user-api-keys consumer-openapi.yaml get /user/v1/keys List user API keys When to use this: View existing keys (metadata only, never plaintext key values). Required scope: keys.read. # Revoke a key and active sessions Source: https://docs.machines.cash/api-reference/keys/revoke-a-key-and-active-sessions consumer-openapi.yaml delete /user/v1/keys/{keyId} Revoke a key and active sessions When to use this: Immediately disable a key and all sessions minted from it. Required scope: keys.write. # Update key scopes or policy Source: https://docs.machines.cash/api-reference/keys/update-key-scopes-or-policy consumer-openapi.yaml patch /user/v1/keys/{keyId} Update key scopes or policy When to use this: Adjust key permissions or policy constraints on an existing key. Required scope: keys.write. # Get KYC by user id Source: https://docs.machines.cash/api-reference/kyc/get-kyc-by-user-id consumer-openapi.yaml get /user/v1/kyc/{userId} Get KYC by user id When to use this: Retrieve KYC status/details for a specific user id. Required scope: kyc.read. # Get KYC status Source: https://docs.machines.cash/api-reference/kyc/get-kyc-status consumer-openapi.yaml get /user/v1/kyc/status Get KYC status When to use this: Check if verification is approved, pending, or needs user action. Required scope: kyc.read. # Initiate KYC application Source: https://docs.machines.cash/api-reference/kyc/initiate-kyc-application consumer-openapi.yaml post /user/v1/kyc/initiate Initiate KYC application When to use this: Start KYC with minimum profile data before full submission. Required scope: kyc.write. # Submit KYC application Source: https://docs.machines.cash/api-reference/kyc/submit-kyc-application consumer-openapi.yaml post /user/v1/kyc Submit KYC application When to use this: Submit full identity details to continue card/account access. Required scope: kyc.write. # Update KYC by user id Source: https://docs.machines.cash/api-reference/kyc/update-kyc-by-user-id consumer-openapi.yaml patch /user/v1/kyc/{userId} Update KYC by user id When to use this: Resubmit corrected KYC fields for a specific user id. Required scope: kyc.write. # Upload document by user id Source: https://docs.machines.cash/api-reference/kyc/upload-document-by-user-id consumer-openapi.yaml post /user/v1/kyc/{userId}/document Upload document by user id When to use this: Attach KYC document to a specific user application. Required scope: kyc.write. # Upload document for current user Source: https://docs.machines.cash/api-reference/kyc/upload-document-for-current-user consumer-openapi.yaml post /user/v1/kyc/me/document Upload document for current user When to use this: Attach KYC document for the active user account. Required scope: kyc.write. # Get notification settings Source: https://docs.machines.cash/api-reference/notifications/get-notification-settings consumer-openapi.yaml get /user/v1/notifications Get notification settings When to use this: Read push/email notification preferences. Required scope: notifications.read. # Register push device Source: https://docs.machines.cash/api-reference/notifications/register-push-device consumer-openapi.yaml post /user/v1/notifications/push Register push device When to use this: Register web push subscription for device/browser. Required scope: notifications.write. # Send test notification Source: https://docs.machines.cash/api-reference/notifications/send-test-notification consumer-openapi.yaml post /user/v1/notifications/test-send Send test notification When to use this: Trigger test push notification for setup verification. Required scope: notifications.write. # Unregister push device Source: https://docs.machines.cash/api-reference/notifications/unregister-push-device consumer-openapi.yaml delete /user/v1/notifications/push Unregister push device When to use this: Remove existing push subscription for device/browser. Required scope: notifications.write. # Update notification settings Source: https://docs.machines.cash/api-reference/notifications/update-notification-settings consumer-openapi.yaml put /user/v1/notifications Update notification settings When to use this: Update push/email notification preferences. Required scope: notifications.write. # Get onboarding state Source: https://docs.machines.cash/api-reference/onboarding/get-onboarding-state consumer-openapi.yaml get /user/v1/onboarding Get onboarding state When to use this: Read onboarding checklist/progress for the current user. Required scope: onboarding.read. # Update onboarding state Source: https://docs.machines.cash/api-reference/onboarding/update-onboarding-state consumer-openapi.yaml post /user/v1/onboarding Update onboarding state When to use this: Persist onboarding completion/progress values. Required scope: onboarding.write. # Get native balances Source: https://docs.machines.cash/api-reference/payments/get-native-balances consumer-openapi.yaml post /user/v1/payments/native-balances Get native balances When to use this: Read native gas-token balances needed for transaction signing. Required scope: payments.write. Requires `idempotency-key` header. # Get payment token metadata Source: https://docs.machines.cash/api-reference/payments/get-payment-token-metadata consumer-openapi.yaml post /user/v1/payments/token-metadata Get payment token metadata When to use this: Resolve metadata for payment tokens/networks. Required scope: payments.write. # Get payment transaction detail Source: https://docs.machines.cash/api-reference/payments/get-payment-transaction-detail consumer-openapi.yaml get /user/v1/payments/transaction Get payment transaction detail When to use this: Read one payment transaction detail. Required scope: payments.read. # Get payment tx status Source: https://docs.machines.cash/api-reference/payments/get-payment-tx-status consumer-openapi.yaml get /user/v1/payments/tx-status Get payment tx status When to use this: Poll payment transaction status. Required scope: payments.read. # Get subscription balances Source: https://docs.machines.cash/api-reference/payments/get-subscription-balances consumer-openapi.yaml get /user/v1/payments/subscription-balances Get subscription balances When to use this: Read balances usable for subscription payments. Required scope: payments.read. # Get token balances Source: https://docs.machines.cash/api-reference/payments/get-token-balances consumer-openapi.yaml post /user/v1/payments/token-balances Get token balances When to use this: Resolve wallet token balances for payment selection. Required scope: payments.write. # List subscription assets Source: https://docs.machines.cash/api-reference/payments/list-subscription-assets consumer-openapi.yaml get /user/v1/payments/subscription-assets List subscription assets When to use this: Read assets available for subscription pay-ins. Required scope: payments.read. # Get referral state Source: https://docs.machines.cash/api-reference/referrals/get-referral-state consumer-openapi.yaml get /user/v1/referrals/me Get referral state When to use this: Read referral stats and rewards state. Required scope: referrals.read. # Redeem referral reward Source: https://docs.machines.cash/api-reference/referrals/redeem-referral-reward consumer-openapi.yaml post /user/v1/referrals/redeem Redeem referral reward When to use this: Redeem available referral reward. Required scope: referrals.write. # Validate referral code Source: https://docs.machines.cash/api-reference/referrals/validate-referral-code consumer-openapi.yaml post /user/v1/referrals/validate Validate referral code When to use this: Check referral code validity before applying. Required scope: referrals.write. # Mint scoped short-lived session Source: https://docs.machines.cash/api-reference/sessions/mint-scoped-short-lived-session consumer-openapi.yaml post /user/v1/sessions Mint scoped short-lived session When to use this: Exchange API key (or privileged session) for a short-lived scoped bearer token. Required scope: sessions.write. # Search spotlight index Source: https://docs.machines.cash/api-reference/spotlight/search-spotlight-index consumer-openapi.yaml post /user/v1/spotlight/search Search spotlight index When to use this: Search cards, transactions, support docs, and quick actions. Required scope: spotlight.read. # Cancel scheduled subscription change Source: https://docs.machines.cash/api-reference/subscriptions/cancel-scheduled-subscription-change consumer-openapi.yaml post /user/v1/subscriptions/scheduled/cancel Cancel scheduled subscription change When to use this: Cancel pending scheduled plan change. Required scope: subscriptions.write. Requires `idempotency-key` header. # Checkout extra-card add-on Source: https://docs.machines.cash/api-reference/subscriptions/checkout-extra-card-add-on consumer-openapi.yaml post /user/v1/subscriptions/addons/extra-card/checkout Checkout extra-card add-on When to use this: Purchase extra-card add-on. Required scope: subscriptions.write. Requires `idempotency-key` header. # Confirm subscription balance payment Source: https://docs.machines.cash/api-reference/subscriptions/confirm-subscription-balance-payment consumer-openapi.yaml post /user/v1/subscriptions/confirm/balance Confirm subscription balance payment When to use this: Confirm balance-based subscription payment. Required scope: subscriptions.write. Requires `idempotency-key` header. # Confirm subscription payin Source: https://docs.machines.cash/api-reference/subscriptions/confirm-subscription-payin consumer-openapi.yaml post /user/v1/subscriptions/confirm/payin Confirm subscription payin When to use this: Confirm onchain pay-in after tx submission. Required scope: subscriptions.write. Requires `idempotency-key` header. # Create subscription checkout Source: https://docs.machines.cash/api-reference/subscriptions/create-subscription-checkout consumer-openapi.yaml post /user/v1/subscriptions/checkout Create subscription checkout When to use this: Start subscription checkout flow. Required scope: subscriptions.write. Requires `idempotency-key` header. # Create subscription payin Source: https://docs.machines.cash/api-reference/subscriptions/create-subscription-payin consumer-openapi.yaml post /user/v1/subscriptions/payin Create subscription payin When to use this: Create pay-in request for subscription. Required scope: subscriptions.write. Requires `idempotency-key` header. # Get current subscription Source: https://docs.machines.cash/api-reference/subscriptions/get-current-subscription consumer-openapi.yaml get /user/v1/subscriptions/current Get current subscription When to use this: Read current plan and renewal state. Required scope: subscriptions.read. # List subscription plans Source: https://docs.machines.cash/api-reference/subscriptions/list-subscription-plans consumer-openapi.yaml get /user/v1/subscriptions/plans List subscription plans When to use this: Read available subscription plans/add-ons. Required scope: subscriptions.read. # Validate promo code Source: https://docs.machines.cash/api-reference/subscriptions/validate-promo-code consumer-openapi.yaml post /user/v1/subscriptions/promo/validate Validate promo code When to use this: Validate promo before checkout. Required scope: subscriptions.write. Requires `idempotency-key` header. # Get support context Source: https://docs.machines.cash/api-reference/support/get-support-context consumer-openapi.yaml get /user/v1/support Get support context When to use this: Fetch support/chat boot context for user support handoff. Required scope: support.read. # Get token metadata Source: https://docs.machines.cash/api-reference/tokens/get-token-metadata consumer-openapi.yaml post /user/v1/tokens/metadata Get token metadata When to use this: Resolve token symbol/logo/decimals metadata by address. Required scope: tokens.read. # List transactions Source: https://docs.machines.cash/api-reference/transactions/list-transactions consumer-openapi.yaml get /user/v1/transactions List transactions When to use this: Read spend/deposit/withdraw activity timeline. Required scope: transactions.read. # Get current user profile Source: https://docs.machines.cash/api-reference/users/get-current-user-profile consumer-openapi.yaml get /user/v1/users Get current user profile When to use this: Read payer/billing profile and account-level user information. Required scope: users.read. # Update current user profile Source: https://docs.machines.cash/api-reference/users/update-current-user-profile consumer-openapi.yaml patch /user/v1/users Update current user profile When to use this: Update editable user profile fields. Required scope: users.write. # Create user API key from web session Source: https://docs.machines.cash/api-reference/webhelper/create-user-api-key-from-web-session consumer-openapi.yaml post /identity/user-api-keys Create user API key from web session When to use this: Use from first-party Machines web app profile to mint a key without wallet re-sign. Required scope: web session. # Create withdrawal Source: https://docs.machines.cash/api-reference/withdrawals/create-withdrawal consumer-openapi.yaml post /user/v1/withdrawals Create withdrawal When to use this: Withdraw funds from collateral contract to destination. Required scope: withdrawals.write. Requires `idempotency-key` header. # Accept user agreements Source: https://docs.machines.cash/api/agreements/accept openapi.yaml post /partner/v1/agreements Marks all agreements as accepted for an approved user. # Get user agreements Source: https://docs.machines.cash/api/agreements/list openapi.yaml get /partner/v1/agreements Returns the agreement text, links, and current acceptance status. # Get balance details Source: https://docs.machines.cash/api/balances/get openapi.yaml get /partner/v1/balances Returns credit limit, spending power, and charge totals (all in cents). # Create a card Source: https://docs.machines.cash/api/cards/create openapi.yaml post /partner/v1/cards Cards are virtual-only. Card labels are optional and can be set with `POST /encryption/encrypt`. Limits are optional. # Delete a card Source: https://docs.machines.cash/api/cards/delete openapi.yaml delete /partner/v1/cards/{cardId} Cancels the card immediately. # Get card by id Source: https://docs.machines.cash/api/cards/get openapi.yaml get /partner/v1/cards/{cardId} # List cards Source: https://docs.machines.cash/api/cards/list openapi.yaml get /partner/v1/cards Returns cards created by your account only. # Retrieve encrypted card secrets Source: https://docs.machines.cash/api/cards/secrets openapi.yaml post /partner/v1/cards/{cardId}/secrets Requires a secrets sessionId and cards.secrets.read scope. # Create a card secrets session Source: https://docs.machines.cash/api/cards/secrets/session openapi.yaml post /partner/v1/cards/secrets/session Returns a short-lived sessionId and secretKey for decrypting card PAN/CVC. # Update card status, limits, or labels Source: https://docs.machines.cash/api/cards/update openapi.yaml patch /partner/v1/cards/{cardId} # List deposit assets Source: https://docs.machines.cash/api/deposits/assets openapi.yaml get /partner/v1/deposits/assets Returns supported token and network ids for standard partner deposits. Min/max values are not returned by this endpoint. # Create a deposit address Source: https://docs.machines.cash/api/deposits/create openapi.yaml post /partner/v1/deposits Returns a deposit address for this user. Production uses USDC on Base; sandbox uses rUSD on Base Sepolia. No extra scopes required. # Estimate deposit receive amount Source: https://docs.machines.cash/api/deposits/estimate openapi.yaml post /partner/v1/deposits/estimate Returns estimated collateral receive amount and routing details for a specific `{ currency, network, amount }` input. # Get a deposit Source: https://docs.machines.cash/api/deposits/get openapi.yaml get /partner/v1/deposits/{depositId} Returns the latest status for a deposit intent. No extra scopes required. # List deposits Source: https://docs.machines.cash/api/deposits/list openapi.yaml get /partner/v1/deposits Returns recent deposits, optionally scoped to active ones. No extra scopes required. # Get min/max range for a deposit pair Source: https://docs.machines.cash/api/deposits/range openapi.yaml post /partner/v1/deposits/range Returns min/max amount and routing details for a specific `{ currency, network }` pair. # Get the per-user data key Source: https://docs.machines.cash/api/encryption/data-key openapi.yaml get /partner/v1/encryption/data-key Use this key to encrypt/decrypt labels with AES-256-GCM. # Decrypt ciphertext with the data key Source: https://docs.machines.cash/api/encryption/decrypt openapi.yaml post /partner/v1/encryption/decrypt # Encrypt plaintext with the data key Source: https://docs.machines.cash/api/encryption/encrypt openapi.yaml post /partner/v1/encryption/encrypt # Submit KYC application data Source: https://docs.machines.cash/api/kyc/applications openapi.yaml post /partner/v1/kyc/applications # Get KYC field requirements Source: https://docs.machines.cash/api/kyc/schema openapi.yaml get /partner/v1/kyc/schema # Get current KYC status Source: https://docs.machines.cash/api/kyc/status openapi.yaml get /partner/v1/kyc/status # Get KYC field requirements and values Source: https://docs.machines.cash/api/kyc/values openapi.yaml get /partner/v1/kyc/values Field requirements plus occupation codes and allowed ranges for KYC fields. Use `countryOfIssue` from these fields for country-specific agreement handling. # Create a short-lived user session token Source: https://docs.machines.cash/api/sessions openapi.yaml post /partner/v1/sessions Use your API key to mint a scoped, short-lived JWT for agent calls. # List transaction history Source: https://docs.machines.cash/api/transactions/list openapi.yaml get /partner/v1/transactions Returns transaction history for the user. Use `type` to filter by one or more transaction types. # Resolve or create a Machines user Source: https://docs.machines.cash/api/users/resolve openapi.yaml post /partner/v1/users/resolve Maps your user id to a Machines user (and wallet). # List withdrawal destination assets Source: https://docs.machines.cash/api/withdrawals/assets openapi.yaml get /partner/v1/withdrawals/assets Returns destination token/network options. Routes are dynamic and provider-driven; always query this endpoint before quoting. Optional source query fields are accepted as hints. # Request a withdrawal signature payload Source: https://docs.machines.cash/api/withdrawals/create openapi.yaml post /partner/v1/withdrawals Creates a ChangeNOW relay route from fixed source collateral (USDC on Base in production, rUSD on Base Sepolia in sandbox) to the selected destination and returns Rain withdrawal signature parameters for onchain execution. # Estimate withdrawal receive amount Source: https://docs.machines.cash/api/withdrawals/estimate openapi.yaml post /partner/v1/withdrawals/estimate Returns estimated destination receive amount for a destination pair and amount. Routes are dynamic and provider-driven. # Get min/max range for a withdrawal destination Source: https://docs.machines.cash/api/withdrawals/range openapi.yaml post /partner/v1/withdrawals/range Returns min/max and route details for a destination pair. Routes are dynamic and provider-driven. # Authentication Source: https://docs.machines.cash/authentication Use your API key to mint short‑lived session tokens. Keep it simple and secure. ## Two credentials * API key: send with X-Partner-Key for server‑to‑server calls (mint sessions). Never expose it to clients. * Session token: short‑lived JWT for protected endpoints. Send with Authorization: Bearer \. ## Flow ```mermaid theme={null} sequenceDiagram participant Backend as Your Backend participant MachinesAPI as Machines API participant Agent as Agent/Service Backend->>MachinesAPI: POST /users/resolve (X-Partner-Key) Backend->>MachinesAPI: POST /sessions (X-Partner-Key + scopes) MachinesAPI-->>Backend: { sessionToken, scopes, expiresAt } Backend->>Agent: Deliver sessionToken (scoped JWT) Agent->>MachinesAPI: call protected endpoints (Bearer sessionToken) MachinesAPI-->>Agent: structured JSON responses ``` ## API flows (step‑by‑step) Endpoint: POST /sessions
Body:
  • userId (string, your user id)
  • walletAddress (0x… address, optional)
  • scopes (array of strings)
  • ttlSeconds (integer, optional)
Response:
  • sessionToken (use as Authorization: Bearer \)
  • sessionId, userId, expiresAt, scopes
```bash theme={null} curl -s \ -d '{"userId":"demo-123","walletAddress":"0xabc...","scopes":["cards.read","cards.write"]}' \ https://dev-api.machines.cash/partner/v1/sessions ``` ```json theme={null} { "ok": true, "data": { "sessionToken": "", "sessionId": "...", "userId": "...", "expiresAt": "2026-01-01T00:00:00.000Z", "scopes": ["cards.read","cards.write"] }, "summary": "session created", "errors": [] } ```
Send Authorization: Bearer \ on protected endpoints. ```bash theme={null} curl -s \ -H 'Authorization: Bearer ' \ https://dev-api.machines.cash/partner/v1/cards ``` Missing/expired tokens return 401; missing permissions return 403. Tokens are short‑lived. Mint a new session when you get 401 Unauthorized. Keep scopes minimal. Common sets:
  • KYC: kyc.read, kyc.write
  • Cards: cards.read, cards.write
  • Card secrets: cards.secrets.read
  • Card labels: encryption.write (encrypt), encryption.read (decrypt)
  • Balances: no extra scopes
  • Transactions: transactions.read
  • Withdrawals: withdrawals.write
Missing a scope returns 403 Forbidden. ## All available scopes Deposits and balances do not require extra scopes. ```text theme={null} users.read users.write kyc.read kyc.write cards.read cards.write cards.secrets.read encryption.read encryption.write deposits.read deposits.write transactions.read withdrawals.write ``` ## Headers quick reference ```text theme={null} # Mint sessions (server-to-server) X-Partner-Key: # Call protected endpoints Authorization: Bearer Content-Type: application/json # Optional Open Responses output X-Open-Responses: 1 X-Open-Responses-Call-Id: ``` ## Token basics * Short‑lived by default (e.g., \~15 minutes). Rotate by minting a new session. * Session payload includes account id, user id, wallet address, scopes, expiry. * Never log tokens or card data; always use HTTPS. Use [https://dev-api.machines.cash](https://dev-api.machines.cash) in sandbox. Switch to production only after key validation. # Balances Source: https://docs.machines.cash/balances Fetch spending power and charge totals. ## Overview * GET /balances returns credit limit, spending power, and charge totals (all in cents). * No extra scopes are required. ## API flow (step‑by‑step) Endpoint: GET /balances
Headers: Authorization: Bearer \ ```bash theme={null} curl -s \ -H "Authorization: Bearer $SESSION_TOKEN" \ https://dev-api.machines.cash/partner/v1/balances ``` Use the returned values to display available spend and current charge totals.
## Response (balances) Available spending power in cents. Credit limit in cents. Pending charges in cents. Posted charges in cents. Balance due in cents. # Agent Best Practices Source: https://docs.machines.cash/best-practices-agents Guardrails and patterns that keep agent calls safe and reliable. * Use Idempotency-Key on card creation and other idempotent writes. * Use propose -> execute for sensitive actions. * Return small, structured results with a summary for LLM chaining. * Prefer cursor pagination and search + get-by-id pairs. * Implement bounded retries on networking timeouts. # Cards Source: https://docs.machines.cash/cards Create, lock/unlock, delete, and retrieve encrypted card secrets. Prerequisite: have a session token. See Authentication. ## Card lifecycle ```mermaid theme={null} sequenceDiagram participant Backend as Your Backend participant MachinesAPI as Machines API Backend->>MachinesAPI: POST /cards MachinesAPI-->>Backend: cardId Backend->>MachinesAPI: PATCH /cards/{"{cardId}"} (lock/unlock, limit) MachinesAPI-->>Backend: updated card Backend->>MachinesAPI: DELETE /cards/{"{cardId}"} MachinesAPI-->>Backend: canceled ``` ## API flows (step‑by‑step) Endpoint : GET /cards Endpoint : POST /cards \ Body : optional encryptedName (encrypted card label) and optional limit with amountCents and frequency .
Tip : To set a card label, call POST /encryption/encrypt first and pass the returned value as encryptedName (see Encryption ). ```bash theme={null} curl -s \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: ' \ -d '{"limit": {"amountCents": 2500, "frequency": "perAuthorization"}}' \ https://dev-api.machines.cash/partner/v1/cards ```
Endpoint : PATCH /cards/ Endpoint : DELETE /cards/ Endpoint : POST /cards/secrets/session
Body : send an empty JSON object if your client sets Content-Type: application/json . ```bash theme={null} curl -s \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -d '{}' \ https://dev-api.machines.cash/partner/v1/cards/secrets/session ```
Endpoint : POST /cards//secrets \ Body : (from the secrets session helper)
## Fields (create/update) Optional encrypted card label field . Generate with POST /encryption/encrypt . Spending cap in cents. One of: perAuthorization , per24HourPeriod , per7DayPeriod , per30DayPeriod , perYearPeriod , allTime . ## Response (secrets session) Session id used to fetch encrypted PAN/CVC. 16‑byte secret (hex) used to decrypt PAN/CVC with AES‑128‑GCM. ## Response (secrets) Base64 ciphertext + auth tag. Base64 IV. Base64 ciphertext + auth tag. Base64 IV. Expiration month (MM). Expiration year (YYYY). Last 4 digits. ## Card labels vs card secrets * Card labels use /encryption/encrypt and /encryption/decrypt . * Card secrets (PAN/CVC) use /cards/secrets/session * /cards//secrets . * Decrypt card labels on your backend and send plaintext labels to your frontend. * Card labels are optional, but recommended for clean UI. ## Card limits * amountCents: integer amount in cents (e.g., 5000 = \$50). Minimum 1. * frequency: one of * perAuthorization — max per single authorization * per24HourPeriod — rolling 24‑hour spend cap * per7DayPeriod — rolling 7‑day spend cap * per30DayPeriod — rolling 30‑day spend cap * perYearPeriod — rolling 1‑year cap * allTime — lifetime cap Examples ```json theme={null} { "limit": { "amountCents": 5000, "frequency": "perAuthorization" } } { "limit": { "amountCents": 20000, "frequency": "per24HourPeriod" } } ``` To change a limit, PATCH the card with a new limit object. To remove a limit, set a permissive value (for example a very high allTime cap) or contact us if you need a true “no limit” configuration for your program. ## Lock / unlock / update limits * PATCH /cards/ with status: "locked" to pause spend. * Set status: "active" to unlock. * Update limits by sending a new limit payload. ## Delete DELETE /cards/ cancels immediately. ## Card number secrets (PAN/CVC) This flow is only for retrieving the card number (PAN) and CVC. Do not use it for card labels. 1. Call POST /cards/secrets/session to get sessionId and secretKey . 2. Call POST /cards//secrets with . 3. Decrypt encryptedPan and encryptedCvc locally using AES‑128‑GCM with the secretKey . This endpoint requires the cards.secrets.read scope. /encryption/decrypt is for card labels only. Use /cards//secrets for PAN/CVC. The sessionId used here is different from your API session token. Always request it from /cards/secrets/session . No decrypted PAN/CVC ever leaves your process; only encrypted blobs are returned by the API. # Claude Source: https://docs.machines.cash/claude-plugin Install the Machines plugin in Claude for balances, cards, deposits, and agentic payments. The Machines plugin for Claude gives you a hosted MCP connection with OAuth login, built-in account guidance, and a local CLI fallback -- all without manual configuration. ## Prerequisites * A Machines account with identity verification complete * Claude desktop or web app ## Install the plugin Machines CLI ## Example prompts * `show my balance` * `list my active cards` * `search apple airpods pro on amazon` * `buy these apple airpods pro on amazon using my default card` * `check the status of my latest purchase` ## Troubleshooting | Problem | Fix | | ----------------------------- | ------------------------------------------------------------------ | | Plugin not listed | Use the manual fallback above | | Connect flow failed | Remove the Machines plugin and install it again | | Still failing after reconnect | See MCP Setup for generic troubleshooting | ## Next steps * MCP Setup -- generic setup, example prompts, and account safety tips * Agentic Payments -- one shared search, buy, status, confirm, and 3DS flow * Machines CLI -- full terminal workflow * Raw Knowledge File -- improve Claude's Machines knowledge # Clawdbot Source: https://docs.machines.cash/clawdbot Connect Clawdbot to Machines for balances, cards, deposits, and agentic payments. Connect Clawdbot to your Machines account for balance checks, card management, crypto deposits, and purchases. No terminal install required. ## Prerequisites * A Machines account with identity verification complete * Clawdbot open with MCP settings accessible ## Setup In Clawdbot's MCP settings, add a remote MCP server and paste this URL: ```text theme={null} https://mcp.machines.cash/mcp ``` Complete the browser sign-in and approve access. Ask Clawdbot: `show my balance` Then try a second action to confirm: `list my cards` Clawdbot connects directly to the hosted MCP server. You don't need to install anything locally. ## Example prompts * `show my balance` * `list my cards` * `search apple airpods pro on amazon` * `buy these apple airpods pro on amazon using my default card` * `check the status of my latest purchase` ## Troubleshooting | Problem | Fix | | --------------------------- | ---------------------------------------------- | | Sign-in window closes early | Restart the connect flow | | Not connected after login | Remove the Machines MCP entry and add it again | | Wrong server URL | Use exactly `https://mcp.machines.cash/mcp` | ## Next steps * MCP Setup -- generic troubleshooting and account safety * Agentic Payments -- one shared search, buy, status, confirm, and 3DS flow * Raw Knowledge File -- add context for better AI responses # Machines CLI Source: https://docs.machines.cash/cli Install and run Machines from your terminal -- login, identity verification, cards, deposits, and agentic payments. Machines CLI lets you manage your Machines account from the terminal. Use it for login, identity verification, balance checks, crypto deposits, card management, agentic payments, and connecting AI apps. ## Prerequisites * Node.js 18+ * A Machines account ## Install ```bash theme={null} npm i -g @machines-cash/cli ``` After installing, run `machines` to open the guided menu, or use commands directly. Don't want a global install? Use `npx machines-cash@latest ` for one-off commands. ## Quick start ```bash theme={null} machines login ``` Opens your browser to authenticate. Your session is saved locally for future commands. ```bash theme={null} machines user create --browser ``` Check your status anytime: ```bash theme={null} machines kyc status ``` ```bash theme={null} machines deposit create --token USDC --network base --amount 25 ``` Check your balance: ```bash theme={null} machines balance ``` ```bash theme={null} machines card create --name "ads-bot" --limit 250 --frequency per30DayPeriod ``` ```bash theme={null} machines buy "https://www.amazon.com/dp/B0DGHMNQ5Q" --wait ``` If you already have an active Machines card and saved billing profile, you usually do not need to pass anything else. ## Commands ### Login ```bash theme={null} machines login # browser login machines login --no-launch-browser # prints URL instead of opening browser machines login --agent # CLI-only login for agents with wallets machines logout # sign out ``` ### Balance and deposits ```bash theme={null} machines balance # check spending power machines deposit assets # list supported tokens and networks machines deposit create --token USDC --network base --amount 25 machines deposit show --id # check one deposit machines deposit watch --id # poll until complete ``` Send only the exact token on the exact network shown. If a memo appears, include it exactly. CLI deposits are crypto only. ### Identity verification Browser-based (recommended): ```bash theme={null} machines user create --browser machines kyc status ``` CLI-based (for automation): ```bash theme={null} machines user create --from-file ./kyc-user.json --open --wait ``` See Identity Verification for the full JSON format and field reference. ### Cards ```bash theme={null} machines card create --name "ads-bot" --limit 250 --frequency per30DayPeriod machines card list machines card reveal --last4 4242 machines card update --last4 4242 --name "ads-bot-v2" machines card limit set --last4 4242 --amount 500 --frequency per30DayPeriod machines card lock --last4 4242 machines card unlock --last4 4242 machines card delete --last4 4242 ``` Disposable cards: ```bash theme={null} machines disposable create --amount-cents 5000 --auto-cancel-after-auth ``` ### Agentic payments ```bash theme={null} machines search "apple airpods pro" machines search "kindle paperwhite" machines search "ninja air fryer" machines buy "https://www.amazon.com/dp/B0DGHMNQ5Q" machines buy "https://www.amazon.com/dp/B0DGHMNQ5Q" --card "" --wait machines agent status machines agent confirm machines agent 3ds --code ``` Notes: * shopping defaults to Amazon right now * `machines search` is the preferred command * `machines browser` still works as a compatibility alias * if `--card` is omitted, Machines uses your default active card and stored billing profile * `--wait` and `--watch` keep polling until the action pauses or finishes * use `--payment-card-file ` only for direct testing; never pass raw card numbers in flags More examples: ```bash theme={null} machines search "lego botanical orchid" machines search "anker usb c charger" machines buy "https://www.amazon.com/dp/B0DGHMNQ5Q" --wait --json ``` See Agentic Payments for the full purchase flow and API examples. ### Connect an AI app ```bash theme={null} machines mcp install --host codex # or: claude, copilot, chatgpt machines mcp auth login machines mcp doctor # check connection health ``` For step-by-step AI setup, see MCP Setup or Claude. ### Agent output Add `--json` to any command for structured output: ```bash theme={null} machines card list --json ``` This also works for commerce commands: ```bash theme={null} machines buy "https://www.amazon.com/dp/B0DGHMNQ5Q" --wait --json ``` ## Troubleshooting | Problem | Fix | | ----------------------------- | ------------------------------------------------------------------- | | Browser didn't open | Use `--no-launch-browser` and open the URL manually | | `user not found` | Complete identity verification first | | `machines: command not found` | Run `npm i -g @machines-cash/cli` or use `npx machines-cash@latest` | | Need full command list | Run `machines --help` | ## Next steps * MCP Setup -- connect Machines to your AI app * Agentic Payments -- one shared search, buy, status, confirm, and 3DS flow * Claude -- recommended setup for Claude users * Raw Knowledge File -- paste context into any AI for better responses # Codex Source: https://docs.machines.cash/codex Connect Machines to Codex for balances, cards, deposits, and agentic payments. Connect Machines to Codex so your coding agent can check balances, create cards, handle crypto deposits, and place purchases. ## Prerequisites * Node.js 18+ * Codex installed and running * A Machines account with identity verification complete ## Setup ```bash theme={null} npx @machines-cash/agent-skill install --host codex ``` ```bash theme={null} npx @machines-cash/agent-skill auth login ``` Approve access in your browser. Open Codex and verify that the Machines skill is available. Ask Codex: `show my balance` ## Example prompts Try: * `show my balance` * `list my active cards` * `search apple airpods pro on amazon` * `buy these apple airpods pro on amazon using my default card` * `check the status of my latest purchase` ## Useful commands ```bash theme={null} npx @machines-cash/agent-skill install --host codex # install npx @machines-cash/agent-skill auth login # login npx @machines-cash/agent-skill auth login --manual-key # manual login fallback npx @machines-cash/agent-skill doctor # health check ``` ## Troubleshooting | Problem | Fix | | ----------------------------- | ------------------------------------------------------------------- | | Machines not visible in Codex | Run the install command again, then reopen Codex | | Login window didn't open | Use `--manual-key` flag for manual login | | Still not connected | Run `doctor` to diagnose, or see MCP Setup | ## Next steps * Machines CLI -- full terminal workflow * Agentic Payments -- one shared search, buy, status, confirm, and 3DS flow * MCP Setup -- generic troubleshooting and account safety * Raw Knowledge File -- add context for better responses # Consumer API Reference Source: https://docs.machines.cash/consumer-api-reference Full reference for /consumer/v1 endpoints used by users, agents, and MCP clients. This is the full consumer API surface. Use this when you are building an agent or automation for a Machines account. Bootstrap, key management, and scoped sessions. Encrypt and decrypt labels for user-safe display. Search products, buy, and continue purchase steps with one shared flow. ## Base URL `https://api.machines.cash` Canonical consumer routes are under `/consumer/v1`. Agent task routes are separate and live under `/agent/v1`. The main task routes are: * `GET /agent/v1/browser` * `POST /agent/v1/browser` * `POST /agent/v1/buy` * `GET /agent/v1/actions/:actionId` * `POST /agent/v1/actions/:actionId/confirm` * `POST /agent/v1/actions/:actionId/3ds` See Agentic Payments for the quickstart and examples. MCP runtime compatibility: * tools are under `machines.consumer.*` * agentic commerce tools are under `machines.agent.*` * resources are under `machines://consumer/*` * `machines.user.cards.list` is the user-friendly cards listing tool ## Authentication * Consumer API key header (for session minting): `X-Consumer-Key` * Consumer session bearer (for operations): `Authorization: Bearer ` * Web session helper: `POST /identity/consumer-api-keys` ## Bootstrap Signing Message `POST /consumer/v1/bootstrap` accepts either template below (exact line order and newlines). Preferred (simpler): ```text theme={null} Machines Cash Bootstrap Address:
Nonce: Issued At: Expires At: ``` Legacy (still accepted): ```text theme={null} Machines Cash Consumer Agent Bootstrap Address:
Nonce: Issued At: Expires At: Connector: Chain ID: Wallet Label: ``` Notes: * Address may be lowercase or checksum. * Keep bootstrap windows short (recommended around 60 seconds). ## Idempotency For state-changing financial writes, include `idempotency-key`. Common required operations include: * deposits create and transfer Preview and poll-style operations do not require idempotency. ## Compatibility behavior * `GET /consumer/v1/users` resolves current user profile (no raw user id required). * `GET /consumer/v1/agreements` and `POST /consumer/v1/agreements` map to application agreement state/actions. * `GET /consumer/v1/kyc/status` resolves current user KYC status. ## Blocked endpoint on consumer surface `GET /consumer/v1/identity/data-key` is intentionally blocked (`403`). Use: * `POST /consumer/v1/crypto/encrypt` * `POST /consumer/v1/crypto/decrypt` for encryption/decryption workflows. ## Partner API Partner routes are documented separately: * Partner docs * Partner API reference # Deposits Source: https://docs.machines.cash/deposits Partner deposit discovery, range validation, estimation, and create flow. Sandbox supports partner deposits only for `rusd` on `base` (Base Sepolia). ## Overview * `GET /partner/v1/deposits/assets`: discover supported `currency` + `network` ids (no min/max). * `POST /partner/v1/deposits/range`: fetch min/max and payout route for one pair. * `POST /partner/v1/deposits/estimate`: quote estimated receive amount for one pair + amount. * `POST /partner/v1/deposits`: create the deposit address/intent. * `GET /partner/v1/deposits` and `GET /partner/v1/deposits/{depositId}`: track lifecycle. Min/max are intentionally omitted from assets. Always call `/deposits/range` (or `/deposits/estimate`) for limits. ## Flow ```mermaid theme={null} sequenceDiagram participant Backend as "Your Backend" participant MachinesAPI as "Machines API" participant Wallet as "Wallet / Exchange" Backend->>MachinesAPI: GET /partner/v1/deposits/assets MachinesAPI-->>Backend: assets[] Backend->>MachinesAPI: POST /partner/v1/deposits/range MachinesAPI-->>Backend: range {minAmount, maxAmount, route} Backend->>MachinesAPI: POST /partner/v1/deposits/estimate MachinesAPI-->>Backend: estimate {estimatedToAmount, rateId} Backend->>MachinesAPI: POST /partner/v1/deposits MachinesAPI-->>Backend: deposit {depositAddress, payinExtraId} Wallet->>MachinesAPI: Send funds to depositAddress (+ memo/tag when payinExtraId exists) Backend->>MachinesAPI: GET /partner/v1/deposits/{depositId} MachinesAPI-->>Backend: status updates ``` ## API flows (step-by-step) Endpoint: GET /partner/v1/deposits/assets ```bash theme={null} curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ "https://api.machines.cash/partner/v1/deposits/assets?q=hbar&limit=20" ``` Response returns `assets[].ticker` and `assets[].networks[].id`. Endpoint: POST /partner/v1/deposits/range ```bash theme={null} curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{"currency":"hbar","network":"hbar"}' \ https://api.machines.cash/partner/v1/deposits/range ``` Use `range.minAmount` / `range.maxAmount` for validation. Endpoint: POST /partner/v1/deposits/estimate ```bash theme={null} curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{"currency":"hbar","network":"hbar","amount":25,"amountCurrency":"crypto"}' \ https://api.machines.cash/partner/v1/deposits/estimate ``` `amountCurrency` supports:
  • crypto (default)
  • usd
Endpoint: POST /partner/v1/deposits ```bash theme={null} curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{"currency":"hbar","network":"hbar","amount":25}' \ https://api.machines.cash/partner/v1/deposits ``` Use the returned `deposit.depositAddress`. If `deposit.payinExtraId` is non-null, pass it as memo/tag in the user’s funding transaction. Endpoints:
## Key response fields Optional memo/tag required by some source networks. Quote input mode (`crypto` or `usd`). Estimated settled amount for the user contract route. Provider rate id when available. # Encryption Source: https://docs.machines.cash/encryption Encrypt card labels using server‑side helpers. Machines cares about privacy—and this extends to API partners. We use end‑to‑end encryption for card UI metadata so only your users can read it. Use our helper endpoints so you don’t have to implement cryptography yourself. What’s encrypted for cards: * Card label (name) → encryptedName * Color → encryptedColor * Emoji → encryptedEmoji * Memo/notes → encryptedMemo Card secrets (PAN/CVC) are different. Use POST /cards/secrets/session + POST /cards//secrets. See Cards → Secrets. Prerequisite: have a session token. See Authentication. ## API flows (step‑by‑step) Endpoint: POST /encryption/encrypt
Body: JSON with a value string (e.g., "Ops Card").
Response: returns an object with value (EncryptedField) ```bash theme={null} curl -s \ -d '{"value":"Ops Card"}' \ https://dev-api.machines.cash/partner/v1/encryption/encrypt ```
Endpoint: POST /encryption/decrypt
Body: JSON with a value EncryptedField. Response: plaintext card label in value ```bash theme={null} curl -s \ -d '{"value":{"v":1,"iv":"Qz4f2m7Hk1P9x0ab","ct":"Hdbb2yT2F4xWZL5m5bJX3eJb4n8wVhjPzqLw2h7i"}}' \ https://dev-api.machines.cash/partner/v1/encryption/decrypt ```
## Fields Plaintext to encrypt. For decryption, pass the encrypted object returned by /encryption/encrypt. ## Response (encrypt) Schema version. Base64url IV. Base64url ciphertext + auth tag. ## Card labels are optional * You can omit encryptedName when creating a card and set it later with PATCH /cards/. * When you do set a card label, always use /encryption/encrypt and /encryption/decrypt (no manual cryptography needed). ## Default flow (server-side) ```mermaid theme={null} sequenceDiagram participant Backend as Backend participant MachinesAPI as Machines API Backend->>MachinesAPI: POST /encryption/encrypt { value } MachinesAPI-->>Backend: { value: encryptedField } Backend->>MachinesAPI: POST /cards { encryptedName } ``` ## Example (server-side) ```ts theme={null} const labelRes = await fetch("https://dev-api.machines.cash/partner/v1/encryption/encrypt", { method: "POST", headers: { Authorization: `Bearer ${sessionToken}`, "Content-Type": "application/json" }, body: JSON.stringify({ value: "Ops Card" }), }); const { data: encrypted } = await labelRes.json(); await fetch("https://dev-api.machines.cash/partner/v1/cards", { method: "POST", headers: { Authorization: `Bearer ${sessionToken}`, "Content-Type": "application/json" }, body: JSON.stringify({ encryptedName: encrypted.value }), }); ``` ## Display card labels in your frontend (recommended) 1. List cards: GET /cards 2. Decrypt each encryptedName with POST /encryption/decrypt 3. Send plaintext labels to your frontend ```ts theme={null} const cardsRes = await fetch("https://dev-api.machines.cash/partner/v1/cards", { headers: { Authorization: `Bearer ${sessionToken}` }, }); const { data: cardsData } = await cardsRes.json(); const labels = await Promise.all( cardsData.cards.map(async (card: { encryptedName: unknown; cardId: string }) => { const decryptRes = await fetch("https://dev-api.machines.cash/partner/v1/encryption/decrypt", { method: "POST", headers: { Authorization: `Bearer ${sessionToken}`, "Content-Type": "application/json" }, body: JSON.stringify({ value: card.encryptedName }), }); const { data } = await decryptRes.json(); return { cardId: card.cardId, label: data.value }; }), ); ``` Use /encryption/decrypt only for card labels and metadata. Card secrets (PAN/CVC) use /cards/secrets/session + /cards//secrets. ## Advanced (client-side, optional) If you need client-side encryption, fetch a per-user data key via GET /encryption/data-key (requires encryption.read) and encrypt locally using AES-256-GCM. ### Encrypted field shape ``` { "v": 1, "iv": "", "ct": "" } ``` * Canonical order is v, iv, ct (order doesn’t matter in JSON). * v: schema version (currently 1) * iv: 12-byte IV, base64url encoded * ct: ciphertext + auth tag, base64url encoded ### Example (Node.js) ```ts theme={null} import { createCipheriv, randomBytes } from "node:crypto"; function base64Url(buf: Buffer) { return buf.toString("base64").replace(/\\+/g, "-").replace(/\\//g, "_").replace(/=+$/g, ""); } export function encryptField(plaintext: string, dataKeyBase64Url: string) { const key = Buffer.from(dataKeyBase64Url, "base64url"); const iv = randomBytes(12); const cipher = createCipheriv("aes-256-gcm", key, iv); const ciphertext = Buffer.concat([cipher.update(plaintext, "utf8"), cipher.final()]); const tag = cipher.getAuthTag(); const combined = Buffer.concat([ciphertext, tag]); return { v: 1, iv: base64Url(iv), ct: base64Url(combined) }; } ``` Card PAN/CVC secrets use a secrets session and AES-128-GCM. See Cards for that flow. # Errors & Retries Source: https://docs.machines.cash/errors Deterministic error codes and retry guidance for agents and services. Common error codes: * invalid\_request (400) * unauthorized (401) * forbidden (403) * not\_found (404) * conflict (409) * service\_unavailable (503) All responses use a consistent envelope by default: `{ ok, data, summary, errors[], next }`. Set X-Open-Responses: 1 to receive Open Responses-style outputs. ## Open Responses error shape (optional) When X-Open-Responses: 1 is set, errors return the Open Responses error object: ```json theme={null} { "error": { "type": "invalid_request", "code": "invalid_request", "param": "walletAddress", "message": "walletAddress required to create a new mapping" } } ``` # Quickstart Source: https://docs.machines.cash/getting-started End-to-end flow for KYC, deposits, and cards. Base URLs: * Production: `https://api.machines.cash/partner/v1` * Sandbox: `https://dev-api.machines.cash/partner/v1` Get API access: email `help@machines.cash` or DM `@erturkarda` on Telegram. All requests are JSON. Use `X-Partner-Key` for steps 1-2. Use `Authorization: Bearer ` for the rest. ## 1. Create a session token Call POST /sessions. ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/sessions \ --header 'Content-Type: application/json' \ --header 'X-Partner-Key: ' \ --data ' { "userId": "eeetest", "scopes": [ "kyc.read", "kyc.write" ], "walletAddress": "0x462B1eD1B62F4c282c0EA342BCefcF8f9919226E", "ttlSeconds": 9001 } ' ``` ```json theme={null} { "ok": true, "data": { "sessionToken": "", "sessionId": "", "userId": "eeetest", "expiresAt": "2026-01-16T16:47:52.000Z", "scopes": [ "kyc.read", "kyc.write" ] }, "summary": "session created", "errors": [] } ``` Use this session token for steps 3-9. ## 2. Create or link the user Call POST /users/resolve. ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/users/resolve \ --header 'Content-Type: application/json' \ --header 'X-Partner-Key: ' \ --data ' { "userId": "eeetest", "walletAddress": "0x462B1eD1B62F4c282c0EA342BCefcF8f9919226E", "walletLabel": "Main Wallet" } ' ``` ```json theme={null} { "ok": true, "data": { "userId": "eeetest", "walletAddress": "0x462b1ed1b62f4c282c0ea342bcefcf8f9919226e", "kycStatus": "not_submitted", "createdAt": "2026-01-16T14:17:51.298Z" }, "summary": "user linked; kyc not started", "errors": [] } ``` ## 3. Get KYC field requirements and values Call GET /kyc/values to build your KYC form. The full occupation list is also available at /kyc-values. ```bash theme={null} curl --request GET \ --url https://api.machines.cash/partner/v1/kyc/values \ --header 'Authorization: Bearer ' ``` ```json theme={null} { "ok": true, "data": { "fields": [ { "name": "firstName", "required": true, "type": "string", "maxLength": 50, "description": "Given name." }, { "name": "lastName", "required": true, "type": "string", "maxLength": 50, "description": "Family name." }, { "name": "birthDate", "required": true, "type": "date", "description": "YYYY-MM-DD (e.g., 1990-01-01)." }, { "name": "nationalId", "required": true, "type": "string", "regex": "^[0-9A-Za-z-]+$", "description": "Government ID number. Letters, numbers, and dashes only." }, { "name": "countryOfIssue", "required": true, "type": "string", "minLength": 2, "maxLength": 2, "description": "ISO-3166-1 alpha-2 (e.g., US)." }, { "name": "email", "required": true, "type": "string", "description": "Valid email address." }, { "name": "address", "required": true, "type": "object", "description": "Object with line1, line2, city, region, postalCode, countryCode." }, { "name": "phoneCountryCode", "required": false, "type": "string", "maxLength": 3, "description": "Country calling code digits only (e.g., 1)." }, { "name": "phoneNumber", "required": false, "type": "string", "maxLength": 15, "description": "Phone number digits only; include area code." }, { "name": "occupation", "required": true, "type": "string", "description": "SOC occupation code (e.g., 49-3023). Use /kyc/values for the list." }, { "name": "annualSalary", "required": true, "type": "string", "enum": [ "<40k", "50k–99k", "100k–149k", "150k+" ], "description": "Choose a salary range." }, { "name": "accountPurpose", "required": true, "type": "string", "enum": [ "everyday spend", "subscriptions", "business expenses", "testing", "other" ], "description": "How the account will be used." }, { "name": "expectedMonthlyVolume", "required": true, "type": "string", "enum": [ "under $1k", "$1k–$5k", "$5k–$20k", "$20k+" ], "description": "Choose a monthly volume range." } ], "occupations": [ { "code": "11-1021", "label": "General and Operations Managers" }, { "code": "11-2011", "label": "Advertising and Promotions Managers" }, { "code": "11-3031", "label": "Financial Managers" }, { "code": "11-9021", "label": "Construction Managers" }, { "code": "11-9041", "label": "Architectural and Engineering Managers" }, { "code": "11-9071", "label": "Gaming Managers" }, { "code": "11-9141", "label": "Property, Real Estate, and Community Association Managers" }, { "code": "13-1041", "label": "Compliance Officers" }, { "code": "13-2011", "label": "Accountants and Auditors" }, { "code": "13-2051", "label": "Financial Analysts" }, { "code": "13-2052", "label": "Personal Financial Advisors" }, { "code": "13-2082", "label": "Tax Preparers" }, { "code": "15-1121", "label": "Computer Systems Analysts" }, { "code": "15-1131", "label": "Computer Programmers" }, { "code": "15-1132", "label": "Software Developers, Applications" }, { "code": "15-1133", "label": "Software Developers, Systems Software" }, { "code": "15-1141", "label": "Database Administrators" }, { "code": "15-1142", "label": "Information Security Analysts" }, { "code": "15-1143", "label": "Computer Network Architects" }, { "code": "15-1151", "label": "Computer User Support Specialists" }, { "code": "17-2051", "label": "Civil Engineers" }, { "code": "17-2071", "label": "Electrical Engineers" }, { "code": "17-2141", "label": "Mechanical Engineers" }, { "code": "19-3011", "label": "Economists" }, { "code": "23-1011", "label": "Lawyers" }, { "code": "23-2011", "label": "Paralegals and Legal Assistants" }, { "code": "25-2021", "label": "Elementary School Teachers" }, { "code": "27-1024", "label": "Graphic Designers" }, { "code": "27-2012", "label": "Producers and Directors" }, { "code": "29-1141", "label": "Registered Nurses" }, { "code": "29-1062", "label": "Family and General Practitioners" }, { "code": "29-1067", "label": "Surgeons" }, { "code": "31-9097", "label": "Phlebotomists" }, { "code": "33-3021", "label": "Detectives and Criminal Investigators" }, { "code": "35-1011", "label": "Chefs and Head Cooks" }, { "code": "41-9011", "label": "Demonstrators and Product Promoters" }, { "code": "41-9021", "label": "Real Estate Brokers" }, { "code": "43-3071", "label": "Tellers" }, { "code": "47-1011", "label": "Construction Supervisors" }, { "code": "47-2061", "label": "Construction Laborers" }, { "code": "49-3023", "label": "Automotive Service Technicians and Mechanics" }, { "code": "51-4121", "label": "Welders, Cutters, Solderers, and Brazers" }, { "code": "53-3032", "label": "Heavy and Tractor-Trailer Truck Drivers" }, { "code": "53-3041", "label": "Taxi Drivers and Chauffeurs" }, { "code": "SELFEMP", "label": "Self-Employed" }, { "code": "UNEMPLO", "label": "Unemployed" }, { "code": "RETIRED", "label": "Retired" }, { "code": "OTHERXX", "label": "Other" } ], "annualSalary": ["<40k", "50k–99k", "100k–149k", "150k+"], "expectedMonthlyVolume": ["under $1k", "$1k–$5k", "$5k–$20k", "$20k+"], "accountPurpose": ["everyday spend", "subscriptions", "business expenses", "testing", "other"] }, "summary": "kyc values", "errors": [] } ``` ## 4. Submit KYC Call POST /kyc/applications. ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/kyc/applications \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "firstName": "John", "lastName": "smith", "birthDate": "1990-01-01", "nationalId": "123456789", "countryOfIssue": "US", "email": "jsmith@example.com", "address": { "line1": "123 Main St", "city": "New York", "region": "NY", "postalCode": "10001", "countryCode": "US", "line2": "Unit 4" }, "occupation": "49-3023", "annualSalary": "<40k", "accountPurpose": "everyday spend", "expectedMonthlyVolume": "under $1k", "phoneCountryCode": "1", "phoneNumber": "4155551234" } ' ``` ```json theme={null} { "ok": true, "data": { "status": "needs_verification", "reason": "", "completionLink": { "url": "https://kyc.machines.cash/verify", "params": { "userId": "18717ac1-c375-4ff6-972d-79dd702b7d44", "signature": "" } }, "externalVerificationLink": { "url": "https://kyc.machines.cash/verify", "params": { "userId": "18717ac1-c375-4ff6-972d-79dd702b7d44", "signature": "" } }, "isActive": true, "isTermsOfServiceAccepted": false }, "summary": "kyc submitted", "errors": [] } ``` ## 5. Complete verification Open the `completionLink` (or `externalVerificationLink`) in a new window so the user can finish verification. ## 6. Poll KYC status Call GET /kyc/status until the status is `approved`. Status meanings are listed in KYC status reference. ```bash theme={null} curl --request GET \ --url https://api.machines.cash/partner/v1/kyc/status \ --header 'Authorization: Bearer ' ``` ```json theme={null} { "ok": true, "data": { "status": "approved", "reason": "", "completionLink": null, "externalVerificationLink": null, "isActive": null, "isTermsOfServiceAccepted": false }, "summary": "kyc status", "errors": [] } ``` ## 7. Show agreements and collect consent Call GET /agreements to fetch agreement text, then POST /agreements to accept. ```bash theme={null} curl --request GET \ --url https://api.machines.cash/partner/v1/agreements \ --header 'Authorization: Bearer ' ``` ```json theme={null} { "ok": true, "data": { "agreements": [ { "id": "esignConsent", "text": "I accept the E-Sign Consent", "links": [ { "label": "E-Sign Consent", "url": "https://machines.cash/e-sign" } ] }, { "id": "accountOpeningPrivacyNotice", "text": "I accept the Account Opening Privacy Notice", "links": [ { "label": "Account Opening Privacy Notice", "url": "https://machines.cash/account-opening-privacy" } ] }, { "id": "cardTermsAndIssuerPrivacyPolicy", "text": "I accept the Machines Card Terms and the Issuer Privacy Policy", "links": [ { "label": "Machines Card Terms", "url": "https://machines.cash/machines-card-terms" }, { "label": "Issuer Privacy Policy", "url": "https://www.third-national.com/privacypolicy" } ] }, { "id": "informationCertification", "text": "I certify that the information I have provided is accurate and that I will abide by all the rules and requirements related to my Machines Spend Card.", "links": [] }, { "id": "solicitationAcknowledgement", "text": "I acknowledge that applying for the Machines Spend Card does not constitute unauthorized solicitation.", "links": [] } ], "accepted": false, "acceptedAt": null }, "summary": "agreements", "errors": [] } ``` ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/agreements \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "accepted": true } ' ``` ```json theme={null} { "ok": true, "data": { "agreements": [ { "id": "esignConsent", "text": "I accept the E-Sign Consent", "links": [ { "label": "E-Sign Consent", "url": "https://machines.cash/e-sign" } ] }, { "id": "accountOpeningPrivacyNotice", "text": "I accept the Account Opening Privacy Notice", "links": [ { "label": "Account Opening Privacy Notice", "url": "https://machines.cash/account-opening-privacy" } ] }, { "id": "cardTermsAndIssuerPrivacyPolicy", "text": "I accept the Machines Card Terms and the Issuer Privacy Policy", "links": [ { "label": "Machines Card Terms", "url": "https://machines.cash/machines-card-terms" }, { "label": "Issuer Privacy Policy", "url": "https://www.third-national.com/privacypolicy" } ] }, { "id": "informationCertification", "text": "I certify that the information I have provided is accurate and that I will abide by all the rules and requirements related to my Machines Spend Card.", "links": [] }, { "id": "solicitationAcknowledgement", "text": "I acknowledge that applying for the Machines Spend Card does not constitute unauthorized solicitation.", "links": [] } ], "accepted": true, "acceptedAt": "2026-01-16T16:22:48.186Z" }, "summary": "agreements accepted", "errors": [] } ``` ## 8. Discover and create a deposit Use the deposit flow in this order: 1. GET /deposits/assets 2. POST /deposits/range 3. POST /deposits/estimate 4. POST /deposits List assets: ```bash theme={null} curl --request GET \ --url 'https://api.machines.cash/partner/v1/deposits/assets?q=hbar&limit=20' \ --header 'Authorization: Bearer ' ``` Get range: ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/deposits/range \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{"currency":"hbar","network":"hbar"}' ``` Get estimate: ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/deposits/estimate \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{"currency":"hbar","network":"hbar","amount":25,"amountCurrency":"crypto"}' ``` Create deposit: ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/deposits \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{"currency":"hbar","network":"hbar","amount":25}' ``` Example create response fields: * `deposit.depositAddress`: send funds here. * `deposit.payinExtraId`: memo/tag to include when required by source network. ## 9. Check deposit status and balances Use GET /deposits/ to check status. Balances typically refresh within a few minutes after completion. ```bash theme={null} curl --request GET \ --url https://api.machines.cash/partner/v1/deposits/ \ --header 'Authorization: Bearer ' ``` Fetch balances with GET /balances: ```bash theme={null} curl --request GET \ --url https://api.machines.cash/partner/v1/balances \ --header 'Authorization: Bearer ' ``` ```json theme={null} { "ok": true, "data": { "balances": { "creditLimit": 3000, "pendingCharges": 0, "postedCharges": 0, "balanceDue": 0, "spendingPower": 3000 } }, "summary": "balances", "errors": [] } ``` ## Optional: Quote a withdrawal route Withdrawal flow uses: 1. GET /withdrawals/assets 2. POST /withdrawals/range 3. POST /withdrawals/estimate 4. POST /withdrawals Withdrawal routes are dynamic (BTC/SOL/EVM and others). Always query `assets`, `range`, and `estimate` before creating a withdrawal. For create requests, `source.contractId` is optional. Example estimate request: ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/withdrawals/estimate \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "destination": { "currency": "hbar", "network": "hbar", "extraId": "optional-tag" }, "amountCents": 2500 }' ``` Create responses include `relay` metadata (`payinAddress`, `payinExtraId`, `payoutAddress`, `payoutExtraId`) and `execution` fields used for onchain signing/broadcast. Execute from the same `adminAddress` you used in create, and send the tx to `execution.callTarget` (not the collateral proxy). For `coordinator_v2`, include the additional admin typed-data signature inputs. ## 10. Create a card session token For card creation, labels, and card secrets, mint a new session token with POST /sessions. Use this token for steps 11-14. ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/sessions \ --header 'Content-Type: application/json' \ --header 'X-Partner-Key: ' \ --data ' { "userId": "eeetest", "scopes": [ "crypto.read", "crypto.write", "cards.secrets.read", "cards.write", "cards.read" ], "walletAddress": "0x462B1eD1B62F4c282c0EA342BCefcF8f9919226E", "ttlSeconds": 9001 } ' ``` ```json theme={null} { "ok": true, "data": { "sessionToken": "", "sessionId": "", "userId": "eeetest", "expiresAt": "2026-01-17T16:32:47.000Z", "scopes": [ "crypto.read", "crypto.write", "cards.secrets.read", "cards.write", "cards.read" ] }, "summary": "session created", "errors": [] } ``` ## 11. Encrypt a card label (optional) If you want to display a card label to your users, encrypt it with POST /encryption/encrypt and pass it as `encryptedName` when creating the card. ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/encryption/encrypt \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "value": "Marketing Spend" } ' ``` ```json theme={null} { "ok": true, "data": { "value": { "v": 1, "iv": "Qz4f2m7Hk1P9x0ab", "ct": "Hdbb2yT2F4xWZL5m5bJX3eJb4n8wVhjPzqLw2h7i" } }, "summary": "encrypted", "errors": [] } ``` ## 12. Create a card Call POST /cards with an optional card label and limit. ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/cards \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "encryptedName": { "v": 1, "iv": "Qz4f2m7Hk1P9x0ab", "ct": "Hdbb2yT2F4xWZL5m5bJX3eJb4n8wVhjPzqLw2h7i" }, "limit": { "amountCents": 2500, "frequency": "perAuthorization" } } ' ``` ```json theme={null} { "ok": true, "data": { "cardId": "9f970d1a-fd8e-41ac-a6fd-5993417942e3", "status": "active", "brand": "VISA", "last4": "4242", "expirationMonth": 12, "expirationYear": 2029 }, "summary": "card created", "errors": [] } ``` ## 13. Create a card secrets session Call POST /cards/secrets/session. ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/cards/secrets/session \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{}' ``` ```json theme={null} { "ok": true, "data": { "sessionId": "", "secretKey": "" }, "summary": "card secrets session", "errors": [] } ``` ## 14. Fetch card secrets Call POST /cards//secrets with the session id from the previous step. This returns encrypted PAN and CVC only (not the card label). ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/cards/9f970d1a-fd8e-41ac-a6fd-5993417942e3/secrets \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "sessionId": "" } ' ``` ```json theme={null} { "ok": true, "data": { "encryptedPan": { "iv": "TTPaDqoFqscIQriDfJ/Efg==", "data": "Mo3n8fEUM0yZpaopmfQvaIPmSy8YgEZpyGLbU7vqqvM=" }, "encryptedCvc": { "iv": "QG5uolhSt7b9MseCnH7ljA==", "data": "ruOb8ZRovieujsg34n0EhGWb5w==" } }, "summary": "card secrets", "errors": [] } ``` ## 15. Decrypt PAN and CVC (server-side) Use the `secretKey` from Step 13 to decrypt the card number and CVC. This step is typically handled server-side (or by an agent) and never exposed to the browser. ```ts theme={null} import { createDecipheriv } from "crypto"; function decrypt({ iv, data }, keyHex) { const key = Buffer.from(keyHex, "hex"); const payload = Buffer.from(data, "base64"); const tag = payload.subarray(payload.length - 16); const ciphertext = payload.subarray(0, payload.length - 16); const decipher = createDecipheriv("aes-128-gcm", key, Buffer.from(iv, "base64")); decipher.setAuthTag(tag); return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf8"); } console.log("PAN:", decrypt(encryptedPan, secretKey)); console.log("CVC:", decrypt(encryptedCvc, secretKey)); ``` # Machines User Source: https://docs.machines.cash/index Use Machines with or without coding. Machines helps you spend with private virtual cards. You can use Machines in two ways: * the Machines app * your own AI assistant using our guides No. You can use the app without coding. Yes. Use Agentic Payments for the shared shopping flow, CLI for the terminal flow, MCP for generic connectors, Claude for Claude setup, Codex for Codex setup through Agent Skill, Clawdbot for Clawdbot, and Raw Knowledge File for extra context. ## Building an integration? Use Partner docs and API reference. # KYC Flow Source: https://docs.machines.cash/kyc-flow Collect and verify identity. Prerequisite: have a session token. See Authentication. ## Flow ```mermaid theme={null} sequenceDiagram participant Backend as Your Backend participant MachinesAPI as Machines API Backend->>MachinesAPI: POST /sessions (create session) Backend->>MachinesAPI: GET /kyc/values Backend->>MachinesAPI: POST /kyc/applications MachinesAPI-->>Backend: status = pending loop poll Backend->>MachinesAPI: GET /kyc/status MachinesAPI-->>Backend: status = approved | needs_information | denied end Backend->>MachinesAPI: GET /agreements Backend->>MachinesAPI: POST /agreements ``` ## Steps GET /kyc/values to see required fields and allowed values. POST /kyc/applications with the fields below. Sandbox: set lastName to approved to auto‑approve. We return a completionLink (or externalVerificationLink). Open it in a browser for document upload and face match. Users finish verification there — you don’t need to handle media. Poll GET /kyc/status until the status becomes approved (or an actionable state such as needs\_information). After approval, fetch the agreements and collect user consent. See Agreements. ## States * approved * pending * needs\_information * needs\_verification * manual\_review * denied * locked * canceled ## Fields (submit application) Given name. Family name. Sandbox shortcut: set to approved to auto-approve. YYYY-MM-DD (e.g., 1990-01-01). Government ID number (letters, numbers, dashes only). ISO-3166-1 alpha-2 country code (e.g., US). Case-insensitive. Email address. Optional phone dial code digits only (e.g., 1). Optional phone number digits only (include area code). Street address (line 1). Street address (line 2). City. State/region (e.g., CA). Postal/ZIP code. ISO-3166-1 alpha-2 country code (e.g., US). Case-insensitive. SOC occupation code (e.g., 49-3023). Full list: KYC Field Values. Choose one label (we map to the underlying range for you): * \<40k * 50k–99k * 100k–149k * 150k+ Choose one: * everyday spend * subscriptions * business expenses * testing * other Choose one label (we map to the underlying range for you): * under \$1k * $1k–$5k * $5k–$20k * \$20k+ ## Response (status) One of: approved, pending, needs\_information, needs\_verification, manual\_review, denied, locked, canceled. Identifier for the submitted application (when available). Additional context for non-approved statuses. Sandbox shortcut: set lastName to approved to auto‑approve. See KYC Field Values for allowed field values. # MCP Setup Source: https://docs.machines.cash/mcp-setup Connect any AI app to your Machines account using MCP for balances, cards, deposits, and agentic payments. MCP (Model Context Protocol) connects AI apps like Claude, ChatGPT, and Copilot to your Machines account. Once connected, your AI can check balances, manage cards, handle deposits, and place purchases directly. There is no separate setup for agentic payments. Once Machines MCP is connected, the shopping flow is available too. Using Claude? The Machines plugin for Claude is the fastest setup. Use this page for other AI apps or as a manual fallback. ## Prerequisites * A Machines account with identity verification complete * An AI app that supports remote MCP servers (Claude, ChatGPT, Copilot, Clawdbot, etc.) ## Connect with OAuth Open your AI app's settings and add a new remote MCP server (sometimes called a connector or integration). ```text theme={null} https://mcp.machines.cash/mcp ``` Click connect, sign in on the Machines page, and approve access. Ask your AI: `list my cards` ## Connect with API key Use this if your app does not support OAuth and asks for manual credentials instead. Go to your Machines dashboard, open Identity, and click Create API Key. Paste your API key where your app asks for a token, API key, or credential. Your app needs one of these headers: ```text theme={null} Authorization: Bearer ``` ```text theme={null} X-Consumer-Key: ``` ## Transport type Use **remote Streamable HTTP** as the connection type with the URL above. Do not use localhost or stdio -- this is a hosted server. ## Example prompts Once connected, try these: * "list my cards" * "show my balances" * "start a USDC deposit on Base" * "check my active deposits" * "reveal full details for my newest card" * "search apple airpods pro on amazon" * "buy these apple airpods pro on amazon using my default card" * "check the status of my latest purchase" For agentic payments, the same purchase flow works everywhere. You can start a purchase in MCP and continue it later through API or CLI with the same `actionId`. ## Troubleshooting | Problem | Fix | | ----------------------------- | -------------------------------------------------------------------- | | Connection fails | Verify you're using exactly `https://mcp.machines.cash/mcp` | | "Missing bearer token" error | Reconnect with OAuth, or add your API key manually | | Labels look raw or unfriendly | Ask for `machines.user.cards.list` or set `presentation: "end_user"` | | Card numbers refused by host | Ask the AI to use `reveal_card_details` instead | | Still not working | Remove the Machines MCP connection and add it again | ## Keep your account safe Never share API keys in chats, screenshots, or support tickets. If a key is exposed, revoke it immediately and create a new one. * Only approve access on trusted Machines pages (`machines.cash` domain) * Reveal full card details only when you explicitly need them * Do not paste keys into shared documents or public channels ## Next steps * Machines CLI -- terminal commands for login, cards, and deposits * Agentic Payments -- one shared search, buy, status, confirm, and 3DS flow * Raw Knowledge File -- paste context into your AI for better responses # Partner Source: https://docs.machines.cash/partner Integration docs for teams building with Machines partner routes. This section is for partners integrating Machines APIs. ## Start here * Quickstart * Authentication * API reference * Supported tokens and chains * Examples ## Wallet Providers * Privy * Crossmint * Openfort ## What this section covers * session auth and scoped access * KYC and agreements * cards and card secrets * balances, deposits, transactions, withdrawals * agent-oriented schemas and patterns If you are a regular user, go back to Machines User docs. # Changelog Source: https://docs.machines.cash/partner-changelog Recent partner-facing updates across the API docs, integrations, and reference guides. This is a lightweight running log of notable updates for Machines partners. ## Better integration examples and partner setup guides * Added a public [partner examples](/partners/examples) index to make starter integrations easier to discover. * Improved wallet-provider setup docs so teams can get to a working integration faster. ## Expanded wallet and reference coverage * Added and improved wallet-provider guides for [Privy](/partners/privy), [Crossmint](/partners/crossmint), and [Openfort](/partners/openfort). * Expanded supported token and chain reference coverage, including HBAR updates and cleaner navigation. * Improved partner reference pages so demos, labels, and integration links are easier to follow. ## Broader deposits and withdrawals guidance * Expanded partner deposit and withdrawal docs with clearer discovery, range, and estimate flows. * Added better endpoint coverage for deposits, withdrawals, and transaction lookups. * Clarified key withdrawal behavior and improved the quickstart and API reference flow. ## Initial partner docs launch * Launched the core partner docs for authentication, encryption, sandbox testing, cards, deposits, and withdrawals. * Added the first quickstart and OpenAPI-backed reference structure for partner integrations. # Crossmint Source: https://docs.machines.cash/partners/crossmint Integrate Machines Partner API with Crossmint embedded wallets. Check out working demo: [Live Demo](https://crossmint-machines-cards-demo.vercel.app/)\ Repo: [crossmint-machines-cards-example](https://github.com/machines-cash/crossmint-machines-cards-example) [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fmachines-cash%2Fcrossmint-machines-cards-example) This guide is for partners already using Crossmint embedded wallets. Scope: * Partner API integration (`/partner/v1`) only. * Crossmint for auth + embedded wallet UX. * Your backend holds partner credentials and calls Machines. * Simple EVM-first path for create card, deposits, and withdrawals. ## Architecture * Frontend uses Crossmint for sign-in and wallet creation. * Frontend calls your backend only. * Your backend calls Machines Partner API. * Your backend executes withdrawal transactions with the embedded wallet signer path you control. ```mermaid theme={null} sequenceDiagram participant User as User participant Frontend as Partner App (Frontend) participant Backend as Partner App (Backend) participant Crossmint as Crossmint participant Machines as Machines Partner API participant Chain as Blockchain User->>Frontend: Sign in with email Frontend->>Crossmint: Create embedded wallet Frontend->>Backend: POST /api/machines/session Backend->>Machines: POST /partner/v1/users/resolve Backend->>Machines: POST /partner/v1/sessions Backend-->>Frontend: partner session token Frontend->>Backend: KYC/cards/deposits/withdrawals requests Backend->>Machines: Partner API calls Backend->>Chain: send withdrawal tx when needed ``` ## Prerequisites * Crossmint project with: * client key for frontend * server key for backend (if you run server-side wallet operations) * embedded EVM wallet creation enabled * Machines partner API key * A backend service that can securely store: * `X-Partner-Key` * Crossmint server credentials (if used) ## Crossmint Embedded Wallet Checklist Before sending traffic: 1. Wallet creation * New users get an embedded EVM wallet at login. * You can read the wallet address after auth. 2. Stable mapping * You persist partner `userId` + Crossmint user id + wallet address. * You always send the same mapped user identity to Machines. 3. Session bootstrap server-side * `POST /partner/v1/users/resolve` and `POST /partner/v1/sessions` happen on your backend. * `X-Partner-Key` is never exposed to browser code. 4. Browser request path * Browser calls your backend routes, not Machines directly. * This avoids CORS failures and secret leakage. 5. Withdrawal execution * Use one signer path consistently. * Persist tx ids/hashes and reconcile status. ## Recommended Data to Persist Per user: * `machinesUserId` * `crossmintUserId` * `embeddedWalletAddress` * `linkedAt` / `lastUsedAt` Per session: * `sessionId` * `scopes` * `expiresAt` Per withdrawal execution: * idempotency key * execution path (`controller_v1` or `coordinator_v2`) * submitted tx id/hash * confirmed tx hash ## End-to-End Partner Flow ### 1) Set up Crossmint providers (frontend) ```tsx theme={null} "use client"; import { CrossmintProvider, CrossmintAuthProvider, CrossmintWalletProvider, } from "@crossmint/client-sdk-react-ui"; export function Providers({ children }: { children: React.ReactNode }) { return ( {children} ); } ``` ### 2) Resolve user + create partner session (backend) ```ts theme={null} import { NextRequest, NextResponse } from "next/server"; const MACHINES_BASE_URL = process.env.MACHINES_PARTNER_BASE_URL || "https://dev-api.machines.cash/partner/v1"; export async function POST(req: NextRequest) { const { externalUserId, walletAddress } = await req.json(); const resolveRes = await fetch(`${MACHINES_BASE_URL}/users/resolve`, { method: "POST", headers: { "Content-Type": "application/json", "X-Partner-Key": process.env.MACHINES_PARTNER_API_KEY!, }, body: JSON.stringify({ userId: externalUserId, wallet: { chain: "evm", address: walletAddress }, walletLabel: "Crossmint Embedded Wallet", }), }); if (!resolveRes.ok) { return NextResponse.json({ ok: false, error: "resolve_failed" }, { status: 502 }); } const sessionRes = await fetch(`${MACHINES_BASE_URL}/sessions`, { method: "POST", headers: { "Content-Type": "application/json", "X-Partner-Key": process.env.MACHINES_PARTNER_API_KEY!, }, body: JSON.stringify({ userId: externalUserId, wallet: { chain: "evm", address: walletAddress }, scopes: [ "kyc.read", "kyc.write", "agreements.read", "agreements.write", "cards.read", "cards.write", "deposits.read", "deposits.write", "withdrawals.read", "withdrawals.write", "transactions.read", ], ttlSeconds: 900, }), }); const payload = await sessionRes.json(); if (!sessionRes.ok || !payload?.ok) { return NextResponse.json({ ok: false, error: "session_failed", payload }, { status: 502 }); } return NextResponse.json({ ok: true, sessionToken: payload.data.sessionToken, sessionId: payload.data.sessionId, expiresAt: payload.data.expiresAt, }); } ``` ### 3) Call Machines through your backend proxy Use the partner session token from step 2. At minimum, support these routes: * `GET /partner/v1/kyc/values` * `POST /partner/v1/kyc/applications` * `GET /partner/v1/kyc/status` * `GET /partner/v1/agreements` * `POST /partner/v1/agreements` * `GET /partner/v1/cards` * `POST /partner/v1/cards` * `GET /partner/v1/deposits/assets` * `POST /partner/v1/deposits/range` * `POST /partner/v1/deposits/estimate` * `POST /partner/v1/deposits` * `GET /partner/v1/transactions` ### 4) Create withdrawals Call sequence: 1. `GET /partner/v1/withdrawals/assets` 2. `POST /partner/v1/withdrawals/range` 3. `POST /partner/v1/withdrawals/estimate` 4. `POST /partner/v1/withdrawals` Create request example: ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/withdrawals \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ' \ --header 'Idempotency-Key: wdrl-001' \ --data '{ "amountCents": 2500, "source": { "contractId": "optional-uuid" }, "destination": { "currency": "hbar", "network": "hbar", "address": "0.0.123456", "extraId": "optional-tag" }, "adminAddress": "0xabc..." }' ``` ### 5) Execute withdrawal transaction Use response fields: * `execution.callTarget` * `execution.callPath` * `parameters` Rules: * send tx to `execution.callTarget` * sender must match `adminAddress` used in create request * if status is `pending`, retry create with the same idempotency key ## Execution Model and Contract Call Paths Machines withdrawal create response includes: * `execution.callTarget` * `execution.callPath` (`controller_v1` or `coordinator_v2`) * `parameters` (7-arg withdrawal payload) Contract paths: * `controller_v1`: call 7-arg `withdrawAsset(...)` * `coordinator_v2`: build admin typed-data signature, then call 10-arg `withdrawAsset(...)` ## Common Integration Pitfalls * Calling Machines directly from browser code. * Use your backend proxy for all partner calls. * Creating sessions without wallet context. * Always pass wallet data when resolving users/sessions. * Not reusing idempotency keys on pending withdrawals. * Retry with the same `Idempotency-Key`. * Executing on the wrong target contract. * Always use `execution.callTarget` from response. ## Further Reading * Crossmint auth quickstart: * [https://docs.crossmint.com/authentication/quickstart](https://docs.crossmint.com/authentication/quickstart) * Crossmint wallets React quickstart: * [https://docs.crossmint.com/wallets/quickstarts/react](https://docs.crossmint.com/wallets/quickstarts/react) * Crossmint wallets overview: * [https://docs.crossmint.com/wallets/overview](https://docs.crossmint.com/wallets/overview) * Machines partner docs: * [https://docs.machines.cash/partners/](https://docs.machines.cash/partners/) # Examples Source: https://docs.machines.cash/partners/examples Public starter repos for Machines partner and agent integrations. Use these examples to get from zero to first successful card flow quickly. ## Generate a starter ```bash theme={null} npm create machines-agent@latest ``` This creates a host-ready starter with: * prewired MCP endpoint config * an example `create disposable card and pay` flow * `machines.policy.json` policy template ## Core agent starters | Starter | Best for | Code | Live preview | | ------------------ | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | | OpenAI Responses | OpenAI Responses SDK projects | [machines-agent-openai-responses-example](https://github.com/machines-cash/machines-agent-openai-responses-example) | [Open](https://skill-deploy-fz3jo069tl-codex-agent-deploys.vercel.app) | | Anthropic Messages | Anthropic Messages API projects | [machines-agent-anthropic-messages-example](https://github.com/machines-cash/machines-agent-anthropic-messages-example) | [Open](https://skill-deploy-704wkg5dyx-codex-agent-deploys.vercel.app) | | LangChain | LangChain orchestration projects | [machines-agent-langchain-example](https://github.com/machines-cash/machines-agent-langchain-example) | [Open](https://skill-deploy-q0xc8sy7f7-codex-agent-deploys.vercel.app) | | Plain Node | Minimal Node.js implementation | [machines-agent-plain-node-example](https://github.com/machines-cash/machines-agent-plain-node-example) | [Open](https://skill-deploy-wgkxac4uzs-codex-agent-deploys.vercel.app) | ## Wallet provider examples | Provider | What it shows | Code | Live preview | | --------- | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | | Crossmint | Embedded wallet + Machines partner session flow | [crossmint-machines-agent-example](https://github.com/machines-cash/crossmint-machines-agent-example) | [Open](https://skill-deploy-4w3e4pef4m-codex-agent-deploys.vercel.app) | | Privy | Embedded wallet + Machines partner session flow | [privy-machines-agent-example](https://github.com/machines-cash/privy-machines-agent-example) | [Open](https://skill-deploy-ygi9miys28-codex-agent-deploys.vercel.app) | | Openfort | Embedded wallet + Machines partner session flow | [openfort-machines-agent-example](https://github.com/machines-cash/openfort-machines-agent-example) | [Open](https://skill-deploy-v3ddmcm6y7-codex-agent-deploys.vercel.app) | If you are integrating wallets for end users first, start with one provider example and keep your backend as the only caller to `partner/v1`. # Partner LLM Context Source: https://docs.machines.cash/partners/llms Partner-specific LLM context file for agent usage. `````text theme={null} # Machines Cash Docs — agents.llm > Single-file bundle for coding agents. Contains repo instructions, navigation, and full content of all docs pages and key specs. Last updated: 2026-02-22 ## How to use this file - Use this file as the primary context when coding agents interact with this repo or API. - Keep changes minimal and scoped; update this file whenever source docs change. - Preserve formatting and code fences inside embedded files; do not rewrite examples unless asked. ## Agent instructions ### Project structure - Documentation lives in root-level *.mdx files. - docs.json controls navigation, theme, and top-level site config. - openapi.yaml is the canonical API reference (OpenAPI 3.x). - password-gate.js is a client-side password gate (deterrent only). - Static assets live in the repo root (e.g., *.svg, favicon.ico). ### Commands - No build, dev, or test commands are defined for this repo. ### Editing rules - Keep frontmatter at the top of each MDX file (title, description). - Match existing tone: short, direct sentences; avoid marketing fluff. - Use fenced code blocks with a language tag (bash, json, ts, etc.). - When adding a new page, add the file in the repo root and update docs.json navigation. - Avoid changing openapi.yaml unless the API contract changed. ### Do / Don't Do: - Keep diffs small and scoped to the requested change. - Preserve existing examples unless explicitly asked to update them. - Update docs.json navigation when adding or removing pages. Don't: - Don't add new dependencies or tooling without an explicit request. - Don't remove pages or reorder navigation without direction. ### Architecture notes - This is a static docs site: MDX pages + docs.json + openapi.yaml. - API reference pages are generated from openapi.yaml. ### Verification - Manually review MDX/JSON/YAML formatting; there is no automated build or test runner. ### Agentic API notes (from the docs) - Base URLs: https://api.machines.cash/partner/v1 (prod) and https://dev-api.machines.cash/partner/v1 (sandbox). - Use X-Partner-Key for session creation and user resolve; use Authorization: Bearer after that. - Use Idempotency-Key on card creation and other idempotent writes. - Use propose -> execute for sensitive actions. - Return small, structured results with a summary for LLM chaining. - Prefer cursor pagination and search + get-by-id pairs. - Implement bounded retries on network timeouts. - For tool JSON Schemas, see agent-tool-schemas.mdx; keep additionalProperties: false and explicit required. ### Partner deposit + withdrawal endpoint index (current) Deposits: - GET /partner/v1/deposits/assets - POST /partner/v1/deposits/range - POST /partner/v1/deposits/estimate - POST /partner/v1/deposits - GET /partner/v1/deposits - GET /partner/v1/deposits/{depositId} Withdrawals: - GET /partner/v1/withdrawals/assets - POST /partner/v1/withdrawals/range - POST /partner/v1/withdrawals/estimate - POST /partner/v1/withdrawals ### Canonical partner flows Deposit flow: 1) assets -> 2) range -> 3) estimate -> 4) create -> 5) status poll Deposit estimate request example: { "currency": "hbar", "network": "hbar", "amount": 25, "amountCurrency": "crypto" } Deposit create responses include: - deposit.depositAddress - deposit.payinExtraId (memo/tag when required) Withdrawal flow: 1) assets -> 2) range -> 3) estimate -> 4) create -> 5) execute onchain Important: destination and route coverage are dynamic. Always query `assets`, `range`, and `estimate` before creating withdrawals. `source.contractId` in withdrawal create is optional. Withdrawal estimate request example: { "destination": { "currency": "hbar", "network": "hbar", "extraId": "optional-tag" }, "amountCents": 2500 } Withdrawal create request body (breaking schema): { "amountCents": 2500, "source": { "contractId": "optional-uuid" }, "destination": { "currency": "hbar", "network": "hbar", "address": "0.0.123456", "extraId": "optional-tag" }, "adminAddress": "0x..." } Withdrawal create responses include relay metadata: - relay.changeNowId - relay.payinAddress - relay.payinExtraId - relay.payoutAddress - relay.payoutExtraId - relay.fromCurrency / relay.fromNetwork - relay.toCurrency / relay.toNetwork ### Privy integration notes - Partners using Privy embedded wallets should execute withdrawals server-side with `execution.callTarget` from `POST /partner/v1/withdrawals`. - Support both call paths: `controller_v1` (7 args) and `coordinator_v2` (10 args + admin typed data signature). - Required wallet methods: `eth_sendTransaction`; add `eth_signTypedData_v4` for `coordinator_v2`. - Use idempotency keys for withdrawal create retries and embedded tx submission retries. - Use sponsored transactions for embedded wallets where available in your Privy config. ### Safety and data handling - Never expose X-Partner-Key, session tokens, or decrypted PAN/CVC in client code or logs. - Card secrets are encrypted; decrypt only in trusted server-side contexts. ## Page index (docs.json navigation order) - index.mdx: Machines Cash API - getting-started.mdx: Quickstart — End-to-end flow for KYC, deposits, and cards. - authentication.mdx: Authentication — Use your API key to mint short‑lived session tokens. Keep it simple and secure. - encryption.mdx: Encryption — Encrypt card labels using server‑side helpers. - sandbox-testing.mdx: Sandbox Testing — Use the sandbox environment to validate KYC, cards, and deposits before production. - partners/privy.mdx: Privy Embedded Wallet Integration — Integrate Machines Partner API with Privy embedded wallets for server-managed signing. - kyc-flow.mdx: KYC Flow — Collect and verify identity. - agreements.mdx: Agreements — Display required user agreements after KYC approval. - cards.mdx: Cards — Create, lock/unlock, delete, and retrieve encrypted card secrets. - balances.mdx: Balances — Fetch spending power and charge totals. - deposits.mdx: Deposits — Discovery, range, estimate, and create flow for partner deposits. - withdrawals.mdx: Withdrawals — Source-specific discovery/range/estimate plus relay-backed create and execution. - agentic-payments.mdx: Agentic Payments — Browse products and place purchases from API, CLI, or MCP using one simple action model. - agent-tool-schemas.mdx: Agent Tool Schemas — Copy-paste JSON Schemas for tools to call the API. - best-practices-agents.mdx: Agent Best Practices — Guardrails and patterns that keep agent calls safe and reliable. - errors.mdx: Errors & Retries — Deterministic error codes and retry guidance for agents and services. - kyc-values.mdx: KYC Field Values — Expected values for occupation, salary, account purpose, and monthly volume. ## Additional MDX pages (not in docs.json navigation) - billing.mdx: Billing — Per-card pricing by default; additional billable events optional. - disposable-cards.mdx: Disposable Cards — Disposable proposal and execute flow. - webhooks.mdx: Webhooks — Subscribe to card + transaction + KYC updates with HMAC signatures. ## Pages (full content) ### In navigation order #### File: index.mdx ````mdx --- title: "Machines Cash API" description: "" --- Machines Cash issues scoped virtual Visa cards backed by onchain collateral, enabling private spending through a unified API. Developers who want to embed KYC, card issuance, and withdrawals without touching issuer credentials. ```` #### File: getting-started.mdx ````mdx --- title: "Quickstart" description: "End-to-end flow for KYC, deposits, and cards." --- Base URLs: - Production: `https://api.machines.cash/partner/v1` - Sandbox: `https://dev-api.machines.cash/partner/v1` Get API access: email `help@machines.cash` or DM `@erturkarda` on Telegram. All requests are JSON. Use `X-Partner-Key` for steps 1-2. Use `Authorization: Bearer ` for the rest. ## 1. Create a session token Call POST /sessions. ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/sessions \ --header 'Content-Type: application/json' \ --header 'X-Partner-Key: ' \ --data ' { "userId": "eeetest", "scopes": [ "kyc.read", "kyc.write" ], "walletAddress": "0x462B1eD1B62F4c282c0EA342BCefcF8f9919226E", "ttlSeconds": 9001 } ' ``` ```json { "ok": true, "data": { "sessionToken": "", "sessionId": "", "userId": "eeetest", "expiresAt": "2026-01-16T16:47:52.000Z", "scopes": [ "kyc.read", "kyc.write" ] }, "summary": "session created", "errors": [] } ``` Use this session token for steps 3-9. ## 2. Create or link the user Call POST /users/resolve. ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/users/resolve \ --header 'Content-Type: application/json' \ --header 'X-Partner-Key: ' \ --data ' { "userId": "eeetest", "walletAddress": "0x462B1eD1B62F4c282c0EA342BCefcF8f9919226E", "walletLabel": "Main Wallet" } ' ``` ```json { "ok": true, "data": { "userId": "eeetest", "walletAddress": "0x462b1ed1b62f4c282c0ea342bcefcf8f9919226e", "kycStatus": "not_submitted", "createdAt": "2026-01-16T14:17:51.298Z" }, "summary": "user linked; kyc not started", "errors": [] } ``` ## 3. Get KYC field requirements and values Call GET /kyc/values to build your KYC form. The full occupation list is also available at /kyc-values. ```bash curl --request GET \ --url https://api.machines.cash/partner/v1/kyc/values \ --header 'Authorization: Bearer ' ``` ```json { "ok": true, "data": { "fields": [ { "name": "firstName", "required": true, "type": "string", "maxLength": 50, "description": "Given name." }, { "name": "lastName", "required": true, "type": "string", "maxLength": 50, "description": "Family name." }, { "name": "birthDate", "required": true, "type": "date", "description": "YYYY-MM-DD (e.g., 1990-01-01)." }, { "name": "nationalId", "required": true, "type": "string", "regex": "^[0-9A-Za-z-]+$", "description": "Government ID number. Letters, numbers, and dashes only." }, { "name": "countryOfIssue", "required": true, "type": "string", "minLength": 2, "maxLength": 2, "description": "ISO-3166-1 alpha-2 (e.g., US)." }, { "name": "email", "required": true, "type": "string", "description": "Valid email address." }, { "name": "address", "required": true, "type": "object", "description": "Object with line1, line2, city, region, postalCode, countryCode." }, { "name": "phoneCountryCode", "required": false, "type": "string", "maxLength": 3, "description": "Country calling code digits only (e.g., 1)." }, { "name": "phoneNumber", "required": false, "type": "string", "maxLength": 15, "description": "Phone number digits only; include area code." }, { "name": "occupation", "required": true, "type": "string", "description": "SOC occupation code (e.g., 49-3023). Use /kyc/values for the list." }, { "name": "annualSalary", "required": true, "type": "string", "enum": [ "<40k", "50k–99k", "100k–149k", "150k+" ], "description": "Choose a salary range." }, { "name": "accountPurpose", "required": true, "type": "string", "enum": [ "everyday spend", "subscriptions", "business expenses", "testing", "other" ], "description": "How the account will be used." }, { "name": "expectedMonthlyVolume", "required": true, "type": "string", "enum": [ "under $1k", "$1k–$5k", "$5k–$20k", "$20k+" ], "description": "Choose a monthly volume range." } ], "occupations": [ { "code": "11-1021", "label": "General and Operations Managers" }, { "code": "11-2011", "label": "Advertising and Promotions Managers" }, { "code": "11-3031", "label": "Financial Managers" }, { "code": "11-9021", "label": "Construction Managers" }, { "code": "11-9041", "label": "Architectural and Engineering Managers" }, { "code": "11-9071", "label": "Gaming Managers" }, { "code": "11-9141", "label": "Property, Real Estate, and Community Association Managers" }, { "code": "13-1041", "label": "Compliance Officers" }, { "code": "13-2011", "label": "Accountants and Auditors" }, { "code": "13-2051", "label": "Financial Analysts" }, { "code": "13-2052", "label": "Personal Financial Advisors" }, { "code": "13-2082", "label": "Tax Preparers" }, { "code": "15-1121", "label": "Computer Systems Analysts" }, { "code": "15-1131", "label": "Computer Programmers" }, { "code": "15-1132", "label": "Software Developers, Applications" }, { "code": "15-1133", "label": "Software Developers, Systems Software" }, { "code": "15-1141", "label": "Database Administrators" }, { "code": "15-1142", "label": "Information Security Analysts" }, { "code": "15-1143", "label": "Computer Network Architects" }, { "code": "15-1151", "label": "Computer User Support Specialists" }, { "code": "17-2051", "label": "Civil Engineers" }, { "code": "17-2071", "label": "Electrical Engineers" }, { "code": "17-2141", "label": "Mechanical Engineers" }, { "code": "19-3011", "label": "Economists" }, { "code": "23-1011", "label": "Lawyers" }, { "code": "23-2011", "label": "Paralegals and Legal Assistants" }, { "code": "25-2021", "label": "Elementary School Teachers" }, { "code": "27-1024", "label": "Graphic Designers" }, { "code": "27-2012", "label": "Producers and Directors" }, { "code": "29-1141", "label": "Registered Nurses" }, { "code": "29-1062", "label": "Family and General Practitioners" }, { "code": "29-1067", "label": "Surgeons" }, { "code": "31-9097", "label": "Phlebotomists" }, { "code": "33-3021", "label": "Detectives and Criminal Investigators" }, { "code": "35-1011", "label": "Chefs and Head Cooks" }, { "code": "41-9011", "label": "Demonstrators and Product Promoters" }, { "code": "41-9021", "label": "Real Estate Brokers" }, { "code": "43-3071", "label": "Tellers" }, { "code": "47-1011", "label": "Construction Supervisors" }, { "code": "47-2061", "label": "Construction Laborers" }, { "code": "49-3023", "label": "Automotive Service Technicians and Mechanics" }, { "code": "51-4121", "label": "Welders, Cutters, Solderers, and Brazers" }, { "code": "53-3032", "label": "Heavy and Tractor-Trailer Truck Drivers" }, { "code": "53-3041", "label": "Taxi Drivers and Chauffeurs" }, { "code": "SELFEMP", "label": "Self-Employed" }, { "code": "UNEMPLO", "label": "Unemployed" }, { "code": "RETIRED", "label": "Retired" }, { "code": "OTHERXX", "label": "Other" } ], "annualSalary": ["<40k", "50k–99k", "100k–149k", "150k+"], "expectedMonthlyVolume": ["under $1k", "$1k–$5k", "$5k–$20k", "$20k+"], "accountPurpose": ["everyday spend", "subscriptions", "business expenses", "testing", "other"] }, "summary": "kyc values", "errors": [] } ``` ## 4. Submit KYC Call POST /kyc/applications. ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/kyc/applications \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "firstName": "John", "lastName": "smith", "birthDate": "1990-01-01", "nationalId": "123456789", "countryOfIssue": "US", "email": "jsmith@example.com", "address": { "line1": "123 Main St", "city": "New York", "region": "NY", "postalCode": "10001", "countryCode": "US", "line2": "Unit 4" }, "occupation": "49-3023", "annualSalary": "<40k", "accountPurpose": "everyday spend", "expectedMonthlyVolume": "under $1k", "phoneCountryCode": "1", "phoneNumber": "4155551234" } ' ``` ```json { "ok": true, "data": { "status": "needs_verification", "reason": "", "completionLink": { "url": "https://kyc.machines.cash/verify", "params": { "userId": "18717ac1-c375-4ff6-972d-79dd702b7d44", "signature": "" } }, "externalVerificationLink": { "url": "https://kyc.machines.cash/verify", "params": { "userId": "18717ac1-c375-4ff6-972d-79dd702b7d44", "signature": "" } }, "isActive": true, "isTermsOfServiceAccepted": false }, "summary": "kyc submitted", "errors": [] } ``` ## 5. Complete verification Open the `completionLink` (or `externalVerificationLink`) in a new window so the user can finish verification. ## 6. Poll KYC status Call GET /kyc/status until the status is `approved`. Status meanings are listed in KYC status reference. ```bash curl --request GET \ --url https://api.machines.cash/partner/v1/kyc/status \ --header 'Authorization: Bearer ' ``` ```json { "ok": true, "data": { "status": "approved", "reason": "", "completionLink": null, "externalVerificationLink": null, "isActive": null, "isTermsOfServiceAccepted": false }, "summary": "kyc status", "errors": [] } ``` ## 7. Show agreements and collect consent Call GET /agreements to fetch agreement text, then POST /agreements to accept. ```bash curl --request GET \ --url https://api.machines.cash/partner/v1/agreements \ --header 'Authorization: Bearer ' ``` ```json { "ok": true, "data": { "agreements": [ { "id": "esignConsent", "text": "I accept the E-Sign Consent", "links": [ { "label": "E-Sign Consent", "url": "https://machines.cash/e-sign" } ] }, { "id": "accountOpeningPrivacyNotice", "text": "I accept the Account Opening Privacy Notice", "links": [ { "label": "Account Opening Privacy Notice", "url": "https://machines.cash/account-opening-privacy" } ] }, { "id": "cardTermsAndIssuerPrivacyPolicy", "text": "I accept the Machines Card Terms and the Issuer Privacy Policy", "links": [ { "label": "Machines Card Terms", "url": "https://machines.cash/machines-card-terms" }, { "label": "Issuer Privacy Policy", "url": "https://www.third-national.com/privacypolicy" } ] }, { "id": "informationCertification", "text": "I certify that the information I have provided is accurate and that I will abide by all the rules and requirements related to my Machines Spend Card.", "links": [] }, { "id": "solicitationAcknowledgement", "text": "I acknowledge that applying for the Machines Spend Card does not constitute unauthorized solicitation.", "links": [] } ], "accepted": false, "acceptedAt": null }, "summary": "agreements", "errors": [] } ``` ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/agreements \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "accepted": true } ' ``` ```json { "ok": true, "data": { "agreements": [ { "id": "esignConsent", "text": "I accept the E-Sign Consent", "links": [ { "label": "E-Sign Consent", "url": "https://machines.cash/e-sign" } ] }, { "id": "accountOpeningPrivacyNotice", "text": "I accept the Account Opening Privacy Notice", "links": [ { "label": "Account Opening Privacy Notice", "url": "https://machines.cash/account-opening-privacy" } ] }, { "id": "cardTermsAndIssuerPrivacyPolicy", "text": "I accept the Machines Card Terms and the Issuer Privacy Policy", "links": [ { "label": "Machines Card Terms", "url": "https://machines.cash/machines-card-terms" }, { "label": "Issuer Privacy Policy", "url": "https://www.third-national.com/privacypolicy" } ] }, { "id": "informationCertification", "text": "I certify that the information I have provided is accurate and that I will abide by all the rules and requirements related to my Machines Spend Card.", "links": [] }, { "id": "solicitationAcknowledgement", "text": "I acknowledge that applying for the Machines Spend Card does not constitute unauthorized solicitation.", "links": [] } ], "accepted": true, "acceptedAt": "2026-01-16T16:22:48.186Z" }, "summary": "agreements accepted", "errors": [] } ``` ## 8. Discover and create a deposit Use the deposit flow in this order: 1. GET /deposits/assets 2. POST /deposits/range 3. POST /deposits/estimate 4. POST /deposits List assets: ```bash curl --request GET \ --url 'https://api.machines.cash/partner/v1/deposits/assets?q=hbar&limit=20' \ --header 'Authorization: Bearer ' ``` Get range: ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/deposits/range \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{"currency":"hbar","network":"hbar"}' ``` Get estimate: ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/deposits/estimate \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{"currency":"hbar","network":"hbar","amount":25,"amountCurrency":"crypto"}' ``` Create deposit: ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/deposits \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{"currency":"hbar","network":"hbar","amount":25}' ``` Example create response fields: - `deposit.depositAddress`: send funds here. - `deposit.payinExtraId`: memo/tag to include when required by source network. ## 9. Check deposit status and balances Use GET /deposits/{depositId} to check status. Balances typically refresh within a few minutes after completion. ```bash curl --request GET \ --url https://api.machines.cash/partner/v1/deposits/ \ --header 'Authorization: Bearer ' ``` Fetch balances with GET /balances: ```bash curl --request GET \ --url https://api.machines.cash/partner/v1/balances \ --header 'Authorization: Bearer ' ``` ```json { "ok": true, "data": { "balances": { "creditLimit": 3000, "pendingCharges": 0, "postedCharges": 0, "balanceDue": 0, "spendingPower": 3000 } }, "summary": "balances", "errors": [] } ``` ## Optional: Quote a withdrawal route Withdrawal flow uses: 1. GET /withdrawals/assets 2. POST /withdrawals/range 3. POST /withdrawals/estimate 4. POST /withdrawals Withdrawal routes are dynamic (BTC/SOL/EVM and others). Always query `assets`, `range`, and `estimate` before creating a withdrawal. For create requests, `source.contractId` is optional. Example estimate request: ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/withdrawals/estimate \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "destination": { "currency": "hbar", "network": "hbar", "extraId": "optional-tag" }, "amountCents": 2500 }' ``` Create responses include `relay` metadata (`payinAddress`, `payinExtraId`, `payoutAddress`, `payoutExtraId`) and `execution` fields used for onchain signing/broadcast. Execute from the same `adminAddress` you used in create, and send the tx to `execution.callTarget` (not the collateral proxy). For `coordinator_v2`, include the additional admin typed-data signature inputs. ## 10. Create a card session token For card creation, labels, and card secrets, mint a new session token with POST /sessions. Use this token for steps 11-14. ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/sessions \ --header 'Content-Type: application/json' \ --header 'X-Partner-Key: ' \ --data ' { "userId": "eeetest", "scopes": [ "crypto.read", "crypto.write", "cards.secrets.read", "cards.write", "cards.read" ], "walletAddress": "0x462B1eD1B62F4c282c0EA342BCefcF8f9919226E", "ttlSeconds": 9001 } ' ``` ```json { "ok": true, "data": { "sessionToken": "", "sessionId": "", "userId": "eeetest", "expiresAt": "2026-01-17T16:32:47.000Z", "scopes": [ "crypto.read", "crypto.write", "cards.secrets.read", "cards.write", "cards.read" ] }, "summary": "session created", "errors": [] } ``` ## 11. Encrypt a card label (optional) If you want to display a card label to your users, encrypt it with POST /encryption/encrypt and pass it as `encryptedName` when creating the card. ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/encryption/encrypt \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "value": "Marketing Spend" } ' ``` ```json { "ok": true, "data": { "value": { "v": 1, "iv": "Qz4f2m7Hk1P9x0ab", "ct": "Hdbb2yT2F4xWZL5m5bJX3eJb4n8wVhjPzqLw2h7i" } }, "summary": "encrypted", "errors": [] } ``` ## 12. Create a card Call POST /cards with an optional card label and limit. ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/cards \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "encryptedName": { "v": 1, "iv": "Qz4f2m7Hk1P9x0ab", "ct": "Hdbb2yT2F4xWZL5m5bJX3eJb4n8wVhjPzqLw2h7i" }, "limit": { "amountCents": 2500, "frequency": "perAuthorization" } } ' ``` ```json { "ok": true, "data": { "cardId": "9f970d1a-fd8e-41ac-a6fd-5993417942e3", "status": "active", "brand": "VISA", "last4": "4242", "expirationMonth": 12, "expirationYear": 2029 }, "summary": "card created", "errors": [] } ``` ## 13. Create a card secrets session Call POST /cards/secrets/session. ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/cards/secrets/session \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{}' ``` ```json { "ok": true, "data": { "sessionId": "", "secretKey": "" }, "summary": "card secrets session", "errors": [] } ``` ## 14. Fetch card secrets Call POST /cards/{cardId}/secrets with the session id from the previous step. This returns encrypted PAN and CVC only (not the card label). ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/cards/9f970d1a-fd8e-41ac-a6fd-5993417942e3/secrets \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "sessionId": "" } ' ``` ```json { "ok": true, "data": { "encryptedPan": { "iv": "TTPaDqoFqscIQriDfJ/Efg==", "data": "Mo3n8fEUM0yZpaopmfQvaIPmSy8YgEZpyGLbU7vqqvM=" }, "encryptedCvc": { "iv": "QG5uolhSt7b9MseCnH7ljA==", "data": "ruOb8ZRovieujsg34n0EhGWb5w==" } }, "summary": "card secrets", "errors": [] } ``` ## 15. Decrypt PAN and CVC (server-side) Use the `secretKey` from Step 13 to decrypt the card number and CVC. This step is typically handled server-side (or by an agent) and never exposed to the browser. ```ts import { createDecipheriv } from "crypto"; function decrypt({ iv, data }, keyHex) { const key = Buffer.from(keyHex, "hex"); const payload = Buffer.from(data, "base64"); const tag = payload.subarray(payload.length - 16); const ciphertext = payload.subarray(0, payload.length - 16); const decipher = createDecipheriv("aes-128-gcm", key, Buffer.from(iv, "base64")); decipher.setAuthTag(tag); return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf8"); } console.log("PAN:", decrypt(encryptedPan, secretKey)); console.log("CVC:", decrypt(encryptedCvc, secretKey)); ``` ```` #### File: authentication.mdx ````mdx --- title: "Authentication" description: "Use your API key to mint short‑lived session tokens. Keep it simple and secure." --- ## Two credentials - API key: send with X-Partner-Key for server‑to‑server calls (mint sessions). Never expose it to clients. - Session token: short‑lived JWT for protected endpoints. Send with Authorization: Bearer <token>. ## Flow ```mermaid sequenceDiagram participant Backend as Your Backend participant MachinesAPI as Machines API participant Agent as Agent/Service Backend->>MachinesAPI: POST /users/resolve (X-Partner-Key) Backend->>MachinesAPI: POST /sessions (X-Partner-Key + scopes) MachinesAPI-->>Backend: { sessionToken, scopes, expiresAt } Backend->>Agent: Deliver sessionToken (scoped JWT) Agent->>MachinesAPI: call protected endpoints (Bearer sessionToken) MachinesAPI-->>Agent: structured JSON responses ``` ## API flows (step‑by‑step) Endpoint: POST /sessions
Body:
  • userId (string, your user id)
  • walletAddress (0x… address, optional)
  • scopes (array of strings)
  • ttlSeconds (integer, optional)
Response:
  • sessionToken (use as Authorization: Bearer <token>)
  • sessionId, userId, expiresAt, scopes
```bash curl -s \ -d '{"userId":"demo-123","walletAddress":"0xabc...","scopes":["cards.read","cards.write"]}' \ https://dev-api.machines.cash/partner/v1/sessions ``` ```json { "ok": true, "data": { "sessionToken": "", "sessionId": "...", "userId": "...", "expiresAt": "2026-01-01T00:00:00.000Z", "scopes": ["cards.read","cards.write"] }, "summary": "session created", "errors": [] } ```
Send Authorization: Bearer <token> on protected endpoints. ```bash curl -s \ -H 'Authorization: Bearer ' \ https://dev-api.machines.cash/partner/v1/cards ``` Missing/expired tokens return 401; missing permissions return 403. Tokens are short‑lived. Mint a new session when you get 401 Unauthorized. Keep scopes minimal. Common sets:
  • KYC: kyc.read, kyc.write
  • Cards: cards.read, cards.write
  • Card secrets: cards.secrets.read
  • Card labels: encryption.write (encrypt), encryption.read (decrypt)
  • Balances: no extra scopes
  • Withdrawals: withdrawals.write
Missing a scope returns 403 Forbidden. ## All available scopes Deposits and balances do not require extra scopes. ```text users.read users.write kyc.read kyc.write cards.read cards.write cards.secrets.read encryption.read encryption.write deposits.read deposits.write withdrawals.write ``` ## Headers quick reference ```text # Mint sessions (server-to-server) X-Partner-Key: # Call protected endpoints Authorization: Bearer Content-Type: application/json # Optional Open Responses output X-Open-Responses: 1 X-Open-Responses-Call-Id: ``` ## Token basics - Short‑lived by default (e.g., ~15 minutes). Rotate by minting a new session. - Session payload includes account id, user id, wallet address, scopes, expiry. - Never log tokens or card data; always use HTTPS. Use https://dev-api.machines.cash in sandbox. Switch to production only after key validation. ```` #### File: encryption.mdx ````mdx --- title: "Encryption" description: "Encrypt card labels using server‑side helpers." --- Machines cares about privacy—and this extends to API partners. We use end‑to‑end encryption for card UI metadata so only your users can read it. Use our helper endpoints so you don’t have to implement cryptography yourself. What’s encrypted for cards: - Card label (name) → encryptedName - Color → encryptedColor - Emoji → encryptedEmoji - Memo/notes → encryptedMemo Card secrets (PAN/CVC) are different. Use POST /cards/secrets/session + POST /cards/{"{cardId}"}/secrets. See Cards → Secrets. Prerequisite: have a session token. See Authentication. ## API flows (step‑by‑step) Endpoint: POST /encryption/encrypt
Body: JSON with a value string (e.g., "Ops Card").
Response: returns an object with value (EncryptedField) ```bash curl -s \ -d '{"value":"Ops Card"}' \ https://dev-api.machines.cash/partner/v1/encryption/encrypt ```
Endpoint: POST /encryption/decrypt
Body: JSON with a value EncryptedField. Response: plaintext card label in value ```bash curl -s \ -d '{"value":{"v":1,"iv":"Qz4f2m7Hk1P9x0ab","ct":"Hdbb2yT2F4xWZL5m5bJX3eJb4n8wVhjPzqLw2h7i"}}' \ https://dev-api.machines.cash/partner/v1/encryption/decrypt ```
## Fields Plaintext to encrypt. For decryption, pass the encrypted object returned by /encryption/encrypt. ## Response (encrypt) Schema version. Base64url IV. Base64url ciphertext + auth tag. ## Card labels are optional - You can omit encryptedName when creating a card and set it later with PATCH /cards/{"{cardId}"}. - When you do set a card label, always use /encryption/encrypt and /encryption/decrypt (no manual cryptography needed). ## Default flow (server-side) ```mermaid sequenceDiagram participant Backend as Backend participant MachinesAPI as Machines API Backend->>MachinesAPI: POST /encryption/encrypt { value } MachinesAPI-->>Backend: { value: encryptedField } Backend->>MachinesAPI: POST /cards { encryptedName } ``` ## Example (server-side) ```ts const labelRes = await fetch("https://dev-api.machines.cash/partner/v1/encryption/encrypt", { method: "POST", headers: { Authorization: `Bearer ${sessionToken}`, "Content-Type": "application/json" }, body: JSON.stringify({ value: "Ops Card" }), }); const { data: encrypted } = await labelRes.json(); await fetch("https://dev-api.machines.cash/partner/v1/cards", { method: "POST", headers: { Authorization: `Bearer ${sessionToken}`, "Content-Type": "application/json" }, body: JSON.stringify({ encryptedName: encrypted.value }), }); ``` ## Display card labels in your frontend (recommended) 1) List cards: GET /cards 2) Decrypt each encryptedName with POST /encryption/decrypt 3) Send plaintext labels to your frontend ```ts const cardsRes = await fetch("https://dev-api.machines.cash/partner/v1/cards", { headers: { Authorization: `Bearer ${sessionToken}` }, }); const { data: cardsData } = await cardsRes.json(); const labels = await Promise.all( cardsData.cards.map(async (card: { encryptedName: unknown; cardId: string }) => { const decryptRes = await fetch("https://dev-api.machines.cash/partner/v1/encryption/decrypt", { method: "POST", headers: { Authorization: `Bearer ${sessionToken}`, "Content-Type": "application/json" }, body: JSON.stringify({ value: card.encryptedName }), }); const { data } = await decryptRes.json(); return { cardId: card.cardId, label: data.value }; }), ); ``` Use /encryption/decrypt only for card labels and metadata. Card secrets (PAN/CVC) use /cards/secrets/session + /cards/{"{cardId}"}/secrets. ## Advanced (client-side, optional) If you need client-side encryption, fetch a per-user data key via GET /encryption/data-key (requires encryption.read) and encrypt locally using AES-256-GCM. ### Encrypted field shape ``` { "v": 1, "iv": "", "ct": "" } ``` - Canonical order is v, iv, ct (order doesn’t matter in JSON). - v: schema version (currently 1) - iv: 12-byte IV, base64url encoded - ct: ciphertext + auth tag, base64url encoded ### Example (Node.js) ```ts import { createCipheriv, randomBytes } from "node:crypto"; function base64Url(buf: Buffer) { return buf.toString("base64").replace(/\\+/g, "-").replace(/\\//g, "_").replace(/=+$/g, ""); } export function encryptField(plaintext: string, dataKeyBase64Url: string) { const key = Buffer.from(dataKeyBase64Url, "base64url"); const iv = randomBytes(12); const cipher = createCipheriv("aes-256-gcm", key, iv); const ciphertext = Buffer.concat([cipher.update(plaintext, "utf8"), cipher.final()]); const tag = cipher.getAuthTag(); const combined = Buffer.concat([ciphertext, tag]); return { v: 1, iv: base64Url(iv), ct: base64Url(combined) }; } ``` Card PAN/CVC secrets use a secrets session and AES-128-GCM. See Cards for that flow. ```` #### File: sandbox-testing.mdx ````mdx --- title: "Sandbox Testing" description: "Use the sandbox environment to validate KYC, cards, and deposits before production." --- ## Environments Use separate API keys per environment. | Environment | Base URL | | --- | --- | | Sandbox | https://dev-api.machines.cash | | Production | https://api.machines.cash | ## Sandbox KYC shortcut To bypass KYC in sandbox, set the applicant's lastName to approved when calling POST /kyc/applications. The next status check returns approved. ## Sandbox deposits (rUSD on Base Sepolia) Sandbox deposits use rUSD on Base Sepolia. You need Base Sepolia ETH for gas. ### 1) Create a deposit intent ``` POST /deposits { "currency": "rusd", "network": "base", "amount": 25 } ``` The response includes deposit.id and deposit.depositAddress (the Base Sepolia deposit address). ### 2) Mint rUSD Mint rUSD on Base Sepolia, then send it to deposit.depositAddress. - Chain: Base Sepolia (84532) - rUSD contract: 0x10b5Be494C2962A7B318aFB63f0Ee30b959D000b - Mint function: mint(uint256 amountDollars_Max100) - Max per mint tx: 100 rUSD ### 3) Track status Poll until the deposit completes: ``` GET /deposits/{"{depositId}"} ``` Sandbox deposits are for testing only. Production deposits use USDC on Base. ```` #### File: partners/privy.mdx ````mdx --- title: "Privy Embedded Wallet Integration" description: "Integrate Machines Partner API with Privy embedded wallets for server-managed signing." --- This guide is for partners already using Privy embedded wallets. Scope: - Partner API integration (`/partner/v1`) only. - Server-side Privy wallet control for signing and sending transactions. - Not a guide for Machines first-party web auth endpoints like `/v1/auth/email/exchange`. ## Architecture - Your backend calls Machines Partner API. - Your backend also calls Privy server APIs for embedded wallet signing/transaction execution. - End users do not need wallet popups for embedded-wallet withdrawal execution paths. ```mermaid sequenceDiagram participant App as Partner App Backend participant Machines as Machines Partner API participant Privy as Privy Wallet API participant Chain as Blockchain App->>Machines: POST /partner/v1/users/resolve App->>Machines: POST /partner/v1/sessions App->>Machines: POST /partner/v1/withdrawals Machines-->>App: withdrawal + execution(callTarget, callPath) App->>Privy: sign typed data (v2 path only) App->>Privy: eth_sendTransaction (to execution.callTarget) Privy-->>App: transactionId/hash Chain-->>App: confirmed tx ``` ## Prerequisites - Privy app configured for your environment. - Privy embedded Ethereum wallets enabled. - Privy authorization key configured for server-side wallet access. - Machines partner API key. - Partner backend can securely store: - Machines partner key - Privy app secret - Privy authorization private key ## Privy Embedded Wallet Checklist (Server-Side) Before sending live traffic, confirm: 1. Wallet control path - You can resolve each user’s Privy embedded Ethereum wallet. - Your backend can sign/send on that wallet using an authorization context (authorization key, user JWT, or a custom sign function). 2. Signer binding - The wallet is configured with a signer path your backend can use (for example an authorization-key signer). - The authorization private key is in a secrets manager, never in client code. 3. Policy attachment - Policy IDs for withdrawal execution are attached to the signer/wallet. - Rules cover `eth_sendTransaction` and `eth_signTypedData_v4`. 4. Sponsorship setup - Gas sponsorship is enabled in Privy Dashboard for the chains you support. - Your backend passes `sponsor: true` for sponsored sends. 5. Status monitoring - You have webhook or polling support for transaction status reconciliation. ## Recommended Data to Persist Per user, persist at least: - `machinesUserId` (your Machines partner user mapping) - `privyUserId` (Privy user id) - `embeddedWalletAddress` (and `walletId` if you store it) - `linkedAt` / `lastUsedAt` Per execution, persist: - partner idempotency key - Privy `transaction_id` / user operation hash (if returned) - final onchain `transaction_hash` - execution path (`controller_v1` or `coordinator_v2`) ## End-to-End Partner Flow ### 1) Resolve or link the user Call `POST /partner/v1/users/resolve` from your backend. ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/users/resolve \ --header 'Content-Type: application/json' \ --header 'X-Partner-Key: ' \ --data '{ "userId": "partner-user-123", "walletAddress": "0xabc...", "walletLabel": "Privy Embedded Wallet" }' ``` ### 2) Create a scoped partner session Call `POST /partner/v1/sessions`. Use the smallest scope set needed for the current operation. ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/sessions \ --header 'Content-Type: application/json' \ --header 'X-Partner-Key: ' \ --data '{ "userId": "partner-user-123", "walletAddress": "0xabc...", "scopes": ["deposits.read", "withdrawals.write"], "ttlSeconds": 900 }' ``` ### 3) Run core Machines flows Use the partner session token for: - KYC - Agreements - Cards - Balances - Deposits This guide focuses on withdrawals because that is where embedded-wallet server signing is most relevant. ### 4) Withdrawal flow (partner + Privy execution) Call sequence: 1. `GET /partner/v1/withdrawals/assets` 2. `POST /partner/v1/withdrawals/range` 3. `POST /partner/v1/withdrawals/estimate` 4. `POST /partner/v1/withdrawals` (include `adminAddress`) 5. Execute onchain via Privy wallet APIs Create request example: ```bash curl --request POST \ --url https://api.machines.cash/partner/v1/withdrawals \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ' \ --header 'Idempotency-Key: wdrl-001' \ --data '{ "amountCents": 2500, "source": { "contractId": "optional-uuid" }, "destination": { "currency": "hbar", "network": "hbar", "address": "0.0.123456", "extraId": "optional-tag" }, "adminAddress": "0xabc..." }' ``` Use the same `Idempotency-Key` when retrying `POST /partner/v1/withdrawals` after pending responses. ## Execution Model and Contract Call Paths Machines withdrawal create response includes: - `execution.callTarget` - `execution.callPath` (`controller_v1` or `coordinator_v2`) - `parameters` (7-arg Rain executor payload) Always send the transaction to `execution.callTarget`. - `controller_v1`: - Call 7-arg `withdrawAsset(...)` - Selector: `0xe167d26a` - Signature: `withdrawAsset(address,address,uint256,address,uint256,bytes32,bytes)` - `coordinator_v2`: - Build admin typed-data signature first - Call 10-arg `withdrawAsset(...)` - Selector: `0x4b268241` - Signature: `withdrawAsset(address,address,uint256,address,uint256,bytes32,bytes,bytes32[],bytes[],bool)` ### v2 Typed Data Shape ```ts const domain = { name: "Collateral", version: "2", chainId, verifyingContract: collateralProxy, salt: adminSalt, // bytes32 }; const types = { Withdraw: [ { name: "user", type: "address" }, { name: "asset", type: "address" }, { name: "amount", type: "uint256" }, { name: "recipient", type: "address" }, { name: "nonce", type: "uint256" }, ], }; const message = { user: adminAddress, asset: tokenAddress, amount, recipient, nonce: adminNonce, }; ``` ### Partner-side Privy Execution (TypeScript) ```ts // 1) Create withdrawal payload at Machines const wd = await fetch("https://api.machines.cash/partner/v1/withdrawals", { method: "POST", headers: { Authorization: `Bearer ${partnerSessionToken}`, "Content-Type": "application/json", "Idempotency-Key": idempotencyKey, }, body: JSON.stringify({ amountCents, destination, adminAddress, }), }).then((r) => r.json()); if (wd?.data?.status === "pending") { // retry same request with same idempotency key } const execution = wd?.data?.execution; const parameters = wd?.data?.parameters; if (!execution?.callTarget || !parameters || parameters.length < 7) { throw new Error("withdrawal payload not ready"); } ``` ```ts // 2) v2 only: sign typed data with Privy const adminSignature = await privy.walletApi.ethereum.signTypedData({ walletId, chainType: "ethereum", typedData: { domain, types, message, primaryType: "Withdraw", }, }); ``` ```ts // 3) Send tx with Privy (v1 or v2 encoded calldata) const send = await privy.walletApi.rpc({ walletId, chainType: "ethereum", caip2: `eip155:${chainId}`, method: "eth_sendTransaction", sponsor: true, idempotencyKey, params: { transaction: { from: adminAddress, to: execution.callTarget, data: encodedCallData, value: "0x0", }, }, }); const transactionId = send?.data?.transactionId; let txHash = send?.data?.hash; if (!txHash && transactionId) { // poll Privy getTransaction(transactionId) until hash is available } ``` ## Privy Method Allowances and Policy Design For this flow, allow at minimum: - `eth_sendTransaction` - `eth_signTypedData_v4` (needed for `coordinator_v2`) Use dynamic target address rules: - Do not hardcode a single contract address. - Restrict `to` to the `execution.callTarget` values returned by Machines for supported chains/contracts. Recommended condition dimensions: - `ethereum_transaction`: - `chain_id` in allowed chains - `to` in your dynamically maintained allowlist - `value == 0` - `ethereum_calldata`: - ABI for Rain withdrawal functions - `function_name == "withdrawAsset"` - `ethereum_typed_data_domain` and `ethereum_typed_data_message` (for v2): - domain name/version chain checks - typed message fields constrained to your expected flow Policy modeling tip: - Keep reusable condition sets per chain + function family. - Compose those sets into authorization policies instead of duplicating large JSON blocks. ### Example Policy Shape (Ethereum) This is a concrete starting shape aligned with Privy’s Ethereum policy examples: ```js { version: "1.0", name: "Machines withdrawal execution", chain_type: "ethereum", rules: [ { name: "Allow withdrawAsset tx to approved call targets", method: "eth_sendTransaction", action: "ALLOW", conditions: [ { field_source: "ethereum_transaction", field: "chain_id", operator: "in", value: ["8453", "84532"] }, { field_source: "ethereum_transaction", field: "to", operator: "in_condition_set", value: "" }, { field_source: "ethereum_transaction", field: "value", operator: "eq", value: "0x0" }, { field_source: "ethereum_calldata", field: "function_name", abi: [ { name: "withdrawAsset", type: "function", stateMutability: "nonpayable", inputs: [ { name: "collateralProxy", type: "address" }, { name: "token", type: "address" }, { name: "amount", type: "uint256" }, { name: "recipient", type: "address" }, { name: "expiresAt", type: "uint256" }, { name: "executorSalt", type: "bytes32" }, { name: "executorSignature", type: "bytes" } ], outputs: [] }, { name: "withdrawAsset", type: "function", stateMutability: "nonpayable", inputs: [ { name: "collateralProxy", type: "address" }, { name: "token", type: "address" }, { name: "amount", type: "uint256" }, { name: "recipient", type: "address" }, { name: "expiresAt", type: "uint256" }, { name: "executorSalt", type: "bytes32" }, { name: "executorSignature", type: "bytes" }, { name: "adminSalt", type: "bytes32[]" }, { name: "adminSignature", type: "bytes[]" }, { name: "directTransfer", type: "bool" } ], outputs: [] } ], operator: "eq", value: "withdrawAsset" } ] }, { name: "Allow v2 domain-constrained typed data signing", method: "eth_signTypedData_v4", action: "ALLOW", conditions: [ { field_source: "ethereum_typed_data_domain", field: "chainId", operator: "in", value: ["8453", "84532"] }, { field_source: "ethereum_typed_data_domain", field: "verifyingContract", operator: "in_condition_set", value: "" }, { field_source: "ethereum_typed_data_message", typed_data: { types: { Withdraw: [ { name: "user", type: "address" }, { name: "asset", type: "address" }, { name: "amount", type: "uint256" }, { name: "recipient", type: "address" }, { name: "nonce", type: "uint256" } ] }, primary_type: "Withdraw" }, field: "amount", operator: "lte", value: "" } ] } ] } ``` Practical guidance: - Use condition sets for `to` addresses and verifying contracts. - Keep policy values as strings matching Privy examples (`chain_id`, hex values, address strings). - Treat this policy as an allowlist; add explicit `DENY` rules only when needed. ## Gas Sponsorship and Transaction Lifecycle - Use `sponsor: true` for embedded wallet sends to sponsor gas. - For gas-sponsored EVM sends, backend responses can return before final onchain hash. - Handle async status fields: - `transaction_id` (Privy transaction id) - `user_operation_hash` - `hash` may be empty until confirmation. - Track final status via: - Privy webhooks (recommended) - or transaction-status API polling by `transaction_id`. - Add operational monitoring: - submission failures - hash timeouts - onchain confirmation delays - spend anomalies and abuse patterns ## Known Constraints and Gotchas - Production destination coverage (BTC/SOL/EVM/etc.) depends on live relay routes. Always query: - `GET /partner/v1/withdrawals/assets` - `POST /partner/v1/withdrawals/range` - `POST /partner/v1/withdrawals/estimate` before quoting or creating withdrawals. - Sandbox source is fixed to rUSD on Base Sepolia. - If withdrawal signature response is `status: pending`, retry with the same idempotency key. ## Further Reading (Privy) - Authorization keys overview: - https://docs.privy.io/controls/authorization-keys - Server-side signing with authorization keys: - https://docs.privy.io/controls/authorization-keys/using-owners/sign/signing-on-the-server - Ethereum policy examples: - https://docs.privy.io/controls/policies/example-policies/ethereum#allow-specific-smart-contract-function-calls - Gas sponsorship setup: - https://docs.privy.io/wallets/gas-and-asset-management/gas/setup - Transaction handling: - https://docs.privy.io/wallets/gas-and-asset-management/gas/transaction-handling - Sponsorship security guidance: - https://docs.privy.io/wallets/gas-and-asset-management/gas/security ```` #### File: kyc-flow.mdx ````mdx --- title: "KYC Flow" description: "Collect and verify identity." --- Prerequisite: have a session token. See Authentication. ## Flow ```mermaid sequenceDiagram participant Backend as Your Backend participant MachinesAPI as Machines API Backend->>MachinesAPI: POST /sessions (create session) Backend->>MachinesAPI: GET /kyc/values Backend->>MachinesAPI: POST /kyc/applications MachinesAPI-->>Backend: status = pending loop poll Backend->>MachinesAPI: GET /kyc/status MachinesAPI-->>Backend: status = approved | needs_information | denied end Backend->>MachinesAPI: GET /agreements Backend->>MachinesAPI: POST /agreements ``` ## Steps GET /kyc/values to see required fields and allowed values. POST /kyc/applications with the fields below. Sandbox: set lastName to approved to auto‑approve. We return a completionLink (or externalVerificationLink). Open it in a browser for document upload and face match. Users finish verification there — you don’t need to handle media. Poll GET /kyc/status until the status becomes approved (or an actionable state such as needs_information). After approval, fetch the agreements and collect user consent. See Agreements. ## States - approved - pending - needs_information - needs_verification - manual_review - denied - locked - canceled ## Fields (submit application) Given name. Family name. Sandbox shortcut: set to approved to auto-approve. YYYY-MM-DD (e.g., 1990-01-01). Government ID number (letters, numbers, dashes only). ISO-3166-1 alpha-2 country code (e.g., US). Case-insensitive. Email address. Optional phone dial code digits only (e.g., 1). Optional phone number digits only (include area code). Street address (line 1). Street address (line 2). City. State/region (e.g., CA). Postal/ZIP code. ISO-3166-1 alpha-2 country code (e.g., US). Case-insensitive. SOC occupation code (e.g., 49-3023). Full list: KYC Field Values. Choose one label (we map to the underlying range for you): - <40k - 50k–99k - 100k–149k - 150k+ Choose one: - everyday spend - subscriptions - business expenses - testing - other Choose one label (we map to the underlying range for you): - under $1k - $1k–$5k - $5k–$20k - $20k+ ## Response (status) One of: approved, pending, needs_information, needs_verification, manual_review, denied, locked, canceled. Identifier for the submitted application (when available). Additional context for non-approved statuses. Sandbox shortcut: set lastName to approved to auto‑approve. See KYC Field Values for allowed field values. ```` #### File: agreements.mdx ````mdx --- title: "Agreements" description: "Display required user agreements after KYC approval." --- Prerequisite: KYC status is approved. ## Flow ```mermaid sequenceDiagram participant Backend as Your Backend participant MachinesAPI as Machines API participant User as User Backend->>MachinesAPI: GET /agreements MachinesAPI-->>Backend: agreements + accepted status Backend->>User: show agreements + links User-->>Backend: accepts all Backend->>MachinesAPI: POST /agreements { accepted: true } MachinesAPI-->>Backend: acceptedAt ``` ## API flows (step-by-step) Endpoint: GET /agreements
Response: agreements[] (text + links), accepted, acceptedAt. ```bash curl -s \ -H 'Authorization: Bearer ' \ https://dev-api.machines.cash/partner/v1/agreements ```
Render each agreement’s text, and open the links[].url in a new tab. The user must accept all agreements. Endpoint: POST /agreements
Body: {"{ \"accepted\": true }"} ```bash curl -s \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -d '{"accepted": true}' \ https://dev-api.machines.cash/partner/v1/agreements ```
If KYC is not approved, these endpoints return 409 with invalid_state. ## What this unlocks After acceptance, the user can create cards, create deposits, and request withdrawals. Those endpoints return 409 until agreements are accepted. ```` #### File: cards.mdx ````mdx --- title: "Cards" description: "Create, lock/unlock, delete, and retrieve encrypted card secrets." --- Prerequisite: have a session token. See Authentication. ## Card lifecycle ```mermaid sequenceDiagram participant Backend as Your Backend participant MachinesAPI as Machines API Backend->>MachinesAPI: POST /cards MachinesAPI-->>Backend: cardId Backend->>MachinesAPI: PATCH /cards/{"{cardId}"} (lock/unlock, limit) MachinesAPI-->>Backend: updated card Backend->>MachinesAPI: DELETE /cards/{"{cardId}"} MachinesAPI-->>Backend: canceled ``` ## API flows (step‑by‑step) Endpoint: GET /cards Endpoint: POST /cards
Body: optional encryptedName (encrypted card label) and optional limit with amountCents and frequency.
Tip: To set a card label, call POST /encryption/encrypt first and pass the returned value as encryptedName (see Encryption). ```bash curl -s \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: ' \ -d '{"limit": {"amountCents": 2500, "frequency": "perAuthorization"}}' \ https://dev-api.machines.cash/partner/v1/cards ```
Endpoint: PATCH /cards/{"{cardId}"} Endpoint: DELETE /cards/{"{cardId}"} Endpoint: POST /cards/secrets/session
Body: send an empty JSON object if your client sets Content-Type: application/json. ```bash curl -s \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -d '{}' \ https://dev-api.machines.cash/partner/v1/cards/secrets/session ```
Endpoint: POST /cards/{"{cardId}"}/secrets
Body: {"{ sessionId }"} (from the secrets session helper)
## Fields (create/update) Optional encrypted card label field {"{ v, iv, ct }"}. Generate with POST /encryption/encrypt. Spending cap in cents. One of: perAuthorization, per24HourPeriod, per7DayPeriod, per30DayPeriod, perYearPeriod, allTime. ## Response (secrets session) Session id used to fetch encrypted PAN/CVC. 16‑byte secret (hex) used to decrypt PAN/CVC with AES‑128‑GCM. ## Response (secrets) Base64 ciphertext + auth tag. Base64 IV. Base64 ciphertext + auth tag. Base64 IV. Expiration month (MM). Expiration year (YYYY). Last 4 digits. ## Card labels vs card secrets - Card labels use /encryption/encrypt and /encryption/decrypt. - Card secrets (PAN/CVC) use /cards/secrets/session + /cards/{"{cardId}"}/secrets. - Decrypt card labels on your backend and send plaintext labels to your frontend. - Card labels are optional, but recommended for clean UI. ## Card limits - amountCents: integer amount in cents (e.g., 5000 = $50). Minimum 1. - frequency: one of - perAuthorization — max per single authorization - per24HourPeriod — rolling 24‑hour spend cap - per7DayPeriod — rolling 7‑day spend cap - per30DayPeriod — rolling 30‑day spend cap - perYearPeriod — rolling 1‑year cap - allTime — lifetime cap Examples ```json { "limit": { "amountCents": 5000, "frequency": "perAuthorization" } } { "limit": { "amountCents": 20000, "frequency": "per24HourPeriod" } } ``` To change a limit, PATCH the card with a new limit object. To remove a limit, set a permissive value (for example a very high allTime cap) or contact us if you need a true “no limit” configuration for your program. ## Lock / unlock / update limits - PATCH /cards/{"{cardId}"} with status: "locked" to pause spend. - Set status: "active" to unlock. - Update limits by sending a new limit payload. ## Delete DELETE /cards/{"{cardId}"} cancels immediately. ## Card number secrets (PAN/CVC) This flow is only for retrieving the card number (PAN) and CVC. Do not use it for card labels. 1) Call POST /cards/secrets/session to get sessionId and secretKey. 2) Call POST /cards/{"{cardId}"}/secrets with {"{ sessionId }"}. 3) Decrypt encryptedPan and encryptedCvc locally using AES‑128‑GCM with the secretKey. This endpoint requires the cards.secrets.read scope. /encryption/decrypt is for card labels only. Use /cards/{"{cardId}"}/secrets for PAN/CVC. The sessionId used here is different from your API session token. Always request it from /cards/secrets/session. No decrypted PAN/CVC ever leaves your process; only encrypted blobs are returned by the API. ```` #### File: balances.mdx ````mdx --- title: "Balances" description: "Fetch spending power and charge totals." --- ## Overview - GET /balances returns credit limit, spending power, and charge totals (all in cents). - No extra scopes are required. ## API flow (step‑by‑step) Endpoint: GET /balances
Headers: Authorization: Bearer <SESSION_TOKEN> ```bash curl -s \ -H "Authorization: Bearer $SESSION_TOKEN" \ https://dev-api.machines.cash/partner/v1/balances ``` Use the returned values to display available spend and current charge totals.
## Response (balances) Available spending power in cents. Credit limit in cents. Pending charges in cents. Posted charges in cents. Balance due in cents. ```` #### File: deposits.mdx ````mdx --- title: "Deposits" description: "Partner deposit discovery, range validation, estimation, and create flow." --- Sandbox supports partner deposits only for `rusd` on `base` (Base Sepolia). ## Overview - `GET /partner/v1/deposits/assets`: discover supported `currency` + `network` ids (no min/max). - `POST /partner/v1/deposits/range`: fetch min/max and payout route for one pair. - `POST /partner/v1/deposits/estimate`: quote estimated receive amount for one pair + amount. - `POST /partner/v1/deposits`: create the deposit address/intent. - `GET /partner/v1/deposits` and `GET /partner/v1/deposits/{depositId}`: track lifecycle. Min/max are intentionally omitted from assets. Always call `/deposits/range` (or `/deposits/estimate`) for limits. ## Flow ```mermaid sequenceDiagram participant Backend as "Your Backend" participant MachinesAPI as "Machines API" participant Wallet as "Wallet / Exchange" Backend->>MachinesAPI: GET /partner/v1/deposits/assets MachinesAPI-->>Backend: assets[] Backend->>MachinesAPI: POST /partner/v1/deposits/range MachinesAPI-->>Backend: range {minAmount, maxAmount, route} Backend->>MachinesAPI: POST /partner/v1/deposits/estimate MachinesAPI-->>Backend: estimate {estimatedToAmount, rateId} Backend->>MachinesAPI: POST /partner/v1/deposits MachinesAPI-->>Backend: deposit {depositAddress, payinExtraId} Wallet->>MachinesAPI: Send funds to depositAddress (+ memo/tag when payinExtraId exists) Backend->>MachinesAPI: GET /partner/v1/deposits/{depositId} MachinesAPI-->>Backend: status updates ``` ## API flows (step-by-step) Endpoint: GET /partner/v1/deposits/assets ```bash curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ "https://api.machines.cash/partner/v1/deposits/assets?q=hbar&limit=20" ``` Response returns `assets[].ticker` and `assets[].networks[].id`. Endpoint: POST /partner/v1/deposits/range ```bash curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{"currency":"hbar","network":"hbar"}' \ https://api.machines.cash/partner/v1/deposits/range ``` Use `range.minAmount` / `range.maxAmount` for validation. Endpoint: POST /partner/v1/deposits/estimate ```bash curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{"currency":"hbar","network":"hbar","amount":25,"amountCurrency":"crypto"}' \ https://api.machines.cash/partner/v1/deposits/estimate ``` `amountCurrency` supports: - `crypto` (default) - `usd` Endpoint: POST /partner/v1/deposits ```bash curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{"currency":"hbar","network":"hbar","amount":25}' \ https://api.machines.cash/partner/v1/deposits ``` Use the returned `deposit.depositAddress`. If `deposit.payinExtraId` is non-null, pass it as memo/tag in the user’s funding transaction. Endpoints: - GET /partner/v1/deposits/{depositId} - GET /partner/v1/deposits?scope=active ## Key response fields Optional memo/tag required by some source networks. Quote input mode (`crypto` or `usd`). Estimated settled amount for the user contract route. Provider rate id when available. ```` #### File: withdrawals.mdx ````mdx --- title: "Withdrawals" description: "Partner withdrawal discovery, range validation, estimation, relay setup, and onchain execution." --- Read endpoints for withdrawals use `deposits.read` scope. Create still requires `withdrawals.write`. ## Overview - `GET /partner/v1/withdrawals/assets`: list destination assets. - `POST /partner/v1/withdrawals/range`: get min/max for a destination pair. - `POST /partner/v1/withdrawals/estimate`: quote destination receive amount for a given amount. - `POST /partner/v1/withdrawals`: create relay + fetch Rain withdrawal signature payload. `POST /partner/v1/withdrawals` uses a breaking request body shape with `source` and `destination` objects. ## Flow ```mermaid sequenceDiagram participant Backend as "Your Backend" participant MachinesAPI as "Machines API" participant Rain as "Rain Contract" participant ChangeNOW as "ChangeNOW Relay" participant Chain as "Blockchain" Backend->>MachinesAPI: GET /partner/v1/withdrawals/assets MachinesAPI-->>Backend: assets[] Backend->>MachinesAPI: POST /partner/v1/withdrawals/range MachinesAPI-->>Backend: range {min/max} Backend->>MachinesAPI: POST /partner/v1/withdrawals/estimate MachinesAPI-->>Backend: estimate {estimatedToAmount} Backend->>MachinesAPI: POST /partner/v1/withdrawals MachinesAPI->>ChangeNOW: create exchange (pay-in = Rain recipient) MachinesAPI->>Rain: get signed withdrawal payload MachinesAPI-->>Backend: status + signature + relay metadata Backend->>Chain: sign/broadcast withdrawAsset(...) ``` ## API flows (step-by-step) Endpoint: GET /partner/v1/withdrawals/assets ```bash curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ "https://api.machines.cash/partner/v1/withdrawals/assets?q=hbar&limit=20" ``` `sourceChainId` and `sourceTokenAddress` are optional hints. Endpoint: POST /partner/v1/withdrawals/range ```bash curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "destination": { "currency": "hbar", "network": "hbar" } }' \ https://api.machines.cash/partner/v1/withdrawals/range ``` Endpoint: POST /partner/v1/withdrawals/estimate ```bash curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "destination": { "currency": "hbar", "network": "hbar", "extraId": "optional-tag" }, "amountCents": 2500 }' \ https://api.machines.cash/partner/v1/withdrawals/estimate ``` Endpoint: POST /partner/v1/withdrawals ```bash curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ -H "Idempotency-Key: wdrl-123456" \ -H "Content-Type: application/json" \ -d '{ "amountCents": 2500, "source": { "contractId": "optional-uuid" }, "destination": { "currency": "hbar", "network": "hbar", "address": "0.0.123456", "extraId": "optional-tag" }, "adminAddress": "0x..." }' \ https://api.machines.cash/partner/v1/withdrawals ``` Ready responses include: - `execution` info for contract call routing. - `relay` metadata (`payinAddress`, `payinExtraId`, `payoutAddress`, `payoutExtraId`, route ids). - `from` must be the same admin EOA used in create (`adminAddress`). - `to` must be `execution.callTarget` (controller/coordinator), not the collateral proxy. - Use ordered args from `parameters`: `[collateralProxy, token, amount, recipient, expiresAt, executorSalt, executorSignature]`. - If `execution.callPath=controller_v1`, call 7-arg `withdrawAsset(...)`. - If `execution.callPath=coordinator_v2`, call 10-arg `withdrawAsset(...)` and include v2 admin typed-data signature values. - If `status` is `pending`, wait `retryAfterSeconds` and retry the same request with the same idempotency key. ## Relay metadata fields Provider exchange id for relay tracking. Address Rain withdrawal sends funds to. Optional memo/tag required on relay pay-in side. Final destination address configured on the relay. Optional destination memo/tag configured for payout. ```` #### File: agentic-payments.mdx ````mdx --- title: "Agentic Payments" description: "Browse products and place purchases from API, CLI, or MCP using one simple action model." --- Use Agentic Payments when you want one simple way to shop with Machines. The same flow works across API, CLI, and MCP: - `browser` finds an item or resolves a direct URL - `buy` starts the purchase - `actions` let you confirm, check progress, or submit a 3DS code Current launch default: shopping flows default to Amazon. `browser` means commerce discovery only. It is not general browser automation. ## What you usually need In most cases, nothing beyond the item itself: - a product URL or shopping query - an authenticated Machines session If the user already has an active Machines card and saved billing profile, Machines uses them automatically. ## The shared action model Every purchase returns an `actionId`. That makes the flow portable across surfaces. You can start a purchase in one place and continue it in another: - start in API, check status in CLI - start in MCP, submit 3DS over API - start in CLI, confirm from MCP Possible action states: | Status | Meaning | |---|---| | `awaiting_confirmation` | Machines is waiting for the user to confirm the purchase | | `processing` | The purchase is in progress | | `awaiting_3ds` | A 3DS verification code is required | | `completed` | The purchase finished successfully | | `failed` | The purchase stopped with a terminal error | | `expired` | The action or quote expired before completion | ## Quickstart ### 1. Browse a product The simplest read-only path is a query string: ```bash curl -s \ -H 'Authorization: Bearer ' \ 'https://api.machines.cash/agent/v1/browser?q=greenies%20cat%20treats' ``` Structured browse requests use `POST /agent/v1/browser`: ```bash curl -s \ -X POST \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ https://api.machines.cash/agent/v1/browser \ -d '{ "input": "airpods pro 3", "provider": "amazon", "limit": 3 }' ``` ### 2. Start a purchase Use `POST /agent/v1/buy` to start checkout. If the user already has a Machines card and billing profile, this is usually enough: ```bash curl -s \ -X POST \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: ' \ https://api.machines.cash/agent/v1/buy \ -d '{ "url": "https://www.amazon.com/dp/B0828W6NXJ" }' ``` You can also override the saved card selector: ```bash curl -s \ -X POST \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: ' \ https://api.machines.cash/agent/v1/buy \ -d '{ "url": "https://www.amazon.com/dp/B0828W6NXJ", "card": "shared" }' ``` ### 3. Check status ```bash curl -s \ -H 'Authorization: Bearer ' \ https://api.machines.cash/agent/v1/actions/543720cb-edb5-4651-90bc-7068ce133668 ``` ### 4. Confirm if needed ```bash curl -s \ -X POST \ -H 'Authorization: Bearer ' \ https://api.machines.cash/agent/v1/actions/543720cb-edb5-4651-90bc-7068ce133668/confirm ``` ### 5. Submit a 3DS code if needed ```bash curl -s \ -X POST \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ https://api.machines.cash/agent/v1/actions/543720cb-edb5-4651-90bc-7068ce133668/3ds \ -d '{ "code": "123456" }' ``` ## CLI The CLI uses the same action model and the same `/agent/v1` routes. ```bash machines browser "airpods pro 3" machines buy "https://www.amazon.com/dp/B0828W6NXJ" machines buy "https://www.amazon.com/dp/B0828W6NXJ" --card shared --wait machines agent status 543720cb-edb5-4651-90bc-7068ce133668 machines agent confirm 543720cb-edb5-4651-90bc-7068ce133668 machines agent 3ds 543720cb-edb5-4651-90bc-7068ce133668 --code 123456 ``` ## MCP and AI apps Machines MCP uses the same flow. The user does not need to paste billing details or card numbers when their Machines account is already set up. Useful prompts: - `buy this https://www.amazon.com/dp/B0828W6NXJ using my default card` - `browse airpods pro 3 on amazon` - `check the status for action 543720cb-edb5-4651-90bc-7068ce133668` - `confirm my pending purchase` - `submit this 3ds code for my purchase: 123456` ```` #### File: agent-tool-schemas.mdx ````mdx --- title: "Agent Tool Schemas" description: "Copy-paste JSON Schemas for tools to call the API." --- ```json api.users.resolve { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "required": ["userId"], "properties": { "userId": { "type": "string", "maxLength": 120 }, "walletAddress": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" }, "walletLabel": { "type": "string", "maxLength": 120 } } } ``` ```json api.sessions.create { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "required": ["userId","scopes"], "properties": { "userId": { "type": "string" }, "walletAddress": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" }, "scopes": { "type": "array", "items": { "type": "string" }, "minItems": 1 }, "ttlSeconds": { "type": "integer", "minimum": 60, "maximum": 86400 } } } ``` ```json api.cards.create { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "properties": { "encryptedName": { "type": "object", "required": ["v","iv","ct"], "properties": { "v": { "type": "integer" }, "iv": { "type": "string" }, "ct": { "type": "string" } }}, "limit": { "type": "object", "required": ["amountCents","frequency"], "properties": { "amountCents": { "type": "integer", "minimum": 1 }, "frequency": { "type": "string", "enum": ["perAuthorization","per24HourPeriod","per7DayPeriod","per30DayPeriod","perYearPeriod","allTime"] } }} } } ``` ```json api.encryption.encrypt { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "required": ["value"], "properties": { "value": { "type": "string" } } } ``` ```json api.balances.get { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "properties": {} } ``` ```json api.cards.update { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "properties": { "status": { "type": "string", "enum": ["active","locked","canceled","not_activated"] }, "limit": { "type": "object", "required": ["amountCents","frequency"], "properties": { "amountCents": { "type": "integer", "minimum": 1 }, "frequency": { "type": "string", "enum": ["perAuthorization","per24HourPeriod","per7DayPeriod","per30DayPeriod","perYearPeriod","allTime"] } }}, "encryptedName": { "type": "object", "required": ["v","iv","ct"], "properties": { "v": { "type": "integer" }, "iv": { "type": "string" }, "ct": { "type": "string" } }} } } ``` ```json api.cards.secrets.get { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "required": ["sessionId"], "properties": { "sessionId": { "type": "string" } } } ``` ```json api.cards.secrets.session { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "properties": {} } ``` ```json api.deposits.create { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "required": ["currency","network"], "properties": { "currency": { "type": "string", "enum": ["usdc","rusd"] }, "network": { "type": "string", "enum": ["base"] }, "amount": { "type": "number", "exclusiveMinimum": 0 } } } ``` ```json api.withdrawals.create { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "additionalProperties": false, "required": ["amountCents","tokenAddress","recipientAddress","chainId"], "properties": { "amountCents": { "type": "integer", "minimum": 1 }, "tokenAddress": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" }, "recipientAddress": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" }, "chainId": { "type": "integer", "minimum": 1 }, "contractId": { "type": "string" }, "adminAddress": { "type": "string", "pattern": "^0x[a-fA-F0-9]{40}$" } } } ``` Set additionalProperties: false and explicit required to keep agents deterministic. ```` #### File: best-practices-agents.mdx ````mdx --- title: "Agent Best Practices" description: "Guardrails and patterns that keep agent calls safe and reliable." --- - Use Idempotency-Key on card creation and other idempotent writes. - Use propose -> execute for sensitive actions. - Return small, structured results with a summary for LLM chaining. - Prefer cursor pagination and search + get-by-id pairs. - Implement bounded retries on networking timeouts. ```` #### File: errors.mdx ````mdx --- title: "Errors & Retries" description: "Deterministic error codes and retry guidance for agents and services." --- Common error codes: - invalid_request (400) - unauthorized (401) - forbidden (403) - not_found (404) - conflict (409) - service_unavailable (503) All responses use a consistent envelope by default: `{ ok, data, summary, errors[], next }`. Set X-Open-Responses: 1 to receive Open Responses-style outputs. ## Open Responses error shape (optional) When X-Open-Responses: 1 is set, errors return the Open Responses error object: ```json { "error": { "type": "invalid_request", "code": "invalid_request", "param": "walletAddress", "message": "walletAddress required to create a new mapping" } } ``` ```` #### File: kyc-values.mdx ````mdx --- title: "KYC Field Values" description: "Expected values for occupation, salary, account purpose, and monthly volume." --- Use these values when submitting KYC. The endpoint returns field requirements plus the allowed values, so you can build the form in one call. Country codes use ISO-3166-1 alpha-2 (e.g., US) for countryOfIssue and address.countryCode. Case-insensitive. API endpoint: GET /kyc/values. The response includes a fields array with required/optional flags and validation hints. ## Occupations (SOC codes) Provide the code value (e.g., 49-3023). - 11-1021 — General and Operations Managers - 11-2011 — Advertising and Promotions Managers - 11-3031 — Financial Managers - 11-9021 — Construction Managers - 11-9041 — Architectural and Engineering Managers - 11-9071 — Gaming Managers - 11-9141 — Property, Real Estate, and Community Association Managers - 13-1041 — Compliance Officers - 13-2011 — Accountants and Auditors - 13-2051 — Financial Analysts - 13-2052 — Personal Financial Advisors - 13-2082 — Tax Preparers - 15-1121 — Computer Systems Analysts - 15-1131 — Computer Programmers - 15-1132 — Software Developers, Applications - 15-1133 — Software Developers, Systems Software - 15-1141 — Database Administrators - 15-1142 — Information Security Analysts - 15-1143 — Computer Network Architects - 15-1151 — Computer User Support Specialists - 17-2051 — Civil Engineers - 17-2071 — Electrical Engineers - 17-2141 — Mechanical Engineers - 19-3011 — Economists - 23-1011 — Lawyers - 23-2011 — Paralegals and Legal Assistants - 25-2021 — Elementary School Teachers - 27-1024 — Graphic Designers - 27-2012 — Producers and Directors - 29-1141 — Registered Nurses - 29-1062 — Family and General Practitioners - 29-1067 — Surgeons - 31-9097 — Phlebotomists - 33-3021 — Detectives and Criminal Investigators - 35-1011 — Chefs and Head Cooks - 41-9011 — Demonstrators and Product Promoters - 41-9021 — Real Estate Brokers - 43-3071 — Tellers - 47-1011 — Construction Supervisors - 47-2061 — Construction Laborers - 49-3023 — Automotive Service Technicians and Mechanics - 51-4121 — Welders, Cutters, Solderers, and Brazers - 53-3032 — Heavy and Tractor-Trailer Truck Drivers - 53-3041 — Taxi Drivers and Chauffeurs - SELFEMP — Self-Employed - UNEMPLO — Unemployed - RETIRED — Retired - OTHERXX — Other ## Annual salary (ranges) - <40k - 50k–99k - 100k–149k - 150k+ ## Expected monthly volume - under $1k - $1k–$5k - $5k–$20k - $20k+ ## Account purpose - everyday spend - subscriptions - business expenses - testing - other Values above match our app’s KYC form to keep integrations consistent. ## Copy as JSON ```json { "fields": [ { "name": "firstName", "required": true, "type": "string", "maxLength": 50, "description": "Given name." }, { "name": "lastName", "required": true, "type": "string", "maxLength": 50, "description": "Family name." }, { "name": "birthDate", "required": true, "type": "date", "description": "YYYY-MM-DD (e.g., 1990-01-01)." }, { "name": "nationalId", "required": true, "type": "string", "regex": "^[0-9A-Za-z-]+$", "description": "Government ID number. Letters, numbers, and dashes only." }, { "name": "countryOfIssue", "required": true, "type": "string", "minLength": 2, "maxLength": 2, "description": "ISO-3166-1 alpha-2 country code (e.g., US). Case-insensitive." }, { "name": "email", "required": true, "type": "string", "description": "Email address." }, { "name": "address", "required": true, "type": "object", "description": "Object with line1, line2, city, region, postalCode, countryCode (case-insensitive)." }, { "name": "phoneCountryCode", "required": false, "type": "string", "maxLength": 3, "description": "Country calling code digits only (e.g., 1)." }, { "name": "phoneNumber", "required": false, "type": "string", "maxLength": 15, "description": "Phone number digits only; include area code." }, { "name": "occupation", "required": true, "type": "string", "description": "SOC occupation code (e.g., 49-3023). Use /kyc/values for the list." }, { "name": "annualSalary", "required": true, "type": "string", "enum": ["<40k", "50k–99k", "100k–149k", "150k+"], "description": "Choose a salary range." }, { "name": "accountPurpose", "required": true, "type": "string", "enum": ["everyday spend", "subscriptions", "business expenses", "testing", "other"], "description": "How the account will be used." }, { "name": "expectedMonthlyVolume", "required": true, "type": "string", "enum": ["under $1k", "$1k–$5k", "$5k–$20k", "$20k+"], "description": "Choose a monthly volume range." } ], "occupations": [ { "code": "11-1021", "label": "General and Operations Managers" }, { "code": "11-2011", "label": "Advertising and Promotions Managers" }, { "code": "11-3031", "label": "Financial Managers" }, { "code": "11-9021", "label": "Construction Managers" }, { "code": "11-9041", "label": "Architectural and Engineering Managers" }, { "code": "11-9071", "label": "Gaming Managers" }, { "code": "11-9141", "label": "Property, Real Estate, and Community Association Managers" }, { "code": "13-1041", "label": "Compliance Officers" }, { "code": "13-2011", "label": "Accountants and Auditors" }, { "code": "13-2051", "label": "Financial Analysts" }, { "code": "13-2052", "label": "Personal Financial Advisors" }, { "code": "13-2082", "label": "Tax Preparers" }, { "code": "15-1121", "label": "Computer Systems Analysts" }, { "code": "15-1131", "label": "Computer Programmers" }, { "code": "15-1132", "label": "Software Developers, Applications" }, { "code": "15-1133", "label": "Software Developers, Systems Software" }, { "code": "15-1141", "label": "Database Administrators" }, { "code": "15-1142", "label": "Information Security Analysts" }, { "code": "15-1143", "label": "Computer Network Architects" }, { "code": "15-1151", "label": "Computer User Support Specialists" }, { "code": "17-2051", "label": "Civil Engineers" }, { "code": "17-2071", "label": "Electrical Engineers" }, { "code": "17-2141", "label": "Mechanical Engineers" }, { "code": "19-3011", "label": "Economists" }, { "code": "23-1011", "label": "Lawyers" }, { "code": "23-2011", "label": "Paralegals and Legal Assistants" }, { "code": "25-2021", "label": "Elementary School Teachers" }, { "code": "27-1024", "label": "Graphic Designers" }, { "code": "27-2012", "label": "Producers and Directors" }, { "code": "29-1141", "label": "Registered Nurses" }, { "code": "29-1062", "label": "Family and General Practitioners" }, { "code": "29-1067", "label": "Surgeons" }, { "code": "31-9097", "label": "Phlebotomists" }, { "code": "33-3021", "label": "Detectives and Criminal Investigators" }, { "code": "35-1011", "label": "Chefs and Head Cooks" }, { "code": "41-9011", "label": "Demonstrators and Product Promoters" }, { "code": "41-9021", "label": "Real Estate Brokers" }, { "code": "43-3071", "label": "Tellers" }, { "code": "47-1011", "label": "Construction Supervisors" }, { "code": "47-2061", "label": "Construction Laborers" }, { "code": "49-3023", "label": "Automotive Service Technicians and Mechanics" }, { "code": "51-4121", "label": "Welders, Cutters, Solderers, and Brazers" }, { "code": "53-3032", "label": "Heavy and Tractor-Trailer Truck Drivers" }, { "code": "53-3041", "label": "Taxi Drivers and Chauffeurs" }, { "code": "SELFEMP", "label": "Self-Employed" }, { "code": "UNEMPLO", "label": "Unemployed" }, { "code": "RETIRED", "label": "Retired" }, { "code": "OTHERXX", "label": "Other" } ], "annualSalary": ["<40k", "50k–99k", "100k–149k", "150k+"], "expectedMonthlyVolume": ["under $1k", "$1k–$5k", "$5k–$20k", "$20k+"], "accountPurpose": ["everyday spend", "subscriptions", "business expenses", "testing", "other"] } ``` ## API endpoint (JSON) ```bash curl -s -H 'Authorization: Bearer ' \ https://dev-api.machines.cash/partner/v1/kyc/values ``` ```` ### Other MDX pages #### File: billing.mdx ````mdx --- title: "Billing" description: "Per-card pricing by default; additional billable events optional." --- Billing endpoints are not currently part of the API guide. - Per card created (primary), optional add-ons: one-time card, secrets read, KYC submit. - Usage endpoints provide cursor pagination and reproducible audit events. ```` #### File: disposable-cards.mdx ````mdx --- title: "Disposable Cards" description: "Create disposable card proposals and execute one-time cards." --- Disposable card endpoints are available in partner API v1. {/* ```mermaid sequenceDiagram participant Agent participant MachinesAPI as Machines API Agent->>MachinesAPI: POST /partner/v1/cards/disposable/proposals MachinesAPI-->>Agent: { disposableId, expiresAt } Agent->>MachinesAPI: POST /partner/v1/cards/disposable/execute MachinesAPI-->>Agent: { card, disposable } Agent->>MachinesAPI: POST /partner/v1/cards/{"{cardId}"}/secrets MachinesAPI-->>Agent: encrypted PAN/CVC Agent->>MachinesAPI: DELETE /partner/v1/cards/{"{cardId}"} ``` Use Idempotency-Key on both propose and execute to make agent retries safe. */} ```` #### File: webhooks.mdx ````mdx --- title: "Webhooks" description: "Subscribe to card + transaction + KYC updates with HMAC signatures." --- Webhooks are not currently documented in this guide. Events include `kyc.status.updated`, `card.created`, `card.updated`, `transaction.*`, and `three_ds.*`. All webhooks are HMAC signed with a shared secret; verify signatures and handle retries idempotently. ```` ## Site configuration (docs.json) ````json { "name": "Machines Cash Docs", "theme": "aspen", "logo": { "dark": "/machines-wordmark.svg", "light": "/machines-wordmark.svg" }, "favicon": "/favicon.ico", "colors": { "primary": "#FF4500", "light": "#f7f7f7" }, "api": { "playground": { "display": "interactive" }, "examples": { "languages": [ "curl", "javascript", "python" ], "defaults": "required", "prefill": true } }, "navigation": { "tabs": [ { "tab": "Machines User", "groups": [ { "group": "Start", "pages": [ "index", "user-kyc", "user-cards", "user-add-money", "user-faq" ] }, { "group": "Use Your Own AI", "pages": [ "mcp-setup", "agent-skills", "clawdbot", "ai-context-file" ] }, { "group": "User API", "pages": [ "consumer-api-reference" ] }, { "group": "User Auth API", "openapi": "consumer-openapi.yaml", "pages": [ "POST /user/v1/bootstrap", "GET /user/v1/keys", "POST /user/v1/keys", "PATCH /user/v1/keys/{keyId}", "DELETE /user/v1/keys/{keyId}", "POST /user/v1/sessions", "POST /identity/user-api-keys" ] }, { "group": "User Crypto API", "openapi": "consumer-openapi.yaml", "pages": [ "POST /user/v1/crypto/encrypt", "POST /user/v1/crypto/decrypt", "GET /user/v1/identity/data-key" ] }, { "group": "User KYC API", "openapi": "consumer-openapi.yaml", "pages": [ "GET /user/v1/users", "PATCH /user/v1/users", "POST /user/v1/kyc/initiate", "POST /user/v1/kyc", "GET /user/v1/kyc/status", "POST /user/v1/kyc/me/document", "GET /user/v1/kyc/{userId}", "PATCH /user/v1/kyc/{userId}", "POST /user/v1/kyc/{userId}/document", "GET /user/v1/agreements", "POST /user/v1/agreements", "GET /user/v1/onboarding", "POST /user/v1/onboarding" ] }, { "group": "User Cards API", "openapi": "consumer-openapi.yaml", "pages": [ "GET /user/v1/cards", "GET /user/v1/cards/deleted", "POST /user/v1/cards", "GET /user/v1/cards/{cardId}", "PATCH /user/v1/cards/{cardId}", "POST /user/v1/cards/{cardId}/delete-now", "POST /user/v1/cards/{cardId}/memo", "PATCH /user/v1/cards/{cardId}/memo", "DELETE /user/v1/cards/{cardId}/memo", "POST /user/v1/cards/reorder", "POST /user/v1/cards/secrets/session", "POST /user/v1/cards/{cardId}/secrets", "GET /user/v1/cards/{cardId}/pin/status", "GET /user/v1/cards/{cardId}/pin", "POST /user/v1/cards/{cardId}/pin", "PUT /user/v1/cards/{cardId}/pin", "POST /user/v1/cards/disposable/proposals", "POST /user/v1/cards/disposable/execute", "GET /user/v1/cards/disposable/{proposalId}", "DELETE /user/v1/cards/disposable/{proposalId}" ] }, { "group": "User Balances & Contracts API", "openapi": "consumer-openapi.yaml", "pages": [ "GET /user/v1/balances", "GET /user/v1/contracts", "POST /user/v1/tokens/metadata", "GET /user/v1/transactions" ] }, { "group": "User Deposits API", "openapi": "consumer-openapi.yaml", "pages": [ "GET /user/v1/deposits/assets", "POST /user/v1/deposits/preview", "POST /user/v1/deposits", "GET /user/v1/deposits", "GET /user/v1/deposits/{depositId}", "POST /user/v1/deposits/{depositId}/poll", "POST /user/v1/deposits/{depositId}/refresh", "POST /user/v1/deposits/{depositId}/save-address", "POST /user/v1/deposits/{depositId}/transfer" ] }, { "group": "User Identity API", "openapi": "consumer-openapi.yaml", "pages": [ "GET /user/v1/identity/wallets", "POST /user/v1/identity/wallets", "POST /user/v1/identity/wallets/manual", "PATCH /user/v1/identity/wallets/{address}", "DELETE /user/v1/identity/wallets/{address}", "GET /user/v1/identity/aliases", "PATCH /user/v1/identity/aliases/{aliasId}", "DELETE /user/v1/identity/aliases/{aliasId}", "GET /user/v1/identity/usage", "GET /user/v1/identity/deposit-preferences", "POST /user/v1/identity/deposit-preferences/activate", "PUT /user/v1/identity/deposit-preferences", "POST /user/v1/identity/deposit-preferences/reorder" ] }, { "group": "User Payments API", "openapi": "consumer-openapi.yaml", "pages": [ "GET /user/v1/payments/subscription-assets", "GET /user/v1/payments/subscription-balances", "POST /user/v1/payments/token-balances", "POST /user/v1/payments/token-metadata", "POST /user/v1/payments/native-balances", "GET /user/v1/payments/tx-status", "GET /user/v1/payments/transaction" ] }, { "group": "User Additional API", "openapi": "consumer-openapi.yaml", "pages": [ "GET /user/v1/folders", "POST /user/v1/folders", "PATCH /user/v1/folders/{folderId}", "DELETE /user/v1/folders/{folderId}", "POST /user/v1/folders/reorder", "POST /user/v1/contracts", "PUT /user/v1/contracts/{contractId}/onramp", "POST /user/v1/withdrawals", "GET /user/v1/notifications", "PUT /user/v1/notifications", "POST /user/v1/notifications/push", "DELETE /user/v1/notifications/push", "POST /user/v1/notifications/test-send", "GET /user/v1/subscriptions/plans", "GET /user/v1/subscriptions/current", "POST /user/v1/subscriptions/promo/validate", "POST /user/v1/subscriptions/scheduled/cancel", "POST /user/v1/subscriptions/checkout", "POST /user/v1/subscriptions/payin", "POST /user/v1/subscriptions/addons/extra-card/checkout", "POST /user/v1/subscriptions/confirm/payin", "POST /user/v1/subscriptions/confirm/balance", "POST /user/v1/referrals/validate", "GET /user/v1/referrals/me", "POST /user/v1/referrals/redeem", "GET /user/v1/bills", "POST /user/v1/bills", "PATCH /user/v1/bills/{billId}", "DELETE /user/v1/bills/{billId}", "GET /user/v1/bills/calendar", "GET /user/v1/bills/suggestions", "GET /user/v1/support", "POST /user/v1/spotlight/search" ] } ] }, { "tab": "Partner", "groups": [ { "group": "Start", "pages": [ "partner", "getting-started", "authentication", "encryption", "sandbox-testing" ] }, { "group": "Core Flows", "pages": [ "kyc-flow", "agreements", "cards", "balances", "deposits", "transactions", "withdrawals" ] }, { "group": "Agentic", "pages": [ "agentic-payments", "agent-tool-schemas", "best-practices-agents", "partners/llms" ] }, { "group": "Reference", "pages": [ "errors" ] }, { "group": "Authentication API", "openapi": "openapi.yaml", "pages": [ "POST /partner/v1/sessions" ] }, { "group": "Users API", "openapi": "openapi.yaml", "pages": [ "POST /partner/v1/users/resolve" ] }, { "group": "KYC API", "openapi": "openapi.yaml", "pages": [ "GET /partner/v1/kyc/schema", "POST /partner/v1/kyc/applications", "GET /partner/v1/kyc/status", "GET /partner/v1/kyc/values" ] }, { "group": "Agreements API", "openapi": "openapi.yaml", "pages": [ "GET /partner/v1/agreements", "POST /partner/v1/agreements" ] }, { "group": "Cards API", "openapi": "openapi.yaml", "pages": [ "GET /partner/v1/cards", "POST /partner/v1/cards", "GET /partner/v1/cards/{cardId}", "PATCH /partner/v1/cards/{cardId}", "DELETE /partner/v1/cards/{cardId}", "POST /partner/v1/cards/secrets/session", "POST /partner/v1/cards/{cardId}/secrets" ] }, { "group": "Encryption API", "openapi": "openapi.yaml", "pages": [ "GET /partner/v1/encryption/data-key", "POST /partner/v1/encryption/encrypt", "POST /partner/v1/encryption/decrypt" ] }, { "group": "Balances API", "openapi": "openapi.yaml", "pages": [ "GET /partner/v1/balances" ] }, { "group": "Deposits API", "openapi": "openapi.yaml", "pages": [ "GET /partner/v1/deposits/assets", "POST /partner/v1/deposits/range", "POST /partner/v1/deposits/estimate", "POST /partner/v1/deposits", "GET /partner/v1/deposits", "GET /partner/v1/deposits/{depositId}" ] }, { "group": "Transactions API", "openapi": "openapi.yaml", "pages": [ "GET /partner/v1/transactions" ] }, { "group": "Withdrawals API", "openapi": "openapi.yaml", "pages": [ "GET /partner/v1/withdrawals/assets", "POST /partner/v1/withdrawals/range", "POST /partner/v1/withdrawals/estimate", "POST /partner/v1/withdrawals" ] }, { "group": "Hidden", "hidden": true, "pages": [ "kyc-values" ] } ] } ] } } ```` ## API reference (openapi.yaml) ````yaml openapi: 3.1.0 jsonSchemaDialect: "https://spec.openapis.org/oas/3.1/dialect/2024-11-10" info: title: Machines Cash API version: "0.3.0" description: | API for KYC, cards, encryption, balances, deposits, transactions, and withdrawals. All responses use a consistent envelope by default: { ok, data, summary, errors[], next }. Set X-Open-Responses: 1 to receive Open Responses-style response objects. servers: - url: https://api.machines.cash description: production - url: https://dev-api.machines.cash description: sandbox tags: - name: users - name: sessions - name: kyc - name: kycValues - name: agreements - name: cards - name: encryption - name: balances - name: deposits - name: transactions - name: withdrawals paths: /partner/v1/users/resolve: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" post: operationId: api.users.resolve tags: [users] summary: Resolve or create a Machines user description: Maps your user id to a Machines user (and wallet). x-mint: href: /api/users/resolve security: - ApiKey: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UserResolveRequest" responses: "200": description: User resolved content: application/json: schema: $ref: "#/components/schemas/UserResolveResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" /partner/v1/sessions: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" post: operationId: api.sessions.create tags: [sessions] summary: Create a short-lived user session token description: Use your API key to mint a scoped, short-lived JWT for agent calls. x-mint: href: /api/sessions security: - ApiKey: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateSessionRequest" responses: "201": description: Session created content: application/json: schema: $ref: "#/components/schemas/CreateSessionResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "409": $ref: "#/components/responses/Conflict" /partner/v1/kyc/schema: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" get: operationId: api.kyc.schema tags: [kyc] summary: Get KYC field requirements x-mint: href: /api/kyc/schema security: - ApiKey: [] responses: "200": description: KYC schema content: application/json: schema: $ref: "#/components/schemas/KycSchemaResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" /partner/v1/kyc/applications: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" post: operationId: api.kyc.submit tags: [kyc] summary: Submit KYC application data x-mint: href: /api/kyc/applications security: - Session: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/KycApplicationCreateRequest" example: firstName: "John" lastName: "Smith" birthDate: "1990-01-01" nationalId: "123456789" countryOfIssue: "US" email: "jsmith@example.com" address: line1: "123 Main St" line2: "Unit 4" city: "New York" region: "NY" postalCode: "10001" countryCode: "US" occupation: "49-3023" annualSalary: "<40k" accountPurpose: "everyday spend" expectedMonthlyVolume: "under $1k" phoneCountryCode: "1" phoneNumber: "4155551234" responses: "201": description: KYC application submitted content: application/json: schema: $ref: "#/components/schemas/KycApplicationResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" /partner/v1/kyc/status: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" get: operationId: api.kyc.status tags: [kyc] summary: Get current KYC status x-mint: href: /api/kyc/status security: - Session: [] responses: "200": description: KYC status content: application/json: schema: $ref: "#/components/schemas/KycApplicationResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" /partner/v1/kyc/values: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" get: operationId: api.kyc.values tags: [kyc] summary: Get KYC field requirements and values description: Field requirements plus occupation codes and allowed ranges for KYC fields. Use `countryOfIssue` from these fields for country-specific agreement handling. x-mint: href: /api/kyc/values security: - Session: [] responses: "200": description: KYC values content: application/json: schema: $ref: "#/components/schemas/KycValuesResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" /partner/v1/agreements: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" get: operationId: api.agreements.list tags: [agreements] summary: Get user agreements description: Returns the agreement text, links, and current acceptance status. x-mint: href: /api/agreements/list security: - Session: [] responses: "200": description: Agreements content: application/json: schema: $ref: "#/components/schemas/AgreementsResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" "409": $ref: "#/components/responses/Conflict" post: operationId: api.agreements.accept tags: [agreements] summary: Accept user agreements description: Marks all agreements as accepted for an approved user. x-mint: href: /api/agreements/accept security: - Session: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AgreementsAcceptRequest" responses: "200": description: Agreements accepted content: application/json: schema: $ref: "#/components/schemas/AgreementsResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" "409": $ref: "#/components/responses/Conflict" /partner/v1/cards: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" get: operationId: api.cards.list tags: [cards] summary: List cards description: Returns cards created by your account only. x-mint: href: /api/cards/list security: - Session: [] parameters: - $ref: "#/components/parameters/Cursor" - $ref: "#/components/parameters/Limit" responses: "200": description: Card list content: application/json: schema: $ref: "#/components/schemas/CardListResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" post: operationId: api.cards.create tags: [cards] summary: Create a card description: Cards are virtual-only. Card labels are optional and can be set with `POST /encryption/encrypt`. Limits are optional. x-mint: href: /api/cards/create security: - Session: [] parameters: - $ref: "#/components/parameters/IdempotencyKey" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CardCreateRequest" responses: "200": description: Idempotent replay content: application/json: schema: $ref: "#/components/schemas/CardResponse" "201": description: Card created content: application/json: schema: $ref: "#/components/schemas/CardResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" /partner/v1/cards/{cardId}: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" get: operationId: api.cards.get tags: [cards] summary: Get card by id x-mint: href: /api/cards/get security: - Session: [] parameters: - $ref: "#/components/parameters/CardId" responses: "200": description: Card content: application/json: schema: $ref: "#/components/schemas/CardResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" patch: operationId: api.cards.update tags: [cards] summary: Update card status, limits, or labels x-mint: href: /api/cards/update security: - Session: [] parameters: - $ref: "#/components/parameters/CardId" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CardUpdateRequest" responses: "200": description: Card updated content: application/json: schema: $ref: "#/components/schemas/CardResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" delete: operationId: api.cards.delete tags: [cards] summary: Delete a card description: Cancels the card immediately. x-mint: href: /api/cards/delete security: - Session: [] parameters: - $ref: "#/components/parameters/CardId" responses: "200": description: Card deleted content: application/json: schema: $ref: "#/components/schemas/CardDeleteResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" /partner/v1/cards/{cardId}/secrets: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" post: operationId: api.cards.secrets.get tags: [cards] summary: Retrieve encrypted card secrets description: Requires a secrets sessionId and cards.secrets.read scope. x-mint: href: /api/cards/secrets security: - Session: [] parameters: - $ref: "#/components/parameters/CardId" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CardSecretsRequest" responses: "200": description: Encrypted card secrets content: application/json: schema: $ref: "#/components/schemas/CardSecretsResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" /partner/v1/cards/secrets/session: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" post: operationId: api.cards.secrets.session tags: [cards] summary: Create a card secrets session description: Returns a short-lived sessionId and secretKey for decrypting card PAN/CVC. x-mint: href: /api/cards/secrets/session security: - Session: [] requestBody: required: false content: application/json: schema: type: object additionalProperties: false description: Optional empty body for clients that require a JSON payload. example: {} responses: "200": description: Card secrets session content: application/json: schema: $ref: "#/components/schemas/CardSecretsSessionResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "503": $ref: "#/components/responses/ServiceUnavailable" /partner/v1/encryption/data-key: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" get: operationId: api.encryption.data_key tags: [encryption] summary: Get the per-user data key description: Use this key to encrypt/decrypt labels with AES-256-GCM. x-mint: href: /api/encryption/data-key security: - Session: [] responses: "200": description: Data key content: application/json: schema: $ref: "#/components/schemas/DataKeyResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "503": $ref: "#/components/responses/ServiceUnavailable" /partner/v1/encryption/encrypt: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" post: operationId: api.encryption.encrypt tags: [encryption] summary: Encrypt plaintext with the data key x-mint: href: /api/encryption/encrypt security: - Session: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/EncryptionEncryptRequest" responses: "200": description: Encrypted value content: application/json: schema: $ref: "#/components/schemas/EncryptionEncryptResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "503": $ref: "#/components/responses/ServiceUnavailable" /partner/v1/encryption/decrypt: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" post: operationId: api.encryption.decrypt tags: [encryption] summary: Decrypt ciphertext with the data key x-mint: href: /api/encryption/decrypt security: - Session: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/EncryptionDecryptRequest" responses: "200": description: Decrypted value content: application/json: schema: $ref: "#/components/schemas/EncryptionDecryptResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "503": $ref: "#/components/responses/ServiceUnavailable" /partner/v1/balances: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" get: operationId: api.balances.get tags: [balances] summary: Get balance details description: Returns credit limit, spending power, and charge totals (all in cents). x-mint: href: /api/balances/get security: - Session: [] responses: "200": description: Balances content: application/json: schema: $ref: "#/components/schemas/BalancesResponse" "401": $ref: "#/components/responses/Unauthorized" "409": $ref: "#/components/responses/Conflict" "503": $ref: "#/components/responses/ServiceUnavailable" /partner/v1/deposits: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" post: operationId: api.deposits.create tags: [deposits] summary: Create a deposit address description: Returns a deposit address for this user. Production uses USDC on Base; sandbox uses rUSD on Base Sepolia. No extra scopes required. x-mint: href: /api/deposits/create security: - Session: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DepositCreateRequest" responses: "201": description: Deposit created content: application/json: schema: $ref: "#/components/schemas/DepositResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "503": $ref: "#/components/responses/ServiceUnavailable" get: operationId: api.deposits.list tags: [deposits] summary: List deposits description: Returns recent deposits, optionally scoped to active ones. No extra scopes required. x-mint: href: /api/deposits/list security: - Session: [] parameters: - $ref: "#/components/parameters/DepositScope" responses: "200": description: Deposit list content: application/json: schema: $ref: "#/components/schemas/DepositListResponse" "401": $ref: "#/components/responses/Unauthorized" "503": $ref: "#/components/responses/ServiceUnavailable" /partner/v1/deposits/assets: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" get: operationId: api.deposits.assets tags: [deposits] summary: List deposit assets description: Returns supported token and network ids for standard partner deposits. Min/max values are not returned by this endpoint. x-mint: href: /api/deposits/assets security: - Session: [] parameters: - $ref: "#/components/parameters/DepositAssetsQuery" - $ref: "#/components/parameters/DepositAssetsLimit" responses: "200": description: Deposit assets content: application/json: schema: $ref: "#/components/schemas/DepositAssetsResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "503": $ref: "#/components/responses/ServiceUnavailable" /partner/v1/deposits/range: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" post: operationId: api.deposits.range tags: [deposits] summary: Get min/max range for a deposit pair description: Returns min/max amount and routing details for a specific `{ currency, network }` pair. x-mint: href: /api/deposits/range security: - Session: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DepositRangeRequest" responses: "200": description: Deposit range content: application/json: schema: $ref: "#/components/schemas/DepositRangeResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "503": $ref: "#/components/responses/ServiceUnavailable" /partner/v1/deposits/estimate: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" post: operationId: api.deposits.estimate tags: [deposits] summary: Estimate deposit receive amount description: Returns estimated collateral receive amount and routing details for a specific `{ currency, network, amount }` input. x-mint: href: /api/deposits/estimate security: - Session: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DepositEstimateRequest" responses: "200": description: Deposit estimate content: application/json: schema: $ref: "#/components/schemas/DepositEstimateResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "503": $ref: "#/components/responses/ServiceUnavailable" /partner/v1/deposits/{depositId}: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" get: operationId: api.deposits.get tags: [deposits] summary: Get a deposit description: Returns the latest status for a deposit intent. No extra scopes required. x-mint: href: /api/deposits/get security: - Session: [] parameters: - $ref: "#/components/parameters/DepositId" responses: "200": description: Deposit content: application/json: schema: $ref: "#/components/schemas/DepositResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" "503": $ref: "#/components/responses/ServiceUnavailable" /partner/v1/transactions: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" get: operationId: api.transactions.list tags: [transactions] summary: List transaction history description: Returns transaction history for the user. Use `type` to filter by one or more transaction types. x-mint: href: /api/transactions/list security: - Session: [] parameters: - $ref: "#/components/parameters/Cursor" - $ref: "#/components/parameters/Limit" - $ref: "#/components/parameters/CardIdQuery" - $ref: "#/components/parameters/TransactionTypeFilter" responses: "200": description: Transactions content: application/json: schema: $ref: "#/components/schemas/TransactionListResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "409": $ref: "#/components/responses/Conflict" "503": $ref: "#/components/responses/ServiceUnavailable" /partner/v1/withdrawals/assets: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" get: operationId: api.withdrawals.assets tags: [withdrawals] summary: List withdrawal destination assets description: Returns destination token/network options. Routes are dynamic and provider-driven; always query this endpoint before quoting. Optional source query fields are accepted as hints. x-mint: href: /api/withdrawals/assets security: - Session: [] parameters: - $ref: "#/components/parameters/WithdrawalSourceChainIdQuery" - $ref: "#/components/parameters/WithdrawalSourceTokenAddressQuery" - $ref: "#/components/parameters/DepositAssetsQuery" - $ref: "#/components/parameters/DepositAssetsLimit" responses: "200": description: Withdrawal assets content: application/json: schema: $ref: "#/components/schemas/WithdrawalAssetsResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "503": $ref: "#/components/responses/ServiceUnavailable" /partner/v1/withdrawals/range: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" post: operationId: api.withdrawals.range tags: [withdrawals] summary: Get min/max range for a withdrawal destination description: Returns min/max and route details for a destination pair. Routes are dynamic and provider-driven. x-mint: href: /api/withdrawals/range security: - Session: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/WithdrawalRangeRequest" responses: "200": description: Withdrawal range content: application/json: schema: $ref: "#/components/schemas/WithdrawalRangeResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "503": $ref: "#/components/responses/ServiceUnavailable" /partner/v1/withdrawals/estimate: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" post: operationId: api.withdrawals.estimate tags: [withdrawals] summary: Estimate withdrawal receive amount description: Returns estimated destination receive amount for a destination pair and amount. Routes are dynamic and provider-driven. x-mint: href: /api/withdrawals/estimate security: - Session: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/WithdrawalEstimateRequest" responses: "200": description: Withdrawal estimate content: application/json: schema: $ref: "#/components/schemas/WithdrawalEstimateResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "503": $ref: "#/components/responses/ServiceUnavailable" /partner/v1/withdrawals: parameters: - $ref: "#/components/parameters/OpenResponses" - $ref: "#/components/parameters/OpenResponsesCallId" post: operationId: api.withdrawals.create tags: [withdrawals] summary: Request a withdrawal signature payload description: Creates a ChangeNOW relay route from the selected source to destination and returns Rain withdrawal signature parameters for onchain execution. x-mint: href: /api/withdrawals/create security: - Session: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/WithdrawalRequest" responses: "200": description: Withdrawal signature payload content: application/json: schema: $ref: "#/components/schemas/WithdrawalResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" components: securitySchemes: ApiKey: type: apiKey in: header name: X-Partner-Key Session: type: http scheme: bearer bearerFormat: JWT parameters: IdempotencyKey: name: Idempotency-Key in: header required: false schema: type: string minLength: 8 maxLength: 128 description: Unique key to prevent duplicate writes. OpenResponses: name: X-Open-Responses in: header required: false schema: type: string enum: ["1", "true"] description: Return Open Responses-compatible output when set (replaces the default response envelope). OpenResponsesCallId: name: X-Open-Responses-Call-Id in: header required: false schema: type: string minLength: 1 description: Tool call id used for function_call_output items when Open Responses mode is enabled. Cursor: name: cursor in: query required: false schema: type: string minLength: 1 description: Cursor returned by the previous page. Limit: name: limit in: query required: false schema: type: integer minimum: 1 maximum: 200 description: Page size (max 200). CardIdQuery: name: cardId in: query required: false schema: type: string format: uuid description: Filter to a specific card id. TransactionTypeFilter: name: type in: query required: false schema: type: string description: Comma-separated transaction types (`spend`, `collateral`, `payment`, `fee`). CardId: name: cardId in: path required: true schema: type: string minLength: 8 description: Machines card id. DepositId: name: depositId in: path required: true schema: type: string minLength: 8 description: Deposit intent id. DepositScope: name: scope in: query required: false schema: type: string enum: [active, all] description: Return recent active deposits (default) or full history. DepositAssetsQuery: name: q in: query required: false schema: type: string description: Optional search query for ticker, name, or network id/label. DepositAssetsLimit: name: limit in: query required: false schema: type: integer minimum: 1 maximum: 100 description: Maximum number of assets to return (max 100). WithdrawalSourceChainIdQuery: name: sourceChainId in: query required: false schema: type: integer minimum: 1 description: Optional source chain hint. Defaults to Base (8453) in production and Base Sepolia in sandbox. WithdrawalSourceTokenAddressQuery: name: sourceTokenAddress in: query required: false schema: $ref: "#/components/schemas/TokenAddress" description: Optional source token hint. Defaults to USDC collateral token in production and rUSD token in sandbox. responses: BadRequest: description: Invalid request content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" Unauthorized: description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" Forbidden: description: Forbidden content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" NotFound: description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" Conflict: description: Conflict content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" ServiceUnavailable: description: Service unavailable content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" schemas: ErrorDetail: type: object additionalProperties: false required: [code, message] properties: code: type: string example: invalid_request message: type: string example: missing required field field: type: string description: Optional field name that caused the error. ErrorResponse: type: object additionalProperties: false required: [ok, summary, errors] properties: ok: type: boolean const: false summary: type: string example: invalid request errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" NextHint: type: object additionalProperties: false properties: pollAfterMs: type: integer minimum: 0 suggestedTool: type: string suggestedArgs: type: object additionalProperties: true EncryptedField: type: object description: Encrypted payload generated by `POST /encryption/encrypt` (recommended). Canonical field order is `v`, `iv`, `ct` (order doesn’t matter in JSON). See `/encryption`. additionalProperties: false required: [v, iv, ct] properties: v: type: integer minimum: 1 maximum: 1000000 description: Schema version. example: 1 iv: type: string description: Base64url-encoded IV (12 bytes). example: "Qz4f2m7Hk1P9x0ab" ct: type: string description: Base64url-encoded ciphertext + auth tag. example: "Hdbb2yT2F4xWZL5m5bJX3eJb4n8wVhjPzqLw2h7i" EncryptedFieldNullable: anyOf: - $ref: "#/components/schemas/EncryptedField" - type: "null" KycValuesResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [fields, occupations, annualSalary, expectedMonthlyVolume, accountPurpose] properties: fields: type: array items: $ref: "#/components/schemas/KycSchemaField" occupations: type: array items: type: object required: [code, label] properties: code: type: string label: type: string annualSalary: type: array items: type: string expectedMonthlyVolume: type: array items: type: string accountPurpose: type: array items: type: string summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" AgreementLink: type: object additionalProperties: false required: [label, url] properties: label: type: string url: type: string Agreement: type: object additionalProperties: false required: [id, text, links] properties: id: type: string text: type: string links: type: array items: $ref: "#/components/schemas/AgreementLink" AgreementsAcceptRequest: type: object additionalProperties: false required: [accepted] properties: accepted: type: boolean const: true description: Must be true to accept all agreements. AgreementsResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [agreements, accepted, acceptedAt] properties: agreements: type: array items: $ref: "#/components/schemas/Agreement" accepted: type: boolean acceptedAt: type: [string, "null"] format: date-time summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" Balances: type: object additionalProperties: false required: [creditLimit, pendingCharges, postedCharges, balanceDue, spendingPower] properties: creditLimit: type: [number, "null"] description: Credit limit in cents. pendingCharges: type: [number, "null"] description: Pending charges in cents. postedCharges: type: [number, "null"] description: Posted charges in cents. balanceDue: type: [number, "null"] description: Balance due in cents. spendingPower: type: [number, "null"] description: Available spending power in cents. BalancesResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [balances] properties: balances: $ref: "#/components/schemas/Balances" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" TransactionType: type: string enum: [spend, collateral, payment, fee] Transaction: type: object additionalProperties: false required: [transactionId, type, status, amountCents, currency, createdAt] properties: transactionId: type: string type: $ref: "#/components/schemas/TransactionType" status: type: string amountCents: type: integer currency: type: string merchantName: type: string cardId: type: string createdAt: type: string format: date-time TransactionListResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [transactions] properties: transactions: type: array items: $ref: "#/components/schemas/Transaction" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" WalletAddress: type: string pattern: "^0x[a-fA-F0-9]{40}$" example: "0x2b0f7f2f7c8e4c3d2d3b3f6a8f9b0c1d2e3f4a5b" TokenAddress: type: string pattern: "^0x[a-fA-F0-9]{40}$" example: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" UserResolveRequest: type: object additionalProperties: false required: [userId] properties: userId: type: string minLength: 1 maxLength: 120 description: Your unique id for this user. example: user-123 walletAddress: $ref: "#/components/schemas/WalletAddress" walletLabel: type: string maxLength: 120 description: Optional label for display. example: Main Wallet User: type: object additionalProperties: false required: [userId, walletAddress, kycStatus, createdAt] properties: userId: type: string description: Your user id. walletAddress: type: [string, "null"] kycStatus: $ref: "#/components/schemas/KycStatus" createdAt: type: string format: date-time UserResolveResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: $ref: "#/components/schemas/User" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" CreateSessionRequest: type: object additionalProperties: false required: [userId, scopes] properties: userId: type: string minLength: 1 maxLength: 120 description: Your user id (must match users.resolve). example: user-123 walletAddress: $ref: "#/components/schemas/WalletAddress" scopes: type: array minItems: 1 description: Scopes to grant to the session token. Deposits and balances do not require extra scopes. example: [kyc.read, kyc.write] items: type: string enum: - users.read - users.write - kyc.read - kyc.write - cards.read - cards.write - cards.secrets.read - encryption.read - encryption.write - deposits.read - deposits.write - transactions.read - withdrawals.write ttlSeconds: type: integer minimum: 60 maximum: 86400 description: Time-to-live in seconds (default 900). example: 900 sessionLabel: type: string maxLength: 120 description: Optional label for auditing. SessionToken: type: object additionalProperties: false required: [sessionToken, sessionId, userId, expiresAt, scopes] properties: sessionToken: type: string description: Bearer token for agent calls. sessionId: type: string userId: type: string description: Your user id. expiresAt: type: string format: date-time scopes: type: array items: type: string CreateSessionResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: $ref: "#/components/schemas/SessionToken" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" KycStatus: type: string enum: [not_submitted, pending, approved, denied, locked, canceled, needs_information, needs_verification, manual_review] KycSchemaField: type: object additionalProperties: false required: [name, required, type] properties: name: type: string required: type: boolean type: type: string maxLength: type: integer minLength: type: integer regex: type: string enum: type: array items: type: string description: type: string KycSchemaResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [fields] properties: fields: type: array items: $ref: "#/components/schemas/KycSchemaField" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" KycAddress: type: object additionalProperties: false required: [line1, city, region, postalCode, countryCode] properties: line1: type: string example: "123 Main St" line2: type: string example: "Unit 4" city: type: string example: "New York" region: type: string example: "NY" postalCode: type: string example: "10001" countryCode: type: string minLength: 2 maxLength: 2 description: ISO-3166-1 alpha-2 country code (e.g., US). Case-insensitive. example: "US" KycApplicationCreateRequest: type: object additionalProperties: false required: - firstName - lastName - birthDate - nationalId - countryOfIssue - email - address - occupation - annualSalary - accountPurpose - expectedMonthlyVolume properties: firstName: type: string maxLength: 50 lastName: type: string maxLength: 50 birthDate: type: string description: YYYY-MM-DD example: 1990-01-01 nationalId: type: string countryOfIssue: type: string minLength: 2 maxLength: 2 description: ISO-3166-1 alpha-2 country code (e.g., US). Case-insensitive. example: "US" email: type: string format: email example: "jsmith@example.com" address: $ref: "#/components/schemas/KycAddress" phoneCountryCode: type: string maxLength: 3 description: Country calling code digits only (e.g., 1). example: "1" phoneNumber: type: string maxLength: 15 description: Phone number digits only (include area code). example: "4155551234" occupation: type: string description: SOC occupation code (e.g., 49-3023). See GET /kyc/values. example: "49-3023" annualSalary: type: string enum: ["<40k", "50k–99k", "100k–149k", "150k+"] example: "<40k" accountPurpose: type: string enum: ["everyday spend", "subscriptions", "business expenses", "testing", "other"] example: "everyday spend" expectedMonthlyVolume: type: string enum: ["under $1k", "$1k–$5k", "$5k–$20k", "$20k+"] example: "under $1k" KycApplication: type: object additionalProperties: false required: [status, isTermsOfServiceAccepted] properties: status: $ref: "#/components/schemas/KycStatus" reason: type: [string, "null"] completionLink: type: [string, "null"] externalVerificationLink: type: [string, "null"] isActive: type: [boolean, "null"] isTermsOfServiceAccepted: type: boolean KycApplicationResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: $ref: "#/components/schemas/KycApplication" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" CardStatus: type: string enum: [active, locked, canceled, not_activated] CardLimitFrequency: type: string enum: [perAuthorization, per24HourPeriod, per7DayPeriod, per30DayPeriod, perYearPeriod, allTime] CardLimit: type: object additionalProperties: false required: [amountCents, frequency] properties: amountCents: type: integer minimum: 1 description: Limit amount in cents. example: 5000 frequency: $ref: "#/components/schemas/CardLimitFrequency" Card: type: object additionalProperties: false required: - cardId - status - last4 - expirationMonth - expirationYear - encryptedName - isPinned - sortOrder - createdAt properties: cardId: type: string status: $ref: "#/components/schemas/CardStatus" brand: type: string example: VISA last4: type: string expirationMonth: type: integer expirationYear: type: integer limit: anyOf: - $ref: "#/components/schemas/CardLimit" - type: "null" encryptedName: $ref: "#/components/schemas/EncryptedFieldNullable" encryptedColor: $ref: "#/components/schemas/EncryptedFieldNullable" encryptedEmoji: $ref: "#/components/schemas/EncryptedFieldNullable" encryptedMemo: $ref: "#/components/schemas/EncryptedFieldNullable" folderId: type: [string, "null"] contractId: type: [string, "null"] isPinned: type: boolean sortOrder: type: integer createdAt: type: string format: date-time CardCreateRequest: type: object additionalProperties: false properties: encryptedName: allOf: - $ref: "#/components/schemas/EncryptedField" description: Optional encrypted card label. Generate with `POST /encryption/encrypt`. encryptedColor: allOf: - $ref: "#/components/schemas/EncryptedField" description: Optional encrypted card color. Generate with `POST /encryption/encrypt`. encryptedEmoji: allOf: - $ref: "#/components/schemas/EncryptedField" description: Optional encrypted card emoji. Generate with `POST /encryption/encrypt`. encryptedMemo: allOf: - $ref: "#/components/schemas/EncryptedField" description: Optional encrypted card memo. Generate with `POST /encryption/encrypt`. limit: $ref: "#/components/schemas/CardLimit" folderId: type: string isPinned: type: boolean sortOrder: type: integer example: limit: amountCents: 2500 frequency: perAuthorization CardUpdateRequest: type: object additionalProperties: false minProperties: 1 properties: status: $ref: "#/components/schemas/CardStatus" limit: $ref: "#/components/schemas/CardLimit" encryptedName: allOf: - $ref: "#/components/schemas/EncryptedField" description: Optional encrypted card label. Generate with `POST /encryption/encrypt`. encryptedColor: allOf: - $ref: "#/components/schemas/EncryptedField" description: Optional encrypted card color. Generate with `POST /encryption/encrypt`. encryptedEmoji: allOf: - $ref: "#/components/schemas/EncryptedField" description: Optional encrypted card emoji. Generate with `POST /encryption/encrypt`. encryptedMemo: allOf: - $ref: "#/components/schemas/EncryptedField" description: Optional encrypted card memo. Generate with `POST /encryption/encrypt`. folderId: type: [string, "null"] isPinned: type: boolean sortOrder: type: integer example: status: locked CardResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: $ref: "#/components/schemas/Card" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" CardListResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [cards] properties: cards: type: array items: $ref: "#/components/schemas/Card" nextCursor: type: string summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" CardDeleteResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [cardId, status, deletedAt] properties: cardId: type: string status: $ref: "#/components/schemas/CardStatus" deletedAt: type: string format: date-time summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" CardSecretsRequest: type: object additionalProperties: false required: [sessionId] properties: sessionId: type: string description: SessionId returned from the secrets session helper. CardSecretsSession: type: object additionalProperties: false required: [sessionId, secretKey] properties: sessionId: type: string description: SessionId used to fetch encrypted PAN/CVC. secretKey: type: string description: 16-byte secret (hex) used to decrypt PAN/CVC (AES-128-GCM). CardSecretsSessionResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: $ref: "#/components/schemas/CardSecretsSession" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" CardSecretBlob: type: object additionalProperties: false required: [data, iv] properties: data: type: string description: Base64-encoded ciphertext + auth tag. iv: type: string description: Base64-encoded IV. CardSecrets: type: object additionalProperties: false required: [encryptedPan, encryptedCvc, expirationMonth, expirationYear, last4] properties: encryptedPan: $ref: "#/components/schemas/CardSecretBlob" encryptedCvc: $ref: "#/components/schemas/CardSecretBlob" expirationMonth: type: integer expirationYear: type: integer last4: type: string brand: type: string keyId: type: string CardSecretsResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: $ref: "#/components/schemas/CardSecrets" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" DataKeyResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [dataKey] properties: dataKey: type: string description: Base64url-encoded 32-byte key. summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" EncryptionEncryptRequest: type: object additionalProperties: false required: [value] properties: value: type: string description: Plaintext value to encrypt. example: value: "Ops Card" EncryptionEncryptResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [value] properties: value: $ref: "#/components/schemas/EncryptedField" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" EncryptionDecryptRequest: type: object additionalProperties: false required: [value] properties: value: allOf: - $ref: "#/components/schemas/EncryptedField" description: Encrypted payload from `POST /encryption/encrypt`. example: value: v: 1 iv: "Qz4f2m7Hk1P9x0ab" ct: "Hdbb2yT2F4xWZL5m5bJX3eJb4n8wVhjPzqLw2h7i" EncryptionDecryptResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [value] properties: value: type: string summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" DepositStatus: type: string enum: [pending, awaitingDeposit, processing, completed, failed, canceled] DepositCreateRequest: type: object additionalProperties: false required: [currency, network] properties: currency: type: string description: Asset ticker. Production uses usdc; sandbox uses rusd. example: usdc network: type: string description: Network slug. Production uses base; sandbox uses base (Base Sepolia). example: base amount: type: number exclusiveMinimum: 0 description: Optional amount to deposit. optional. DepositAssetNetwork: type: object additionalProperties: false required: [id, label] properties: id: type: string description: Network id to pass as `network` in deposit requests. label: type: string description: Human-readable network label. chainId: type: [integer, "null"] tokenContract: type: [string, "null"] DepositAsset: type: object additionalProperties: false required: [ticker, name, icon, networks] properties: ticker: type: string description: Token ticker to pass as `currency` in deposit requests. name: type: string icon: type: [string, "null"] networks: type: array items: $ref: "#/components/schemas/DepositAssetNetwork" DepositAssetsResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [assets] properties: assets: type: array items: $ref: "#/components/schemas/DepositAsset" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" DepositRangeRequest: type: object additionalProperties: false required: [currency, network] properties: currency: type: string description: Token ticker from `GET /partner/v1/deposits/assets`. example: usdc network: type: string description: Network id from `GET /partner/v1/deposits/assets`. example: base DepositRange: type: object additionalProperties: false required: - fromCurrency - fromNetwork - toCurrency - toNetwork - contractId - payoutAddress - payoutChainId - minAmount - maxAmount properties: fromCurrency: type: string fromNetwork: type: string toCurrency: type: string toNetwork: type: string contractId: type: string payoutAddress: type: string payoutChainId: type: [integer, "null"] minAmount: type: [number, "null"] maxAmount: type: [number, "null"] DepositRangeResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [range] properties: range: $ref: "#/components/schemas/DepositRange" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" DepositEstimateRequest: type: object additionalProperties: false required: [currency, network, amount] properties: currency: type: string description: Token ticker from `GET /partner/v1/deposits/assets`. example: hbar network: type: string description: Network id from `GET /partner/v1/deposits/assets`. example: hbar amount: type: number exclusiveMinimum: 0 amountCurrency: type: string enum: [crypto, usd] description: Quote input amount mode. Defaults to `crypto`. DepositEstimate: type: object additionalProperties: false required: - fromCurrency - fromNetwork - toCurrency - toNetwork - contractId - payoutAddress - payoutChainId - quotedAmount - quotedAmountCurrency - estimatedToAmount - minAmount - maxAmount - rateId properties: fromCurrency: type: string fromNetwork: type: string toCurrency: type: string toNetwork: type: string contractId: type: string payoutAddress: type: string payoutChainId: type: [integer, "null"] quotedAmount: type: number quotedAmountCurrency: type: string enum: [crypto, usd] estimatedToAmount: type: [number, "null"] minAmount: type: [number, "null"] maxAmount: type: [number, "null"] rateId: type: [string, "null"] DepositEstimateResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [estimate] properties: estimate: $ref: "#/components/schemas/DepositEstimate" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" Deposit: type: object additionalProperties: false required: - id - contractId - changeNowId - fromCurrency - fromNetwork - depositAddress - payinExtraId - chainId - minAmount - maxAmount - status - createdAt - updatedAt properties: id: type: string contractId: type: string changeNowId: type: [string, "null"] description: Provider order id (nullable). fromCurrency: type: string fromNetwork: type: string minAmount: type: [number, "null"] maxAmount: type: [number, "null"] depositAddress: type: [string, "null"] description: Address to send funds (USDC on Base in production). payinExtraId: type: [string, "null"] description: Optional memo/tag required by some deposit networks. chainId: type: [number, "null"] description: Chain id for the deposit network. status: $ref: "#/components/schemas/DepositStatus" createdAt: type: string format: date-time updatedAt: type: string format: date-time DepositResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [deposit] properties: deposit: $ref: "#/components/schemas/Deposit" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" DepositListResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [deposits] properties: deposits: type: array items: $ref: "#/components/schemas/Deposit" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" WithdrawalRequest: type: object additionalProperties: false required: [amountCents, destination] properties: amountCents: type: integer minimum: 1 description: Amount in cents. source: $ref: "#/components/schemas/WithdrawalSource" destination: $ref: "#/components/schemas/WithdrawalDestination" adminAddress: $ref: "#/components/schemas/WalletAddress" WithdrawalSource: type: object additionalProperties: false properties: chainId: type: integer minimum: 1 description: Optional source chain hint. Defaults to Base (8453) in production and Base Sepolia in sandbox. tokenAddress: $ref: "#/components/schemas/TokenAddress" description: Optional source token hint. Defaults to USDC collateral token in production and rUSD token in sandbox. contractId: type: [string, "null"] format: uuid WithdrawalDestination: type: object additionalProperties: false required: [currency, network, address] properties: currency: type: string example: hbar network: type: string example: hbar address: type: string minLength: 1 maxLength: 200 description: Destination payout address for ChangeNOW. extraId: type: [string, "null"] description: Optional destination memo/tag for payout networks that require it. WithdrawalDestinationQuote: type: object additionalProperties: false required: [currency, network] properties: currency: type: string example: hbar network: type: string example: hbar extraId: type: [string, "null"] description: Optional destination memo/tag for payout networks that require it. WithdrawalAssetNetwork: type: object additionalProperties: false required: [id, label, supportsExtraId] properties: id: type: string label: type: string chainId: type: [integer, "null"] tokenContract: type: [string, "null"] supportsExtraId: type: boolean WithdrawalAsset: type: object additionalProperties: false required: [ticker, name, icon, networks] properties: ticker: type: string name: type: string icon: type: [string, "null"] networks: type: array items: $ref: "#/components/schemas/WithdrawalAssetNetwork" WithdrawalAssetsResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [assets] properties: assets: type: array items: $ref: "#/components/schemas/WithdrawalAsset" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" WithdrawalRangeRequest: type: object additionalProperties: false required: [destination] properties: source: $ref: "#/components/schemas/WithdrawalSource" destination: $ref: "#/components/schemas/WithdrawalDestinationQuote" WithdrawalRange: type: object additionalProperties: false required: - fromCurrency - fromNetwork - toCurrency - toNetwork - minAmount - maxAmount - minAmountCents - maxAmountCents - destinationSupportsExtraId properties: fromCurrency: type: string fromNetwork: type: string toCurrency: type: string toNetwork: type: string minAmount: type: [number, "null"] maxAmount: type: [number, "null"] minAmountCents: type: [integer, "null"] maxAmountCents: type: [integer, "null"] destinationSupportsExtraId: type: boolean WithdrawalRangeResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [range] properties: range: $ref: "#/components/schemas/WithdrawalRange" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" WithdrawalEstimateRequest: type: object additionalProperties: false required: [destination, amountCents] properties: source: $ref: "#/components/schemas/WithdrawalSource" destination: $ref: "#/components/schemas/WithdrawalDestinationQuote" amountCents: type: integer minimum: 1 WithdrawalEstimate: type: object additionalProperties: false required: - fromCurrency - fromNetwork - toCurrency - toNetwork - minAmount - maxAmount - minAmountCents - maxAmountCents - destinationSupportsExtraId - fromAmount - fromAmountCents - estimatedToAmount - rateId - destinationExtraId properties: fromCurrency: type: string fromNetwork: type: string toCurrency: type: string toNetwork: type: string minAmount: type: [number, "null"] maxAmount: type: [number, "null"] minAmountCents: type: [integer, "null"] maxAmountCents: type: [integer, "null"] destinationSupportsExtraId: type: boolean fromAmount: type: number fromAmountCents: type: integer estimatedToAmount: type: [number, "null"] rateId: type: [string, "null"] destinationExtraId: type: [string, "null"] WithdrawalEstimateResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: type: object additionalProperties: false required: [estimate] properties: estimate: $ref: "#/components/schemas/WithdrawalEstimate" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" WithdrawalRelay: type: object additionalProperties: false required: - changeNowId - payinAddress - payinExtraId - payoutAddress - payoutExtraId - fromCurrency - fromNetwork - toCurrency - toNetwork properties: changeNowId: type: string payinAddress: type: string payinExtraId: type: [string, "null"] payoutAddress: type: string payoutExtraId: type: [string, "null"] fromCurrency: type: string fromNetwork: type: string toCurrency: type: string toNetwork: type: string WithdrawalPayload: type: object additionalProperties: false required: [status] properties: status: type: string enum: [pending, ready] retryAfterSeconds: type: [integer, "null"] parameters: type: [array, "null"] items: type: string execution: anyOf: - $ref: "#/components/schemas/WithdrawalExecution" - type: "null" relay: anyOf: - $ref: "#/components/schemas/WithdrawalRelay" - type: "null" signature: anyOf: - $ref: "#/components/schemas/WithdrawalSignature" - type: "null" expiresAt: type: [string, "null"] format: date-time WithdrawalExecution: type: object additionalProperties: false required: - contractId - contractVersion - chainId - collateralProxyAddress - controllerAddress - coordinatorAddress - callTarget - callPath properties: contractId: type: [string, "null"] contractVersion: type: [integer, "null"] chainId: type: [integer, "null"] collateralProxyAddress: type: [string, "null"] controllerAddress: type: [string, "null"] coordinatorAddress: type: [string, "null"] callTarget: type: [string, "null"] callPath: type: string enum: [controller_v1, coordinator_v2, unknown] WithdrawalSignature: type: object additionalProperties: false properties: data: type: [string, "null"] salt: type: [string, "null"] parameters: type: array items: type: string WithdrawalResponse: type: object additionalProperties: false required: [ok, data, summary, errors] properties: ok: type: boolean const: true data: $ref: "#/components/schemas/WithdrawalPayload" summary: type: string errors: type: array items: $ref: "#/components/schemas/ErrorDetail" next: $ref: "#/components/schemas/NextHint" ```` ## Supporting script (password-gate.js) ````js // Client-side password gate (deterrent only; not real access control). (function () { var PASSWORD = "machines"; // case-insensitive check var STORAGE_KEY = "machines_docs_pw_ok_v1"; var storage = null; var hasAccessInMemory = false; var prevHtmlOverflow = ""; var prevBodyOverflow = ""; try { storage = window.localStorage; } catch (e) { storage = null; } if (!storage) { try { storage = window.sessionStorage; } catch (e2) { storage = null; } } function hasAccess() { if (storage) { try { return storage.getItem(STORAGE_KEY) === "1"; } catch (e) { return hasAccessInMemory; } } return hasAccessInMemory; } function setAccess() { hasAccessInMemory = true; if (storage) { try { storage.setItem(STORAGE_KEY, "1"); } catch (e) { // Ignore storage errors; in-memory flag still allows current session. } } } function lockScroll(lock) { if (lock) { prevHtmlOverflow = document.documentElement.style.overflow || ""; prevBodyOverflow = document.body.style.overflow || ""; document.documentElement.style.overflow = "hidden"; document.body.style.overflow = "hidden"; } else { document.documentElement.style.overflow = prevHtmlOverflow; document.body.style.overflow = prevBodyOverflow; } } function createStyles() { var style = document.createElement("style"); style.setAttribute("data-password-gate", "true"); style.textContent = "#password-gate{position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;background:rgba(8,10,12,.78);backdrop-filter:saturate(120%) blur(6px);}" + "#password-gate .pg-card{width:min(420px,92vw);background:#ffffff;color:#111827;border-radius:14px;padding:24px 22px 20px;box-shadow:0 12px 40px rgba(0,0,0,.35);font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;}" + "#password-gate .pg-title{font-size:20px;font-weight:700;margin:0 0 6px;}" + "#password-gate .pg-sub{font-size:13px;line-height:1.45;margin:0 0 14px;color:#4b5563;}" + "#password-gate .pg-form{display:flex;gap:10px;align-items:center;}" + "#password-gate .pg-input{flex:1;border:1px solid #e5e7eb;border-radius:10px;padding:10px 12px;font-size:14px;outline:none;}" + "#password-gate .pg-input:focus{border-color:#111827;box-shadow:0 0 0 3px rgba(17,24,39,.12);}" + "#password-gate .pg-button{border:0;border-radius:10px;padding:10px 14px;font-size:14px;font-weight:600;background:#111827;color:#fff;cursor:pointer;}" + "#password-gate .pg-button:hover{background:#0b1220;}" + "#password-gate .pg-error{margin-top:10px;font-size:13px;color:#b91c1c;min-height:16px;}"; return style; } function showGate() { if (document.getElementById("password-gate")) return; var overlay = document.createElement("div"); overlay.id = "password-gate"; var card = document.createElement("div"); card.className = "pg-card"; var title = document.createElement("div"); title.className = "pg-title"; title.textContent = "Password required"; var sub = document.createElement("div"); sub.className = "pg-sub"; sub.textContent = "contact help@machines.cash"; var form = document.createElement("form"); form.className = "pg-form"; form.setAttribute("autocomplete", "off"); var input = document.createElement("input"); input.className = "pg-input"; input.type = "password"; input.name = "password"; input.placeholder = "Enter password"; input.setAttribute("aria-label", "Password"); var button = document.createElement("button"); button.className = "pg-button"; button.type = "submit"; button.textContent = "Unlock"; var error = document.createElement("div"); error.className = "pg-error"; error.setAttribute("aria-live", "polite"); form.appendChild(input); form.appendChild(button); form.addEventListener("submit", function (event) { event.preventDefault(); var attempt = (input.value || "").trim().toLowerCase(); if (!attempt) { error.textContent = "Please enter a password."; return; } if (attempt === PASSWORD) { setAccess(); lockScroll(false); overlay.remove(); input.value = ""; return; } error.textContent = "Incorrect password."; input.focus(); input.select(); }); input.addEventListener("input", function () { if (error.textContent) error.textContent = ""; }); card.appendChild(title); card.appendChild(sub); card.appendChild(form); card.appendChild(error); overlay.appendChild(card); document.head.appendChild(createStyles()); document.body.appendChild(overlay); lockScroll(true); setTimeout(function () { input.focus(); }, 0); } function init() { if (hasAccess()) return; if (!document.body) { setTimeout(init, 50); return; } showGate(); } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", init); } else { init(); } })(); ```` ## Assets (binary files; not inlined) - favicon.ico - logo-dark.svg - logo-light.svg - machines-wordmark.svg ````` # Openfort Source: https://docs.machines.cash/partners/openfort Integrate Machines Partner API with Openfort embedded wallets. Check out working demo: [Live Demo](https://openfort-machines-cards-demo.vercel.app/)\ Repo: [openfort-machines-cards-example](https://github.com/machines-cash/openfort-machines-cards-example) [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fmachines-cash%2Fopenfort-machines-cards-example) This guide is for partners already using Openfort embedded wallets. Scope: * Partner API integration (`/partner/v1`) only. * Openfort for auth + embedded wallet UX. * Your backend holds partner credentials and calls Machines. * Simple EVM-first flow for create card, deposits, and withdrawals. ## Architecture * Frontend uses Openfort for sign-in and embedded wallet creation. * Frontend calls your backend only. * Your backend calls Machines Partner API. * Your backend executes withdrawal transactions with the signer path you control. ```mermaid theme={null} sequenceDiagram participant User as User participant Frontend as Partner App (Frontend) participant Backend as Partner App (Backend) participant Openfort as Openfort participant Machines as Machines Partner API participant Chain as Blockchain User->>Frontend: Sign in with email Frontend->>Openfort: Create embedded wallet Frontend->>Backend: POST /api/machines/session Backend->>Machines: POST /partner/v1/users/resolve Backend->>Machines: POST /partner/v1/sessions Backend-->>Frontend: partner session token Frontend->>Backend: KYC/cards/deposits/withdrawals requests Backend->>Machines: Partner API calls Backend->>Chain: send withdrawal tx when needed ``` ## Prerequisites * Openfort project with: * publishable key for frontend * secret key for backend routes that call Openfort server APIs * embedded wallet (Shield) key configured * policy id configured for sponsored transactions * Machines partner API key * A backend service that can securely store: * `X-Partner-Key` * Openfort server credentials ## Openfort Embedded Wallet Checklist Before sending traffic: 1. Wallet creation * New users get an embedded EVM wallet at login. * You can read the wallet address after auth. 2. Stable mapping * You persist partner `userId` + Openfort user id + wallet address. * You always send the same mapped user identity to Machines. 3. Session bootstrap server-side * `POST /partner/v1/users/resolve` and `POST /partner/v1/sessions` happen on your backend. * `X-Partner-Key` is never exposed to browser code. 4. Browser request path * Browser calls your backend routes, not Machines directly. * This avoids CORS failures and secret leakage. 5. Gas sponsorship * Openfort policy id is configured and attached for EVM sends. * Use sponsored send options for wallet execution paths where required. ## Recommended Data to Persist Per user: * `machinesUserId` * `openfortUserId` * `embeddedWalletAddress` * `linkedAt` / `lastUsedAt` Per session: * `sessionId` * `scopes` * `expiresAt` Per withdrawal execution: * idempotency key * execution path (`controller_v1` or `coordinator_v2`) * submitted tx hash * confirmed tx hash ## End-to-End Partner Flow ### 1) Set up Openfort providers (frontend) ```tsx theme={null} "use client"; import { AuthProvider, OpenfortProvider } from "@openfort/react"; export function Providers({ children }: { children: React.ReactNode }) { return ( {children} ); } ``` ### 2) Resolve user + create partner session (backend) ```ts theme={null} import { NextRequest, NextResponse } from "next/server"; const MACHINES_BASE_URL = process.env.MACHINES_PARTNER_BASE_URL || "https://dev-api.machines.cash/partner/v1"; export async function POST(req: NextRequest) { const { externalUserId, walletAddress } = await req.json(); const resolveRes = await fetch(`${MACHINES_BASE_URL}/users/resolve`, { method: "POST", headers: { "Content-Type": "application/json", "X-Partner-Key": process.env.MACHINES_PARTNER_API_KEY!, }, body: JSON.stringify({ userId: externalUserId, wallet: { chain: "evm", address: walletAddress }, walletLabel: "Openfort Embedded Wallet", }), }); if (!resolveRes.ok) { return NextResponse.json({ ok: false, error: "resolve_failed" }, { status: 502 }); } const sessionRes = await fetch(`${MACHINES_BASE_URL}/sessions`, { method: "POST", headers: { "Content-Type": "application/json", "X-Partner-Key": process.env.MACHINES_PARTNER_API_KEY!, }, body: JSON.stringify({ userId: externalUserId, wallet: { chain: "evm", address: walletAddress }, scopes: [ "kyc.read", "kyc.write", "agreements.read", "agreements.write", "cards.read", "cards.write", "deposits.read", "deposits.write", "withdrawals.read", "withdrawals.write", "transactions.read", ], ttlSeconds: 900, }), }); const payload = await sessionRes.json(); if (!sessionRes.ok || !payload?.ok) { return NextResponse.json({ ok: false, error: "session_failed", payload }, { status: 502 }); } return NextResponse.json({ ok: true, sessionToken: payload.data.sessionToken, sessionId: payload.data.sessionId, expiresAt: payload.data.expiresAt, }); } ``` ### 3) Call Machines through your backend proxy Use the partner session token from step 2. At minimum, support these routes: * `GET /partner/v1/kyc/values` * `POST /partner/v1/kyc/applications` * `GET /partner/v1/kyc/status` * `GET /partner/v1/agreements` * `POST /partner/v1/agreements` * `GET /partner/v1/cards` * `POST /partner/v1/cards` * `GET /partner/v1/deposits/assets` * `POST /partner/v1/deposits/range` * `POST /partner/v1/deposits/estimate` * `POST /partner/v1/deposits` * `GET /partner/v1/transactions` ### 4) Create withdrawals Call sequence: 1. `GET /partner/v1/withdrawals/assets` 2. `POST /partner/v1/withdrawals/range` 3. `POST /partner/v1/withdrawals/estimate` 4. `POST /partner/v1/withdrawals` Create request example: ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/withdrawals \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ' \ --header 'Idempotency-Key: wdrl-001' \ --data '{ "amountCents": 2500, "source": { "contractId": "optional-uuid" }, "destination": { "currency": "hbar", "network": "hbar", "address": "0.0.123456", "extraId": "optional-tag" }, "adminAddress": "0xabc..." }' ``` ### 5) Execute withdrawal transaction Use response fields: * `execution.callTarget` * `execution.callPath` * `parameters` Rules: * send tx to `execution.callTarget` * sender must match `adminAddress` used in create request * if status is `pending`, retry create with the same idempotency key ## Execution Model and Contract Call Paths Machines withdrawal create response includes: * `execution.callTarget` * `execution.callPath` (`controller_v1` or `coordinator_v2`) * `parameters` (7-arg withdrawal payload) Send to `execution.callTarget` using the signer you control. * `controller_v1`: * call `withdrawAsset(address,address,uint256,address,uint256,bytes32,bytes)` * `coordinator_v2`: * build admin typed-data signature * call 10-arg `withdrawAsset(...)` with admin signature arrays ## Environment Variables Frontend: * `NEXT_PUBLIC_OPENFORT_PUBLISHABLE_KEY` * `NEXT_PUBLIC_OPENFORT_SHIELD_PUBLISHABLE_KEY` * `NEXT_PUBLIC_OPENFORT_POLICY_ID` * `NEXT_PUBLIC_OPENFORT_DEFAULT_CHAIN` Backend: * `MACHINES_PARTNER_BASE_URL` * `MACHINES_PARTNER_API_KEY` * `MACHINES_PARTNER_DEFAULT_SCOPES` * `MACHINES_PARTNER_EXTERNAL_USER_PREFIX` * Openfort server credentials for your execution routes ## API Routes Used User/session: * `POST /partner/v1/users/resolve` * `POST /partner/v1/sessions` KYC: * `GET /partner/v1/kyc/values` * `POST /partner/v1/kyc/applications` * `GET /partner/v1/kyc/status` Agreements: * `GET /partner/v1/agreements` * `POST /partner/v1/agreements` Cards: * `GET /partner/v1/cards` * `POST /partner/v1/cards` * `POST /partner/v1/cards/secrets/session` * `POST /partner/v1/cards/{cardId}/secrets` Deposits: * `GET /partner/v1/deposits/assets` * `POST /partner/v1/deposits/range` * `POST /partner/v1/deposits/estimate` * `POST /partner/v1/deposits` Withdrawals: * `GET /partner/v1/withdrawals/assets` * `POST /partner/v1/withdrawals/range` * `POST /partner/v1/withdrawals/estimate` * `POST /partner/v1/withdrawals` Transactions: * `GET /partner/v1/transactions` * `GET /partner/v1/transactions/{transactionId}` ## Notes * Keep all partner calls server-side. * Keep idempotency keys stable on retries. * Keep one wallet mapping per user to avoid identity drift. # Privy Source: https://docs.machines.cash/partners/privy Integrate Machines Partner API with Privy embedded wallets for server-managed signing. Check out working demo: [Live Demo](https://privy-machines-cards-demo.vercel.app/)\ Repo: [privy-machines-cards-example](https://github.com/machines-cash/privy-machines-cards-example) [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fmachines-cash%2Fprivy-machines-cards-example) This guide is for partners already using Privy embedded wallets. Scope: * Partner API integration (`/partner/v1`) only. * Server-side Privy wallet control for signing and sending transactions. * Not a guide for Machines first-party web auth endpoints like `/v1/auth/email/exchange`. ## Architecture * Your backend calls Machines Partner API. * Your backend also calls Privy server APIs for embedded wallet signing/transaction execution. * End users do not need wallet popups for embedded-wallet withdrawal execution paths. ```mermaid theme={null} sequenceDiagram participant App as Partner App Backend participant Machines as Machines Partner API participant Privy as Privy Wallet API participant Chain as Blockchain App->>Machines: POST /partner/v1/users/resolve App->>Machines: POST /partner/v1/sessions App->>Machines: POST /partner/v1/withdrawals Machines-->>App: withdrawal + execution(callTarget, callPath) App->>Privy: sign typed data (v2 path only) App->>Privy: eth_sendTransaction (to execution.callTarget) Privy-->>App: transactionId/hash Chain-->>App: confirmed tx ``` ## Prerequisites * Privy app configured for your environment. * Privy embedded Ethereum wallets enabled. * Privy authorization key configured for server-side wallet access. * Machines partner API key. * Partner backend can securely store: * Machines partner key * Privy app secret * Privy authorization private key ## Privy Embedded Wallet Checklist (Server-Side) Before sending live traffic, confirm: 1. Wallet control path * You can resolve each user’s Privy embedded Ethereum wallet. * Your backend can sign/send on that wallet using an authorization context (authorization key, user JWT, or a custom sign function). 2. Signer binding * The wallet is configured with a signer path your backend can use (for example an authorization-key signer). * The authorization private key is in a secrets manager, never in client code. 3. Policy attachment * Policy IDs for withdrawal execution are attached to the signer/wallet. * Rules cover `eth_sendTransaction` and `eth_signTypedData_v4`. 4. Sponsorship setup * Gas sponsorship is enabled in Privy Dashboard for the chains you support. * Your backend passes `sponsor: true` for sponsored sends. 5. Status monitoring * You have webhook or polling support for transaction status reconciliation. ## Recommended Data to Persist Per user, persist at least: * `machinesUserId` (your Machines partner user mapping) * `privyUserId` (Privy user id) * `embeddedWalletAddress` (and `walletId` if you store it) * `linkedAt` / `lastUsedAt` Per execution, persist: * partner idempotency key * Privy `transaction_id` / user operation hash (if returned) * final onchain `transaction_hash` * execution path (`controller_v1` or `coordinator_v2`) ## End-to-End Partner Flow ### 1) Resolve or link the user Call `POST /partner/v1/users/resolve` from your backend. ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/users/resolve \ --header 'Content-Type: application/json' \ --header 'X-Partner-Key: ' \ --data '{ "userId": "partner-user-123", "walletAddress": "0xabc...", "walletLabel": "Privy Embedded Wallet" }' ``` ### 2) Create a scoped partner session Call `POST /partner/v1/sessions`. Use the smallest scope set needed for the current operation. ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/sessions \ --header 'Content-Type: application/json' \ --header 'X-Partner-Key: ' \ --data '{ "userId": "partner-user-123", "walletAddress": "0xabc...", "scopes": ["deposits.read", "withdrawals.write"], "ttlSeconds": 900 }' ``` ### 3) Run core Machines flows Use the partner session token for: * KYC * Agreements * Cards * Balances * Deposits This guide focuses on withdrawals because that is where embedded-wallet server signing is most relevant. ### 4) Withdrawal flow (partner + Privy execution) Call sequence: 1. `GET /partner/v1/withdrawals/assets` 2. `POST /partner/v1/withdrawals/range` 3. `POST /partner/v1/withdrawals/estimate` 4. `POST /partner/v1/withdrawals` (include `adminAddress`) 5. Execute onchain via Privy wallet APIs Create request example: ```bash theme={null} curl --request POST \ --url https://api.machines.cash/partner/v1/withdrawals \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ' \ --header 'Idempotency-Key: wdrl-001' \ --data '{ "amountCents": 2500, "source": { "contractId": "optional-uuid" }, "destination": { "currency": "hbar", "network": "hbar", "address": "0.0.123456", "extraId": "optional-tag" }, "adminAddress": "0xabc..." }' ``` Use the same `Idempotency-Key` when retrying `POST /partner/v1/withdrawals` after pending responses. ## Execution Model and Contract Call Paths Machines withdrawal create response includes: * `execution.callTarget` * `execution.callPath` (`controller_v1` or `coordinator_v2`) * `parameters` (7-arg Rain executor payload) Always send the transaction to `execution.callTarget`. * `controller_v1`: * Call 7-arg `withdrawAsset(...)` * Selector: `0xe167d26a` * Signature: `withdrawAsset(address,address,uint256,address,uint256,bytes32,bytes)` * `coordinator_v2`: * Build admin typed-data signature first * Call 10-arg `withdrawAsset(...)` * Selector: `0x4b268241` * Signature: `withdrawAsset(address,address,uint256,address,uint256,bytes32,bytes,bytes32[],bytes[],bool)` ### v2 Typed Data Shape ```ts theme={null} const domain = { name: "Collateral", version: "2", chainId, verifyingContract: collateralProxy, salt: adminSalt, // bytes32 }; const types = { Withdraw: [ { name: "user", type: "address" }, { name: "asset", type: "address" }, { name: "amount", type: "uint256" }, { name: "recipient", type: "address" }, { name: "nonce", type: "uint256" }, ], }; const message = { user: adminAddress, asset: tokenAddress, amount, recipient, nonce: adminNonce, }; ``` ### Partner-side Privy Execution (TypeScript) ```ts theme={null} // 1) Create withdrawal payload at Machines const wd = await fetch("https://api.machines.cash/partner/v1/withdrawals", { method: "POST", headers: { Authorization: `Bearer ${partnerSessionToken}`, "Content-Type": "application/json", "Idempotency-Key": idempotencyKey, }, body: JSON.stringify({ amountCents, destination, adminAddress, }), }).then((r) => r.json()); if (wd?.data?.status === "pending") { // retry same request with same idempotency key } const execution = wd?.data?.execution; const parameters = wd?.data?.parameters; if (!execution?.callTarget || !parameters || parameters.length < 7) { throw new Error("withdrawal payload not ready"); } ``` ```ts theme={null} // 2) v2 only: sign typed data with Privy const adminSignature = await privy.walletApi.ethereum.signTypedData({ walletId, chainType: "ethereum", typedData: { domain, types, message, primaryType: "Withdraw", }, }); ``` ```ts theme={null} // 3) Send tx with Privy (v1 or v2 encoded calldata) const send = await privy.walletApi.rpc({ walletId, chainType: "ethereum", caip2: `eip155:${chainId}`, method: "eth_sendTransaction", sponsor: true, idempotencyKey, params: { transaction: { from: adminAddress, to: execution.callTarget, data: encodedCallData, value: "0x0", }, }, }); const transactionId = send?.data?.transactionId; let txHash = send?.data?.hash; if (!txHash && transactionId) { // poll Privy getTransaction(transactionId) until hash is available } ``` ## Privy Method Allowances and Policy Design For this flow, allow at minimum: * `eth_sendTransaction` * `eth_signTypedData_v4` (needed for `coordinator_v2`) Use dynamic target address rules: * Do not hardcode a single contract address. * Restrict `to` to the `execution.callTarget` values returned by Machines for supported chains/contracts. Recommended condition dimensions: * `ethereum_transaction`: * `chain_id` in allowed chains * `to` in your dynamically maintained allowlist * `value == 0` * `ethereum_calldata`: * ABI for Rain withdrawal functions * `function_name == "withdrawAsset"` * `ethereum_typed_data_domain` and `ethereum_typed_data_message` (for v2): * domain name/version chain checks * typed message fields constrained to your expected flow Policy modeling tip: * Keep reusable condition sets per chain + function family. * Compose those sets into authorization policies instead of duplicating large JSON blocks. ### Example Policy Shape (Ethereum) This is a concrete starting shape aligned with Privy’s Ethereum policy examples: ```js theme={null} { version: "1.0", name: "Machines withdrawal execution", chain_type: "ethereum", rules: [ { name: "Allow withdrawAsset tx to approved call targets", method: "eth_sendTransaction", action: "ALLOW", conditions: [ { field_source: "ethereum_transaction", field: "chain_id", operator: "in", value: ["8453", "84532"] }, { field_source: "ethereum_transaction", field: "to", operator: "in_condition_set", value: "" }, { field_source: "ethereum_transaction", field: "value", operator: "eq", value: "0x0" }, { field_source: "ethereum_calldata", field: "function_name", abi: [ { name: "withdrawAsset", type: "function", stateMutability: "nonpayable", inputs: [ { name: "collateralProxy", type: "address" }, { name: "token", type: "address" }, { name: "amount", type: "uint256" }, { name: "recipient", type: "address" }, { name: "expiresAt", type: "uint256" }, { name: "executorSalt", type: "bytes32" }, { name: "executorSignature", type: "bytes" } ], outputs: [] }, { name: "withdrawAsset", type: "function", stateMutability: "nonpayable", inputs: [ { name: "collateralProxy", type: "address" }, { name: "token", type: "address" }, { name: "amount", type: "uint256" }, { name: "recipient", type: "address" }, { name: "expiresAt", type: "uint256" }, { name: "executorSalt", type: "bytes32" }, { name: "executorSignature", type: "bytes" }, { name: "adminSalt", type: "bytes32[]" }, { name: "adminSignature", type: "bytes[]" }, { name: "directTransfer", type: "bool" } ], outputs: [] } ], operator: "eq", value: "withdrawAsset" } ] }, { name: "Allow v2 domain-constrained typed data signing", method: "eth_signTypedData_v4", action: "ALLOW", conditions: [ { field_source: "ethereum_typed_data_domain", field: "chainId", operator: "in", value: ["8453", "84532"] }, { field_source: "ethereum_typed_data_domain", field: "verifyingContract", operator: "in_condition_set", value: "" }, { field_source: "ethereum_typed_data_message", typed_data: { types: { Withdraw: [ { name: "user", type: "address" }, { name: "asset", type: "address" }, { name: "amount", type: "uint256" }, { name: "recipient", type: "address" }, { name: "nonce", type: "uint256" } ] }, primary_type: "Withdraw" }, field: "amount", operator: "lte", value: "" } ] } ] } ``` Practical guidance: * Use condition sets for `to` addresses and verifying contracts. * Keep policy values as strings matching Privy examples (`chain_id`, hex values, address strings). * Treat this policy as an allowlist; add explicit `DENY` rules only when needed. ## Gas Sponsorship and Transaction Lifecycle * Use `sponsor: true` for embedded wallet sends to sponsor gas. * For gas-sponsored EVM sends, backend responses can return before final onchain hash. * Handle async status fields: * `transaction_id` (Privy transaction id) * `user_operation_hash` * `hash` may be empty until confirmation. * Track final status via: * Privy webhooks (recommended) * or transaction-status API polling by `transaction_id`. * Add operational monitoring: * submission failures * hash timeouts * onchain confirmation delays * spend anomalies and abuse patterns ## Known Constraints and Gotchas * Production destination coverage (BTC/SOL/EVM/etc.) depends on live relay routes. Always query: * `GET /partner/v1/withdrawals/assets` * `POST /partner/v1/withdrawals/range` * `POST /partner/v1/withdrawals/estimate` before quoting or creating withdrawals. * Sandbox source is fixed to rUSD on Base Sepolia. * If withdrawal signature response is `status: pending`, retry with the same idempotency key. ## Further Reading (Privy) * Authorization keys overview: * [https://docs.privy.io/controls/authorization-keys](https://docs.privy.io/controls/authorization-keys) * Server-side signing with authorization keys: * [https://docs.privy.io/controls/authorization-keys/using-owners/sign/signing-on-the-server](https://docs.privy.io/controls/authorization-keys/using-owners/sign/signing-on-the-server) * Ethereum policy examples: * [https://docs.privy.io/controls/policies/example-policies/ethereum#allow-specific-smart-contract-function-calls](https://docs.privy.io/controls/policies/example-policies/ethereum#allow-specific-smart-contract-function-calls) * Gas sponsorship setup: * [https://docs.privy.io/wallets/gas-and-asset-management/gas/setup](https://docs.privy.io/wallets/gas-and-asset-management/gas/setup) * Transaction handling: * [https://docs.privy.io/wallets/gas-and-asset-management/gas/transaction-handling](https://docs.privy.io/wallets/gas-and-asset-management/gas/transaction-handling) * Sponsorship security guidance: * [https://docs.privy.io/wallets/gas-and-asset-management/gas/security](https://docs.privy.io/wallets/gas-and-asset-management/gas/security) # Supported Tokens and Chains Source: https://docs.machines.cash/partners/supported-tokens-and-chains Supported token and chain pairs for deposits & withdrawals. ## Sandbox ### RUSD * ✅ base sepolia testnet * ✅ solana testnet ## Production ### ADA * ✅ ada * ✅ bsc ### AVAX * ✅ bsc * ✅ cchain * ✅ xchain ### BNB * ✅ bsc * ✅ opbnb ### BTC * ✅ btc ### DOGE * ✅ bsc * ✅ doge * ✅ eth ### DOT * ✅ assethub * ✅ bsc ### ETH * ✅ arbitrum * ✅ base * ✅ bsc * ✅ eth * ✅ lna * ✅ manta * ✅ op * ✅ strk * ✅ zksync ### HYPE * ✅ hyperevm ### LINK * ✅ arbitrum * ✅ bsc * ✅ eth * ✅ matic ### LTC * ✅ bsc * ✅ ltc ### MONAD * ✅ mon ### POL * ✅ eth ### SOL * ✅ bsc * ✅ eth * ✅ sol ### SUI * ✅ sui ### TON * ✅ bsc * ✅ eth * ✅ ton ### TRX * ✅ bsc * ✅ trx ### USDC * ✅ algo * ✅ apt * ✅ arbitrum * ✅ avaxc * ✅ base * ✅ bsc * ✅ celo * ✅ eth * ✅ matic * ✅ mon * ✅ op * ✅ sol * ✅ sui ### USDT * ✅ apt * ✅ arbitrum * ✅ assethub * ✅ avaxc * ✅ bsc * ✅ celo * ✅ eth * ✅ matic * ✅ op * ✅ sol * ✅ ton * ✅ trx ### XMR * ✅ xmr ### XRP * ✅ bsc * ✅ xrp ### ZEC * ✅ bsc * ✅ zec # Raw Knowledge File Source: https://docs.machines.cash/raw-knowledge-file Paste Machines context into your AI app for more accurate responses. A knowledge file gives your AI detailed context about how Machines works -- account actions, command syntax, and safety rules. Paste it into any AI app that supports custom instructions or memory to get more accurate responses. ## MCP connection vs knowledge file | | MCP connection | Knowledge file | | ------------ | ----------------------------------------- | ---------------------------------------------- | | What it does | Gives your AI live access to your account | Gives your AI context about how Machines works | | Required? | Yes | No, but recommended | | Setup | MCP Setup | Copy and paste (see below) | ## When to use it Use this when your AI app supports custom instructions, memory, or pasted context and you want better responses beyond what MCP tools provide alone. It helps your AI understand Machines terminology and handle requests more accurately. ## Setup Go to [https://docs.machines.cash/llms.txt](https://docs.machines.cash/llms.txt) Select all text on the page and copy it. Paste into your app's custom instructions, memory, or context field. ## What this improves * More accurate card, balance, and deposit requests * Fewer incorrect tool calls * Better handling of sensitive actions The knowledge file does not replace an MCP connection. You still need to connect first. ## Next steps * MCP Setup -- required connection setup * Machines CLI -- terminal commands for direct use # Sandbox Testing Source: https://docs.machines.cash/sandbox-testing Use the sandbox environment to validate KYC, cards, and deposits before production. ## Environments Use separate API keys per environment. | Environment | Base URL | | ----------- | --------------------------------------------------------------------------- | | Sandbox | [https://dev-api.machines.cash](https://dev-api.machines.cash) | | Production | [https://api.machines.cash](https://api.machines.cash) | Recommended env file for local API testing: ```bash theme={null} cat > .env.local <<'EOF' MC_ENV=sandbox MC_API_BASE_URL=https://dev-api.machines.cash/partner/v1 MC_API_BASE_URL_PRODUCTION=https://api.machines.cash/partner/v1 MC_PARTNER_KEY=replace-with-your-sandbox-partner-key EOF set -a source .env.local set +a ``` ## Sandbox KYC shortcut To bypass KYC in sandbox, set the applicant's lastName to approved when calling POST /kyc/applications. The next status check returns approved. ```bash theme={null} curl --request POST \ --url ${MC_API_BASE_URL}/kyc/applications \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data ' { "firstName": "John", "lastName": "approved", "birthDate": "1990-01-01", "nationalId": "123456789", "countryOfIssue": "US", "email": "jsmith@example.com", "address": { "line1": "123 Main St", "city": "New York", "region": "NY", "postalCode": "10001", "countryCode": "US" }, "occupation": "49-3023", "annualSalary": "<40k", "accountPurpose": "testing", "expectedMonthlyVolume": "under $1k" } ' ``` ## Sandbox deposits (rUSD on Base Sepolia) Sandbox deposits use rUSD on Base Sepolia. You need Base Sepolia ETH for gas. ### 1) Create a deposit intent ``` POST /deposits { "currency": "rusd", "network": "base", "amount": 25 } ``` The response includes deposit.id and deposit.depositAddress (the Base Sepolia deposit address). ### 2) Mint rUSD Mint rUSD on Base Sepolia, then send it to deposit.depositAddress. * Chain: Base Sepolia (84532) * rUSD contract: 0x10b5Be494C2962A7B318aFB63f0Ee30b959D000b * Mint function: mint(uint256 amountDollars\_Max100) * Max per mint tx: 100 rUSD ### 3) Track status Poll until the deposit completes: ``` GET /deposits/{"{depositId}"} ``` Sandbox deposits are for testing only. Production deposits use USDC on Base. # Terms Source: https://docs.machines.cash/terms Partner branding, compliance, and legal requirements for integrating Machines Card. ## Terms - Integrating Machines Card ### Partner Branding and Compliance Requirements These requirements apply to all partners integrating Machines virtual card infrastructure under the Machines Partner Integration. White-label usage is not permitted. Production API access is conditional on compliance with the requirements below. ## 1. Brand Visibility Requirements The Machines brand must be clearly visible anywhere the card product is displayed or marketed. Minimum requirements: * The Machines logo must be present on the card visual. * The Machines wordmark must be visible within the card interface or card details view. * The product must not be presented as solely the partner's proprietary card. The following disclosure is required: > "This card is powered by Machines and is subject to Machines Terms of Service and Privacy Policy." This disclosure must be clearly visible before card issuance. ## 2. User Acknowledgment and Legal Acceptance Before issuing a card, the end user must: * Explicitly accept Machines Terms of Service. * Explicitly accept Machines Privacy Policy. * Be informed that they are becoming a Machines cardholder under the Machines card program. Checkbox acceptance must not be pre-selected. Links to the following must be provided at the point of acceptance: * Machines Terms of Service * Machines Privacy Policy ## 3. Card Design Requirements Allowed: * Custom card background color. * Limited visual customization, subject to approval. * Co-brand layouts where Machines branding remains clearly visible. Not allowed: * Removal of the Machines logo. * Removal of the Machines wordmark. * Designs that imply the card is issued solely by the partner. * Alterations to regulatory or issuer disclosures. Final card design must be approved by Machines prior to production activation. ## 4. Compliance Structure Partners may not: * Resell Machines card access. * Sub-license API access. * Offer card issuance outside approved flows. * Modify KYC, AML, or compliance flows. All issuance must: * Flow through Machines infrastructure. * Use Machines compliance logic. * Follow issuer guidelines provided by Machines. ## 5. API Key Controls * Development keys may be issued for testing. * Production keys are granted only after: * Branding review * UX review * Compliance flow review * Legal acceptance verification Machines reserves the right to suspend or revoke API keys if requirements are not met. ## 6. Marketing and Announcements Any public announcement referencing the card must: * Clearly state the card is part of Machines Card Program. * Avoid implying exclusive ownership by the partner. * Not misrepresent the issuer or program structure. Marketing materials may require prior review. ## 7. Enforcement Failure to comply may result in: * Suspension of production API access. * Immediate key revocation. * Termination of partner access. These requirements should be implemented and validated before requesting production activation. # Transactions Source: https://docs.machines.cash/transactions List transaction history for a user. ## Overview * GET /transactions returns transaction history for the current user session. * Required scope: transactions.read. * Optional filters: type (comma-separated), cardId, limit, cursor. ## API flow (step-by-step) Endpoint: GET /transactions
Headers: Authorization: Bearer \ ```bash theme={null} curl -s \ -H "Authorization: Bearer $SESSION_TOKEN" \ "https://dev-api.machines.cash/partner/v1/transactions?type=spend,collateral&limit=25" ``` Example response: ```json theme={null} { "ok": true, "data": { "transactions": [ { "transactionId": "txn_123", "type": "spend", "status": "posted", "amountCents": 1299, "currency": "USD", "merchantName": "Example Merchant", "cardId": "9f970d1a-fd8e-41ac-a6fd-5993417942e3", "createdAt": "2026-02-18T18:30:00.000Z" } ] }, "summary": "transactions", "errors": [] } ```
## Query parameters Comma-separated transaction types: spend, collateral, payment, fee. Optional card id filter. Optional page size (max 100). Optional pagination cursor. ## Response fields Transaction id. spend | collateral | payment | fee. Transaction status. Amount in cents. Currency code. Merchant or descriptor when available. Card id for spend transactions. ISO 8601 timestamp. # Add Money Source: https://docs.machines.cash/user-add-money Deposit with exact token, network, and address instructions. When you ask to add money, Machines gives you exact instructions. ## What you will receive * deposit address * token to send * chain/network to use * memo, if one is required ## Fastest CLI path Check spending power: ```bash theme={null} machines balance ``` Get a deposit address: ```bash theme={null} machines deposit create --token USDC --network base --amount 25 ``` Watch status: ```bash theme={null} machines deposit watch --id ``` If you want the guided version, run: ```bash theme={null} machines ``` Then choose `balance` -> `add money`. ## Important * Send only the exact token on the exact chain shown. * If a memo is shown, include it exactly. * If token or chain is wrong, funds can be lost. * Start with a small test amount if you are unsure. ## Example prompt "give me deposit instructions" The response should return clear values you can copy. # Cards Source: https://docs.machines.cash/user-cards Create, label, and manage your virtual cards. Machines cards are virtual cards. ## What you can do * create a new card * set spending limits * lock or unlock * rename card labels * reveal details when needed ## Typical agent commands * "create a card called subscriptions" * "set this card limit to 25 per day" * "lock my travel card" * "show details for my last card" ## Safety * Card details are revealed only when you ask. * Card secrets are handled in secure server flows. # Changelog Source: https://docs.machines.cash/user-changelog Recent user-facing updates across the app, CLI, MCP, and agentic payments. This is a lightweight running log of notable updates for Machines users. ## Simpler AI shopping and purchase flows * Added a new [Agentic Payments](/agentic-payments) guide with one shared model for search, buy, status, confirm, and 3DS. * Improved [CLI](/cli) shopping guidance so common purchase flows are easier to run from the terminal. * Added clearer purchase examples across [MCP Setup](/mcp-setup), [Codex](/codex), [Claude](/claude-plugin), and [Agent Skills](/agent-skills). * Improved the Claude setup guide with a setup video and a copyable hosted MCP URL. ## Better AI setup and safer card guidance * Improved MCP setup guidance so it is easier to connect Machines to hosted AI tools. * Clarified safer card-reveal behavior and more user-friendly card-reading guidance for AI assistants. * Tightened user API and account guidance for common balance, card, and deposit workflows. ## Initial user docs launch * Launched the core user docs for identity verification, cards, balances, and add-money flows. * Added the first CLI and AI-connection guides so users could manage Machines from the terminal and connected assistants. * Added the first user API references and shopping-related guidance for purchase flows. # FAQ Source: https://docs.machines.cash/user-faq Quick answers for common user questions. ## Do I need to understand APIs? No. You can use Machines without coding. ## Why do I need identity verification? It is required before card usage. ## How do I connect my AI to Machines (MCP)? Use MCP and follow the step-by-step setup. ## How do I set up Claude? Open Claude. If the listing is not visible in your workspace yet, use the manual CLI fallback on that page. ## How do I set up Codex? Open Codex and install Machines through Agent Skill. ## How do I set up Agent Skill for Codex or manual Claude fallback? Open Agent Skill and run the install and login commands. ## How do I set up Clawdbot? Use Clawdbot and follow the setup flow. ## Can I use my own AI agent? Yes. You can also paste Raw Knowledge File for better results. ## I need partner integration docs. Go to Partner docs. # Identity Verification Source: https://docs.machines.cash/user-kyc What happens and what you need to do. Identity verification is required before card usage. ## How it works 1. Agent starts your verification flow. 2. You get a hosted verification link. 3. You open the link and complete: * ID upload * selfie / liveness check 4. You come back and tell the agent you are done. 5. Agent checks status and continues when approved. ## Important * Verification is hosted and manual. * The agent cannot do ID upload or selfie for you. * If verification needs more info, the agent tells you exactly what to do next. ## Status language * `approved`: you can continue. * `pending` or `manualReview`: wait while checks run. * `needsVerification` or `needsInformation`: action required from you. * `denied`, `canceled`, `locked`: blocked state. # Withdrawals Source: https://docs.machines.cash/withdrawals Partner withdrawal discovery, range validation, estimation, relay setup, and onchain execution. Read endpoints for withdrawals use `deposits.read` scope. Create still requires `withdrawals.write`. ## Overview * `GET /partner/v1/withdrawals/assets`: list destination assets. * `POST /partner/v1/withdrawals/range`: get min/max for a destination pair. * `POST /partner/v1/withdrawals/estimate`: quote destination receive amount for a given amount. * `POST /partner/v1/withdrawals`: create relay + fetch Rain withdrawal signature payload. `POST /partner/v1/withdrawals` uses a breaking request body shape with `source` and `destination` objects. Withdrawal routes are dynamic (BTC/SOL/EVM and others) and can change. Always call assets, range, and estimate before create. In sandbox, source is fixed to rUSD on Base Sepolia. source.contractId is optional. ## Flow ```mermaid theme={null} sequenceDiagram participant Backend as "Your Backend" participant MachinesAPI as "Machines API" participant Rain as "Rain Contract" participant ChangeNOW as "ChangeNOW Relay" participant Chain as "Blockchain" Backend->>MachinesAPI: GET /partner/v1/withdrawals/assets MachinesAPI-->>Backend: assets[] Backend->>MachinesAPI: POST /partner/v1/withdrawals/range MachinesAPI-->>Backend: range {min/max} Backend->>MachinesAPI: POST /partner/v1/withdrawals/estimate MachinesAPI-->>Backend: estimate {estimatedToAmount} Backend->>MachinesAPI: POST /partner/v1/withdrawals MachinesAPI->>ChangeNOW: create exchange (pay-in = Rain recipient) MachinesAPI->>Rain: get signed withdrawal payload MachinesAPI-->>Backend: status + signature + relay metadata Backend->>Chain: sign/broadcast withdrawAsset(...) ``` ## API flows (step-by-step) Endpoint : GET /partner/v1/withdrawals/assets ```bash theme={null} curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ "https://api.machines.cash/partner/v1/withdrawals/assets?q=hbar&limit=20" ``` You can optionally pass `sourceChainId` and `sourceTokenAddress` as hints, but they are not required. Endpoint : POST /partner/v1/withdrawals/range ```bash theme={null} curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "destination": { "currency": "hbar", "network": "hbar" } }' \ https://api.machines.cash/partner/v1/withdrawals/range ``` Endpoint : POST /partner/v1/withdrawals/estimate ```bash theme={null} curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "destination": { "currency": "hbar", "network": "hbar", "extraId": "optional-tag" }, "amountCents": 2500 }' \ https://api.machines.cash/partner/v1/withdrawals/estimate ``` Endpoint : POST /partner/v1/withdrawals ```bash theme={null} curl -s \ -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \ -H "Idempotency-Key: wdrl-123456" \ -H "Content-Type: application/json" \ -d '{ "amountCents": 2500, "source": { "contractId": "optional-uuid" }, "destination": { "currency": "hbar", "network": "hbar", "address": "0.0.123456", "extraId": "optional-tag" }, "adminAddress": "0x..." }' \ https://api.machines.cash/partner/v1/withdrawals ``` Ready responses include:
  • execution info for contract call routing.
  • relay metadata (payinAddress, payinExtraId, payoutAddress, payoutExtraId, route ids).
  • from must be the same admin EOA used in the create request (adminAddress).
  • to must be execution.callTarget (controller or coordinator), not the collateral proxy address.
  • Use parameters in order: \[collateralProxy, token, amount, recipient, expiresAt, executorSalt, executorSignature].
  • If execution.callPath = controller\_v1, call 7-arg withdrawAsset(...).
  • If execution.callPath = coordinator\_v2, call 10-arg withdrawAsset(...) and include v2 admin signature values.
  • If status is pending, wait retryAfterSeconds and retry the same request with the same idempotency key.
## Onchain execution details For `coordinator_v2`, you must generate an additional admin signature before calling the contract. ```ts theme={null} // response from POST /partner/v1/withdrawals const { data } = withdrawalResponse; if (data.status !== "ready" || !data.parameters || !data.execution?.callTarget) { throw new Error("withdrawal signature is not ready"); } const [collateralProxy, token, amount, recipient, expiresAt, executorSalt, executorSignature] = data.parameters; // tx sender must match adminAddress used in create request const adminAddress = "0x..."; // same value you sent as adminAddress if (data.execution.callPath === "controller_v1") { // to = data.execution.callTarget await controller.withdrawAsset( collateralProxy, token, amount, recipient, expiresAt, executorSalt, executorSignature, ); } else if (data.execution.callPath === "coordinator_v2") { // 1) Read nonce from collateral proxy const nonce = await collateral.adminNonce(); // 2) Build typed data const adminSalt = randomBytes(32); const domain = { name: "Collateral", version: "2", chainId: data.execution.chainId, verifyingContract: collateralProxy, salt: hexlify(adminSalt), }; const types = { Withdraw: [ { name: "user", type: "address" }, { name: "asset", type: "address" }, { name: "amount", type: "uint256" }, { name: "recipient", type: "address" }, { name: "nonce", type: "uint256" }, ], }; const message = { user: adminAddress, asset: token, amount: BigInt(amount), recipient, nonce, }; const adminSignature = await signer.signTypedData(domain, types, message); // 3) Call coordinator (to = data.execution.callTarget) await coordinator.withdrawAsset( collateralProxy, token, amount, recipient, expiresAt, executorSalt, executorSignature, [adminSalt], [adminSignature], true, ); } ``` ## Relay metadata fields Provider exchange id for relay tracking. Address Rain withdrawal sends funds to. Optional memo/tag required on relay pay-in side. Final destination address configured on the relay. Optional destination memo/tag configured for payout.