# Creating a Transfer

This endpoint is the starting point for initializing all Wyre transfers - moving and/or exchanging currency or tokens.

After you create the transfer it will be in an `UNCONFIRMED` state. You will have a limited window of time to review the transfer and confirm it before the quote expires. This window depends on the exact currency pair being exchanged, and the `expiresAt` attribute indicates the expiry time (epoch timestamp in milliseconds), based on this window. If the transfer expires you'll have to reissue the transfer request and confirm the new transfer.

You may also instead automatically confirm the transfer by supply `autoConfirm=true` to skip the followup price confirmation.

## Constructing the Transfer Request

The Transfer API offers flexibility in the intents that it accepts. There are three primary constructs that together create this functionality:

### S**ource and destination** <a href="#section-source-and-destination" id="section-source-and-destination"></a>

The `source` of the transfer is the system from which funds are being pulled, while the `dest` is, somewhat unsurprisingly, the final destination of the funds. These parameters are SRNs and can be different types - accounts, payment methods, wallets, or blockchain addresses.

Eligibility varies across these types as well as between specific instances for usage as source or destination. e.g. a bitcoin address may be used (currently) only as a destination, while some payment methods may be able to be used for either source or destination.

### Movement VS Exchange <a href="#section-movement-vs-exchange" id="section-movement-vs-exchange"></a>

The API offers two paramters, `sourceCurrency` and `destCurrency`, which collectively control the exchange behavior of the transfer.

If only `sourceCurrency` is supplied, or both are supplied and are identical, the transfer will perform no exchange and the currency will remain in its original form.

If the two are different, then an exchange is performed to convert the `sourceCurrency` taken from the source to the `destCurrency`.

### Totals <a href="#section-totals" id="section-totals"></a>

There are three common ways to express the numeric totals involved in your Transfer:

**Amount of money to process**

You indicate the amount to move or convert. Fees are added on top of your indicated subtotal, and the resulting final total is withdrawn/requested from the source.

In this case, specify only `sourceAmount`, and `amountIncludesFees` will default to *false*.

**Total to withdraw**

You want to indicate the total amount that will be withdrawn/requested from the source, inclusive of fees.

In this case, specify `sourceAmount` and also specify `amountIncludesFees=true`.

**Total to arrive**

You want to indicate the total amount that will hit the destination. The system will compensate in fees and exchange rate to accomplish it.

In this case, specify only `destAmount`, and `amountIncludesFees` will default to *false*.

## Transfer Fields

| Field          | Description                                                                                                                                                                                                                        |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `exchangeRate` | <p>The quoted exchange rate for the transfer expressed as a multiplier, such that:</p><p><code>sourceAmount \* exchangeRate = destAmount</code></p><p>This rate may vary on shallow markets</p>                                    |
| `totalFees`    | The total fees will always be represented in the source currency. To convert `totalFees` to the destination currency, multiply it by the exchange rate. Note that this object includes all Wyre fees and miner fees if applicable. |
| `sourceAmount` | the total amount of funds, incl. fees, used in processing this transfer                                                                                                                                                            |
| `destAmount`   | the total amount of funds that should be received by the destination                                                                                                                                                               |

## Create Transfer

<mark style="color:green;">`POST`</mark> `https://api.sendwyre.com/v3/transfers`

#### Request Body

| Name               | Type    | Description                                                                                                                                                                                                                                                                                    |
| ------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| source             | string  | An SRN representing an account that the funds will be retrieved from                                                                                                                                                                                                                           |
| sourceAmount       | String  | The amount to withdrawal from the source, in units of `sourceCurrency`. Only include `sourceAmount` OR `destAmount`, not both.                                                                                                                                                                 |
| sourceCurrency     | string  | The currency (ISO 3166-1 alpha-3) to withdrawal from the source wallet                                                                                                                                                                                                                         |
| dest               | string  | An email address, cellphone number, digital currency address or bank account to send the digital currency to. For bitcoin address use "bitcoin:\[address]". Note: cellphone numbers are assumed to be a US number, for international numbers include a '+' and the country code as the prefix. |
| destAmount         | String  | Specifies the total amount of currency to deposit (as defined in `depositCurrency)`. Only include `sourceAmount` OR `destAmount`, not both.                                                                                                                                                    |
| destCurrency       | string  | The currency (ISO 3166-1 alpha-3) to deposit. if not provided, the deposit will be the same as the withdrawal currency (no exchange performed)                                                                                                                                                 |
| message            | string  | A user-visible message to be sent with the transaction.                                                                                                                                                                                                                                        |
| notifyUrl          | string  | An optional URL that Wyre will `POST` a status callback                                                                                                                                                                                                                                        |
| autoConfirm        | boolean | automatically confirm the transfer order.                                                                                                                                                                                                                                                      |
| customId           | string  | An optional custom ID to tag the transfer                                                                                                                                                                                                                                                      |
| amountIncludesFees | boolean | When true, the amount indicated (source or dest) will be treated as already including the fees                                                                                                                                                                                                 |
| preview            | boolean | creates a quote transfer object, but does not execute a real transfer.                                                                                                                                                                                                                         |
| muteMessages       | boolean | When true, disables outbound emails/messages to the destination                                                                                                                                                                                                                                |

{% tabs %}
{% tab title="200 " %}

```
{
    "id": "TF-4F3HRUYPNFY",
    "sourceAmount": 5,
    "sourceCurrency": "USD",
    "destAmount": 0.01,
    "destCurrency": "BTC",
    "status": "PENDING",
    "message": "Payment for DorianNakamoto@sendwyre.com",
    "customId": null,
    "exchangeRate": 499.00,
    "createdAt": 1541552388000,
    "fees": {
        "USD": 0.1,
        "BTC": 0
    },
    "totalFees": 0.1,
    "completedAt": 1541552388000,
    "cancelledAt": null,
    "failureReason": null,
    "expiresAt": 1541553288000,
    "reversingSubStatus": null,
    "reversalReason": null,
    "pendingSubStatus": null,
    "dest": "bitcoin:14CriXWTRoJmQdBzdikw6tEmSuwxMozWWq",
    "blockchainTx": null,
    "statusHistories": [
        {
            "id": "N88AFATLRZY",
            "transferId": "TF-4F3HRUYPNFY",
            "createdAt": 1541552388000,
            "type": "OUTGOING",
            "statusOrder": 0,
            "statusDetail": "Initiating Transfer",
            "state": "INITIATED",
            "failedState": null
        },
        {
            "id": "PED3FNLNUV7",
            "transferId": "TF-4F3HRUYPNFY",
            "createdAt": 1541552388000,
            "type": "OUTGOING",
            "statusOrder": 200,
            "statusDetail": "Processing Exchange",
            "state": "PENDING",
            "failedState": null
        }
    ],
    "owner": "account:AC-WYUR7ZZ6UMU",
    "source": "account:AC-WYUR7ZZ6UMU"
}
```

{% endtab %}
{% endtabs %}

## Examples

```
 {  
     "source":"account:AC-WYUR7ZZ6UMU",
     "sourceCurrency":"USD",
     "sourceAmount":"5",
     "dest":"bitcoin:14CriXWTRoJmQdBzdikw6tEmSuwxMozWWq",
     "destCurrency":"BTC", 
     "message": "Payment for DorianNakamoto@sendwyre.com",
     "autoConfirm":true  
   }
```

####
