mercury

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Mercury Banking API

Mercury Banking API

Manage business bank accounts, transactions, transfers, and financial operations via Mercury's REST API.

通过Mercury的REST API管理企业银行账户、交易、转账及各类金融操作。

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

前置条件

  1. Sign up for a Mercury business bank account at https://mercury.com
  2. Go to Settings > Developers > API Tokens
  3. Create a new API token with appropriate permissions
Set environment variable:
bash
export MERCURY_API_TOKEN="your-api-token"
Important: When using
$VAR
in a command that pipes to another command, wrap the command containing
$VAR
in
bash -c '...'
. Due to a Claude Code bug, environment variables are silently cleared when pipes are used directly.
bash
bash -c 'curl -s "https://api.example.com" --header "Authorization: Bearer $API_KEY"'

  1. https://mercury.com注册Mercury企业银行账户
  2. 进入 设置 > 开发者 > API令牌 页面
  3. 创建一个具备相应权限的新API令牌
设置环境变量:
bash
export MERCURY_API_TOKEN="your-api-token"
重要提示: 当在包含管道的命令中使用
$VAR
时,请将包含
$VAR
的命令用
bash -c '...'
包裹。由于Claude Code的bug,直接使用管道时环境变量会被静默清除。
bash
bash -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
<your-account-id>
with the actual account ID:
bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>" --header "Authorization: Bearer $MERCURY_API_TOKEN"'
<your-account-id>
替换为实际账户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
<your-account-id>
with the actual account ID:
bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>/cards" --header "Authorization: Bearer $MERCURY_API_TOKEN"'

<your-account-id>
替换为实际账户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
<your-account-id>
with the actual account ID:
bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>/transactions" --header "Authorization: Bearer $MERCURY_API_TOKEN"'
<your-account-id>
替换为实际账户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
<your-account-id>
with the actual 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"'
按日期范围、状态或数量筛选。将
<your-account-id>
替换为实际账户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
<your-account-id>
and
<your-transaction-id>
with the actual IDs:
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"'

<your-account-id>
<your-transaction-id>
替换为实际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.json
:
json
{
  "toAccountId": "target-account-id",
  "amount": 100.00,
  "note": "Internal transfer"
}
Then run. Replace
<your-account-id>
with the actual 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.json
json
{
  "toAccountId": "target-account-id",
  "amount": 100.00,
  "note": "Internal transfer"
}
然后执行命令。将
<your-account-id>
替换为实际账户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.json
:
json
{
  "recipientId": "recipient-id",
  "amount": 100.00,
  "paymentMethod": "ach",
  "idempotencyKey": "unique-key-123"
}
Then run. Replace
<your-account-id>
with the actual 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.json
json
{
  "recipientId": "recipient-id",
  "amount": 100.00,
  "paymentMethod": "ach",
  "idempotencyKey": "unique-key-123"
}
然后执行命令。将
<your-account-id>
替换为实际账户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
<your-request-id>
with the actual 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"'

<your-request-id>
替换为实际请求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
<your-recipient-id>
with the actual recipient ID:
bash
bash -c 'curl -s "https://api.mercury.com/api/v1/recipient/<your-recipient-id>" --header "Authorization: Bearer $MERCURY_API_TOKEN"'
<your-recipient-id>
替换为实际收款人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.json
:
json
{
  "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.json
json
{
  "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
<your-account-id>
with the actual account ID:
bash
bash -c 'curl -s "https://api.mercury.com/api/v1/account/<your-account-id>/statements" --header "Authorization: Bearer $MERCURY_API_TOKEN"'
<your-account-id>
替换为实际账户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
<your-account-id>
and
<your-statement-id>
with the actual IDs:
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

<your-account-id>
<your-statement-id>
替换为实际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

Organization

企业信息

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
<your-treasury-id>
with the actual treasury ID:
bash
bash -c 'curl -s "https://api.mercury.com/api/v1/treasury/<your-treasury-id>" --header "Authorization: Bearer $MERCURY_API_TOKEN"'
<your-treasury-id>
替换为实际资金管理账户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
<your-treasury-id>
with the actual treasury ID:
bash
bash -c 'curl -s "https://api.mercury.com/api/v1/treasury/<your-treasury-id>/transactions" --header "Authorization: Bearer $MERCURY_API_TOKEN"'

<your-treasury-id>
替换为实际资金管理账户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.json
:
json
{
  "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.json
json
{
  "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.json
:
json
{
  "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.json
json
{
  "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
<your-invoice-id>
with the actual 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

<your-invoice-id>
替换为实际发票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

Guidelines

注意事项

  1. Rate Limits: Mercury may enforce rate limits; implement appropriate backoff strategies for high-volume operations
  2. Idempotency: Use
    idempotencyKey
    for transfer operations to prevent duplicate transactions
  3. Security: Never expose API tokens in logs or client-side code
  4. Amounts: All monetary amounts are typically in USD and represented as decimal numbers
  5. Pagination: For large result sets, use
    limit
    and
    offset
    parameters where supported

  1. 速率限制:Mercury可能会实施请求速率限制,高频率操作时请实现相应的退避策略
  2. 幂等性:转账操作请使用
    idempotencyKey
    以避免重复交易
  3. 安全规范:切勿在日志或客户端代码中暴露API令牌
  4. 金额格式:所有金额默认以美元为单位,采用十进制数值表示
  5. 分页处理:对于大量结果集,请使用支持的
    limit
    offset
    参数进行分页

API Reference

API参考