> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stablepayfi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 创建账户间划转

> 创建账户间划转

完整[认证、签名、数据约定与错误响应](https://docs.stablepayfi.ai/zh/api/global-accounts/overview)。每次重试均须重新生成时间戳、nonce 与签名。

`POST /fund/account_transfers` 同一商户两个同币种账户之间划转，同步执行。

## 请求头

**Authorization** `string` *required*

Bearer API Key。

**X-StablePay-Timestamp** `string` *required*

Unix 秒，允许与服务端相差最多 5 分钟。

**X-StablePay-Nonce** `string` *required*

每次请求唯一的随机串，16–64 字符。

**X-StablePay-Signature** `string` *required*

HMAC-SHA256 签名，小写十六进制；签名必须对应实际发送的请求体。

**Idempotency-Key** `string`

幂等键

## 请求参数

**merchant\_id** `string`

10 位数字；商户 App 不传，服务商 App 必传

**external\_account\_transfer\_id** `string`

业务参考号

**currency** `string` *required*

币种，两个账户同币种

**amount** `integer` *required*

划转金额

**source\_account\_no** `string` *required*

转出账户编号

**target\_account\_no** `string` *required*

转入账户编号

**metadata** `object`

自定义元数据

## 响应

**account\_transfer\_id** `string` *required*

划转 ID，10 位数字

**merchant\_id** `string` *required*

商户 ID

**external\_account\_transfer\_id** `string`

业务参考号

**currency** `string` *required*

币种

**amount** `integer` *required*

划转金额

**source\_account\_no** `string` *required*

转出账户

**target\_account\_no** `string` *required*

转入账户

**status** `string` *required*

completed

**created** `integer` *required*

创建时间

## 状态与错误

400 参数不合法；409 余额不足或幂等冲突。

```bash cURL theme={"system"}
curl --request POST \
  --url "https://api.stablepay.co/api/v1/fund/account_transfers" \
  --header "Authorization: Bearer <API_KEY>" \
  --header "X-StablePay-Timestamp: <TIMESTAMP>" \
  --header "X-StablePay-Nonce: <NONCE>" \
  --header "X-StablePay-Signature: <SIGNATURE>" \
  --header "Content-Type: application/json" \
  --data '{
  "merchant_id": "2000000001",
  "currency": "USDC",
  "amount": 500000,
  "source_account_no": "00000001",
  "target_account_no": "00000002"
}'
```

```javascript JavaScript theme={"system"}
const response = await fetch("https://api.stablepay.co/api/v1/fund/account_transfers", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <API_KEY>",
    "X-StablePay-Timestamp": "<TIMESTAMP>",
    "X-StablePay-Nonce": "<NONCE>",
    "X-StablePay-Signature": "<SIGNATURE>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "merchant_id": "2000000001",
    "currency": "USDC",
    "amount": 500000,
    "source_account_no": "00000001",
    "target_account_no": "00000002"
  })
});
console.log(await response.json());
```

```json 200 theme={"system"}
{
  "account_transfer_id": "9000000034",
  "merchant_id": "2000000001",
  "currency": "USDC",
  "amount": 500000,
  "source_account_no": "00000001",
  "target_account_no": "00000002",
  "status": "completed",
  "created": 1718726401
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.