mercury
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMercury Banking API
Mercury Banking API
Manage business bank accounts, transactions, transfers, and financial operations via Mercury's REST API.
Official docs: https://docs.mercury.com/reference/getaccount
When to Use
适用场景
Use this skill when you need to:
- View account balances and details
- List and search transactions
- Create internal transfers between accounts
- Manage recipients for external transfers
- Download account statements
- Access treasury account information
当你需要以下操作时使用该技能:
- 查看账户余额及详情
- 列出并搜索交易记录
- 在账户间创建内部转账
- 管理外部转账的收款人
- 下载账户对账单
- 访问Treasury账户信息
Prerequisites
前置条件
- Sign up for a Mercury business bank account at https://mercury.com
- Go to Settings > Developers > API Tokens
- Create a new API token with appropriate permissions
Set environment variable:
bash
export MERCURY_API_TOKEN="your-api-token"Important: When usingin a command that pipes to another command, wrap the command containing$VARin$VAR. Due to a Claude Code bug, environment variables are silently cleared when pipes are used directly.bash -c '...'bashbash -c 'curl -s "https://api.example.com" --header "Authorization: Bearer $API_KEY"'
- 在https://mercury.com注册Mercury企业银行账户
- 进入 设置 > 开发者 > API令牌 页面
- 创建一个具备相应权限的新API令牌
设置环境变量:
bash
export MERCURY_API_TOKEN="your-api-token"重要提示: 当在包含管道的命令中使用时,请将包含$VAR的命令用$VAR包裹。由于Claude Code的bug,直接使用管道时环境变量会被静默清除。bash -c '...'bashbash -c 'curl -s "https://api.example.com" --header "Authorization: Bearer $API_KEY"'
Accounts
账户管理
List All Accounts
列出所有账户
bash
bash -c 'curl -s "https://api.mercury.com/api/v1/accounts" --header "Authorization: Bearer $MERCURY_API_TOKEN"'bash
bash -c 'curl -s "https://api.mercury.com/api/v1/accounts" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Get Account by ID
通过ID获取账户详情
Replace with the actual account ID:
<your-account-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>" --header "Authorization: Bearer $MERCURY_API_TOKEN"'将替换为实际账户ID:
<your-account-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Get Account Cards
获取账户关联卡片
Replace with the actual account ID:
<your-account-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>/cards" --header "Authorization: Bearer $MERCURY_API_TOKEN"'将替换为实际账户ID:
<your-account-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>/cards" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Transactions
交易管理
List Account Transactions
列出账户交易记录
Replace with the actual account ID:
<your-account-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>/transactions" --header "Authorization: Bearer $MERCURY_API_TOKEN"'将替换为实际账户ID:
<your-account-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>/transactions" --header "Authorization: Bearer $MERCURY_API_TOKEN"'List Transactions with Filters
筛选交易记录
Filter by date range, status, or limit. Replace with the actual account ID:
<your-account-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>/transactions?limit=50&start=2024-01-01&end=2024-12-31" --header "Authorization: Bearer $MERCURY_API_TOKEN"'按日期范围、状态或数量筛选。将替换为实际账户ID:
<your-account-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>/transactions?limit=50&start=2024-01-01&end=2024-12-31" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Get Transaction by ID
通过ID获取交易详情
Replace and with the actual IDs:
<your-account-id><your-transaction-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>/transaction/<your-transaction-id>" --header "Authorization: Bearer $MERCURY_API_TOKEN"'将和替换为实际ID:
<your-account-id><your-transaction-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>/transaction/<your-transaction-id>" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Transfers
转账管理
Create Internal Transfer
创建内部转账
Transfer funds between your Mercury accounts.
Write to :
/tmp/mercury_request.jsonjson
{
"toAccountId": "target-account-id",
"amount": 100.00,
"note": "Internal transfer"
}Then run. Replace with the actual account ID:
<your-account-id>bash
bash -c 'curl -s -X POST "https://api.mercury.com/api/v1/account/<your-account-id>/internal-transfer" --header "Authorization: Bearer $MERCURY_API_TOKEN" --header "Content-Type: application/json" -d @/tmp/mercury_request.json'在你的Mercury账户间划转资金。
写入内容到:
/tmp/mercury_request.jsonjson
{
"toAccountId": "target-account-id",
"amount": 100.00,
"note": "Internal transfer"
}然后执行命令。将替换为实际账户ID:
<your-account-id>bash
bash -c 'curl -s -X POST "https://api.mercury.com/api/v1/account/<your-account-id>/internal-transfer" --header "Authorization: Bearer $MERCURY_API_TOKEN" --header "Content-Type: application/json" -d @/tmp/mercury_request.json'Send Money Request
发起转账请求
Initiate a money transfer request.
Write to :
/tmp/mercury_request.jsonjson
{
"recipientId": "recipient-id",
"amount": 100.00,
"paymentMethod": "ach",
"idempotencyKey": "unique-key-123"
}Then run. Replace with the actual account ID:
<your-account-id>bash
bash -c 'curl -s -X POST "https://api.mercury.com/api/v1/account/<your-account-id>/send-money" --header "Authorization: Bearer $MERCURY_API_TOKEN" --header "Content-Type: application/json" -d @/tmp/mercury_request.json'创建一笔对外转账请求。
写入内容到:
/tmp/mercury_request.jsonjson
{
"recipientId": "recipient-id",
"amount": 100.00,
"paymentMethod": "ach",
"idempotencyKey": "unique-key-123"
}然后执行命令。将替换为实际账户ID:
<your-account-id>bash
bash -c 'curl -s -X POST "https://api.mercury.com/api/v1/account/<your-account-id>/send-money" --header "Authorization: Bearer $MERCURY_API_TOKEN" --header "Content-Type: application/json" -d @/tmp/mercury_request.json'Get Send Money Request Status
查询转账请求状态
Replace with the actual request ID:
<your-request-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/request-send-money/<your-request-id>" --header "Authorization: Bearer $MERCURY_API_TOKEN"'将替换为实际请求ID:
<your-request-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/request-send-money/<your-request-id>" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Recipients
收款人管理
List All Recipients
列出所有收款人
bash
bash -c 'curl -s "https://api.mercury.com/api/v1/recipients" --header "Authorization: Bearer $MERCURY_API_TOKEN"'bash
bash -c 'curl -s "https://api.mercury.com/api/v1/recipients" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Get Recipient by ID
通过ID获取收款人详情
Replace with the actual recipient ID:
<your-recipient-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/recipient/<your-recipient-id>" --header "Authorization: Bearer $MERCURY_API_TOKEN"'将替换为实际收款人ID:
<your-recipient-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/recipient/<your-recipient-id>" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Create Recipient
创建收款人
Write to :
/tmp/mercury_request.jsonjson
{
"name": "Vendor Name",
"emails": ["vendor@example.com"],
"paymentMethod": "ach",
"electronicRoutingInfo": {
"accountNumber": "123456789",
"routingNumber": "021000021",
"bankName": "Example Bank",
"electronicAccountType": "businessChecking"
}
}Then run:
bash
bash -c 'curl -s -X POST "https://api.mercury.com/api/v1/recipients" --header "Authorization: Bearer $MERCURY_API_TOKEN" --header "Content-Type: application/json" -d @/tmp/mercury_request.json'写入内容到:
/tmp/mercury_request.jsonjson
{
"name": "Vendor Name",
"emails": ["vendor@example.com"],
"paymentMethod": "ach",
"electronicRoutingInfo": {
"accountNumber": "123456789",
"routingNumber": "021000021",
"bankName": "Example Bank",
"electronicAccountType": "businessChecking"
}
}然后执行命令:
bash
bash -c 'curl -s -X POST "https://api.mercury.com/api/v1/recipients" --header "Authorization: Bearer $MERCURY_API_TOKEN" --header "Content-Type: application/json" -d @/tmp/mercury_request.json'Statements
对账单管理
List Account Statements
列出账户对账单
Replace with the actual account ID:
<your-account-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>/statements" --header "Authorization: Bearer $MERCURY_API_TOKEN"'将替换为实际账户ID:
<your-account-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>/statements" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Download Statement PDF
下载对账单PDF
Replace and with the actual IDs:
<your-account-id><your-statement-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>/statement/<your-statement-id>/pdf" --header "Authorization: Bearer $MERCURY_API_TOKEN"' > statement.pdf将和替换为实际ID:
<your-account-id><your-statement-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>/statement/<your-statement-id>/pdf" --header "Authorization: Bearer $MERCURY_API_TOKEN"' > statement.pdfOrganization
企业信息
Get Organization Info
获取企业信息
bash
bash -c 'curl -s "https://api.mercury.com/api/v1/organization" --header "Authorization: Bearer $MERCURY_API_TOKEN"'bash
bash -c 'curl -s "https://api.mercury.com/api/v1/organization" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Treasury
资金管理账户
List Treasury Accounts
列出资金管理账户
bash
bash -c 'curl -s "https://api.mercury.com/api/v1/treasury" --header "Authorization: Bearer $MERCURY_API_TOKEN"'bash
bash -c 'curl -s "https://api.mercury.com/api/v1/treasury" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Get Treasury Account by ID
通过ID获取资金管理账户详情
Replace with the actual treasury ID:
<your-treasury-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/treasury/<your-treasury-id>" --header "Authorization: Bearer $MERCURY_API_TOKEN"'将替换为实际资金管理账户ID:
<your-treasury-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/treasury/<your-treasury-id>" --header "Authorization: Bearer $MERCURY_API_TOKEN"'List Treasury Transactions
列出资金管理账户交易记录
Replace with the actual treasury ID:
<your-treasury-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/treasury/<your-treasury-id>/transactions" --header "Authorization: Bearer $MERCURY_API_TOKEN"'将替换为实际资金管理账户ID:
<your-treasury-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/treasury/<your-treasury-id>/transactions" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Users
用户管理
List Users
列出所有用户
bash
bash -c 'curl -s "https://api.mercury.com/api/v1/users" --header "Authorization: Bearer $MERCURY_API_TOKEN"'bash
bash -c 'curl -s "https://api.mercury.com/api/v1/users" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Credit
信贷管理
List Credit Accounts
列出信贷账户
bash
bash -c 'curl -s "https://api.mercury.com/api/v1/credit" --header "Authorization: Bearer $MERCURY_API_TOKEN"'bash
bash -c 'curl -s "https://api.mercury.com/api/v1/credit" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Accounts Receivable
应收账款管理
List Customers
列出客户
bash
bash -c 'curl -s "https://api.mercury.com/api/v1/accounts-receivable/customers" --header "Authorization: Bearer $MERCURY_API_TOKEN"'bash
bash -c 'curl -s "https://api.mercury.com/api/v1/accounts-receivable/customers" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Create Customer
创建客户
Write to :
/tmp/mercury_request.jsonjson
{
"name": "Customer Name",
"email": "customer@example.com"
}Then run:
bash
bash -c 'curl -s -X POST "https://api.mercury.com/api/v1/accounts-receivable/customers" --header "Authorization: Bearer $MERCURY_API_TOKEN" --header "Content-Type: application/json" -d @/tmp/mercury_request.json'写入内容到:
/tmp/mercury_request.jsonjson
{
"name": "Customer Name",
"email": "customer@example.com"
}然后执行命令:
bash
bash -c 'curl -s -X POST "https://api.mercury.com/api/v1/accounts-receivable/customers" --header "Authorization: Bearer $MERCURY_API_TOKEN" --header "Content-Type: application/json" -d @/tmp/mercury_request.json'List Invoices
列出发票
bash
bash -c 'curl -s "https://api.mercury.com/api/v1/accounts-receivable/invoices" --header "Authorization: Bearer $MERCURY_API_TOKEN"'bash
bash -c 'curl -s "https://api.mercury.com/api/v1/accounts-receivable/invoices" --header "Authorization: Bearer $MERCURY_API_TOKEN"'Create Invoice
创建发票
Write to :
/tmp/mercury_request.jsonjson
{
"customerId": "customer-id",
"lineItems": [{"description": "Service", "amount": 500.00}],
"dueDate": "2024-12-31"
}Then run:
bash
bash -c 'curl -s -X POST "https://api.mercury.com/api/v1/accounts-receivable/invoices" --header "Authorization: Bearer $MERCURY_API_TOKEN" --header "Content-Type: application/json" -d @/tmp/mercury_request.json'写入内容到:
/tmp/mercury_request.jsonjson
{
"customerId": "customer-id",
"lineItems": [{"description": "Service", "amount": 500.00}],
"dueDate": "2024-12-31"
}然后执行命令:
bash
bash -c 'curl -s -X POST "https://api.mercury.com/api/v1/accounts-receivable/invoices" --header "Authorization: Bearer $MERCURY_API_TOKEN" --header "Content-Type: application/json" -d @/tmp/mercury_request.json'Download Invoice PDF
下载发票PDF
Replace with the actual invoice ID:
<your-invoice-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/accounts-receivable/invoice/<your-invoice-id>/pdf" --header "Authorization: Bearer $MERCURY_API_TOKEN"' > invoice.pdf将替换为实际发票ID:
<your-invoice-id>bash
bash -c 'curl -s "https://api.mercury.com/api/v1/accounts-receivable/invoice/<your-invoice-id>/pdf" --header "Authorization: Bearer $MERCURY_API_TOKEN"' > invoice.pdfGuidelines
注意事项
- Rate Limits: Mercury may enforce rate limits; implement appropriate backoff strategies for high-volume operations
- Idempotency: Use for transfer operations to prevent duplicate transactions
idempotencyKey - Security: Never expose API tokens in logs or client-side code
- Amounts: All monetary amounts are typically in USD and represented as decimal numbers
- Pagination: For large result sets, use and
limitparameters where supportedoffset
- 速率限制:Mercury可能会实施请求速率限制,高频率操作时请实现相应的退避策略
- 幂等性:转账操作请使用以避免重复交易
idempotencyKey - 安全规范:切勿在日志或客户端代码中暴露API令牌
- 金额格式:所有金额默认以美元为单位,采用十进制数值表示
- 分页处理:对于大量结果集,请使用支持的和
limit参数进行分页offset
API Reference
API参考
- Documentation: https://docs.mercury.com/reference/getaccount
- Dashboard: https://dashboard.mercury.com