grid-api
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGrid API Skill
Grid API Skill
Assist users with global payment operations via the Grid API. Core capabilities:
- Execute API Operations - Use to interact with the Grid API directly
curl - Answer Documentation Questions - Fetch docs from https://grid.lightspark.com/llms.txt or the OpenAPI spec (https://raw.githubusercontent.com/lightsparkdev/grid-api/refs/heads/main/openapi.yaml)
- Guide Payment Workflows - Help users send payments to bank accounts, UMA addresses, and crypto wallets
通过Grid API协助用户进行全球支付操作。核心功能:
- 执行API操作 - 使用直接与Grid API交互
curl - 解答文档相关问题 - 从https://grid.lightspark.com/llms.txt或OpenAPI规范(https://raw.githubusercontent.com/lightsparkdev/grid-api/refs/heads/main/openapi.yaml)获取文档内容
- 指导支付工作流 - 帮助用户向银行账户、UMA地址和加密货币钱包发起支付
Supporting References
参考资料
For detailed information, read these reference files in the directory:
references/- - Country-specific external account requirements (CLABE, PIX, IBAN, UPI, etc.) with field requirements and curl examples. Read this when creating external accounts for international payments.
references/account-types.md - - Complete API endpoint reference with methods, paths, and response codes. Read this when answering questions about specific API capabilities.
references/endpoints.md - - Step-by-step payment workflow guides for common scenarios (UMA payments, international transfers, on-ramp, off-ramp). Read this when guiding users through multi-step payment flows.
references/workflows.md
如需详细信息,请阅读目录下的以下参考文件:
references/- - 特定国家的外部账户要求(CLABE、PIX、IBAN、UPI等),包含字段要求和curl示例。创建国际支付的外部账户时请阅读此文件。
references/account-types.md - - 完整的API端点参考,包含请求方法、路径和响应代码。解答特定API功能相关问题时请阅读此文件。
references/endpoints.md - - 常见场景的分步支付工作流指南(UMA支付、国际转账、法币入金、法币出金)。指导用户完成多步骤支付流程时请阅读此文件。
references/workflows.md
Key Concepts
核心概念
Entities
实体
- Platform: The top-level entity (the API user's business)
- Customer: End users of the platform who send/receive payments
- Internal Account: Grid-managed account for holding funds (can be platform-owned or customer-owned)
- External Account: Bank account or crypto wallet outside Grid (destination for payouts)
- UMA Address: Universal Money Address (e.g., ) for receiving payments
$user@domain.com
- Platform(平台):顶级实体(API用户的业务主体)
- Customer(客户):平台的终端用户,可发起/接收支付
- Internal Account(内部账户):由Grid管理的资金账户(可归平台或客户所有)
- External Account(外部账户):Grid体系外的银行账户或加密货币钱包(付款的目标账户)
- UMA Address(UMA地址):用于接收支付的通用资金地址(例如:)
$user@domain.com
Account Types
账户类型
- Platform internal accounts: For pooled funds, rewards distribution, treasury
- Customer internal accounts: Per-currency holding accounts created automatically for each customer
- External accounts: Traditional bank accounts (CLABE, IBAN, UPI, etc.) or crypto wallets
- 平台内部账户:用于资金池、奖励发放、财务资金管理
- 客户内部账户:为每个客户自动创建的多币种资金账户
- 外部账户:传统银行账户(CLABE、IBAN、UPI等)或加密货币钱包
Account Status Lifecycle
账户状态生命周期
PENDINGACTIVEUNDER_REVIEWINACTIVEPENDINGACTIVEUNDER_REVIEWINACTIVECurrency & Amounts
货币与金额
- All amounts are in the smallest currency unit (cents for USD, satoshis for BTC)
- Use the field to convert for display (USD=2, BTC=8, etc.)
currency.decimals - Example: with
10000= $100.00decimals: 2
- 所有金额均以最小货币单位表示(美元为美分,比特币为聪)
- 使用字段转换为显示格式(USD=2,BTC=8等)
currency.decimals - 示例:且
10000= 100.00美元decimals: 2
Configuration
配置
The Grid API uses HTTP Basic Auth. Before making any API calls, ensure credentials and base URL are set as environment variables:
- - API token ID
GRID_API_TOKEN_ID - - API client secret
GRID_API_CLIENT_SECRET - - API base URL
GRID_BASE_URL
If not set, load them from :
~/.grid-credentialsbash
export GRID_API_TOKEN_ID=$(jq -r .apiTokenId ~/.grid-credentials)
export GRID_API_CLIENT_SECRET=$(jq -r .apiClientSecret ~/.grid-credentials)
export GRID_BASE_URL=$(jq -r '.baseUrl // "https://api.lightspark.com/grid/2025-10-13"' ~/.grid-credentials)Always load credentials from before making API calls if the environment variables are not already set.
~/.grid-credentialsGrid API使用HTTP Basic Auth。发起任何API调用前,请确保凭证和基础URL已设置为环境变量:
- - API令牌ID
GRID_API_TOKEN_ID - - API客户端密钥
GRID_API_CLIENT_SECRET - - API基础URL
GRID_BASE_URL
如果未设置,请从加载:
~/.grid-credentialsbash
export GRID_API_TOKEN_ID=$(jq -r .apiTokenId ~/.grid-credentials)
export GRID_API_CLIENT_SECRET=$(jq -r .apiClientSecret ~/.grid-credentials)
export GRID_BASE_URL=$(jq -r '.baseUrl // "https://api.lightspark.com/grid/2025-10-13"' ~/.grid-credentials)如果环境变量未设置,发起API调用前请务必从加载凭证。
~/.grid-credentialsBase URL
基础URL
- Production:
https://api.lightspark.com/grid/2025-10-13 - Dev or local: May use a different base URL — check for the
~/.grid-credentialsfieldbaseUrl
- 生产环境:
https://api.lightspark.com/grid/2025-10-13 - 开发或本地环境:可能使用不同的基础URL — 请查看中的
~/.grid-credentials字段baseUrl
Documentation Resources
文档资源
For questions not covered by this skill's reference files, fetch additional information from the web:
- LLM-optimized docs: Fetch for a concise overview of the Grid API, or
https://grid.lightspark.com/llms.txtfor comprehensive documentationhttps://grid.lightspark.com/llms-full.txt - OpenAPI Spec: Fetch for the full API schema with request/response definitions
https://raw.githubusercontent.com/lightsparkdev/grid-api/refs/heads/main/openapi.yaml - Published docs: Browse for guides, tutorials, and API reference. Any page can use the
https://grid.lightspark.comsuffix for a more agent-readable format..md
对于本Skill参考文件未覆盖的问题,可从网络获取更多信息:
- LLM优化文档:获取以获取Grid API的简明概述,或
https://grid.lightspark.com/llms.txt获取完整文档https://grid.lightspark.com/llms-full.txt - OpenAPI规范:获取以获取包含请求/响应定义的完整API架构
https://raw.githubusercontent.com/lightsparkdev/grid-api/refs/heads/main/openapi.yaml - 官方发布文档:浏览获取指南、教程和API参考。所有页面均可使用
https://grid.lightspark.com后缀以获得更适合Agent读取的格式。.md
Making API Calls
发起API调用
All API calls use HTTP Basic Auth via :
curl -ubash
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET" \
"$GRID_BASE_URL/<endpoint>"For POST/PATCH requests, add the JSON body:
bash
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET" \
-X POST \
-H "Content-Type: application/json" \
-d '<json-body>' \
"$GRID_BASE_URL/<endpoint>"Pipe through for readable output:
jq| jq .所有API调用均通过使用HTTP Basic Auth:
curl -ubash
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET" \
"$GRID_BASE_URL/<endpoint>"对于POST/PATCH请求,需添加JSON请求体:
bash
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET" \
-X POST \
-H "Content-Type: application/json" \
-d '<json-body>' \
"$GRID_BASE_URL/<endpoint>"通过管道输出以获得可读格式:
jq| jq .API Operations
API操作
Platform Configuration
平台配置
bash
undefinedbash
undefinedGet platform config (currencies, limits)
获取平台配置(支持的货币、限额)
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/config" | jq .
"$GRID_BASE_URL/config" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/config" | jq .
"$GRID_BASE_URL/config" | jq .
Update platform config (e.g., set webhook endpoint)
更新平台配置(例如:设置webhook端点)
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X PATCH -H "Content-Type: application/json"
-d '{"webhookEndpoint": "https://example.com/webhooks"}'
"$GRID_BASE_URL/config" | jq .
-X PATCH -H "Content-Type: application/json"
-d '{"webhookEndpoint": "https://example.com/webhooks"}'
"$GRID_BASE_URL/config" | jq .
undefinedcurl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X PATCH -H "Content-Type: application/json"
-d '{"webhookEndpoint": "https://example.com/webhooks"}'
"$GRID_BASE_URL/config" | jq .
-X PATCH -H "Content-Type: application/json"
-d '{"webhookEndpoint": "https://example.com/webhooks"}'
"$GRID_BASE_URL/config" | jq .
undefinedCustomer Management
客户管理
bash
undefinedbash
undefinedList customers
列出客户
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/customers?limit=20" | jq .
"$GRID_BASE_URL/customers?limit=20" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/customers?limit=20" | jq .
"$GRID_BASE_URL/customers?limit=20" | jq .
Get customer details
获取客户详情
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/customers/<customerId>" | jq .
"$GRID_BASE_URL/customers/<customerId>" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/customers/<customerId>" | jq .
"$GRID_BASE_URL/customers/<customerId>" | jq .
Create customer
创建客户
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "platformCustomerId": "<platform-id>", "customerType": "INDIVIDUAL", "fullName": "Name" }'
"$GRID_BASE_URL/customers" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "platformCustomerId": "<platform-id>", "customerType": "INDIVIDUAL", "fullName": "Name" }'
"$GRID_BASE_URL/customers" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "platformCustomerId": "<platform-id>", "customerType": "INDIVIDUAL", "fullName": "Name" }'
"$GRID_BASE_URL/customers" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "platformCustomerId": "<platform-id>", "customerType": "INDIVIDUAL", "fullName": "Name" }'
"$GRID_BASE_URL/customers" | jq .
Update customer (customerType is required)
更新客户(customerType为必填项)
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X PATCH -H "Content-Type: application/json"
-d '{"customerType": "INDIVIDUAL", "fullName": "New Name"}'
"$GRID_BASE_URL/customers/<customerId>" | jq .
-X PATCH -H "Content-Type: application/json"
-d '{"customerType": "INDIVIDUAL", "fullName": "New Name"}'
"$GRID_BASE_URL/customers/<customerId>" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X PATCH -H "Content-Type: application/json"
-d '{"customerType": "INDIVIDUAL", "fullName": "New Name"}'
"$GRID_BASE_URL/customers/<customerId>" | jq .
-X PATCH -H "Content-Type: application/json"
-d '{"customerType": "INDIVIDUAL", "fullName": "New Name"}'
"$GRID_BASE_URL/customers/<customerId>" | jq .
Delete customer
删除客户
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X DELETE
"$GRID_BASE_URL/customers/<customerId>" | jq .
-X DELETE
"$GRID_BASE_URL/customers/<customerId>" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X DELETE
"$GRID_BASE_URL/customers/<customerId>" | jq .
-X DELETE
"$GRID_BASE_URL/customers/<customerId>" | jq .
Generate KYC link (GET with query params)
生成KYC链接(带查询参数的GET请求)
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/customers/kyc-link?platformCustomerId=<platformCustomerId>&redirectUri=https://example.com/callback" | jq .
"$GRID_BASE_URL/customers/kyc-link?platformCustomerId=<platformCustomerId>&redirectUri=https://example.com/callback" | jq .
undefinedcurl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/customers/kyc-link?platformCustomerId=<platformCustomerId>&redirectUri=https://example.com/callback" | jq .
"$GRID_BASE_URL/customers/kyc-link?platformCustomerId=<platformCustomerId>&redirectUri=https://example.com/callback" | jq .
undefinedAccount Management
账户管理
bash
undefinedbash
undefinedList customer internal accounts
列出客户内部账户
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/customers/internal-accounts?customerId=<customerId>" | jq .
"$GRID_BASE_URL/customers/internal-accounts?customerId=<customerId>" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/customers/internal-accounts?customerId=<customerId>" | jq .
"$GRID_BASE_URL/customers/internal-accounts?customerId=<customerId>" | jq .
List platform internal accounts
列出平台内部账户
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/platform/internal-accounts" | jq .
"$GRID_BASE_URL/platform/internal-accounts" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/platform/internal-accounts" | jq .
"$GRID_BASE_URL/platform/internal-accounts" | jq .
List customer external accounts
列出客户外部账户
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/customers/external-accounts?customerId=<customerId>" | jq .
"$GRID_BASE_URL/customers/external-accounts?customerId=<customerId>" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/customers/external-accounts?customerId=<customerId>" | jq .
"$GRID_BASE_URL/customers/external-accounts?customerId=<customerId>" | jq .
Create external account (example: Mexico CLABE - Individual)
创建外部账户(示例:墨西哥CLABE - 个人账户)
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "customerId": "<customerId>", "currency": "MXN", "accountInfo": { "accountType": "CLABE", "clabeNumber": "<18-digit-number>", "beneficiary": { "beneficiaryType": "INDIVIDUAL", "fullName": "Full Name", "birthDate": "1990-01-15", "nationality": "MX" } } }'
"$GRID_BASE_URL/customers/external-accounts" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "customerId": "<customerId>", "currency": "MXN", "accountInfo": { "accountType": "CLABE", "clabeNumber": "<18-digit-number>", "beneficiary": { "beneficiaryType": "INDIVIDUAL", "fullName": "Full Name", "birthDate": "1990-01-15", "nationality": "MX" } } }'
"$GRID_BASE_URL/customers/external-accounts" | jq .
For all supported account types (PIX, IBAN, UPI, NGN, US, crypto wallets) and their field requirements, read `references/account-types.md`.curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "customerId": "<customerId>", "currency": "MXN", "accountInfo": { "accountType": "CLABE", "clabeNumber": "<18-digit-number>", "beneficiary": { "beneficiaryType": "INDIVIDUAL", "fullName": "Full Name", "birthDate": "1990-01-15", "nationality": "MX" } } }'
"$GRID_BASE_URL/customers/external-accounts" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "customerId": "<customerId>", "currency": "MXN", "accountInfo": { "accountType": "CLABE", "clabeNumber": "<18-digit-number>", "beneficiary": { "beneficiaryType": "INDIVIDUAL", "fullName": "Full Name", "birthDate": "1990-01-15", "nationality": "MX" } } }'
"$GRID_BASE_URL/customers/external-accounts" | jq .
如需了解所有支持的账户类型(PIX、IBAN、UPI、NGN、美国账户、加密货币钱包)及其字段要求,请阅读`references/account-types.md`。Quotes (Cross-Currency Transfers)
报价(跨币种转账)
bash
undefinedbash
undefinedAccount-funded to UMA: Use when funds are already in an internal account
账户资金支付至UMA:适用于资金已在内部账户的场景
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "source": { "sourceType": "ACCOUNT", "accountId": "<internalAccountId>" }, "destination": { "destinationType": "UMA_ADDRESS", "umaAddress": "<address>", "currency": "USD" }, "lockedCurrencyAmount": 10000, "lockedCurrencySide": "SENDING" }'
"$GRID_BASE_URL/quotes" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "source": { "sourceType": "ACCOUNT", "accountId": "<internalAccountId>" }, "destination": { "destinationType": "UMA_ADDRESS", "umaAddress": "<address>", "currency": "USD" }, "lockedCurrencyAmount": 10000, "lockedCurrencySide": "SENDING" }'
"$GRID_BASE_URL/quotes" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "source": { "sourceType": "ACCOUNT", "accountId": "<internalAccountId>" }, "destination": { "destinationType": "UMA_ADDRESS", "umaAddress": "<address>", "currency": "USD" }, "lockedCurrencyAmount": 10000, "lockedCurrencySide": "SENDING" }'
"$GRID_BASE_URL/quotes" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "source": { "sourceType": "ACCOUNT", "accountId": "<internalAccountId>" }, "destination": { "destinationType": "UMA_ADDRESS", "umaAddress": "<address>", "currency": "USD" }, "lockedCurrencyAmount": 10000, "lockedCurrencySide": "SENDING" }'
"$GRID_BASE_URL/quotes" | jq .
Account-funded to external account: IMPORTANT - always include destination currency
账户资金支付至外部账户:重要提示 - 必须包含目标货币
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "source": { "sourceType": "ACCOUNT", "accountId": "<internalAccountId>" }, "destination": { "destinationType": "ACCOUNT", "accountId": "<externalAccountId>", "currency": "<currency>" }, "lockedCurrencyAmount": 10000, "lockedCurrencySide": "SENDING" }'
"$GRID_BASE_URL/quotes" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "source": { "sourceType": "ACCOUNT", "accountId": "<internalAccountId>" }, "destination": { "destinationType": "ACCOUNT", "accountId": "<externalAccountId>", "currency": "<currency>" }, "lockedCurrencyAmount": 10000, "lockedCurrencySide": "SENDING" }'
"$GRID_BASE_URL/quotes" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "source": { "sourceType": "ACCOUNT", "accountId": "<internalAccountId>" }, "destination": { "destinationType": "ACCOUNT", "accountId": "<externalAccountId>", "currency": "<currency>" }, "lockedCurrencyAmount": 10000, "lockedCurrencySide": "SENDING" }'
"$GRID_BASE_URL/quotes" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "source": { "sourceType": "ACCOUNT", "accountId": "<internalAccountId>" }, "destination": { "destinationType": "ACCOUNT", "accountId": "<externalAccountId>", "currency": "<currency>" }, "lockedCurrencyAmount": 10000, "lockedCurrencySide": "SENDING" }'
"$GRID_BASE_URL/quotes" | jq .
Real-time/JIT funded: Returns paymentInstructions for funding
实时/JIT资金支付:返回包含资金选项的paymentInstructions
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "source": { "sourceType": "REALTIME_FUNDING", "customerId": "<customerId>", "currency": "<sourceCurrency>" }, "destination": { "destinationType": "ACCOUNT", "accountId": "<accountId>", "currency": "<destCurrency>" }, "lockedCurrencyAmount": 100000, "lockedCurrencySide": "RECEIVING" }'
"$GRID_BASE_URL/quotes" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "source": { "sourceType": "REALTIME_FUNDING", "customerId": "<customerId>", "currency": "<sourceCurrency>" }, "destination": { "destinationType": "ACCOUNT", "accountId": "<accountId>", "currency": "<destCurrency>" }, "lockedCurrencyAmount": 100000, "lockedCurrencySide": "RECEIVING" }'
"$GRID_BASE_URL/quotes" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "source": { "sourceType": "REALTIME_FUNDING", "customerId": "<customerId>", "currency": "<sourceCurrency>" }, "destination": { "destinationType": "ACCOUNT", "accountId": "<accountId>", "currency": "<destCurrency>" }, "lockedCurrencyAmount": 100000, "lockedCurrencySide": "RECEIVING" }'
"$GRID_BASE_URL/quotes" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "source": { "sourceType": "REALTIME_FUNDING", "customerId": "<customerId>", "currency": "<sourceCurrency>" }, "destination": { "destinationType": "ACCOUNT", "accountId": "<accountId>", "currency": "<destCurrency>" }, "lockedCurrencyAmount": 100000, "lockedCurrencySide": "RECEIVING" }'
"$GRID_BASE_URL/quotes" | jq .
Execute a quote
执行报价
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST
"$GRID_BASE_URL/quotes/<quoteId>/execute" | jq .
-X POST
"$GRID_BASE_URL/quotes/<quoteId>/execute" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST
"$GRID_BASE_URL/quotes/<quoteId>/execute" | jq .
-X POST
"$GRID_BASE_URL/quotes/<quoteId>/execute" | jq .
List quotes
列出报价
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/quotes?status=PENDING" | jq .
"$GRID_BASE_URL/quotes?status=PENDING" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/quotes?status=PENDING" | jq .
"$GRID_BASE_URL/quotes?status=PENDING" | jq .
Get quote details
获取报价详情
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/quotes/<quoteId>" | jq .
"$GRID_BASE_URL/quotes/<quoteId>" | jq .
undefinedcurl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/quotes/<quoteId>" | jq .
"$GRID_BASE_URL/quotes/<quoteId>" | jq .
undefinedSame-Currency Transfers
同币种转账
bash
undefinedbash
undefinedTransfer in (external → internal, same currency)
转入(外部账户 → 内部账户,同币种)
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "source": {"accountId": "<externalAccountId>"}, "destination": {"accountId": "<internalAccountId>"}, "amount": 10000 }'
"$GRID_BASE_URL/transfer-in" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "source": {"accountId": "<externalAccountId>"}, "destination": {"accountId": "<internalAccountId>"}, "amount": 10000 }'
"$GRID_BASE_URL/transfer-in" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "source": {"accountId": "<externalAccountId>"}, "destination": {"accountId": "<internalAccountId>"}, "amount": 10000 }'
"$GRID_BASE_URL/transfer-in" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "source": {"accountId": "<externalAccountId>"}, "destination": {"accountId": "<internalAccountId>"}, "amount": 10000 }'
"$GRID_BASE_URL/transfer-in" | jq .
Transfer out (internal → external, same currency)
转出(内部账户 → 外部账户,同币种)
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "source": {"accountId": "<internalAccountId>"}, "destination": {"accountId": "<externalAccountId>"}, "amount": 10000 }'
"$GRID_BASE_URL/transfer-out" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "source": {"accountId": "<internalAccountId>"}, "destination": {"accountId": "<externalAccountId>"}, "amount": 10000 }'
"$GRID_BASE_URL/transfer-out" | jq .
undefinedcurl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "source": {"accountId": "<internalAccountId>"}, "destination": {"accountId": "<externalAccountId>"}, "amount": 10000 }'
"$GRID_BASE_URL/transfer-out" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "source": {"accountId": "<internalAccountId>"}, "destination": {"accountId": "<externalAccountId>"}, "amount": 10000 }'
"$GRID_BASE_URL/transfer-out" | jq .
undefinedTransactions
交易记录
bash
undefinedbash
undefinedList transactions
列出交易记录
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/transactions?status=PENDING" | jq .
"$GRID_BASE_URL/transactions?status=PENDING" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/transactions?status=PENDING" | jq .
"$GRID_BASE_URL/transactions?status=PENDING" | jq .
Get transaction details
获取交易详情
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/transactions/<transactionId>" | jq .
"$GRID_BASE_URL/transactions/<transactionId>" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/transactions/<transactionId>" | jq .
"$GRID_BASE_URL/transactions/<transactionId>" | jq .
Approve incoming payment
批准待处理入账请求
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST
"$GRID_BASE_URL/transactions/<transactionId>/approve" | jq .
-X POST
"$GRID_BASE_URL/transactions/<transactionId>/approve" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST
"$GRID_BASE_URL/transactions/<transactionId>/approve" | jq .
-X POST
"$GRID_BASE_URL/transactions/<transactionId>/approve" | jq .
Reject incoming payment
拒绝待处理入账请求
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{"reason": "Reason for rejection"}'
"$GRID_BASE_URL/transactions/<transactionId>/reject" | jq .
-X POST -H "Content-Type: application/json"
-d '{"reason": "Reason for rejection"}'
"$GRID_BASE_URL/transactions/<transactionId>/reject" | jq .
undefinedcurl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{"reason": "拒绝原因"}'
"$GRID_BASE_URL/transactions/<transactionId>/reject" | jq .
-X POST -H "Content-Type: application/json"
-d '{"reason": "拒绝原因"}'
"$GRID_BASE_URL/transactions/<transactionId>/reject" | jq .
undefinedReceiver Lookup
收款方查询
bash
undefinedbash
undefinedLook up UMA address capabilities
查询UMA地址的收款能力
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/receiver/uma/%24alice%40example.com" | jq .
"$GRID_BASE_URL/receiver/uma/%24alice%40example.com" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/receiver/uma/%24alice%40example.com" | jq .
"$GRID_BASE_URL/receiver/uma/%24alice%40example.com" | jq .
Look up external account capabilities
查询外部账户的收款能力
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/receiver/external-account/<accountId>" | jq .
"$GRID_BASE_URL/receiver/external-account/<accountId>" | jq .
**Note:** UMA addresses contain `$` which must be URL-encoded as `%24` in the path.curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
"$GRID_BASE_URL/receiver/external-account/<accountId>" | jq .
"$GRID_BASE_URL/receiver/external-account/<accountId>" | jq .
**注意:** UMA地址包含`$`符号,在URL路径中必须编码为`%24`。Sandbox Testing
沙箱测试
bash
undefinedbash
undefinedFund an internal account in sandbox
为沙箱环境中的内部账户充值
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{"amount": 100000}'
"$GRID_BASE_URL/sandbox/internal-accounts/<internalAccountId>/fund" | jq .
-X POST -H "Content-Type: application/json"
-d '{"amount": 100000}'
"$GRID_BASE_URL/sandbox/internal-accounts/<internalAccountId>/fund" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{"amount": 100000}'
"$GRID_BASE_URL/sandbox/internal-accounts/<internalAccountId>/fund" | jq .
-X POST -H "Content-Type: application/json"
-d '{"amount": 100000}'
"$GRID_BASE_URL/sandbox/internal-accounts/<internalAccountId>/fund" | jq .
Simulate sending funds to a real-time quote
模拟向实时报价付款
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{"quoteId": "<quoteId>", "currencyCode": "<code>"}'
"$GRID_BASE_URL/sandbox/send" | jq .
-X POST -H "Content-Type: application/json"
-d '{"quoteId": "<quoteId>", "currencyCode": "<code>"}'
"$GRID_BASE_URL/sandbox/send" | jq .
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{"quoteId": "<quoteId>", "currencyCode": "<code>"}'
"$GRID_BASE_URL/sandbox/send" | jq .
-X POST -H "Content-Type: application/json"
-d '{"quoteId": "<quoteId>", "currencyCode": "<code>"}'
"$GRID_BASE_URL/sandbox/send" | jq .
Simulate receiving a UMA payment
模拟接收UMA支付
curl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "senderUmaAddress": "$sender@sandbox.grid.uma.money", "receiverUmaAddress": "<receiverAddress>", "receivingCurrencyCode": "USD", "receivingCurrencyAmount": 1000 }'
"$GRID_BASE_URL/sandbox/uma/receive" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "senderUmaAddress": "$sender@sandbox.grid.uma.money", "receiverUmaAddress": "<receiverAddress>", "receivingCurrencyCode": "USD", "receivingCurrencyAmount": 1000 }'
"$GRID_BASE_URL/sandbox/uma/receive" | jq .
undefinedcurl -s -u "$GRID_API_TOKEN_ID:$GRID_API_CLIENT_SECRET"
-X POST -H "Content-Type: application/json"
-d '{ "senderUmaAddress": "$sender@sandbox.grid.uma.money", "receiverUmaAddress": "<receiverAddress>", "receivingCurrencyCode": "USD", "receivingCurrencyAmount": 1000 }'
"$GRID_BASE_URL/sandbox/uma/receive" | jq .
-X POST -H "Content-Type: application/json"
-d '{ "senderUmaAddress": "$sender@sandbox.grid.uma.money", "receiverUmaAddress": "<receiverAddress>", "receivingCurrencyCode": "USD", "receivingCurrencyAmount": 1000 }'
"$GRID_BASE_URL/sandbox/uma/receive" | jq .
undefinedPayment Flow Patterns
支付流程模式
Grid supports three main payment patterns:
Grid支持三种主要支付模式:
1. Prefunded (Account-Funded)
1. 预资金模式(账户资金支付)
Funds are already in an internal account. Quote executes immediately from existing balance.
Internal Account (USD) → Quote → External Account/UMA (EUR)Use with an internal account ID.
sourceType: "ACCOUNT"资金已存在于内部账户中。报价将立即从现有余额中执行。
内部账户(USD) → 报价 → 外部账户/UMA(EUR)使用并指定内部账户ID。
sourceType: "ACCOUNT"2. Just-in-Time (Real-Time Funded)
2. 即时资金模式(实时资金支付)
Funds will be provided at execution time. Quote returns with multiple funding options. Grid auto-executes when deposit is received.
paymentInstructionsCustomer sends crypto/fiat → Grid detects deposit → Auto-executes at locked rateUse with customer ID and currency. Only works with instant settlement methods.
sourceType: "REALTIME_FUNDING"资金将在执行时提供。报价返回包含多种资金选项的。当Grid收到存款时将自动执行。
paymentInstructions客户发送加密货币/法币 → Grid检测到存款 → 按锁定汇率自动执行使用并指定客户ID和货币。仅适用于即时结算方式。
sourceType: "REALTIME_FUNDING"3. Same-Currency Transfers
3. 同币种转账
Direct transfers between accounts without currency conversion. No quote needed.
External Account (USD) → Internal Account (USD) [transfer-in]
Internal Account (USD) → External Account (USD) [transfer-out]账户间直接转账,无需货币转换。无需创建报价。
外部账户(USD) → 内部账户(USD) [transfer-in]
内部账户(USD) → 外部账户(USD) [transfer-out]Interactive Payment Workflows
交互式支付工作流
For step-by-step payment workflows, read . Common workflows:
references/workflows.md- UMA Payment: Receiver lookup -> Quote -> Confirm -> Execute
- International Bank Transfer: Create external account -> Receiver lookup -> Quote -> Confirm -> Execute
- On-Ramp (Fiat to Crypto): Verify KYC -> Deposit fiat -> Create crypto external account -> Quote with
immediatelyExecute - Off-Ramp (Crypto to Fiat): Create fiat external account -> Deposit crypto -> Quote -> Execute
- Incoming Payment Handling: List pending approvals -> Review -> Approve/Reject
如需分步支付工作流,请阅读。常见工作流:
references/workflows.md- UMA支付:收款方查询 → 创建报价 → 确认 → 执行
- 国际银行转账:创建外部账户 → 收款方查询 → 创建报价 → 确认 → 执行
- 法币入金(法币转加密货币):验证KYC → 存入法币 → 创建加密货币外部账户 → 使用创建报价
immediatelyExecute - 法币出金(加密货币转法币):创建法币外部账户 → 存入加密货币 → 创建报价 → 执行
- 入账请求处理:列出待批准请求 → 审核 → 批准/拒绝
Real-Time / Just-in-Time Funded Transfers
实时/即时资金转账
Use this flow when the user asks for a "realtime quote" or "just in time" funded transfer. Only use with instant settlement methods — do not use with slow methods like ACH since quotes expire quickly.
Compatible instant methods:
- Crypto: BTC (Lightning, Spark), USDC (Solana, Base, Polygon), USDT (Tron)
- Fiat: RTP, SEPA Instant, and other instant payment rails
Flow:
- Create a quote with . Destination can be an internal account, external account, or UMA address.
sourceType: "REALTIME_FUNDING" - The response includes with multiple funding options simultaneously (e.g., Lightning + Spark for BTC, Solana + Base + Polygon for USDC). Show all options to the user.
paymentInstructions - Auto-execution: Once the user sends funds to ANY of the provided addresses, Grid automatically detects the deposit and executes at the locked rate. Do NOT call the execute endpoint for JIT quotes. Webhooks sent: on deposit,
ACCOUNT_STATUSon completion.OUTGOING_PAYMENT - Quote expiration: Quotes expire in 1-5 minutes. If expired, create a new quote.
当用户请求“实时报价”或“即时资金”转账时使用此流程。仅适用于即时结算方式 — 请勿用于ACH等慢速方式,因为报价会快速过期。
兼容的即时结算方式:
- 加密货币:BTC(Lightning、Spark)、USDC(Solana、Base、Polygon)、USDT(Tron)
- 法币:RTP、SEPA Instant及其他即时支付网络
流程:
- 使用创建报价。目标账户可以是内部账户、外部账户或UMA地址。
sourceType: "REALTIME_FUNDING" - 响应结果包含,其中同时提供多种资金选项(例如:BTC的Lightning + Spark,USDC的Solana + Base + Polygon)。需向用户展示所有选项。
paymentInstructions - 自动执行:当用户向任何提供的地址发送资金后,Grid将自动检测到存款并按锁定汇率执行。请勿为JIT报价调用执行端点。触发的Webhook:存款时触发,完成时触发
ACCOUNT_STATUS。OUTGOING_PAYMENT - 报价过期:报价在1-5分钟内过期。如果过期,请创建新报价。
Best Practices and Common Pitfalls
最佳实践与常见陷阱
- Check platform config first: Call to see supported currencies and required fields
GET /config - Use smallest currency units: All amounts are in cents/satoshis - use field for display
decimals - Handle quote expiration: Quotes expire in 1-5 minutes; be prepared to create new quotes
- Choose the right flow: Use prefunded for immediate execution, JIT for crypto/instant rails
- Pipe through jq: Always append for readable output, or
| jq .to extract specific values| jq -r .field - URL-encode special characters: UMA addresses contain — encode as
$in URL paths%24 - Always include destination currency in quotes: When specifying a destination account, you MUST include in the destination object even though the external account already has a currency
currency - Individual beneficiary fields are all required: For , you MUST include
beneficiaryType: "INDIVIDUAL",fullName(YYYY-MM-DD), andbirthDate(2-letter code) in thenationalityobjectbeneficiary - Use correct Nigerian field names: Use (NOT
bankName) and includebankCodepurposeOfPayment - Don't forget country-specific required fields: Brazil (PIX) requires ,
pixKey, andpixKeyType; Europe (IBAN) requirestaxIdswiftBic
- 先检查平台配置:调用查看支持的货币和必填字段
GET /config - 使用最小货币单位:所有金额均为美分/聪 — 使用字段转换为显示格式
decimals - 处理报价过期:报价在1-5分钟内过期;需准备创建新报价
- 选择正确的流程:预资金模式适用于即时执行,JIT模式适用于加密货币/即时结算方式
- 通过jq输出:始终追加以获得可读格式,或使用
| jq .提取特定值| jq -r .field - URL编码特殊字符:UMA地址包含— 在URL路径中需编码为
$%24 - 报价中始终包含目标货币:指定目标账户时,即使外部账户已有货币,也必须在目标对象中包含字段
currency - 个人收款方字段均为必填:对于,必须在
beneficiaryType: "INDIVIDUAL"对象中包含beneficiary、fullName(YYYY-MM-DD格式)和birthDate(两位国家代码)nationality - 使用正确的尼日利亚字段名称:使用(而非
bankName)并包含bankCodepurposeOfPayment - 不要忘记特定国家的必填字段:巴西(PIX)需要、
pixKey和pixKeyType;欧洲(IBAN)需要taxIdswiftBic
Error Handling
错误处理
API responses follow this structure on success:
json
{
"id": "...",
"status": "...",
...
}On error:
json
{
"code": "ERROR_CODE",
"message": "Human readable message"
}The HTTP status code indicates the error category (400 for bad input, 401 for auth issues, 404 for not found, etc.).
成功时API响应遵循以下结构:
json
{
"id": "...",
"status": "...",
...
}错误时:
json
{
"code": "ERROR_CODE",
"message": "易读的错误信息"
}HTTP状态码表示错误类别(400表示输入错误,401表示认证问题,404表示资源不存在等)。
Common Error Codes
常见错误码
Quote/Transfer Errors:
- - Quote timed out; create a new quote
QUOTE_EXPIRED - - Check internal account balance before transfer
INSUFFICIENT_BALANCE - - Validate field formats per country requirements
INVALID_BANK_ACCOUNT - - Transient error; retry with exponential backoff
QUOTE_EXECUTION_FAILED
Incoming Payment Errors:
- - Webhook approval not received within 5 seconds
PAYMENT_APPROVAL_TIMED_OUT - - Webhook returned error
PAYMENT_APPROVAL_WEBHOOK_ERROR
Validation Errors:
- - Check required fields; the
INVALID_INPUTfield has detailsreason - - Customer or sender info missing required fields
MISSING_MANDATORY_USER_INFO
Always check the HTTP status code and report errors clearly to the user.
报价/转账错误:
- - 报价超时;请创建新报价
QUOTE_EXPIRED - - 转账前请检查内部账户余额
INSUFFICIENT_BALANCE - - 根据国家要求验证字段格式
INVALID_BANK_ACCOUNT - - 临时错误;使用指数退避策略重试
QUOTE_EXECUTION_FAILED
入账请求错误:
- - 5秒内未收到Webhook批准
PAYMENT_APPROVAL_TIMED_OUT - - Webhook返回错误
PAYMENT_APPROVAL_WEBHOOK_ERROR
验证错误:
- - 检查必填字段;
INVALID_INPUT字段包含详细信息reason - - 客户或付款方信息缺少必填字段
MISSING_MANDATORY_USER_INFO
请始终检查HTTP状态码,并向用户清晰报告错误信息。