> ## 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.

# Create a transfer (fiat to stablecoin, stablecoin to fiat, stablecoin swap)

> Create a transfer (fiat to stablecoin, stablecoin to fiat, stablecoin swap)

See [authentication, signing, data conventions, and errors](https://docs.stablepayfi.ai/en/api/stablecoin-exchange/overview). Regenerate the timestamp, nonce, and signature on every retry.

`POST /transfer` One conversion: `on_ramp` fiat to stablecoin, `off_ramp` stablecoin to fiat, swap stablecoin to stablecoin.

## Request headers

**Authorization** `string` *required*

Bearer API Key.

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

Unix seconds, within five minutes of server time.

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

Unique per request, 16–64 characters.

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

Lowercase hexadecimal HMAC-SHA256 signature for the exact request body.

**Idempotency-Key** `string`

Idempotency key

## Request parameters

**merchant\_id** `string`

Must match the quote merchant when `quote_id` is used

**transfer\_type** `string` *required*

`on_ramp`, `off_ramp`, swap

**amount** `integer` *required*

Sell amount; must equal the deposit amount for `on_ramp`

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

Business reference

**quote\_id** `string`

Quote to execute; exclusive with `rate_type`

**rate\_type** `string`

fixed or floating

**fiat\_deposit\_id** `string`

Required for `on_ramp`

**source\_currency** `string`

Sell currency for swap and `off_ramp`

**source\_network** `string`

Source network

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

Required for swap and `off_ramp`

**target\_currency** `string`

Buy currency

**target\_network** `string`

Target network

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

Target account for `on_ramp`

**recipient\_id** `string`

Required for `off_ramp`; optional for `on_ramp` and swap

**metadata** `object`

Custom metadata

## Response

**transfer\_id** `string` *required*

Transfer ID

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

Merchant ID

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

Business reference

**transfer\_type** `string` *required*

`on_ramp`, `off_ramp`, swap

**quote\_id** `string`

Executed quote ID

**fiat\_deposit\_id** `string`

Deposit record for `on_ramp`

**source\_currency** `string`

Sell currency

**target\_currency** `string`

Buy currency

**source\_network** `string`

Source network

**target\_network** `string`

Target network

**source\_amount** `integer`

Sell amount excluding fees

**target\_amount** `integer`

Buy amount; estimate under floating

**rate\_type** `string`

fixed or floating

**rate** `string`

Rate, decimal string

**fee\_amount** `integer`

Fee

**fee\_currency** `string`

Fee currency

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

Source account

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

Target account

**recipient\_id** `string`

Recipient ID

**recipient** `object`

Address and memo, or bank fields

**status** `string` *required*

processing, `payment_submitted`, completed, `funds_refunded`, `bounced_back`

**failure\_reason** `string`

Failure reason

**metadata** `object`

Custom metadata

**created** `integer` *required*

Creation time

**updated** `integer`

Last update time

## Status and errors

400 invalid parameters; 404 unknown quote or deposit; 409 quote consumed, expired, or insufficient funds.

```bash cURL theme={"system"}
curl --request POST \
  --url "https://api.stablepay.co/api/v1/transfer" \
  --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 '{
  "transfer_type": "on_ramp",
  "fiat_deposit_id": "9000000090",
  "amount": 100500,
  "target_currency": "USDC",
  "target_network": "solana",
  "rate_type": "fixed"
}'
```

```javascript JavaScript theme={"system"}
const response = await fetch("https://api.stablepay.co/api/v1/transfer", {
  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({
    "transfer_type": "on_ramp",
    "fiat_deposit_id": "9000000090",
    "amount": 100500,
    "target_currency": "USDC",
    "target_network": "solana",
    "rate_type": "fixed"
  })
});
console.log(await response.json());
```

```json 200 theme={"system"}
{
  "transfer_id": "9000000011",
  "merchant_id": "2000000001",
  "transfer_type": "on_ramp",
  "quote_id": "9000000017",
  "fiat_deposit_id": "9000000090",
  "source_amount": 100500,
  "target_amount": 100479,
  "rate_type": "fixed",
  "rate": "0.9998",
  "fee_amount": 5,
  "fee_currency": "USD",
  "target_account_no": "00000001",
  "status": "processing",
  "created": 1718726400
}
```


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