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

# Create Transfer

> Execute an onramp or offramp transfer using a quote

## Offramp Transfer (Crypto → Fiat)

Convert cryptocurrency to fiat and send to a bank account.

### Method Signature

```typescript theme={null}
align.transfers.createOfframpTransfer(
  customerId: string,
  quoteId: string,
  data: CreateOfframpTransferRequest
): Promise<Transfer>
```

### Parameters

<ParamField path="customerId" type="string" required>
  The unique customer identifier (UUID format)
</ParamField>

<ParamField path="quoteId" type="string" required>
  Quote ID from a previous `createOfframpQuote` call
</ParamField>

<ParamField body="transfer_purpose" type="string" required>
  Transfer purpose code (e.g., `personal_expenses`, `business_payment`)
</ParamField>

<ParamField body="destination_external_account_id" type="string">
  Bank account ID to receive the fiat funds. Required if
  `destination_bank_account` is not provided.
</ParamField>

<ParamField body="destination_bank_account" type="object">
  Inline bank account details (alternative to `destination_external_account_id`)
</ParamField>

### Example

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    import Align from "@tolbel/align";

    const align = new Align({
      apiKey: process.env.ALIGN_API_KEY!,
      environment: "sandbox",
    });

    // Step 1: Get a quote
    const quote = await align.transfers.createOfframpQuote(customerId, {
      source_amount: "100.00",
      source_token: "usdc",
      source_network: "polygon",
      destination_currency: "usd",
      destination_payment_rails: "ach",
    });

    // Step 2: Execute the transfer
    const transfer = await align.transfers.createOfframpTransfer(
      customerId,
      quote.quote_id,
      {
        destination_external_account_id: "ext_123",
        transfer_purpose: "personal_expenses",
      }
    );

    console.log(`Transfer ID: ${transfer.id}`);
    console.log(`Status: ${transfer.status}`);
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const quote = await align.transfers.createOfframpQuote(customerId, {
      source_amount: "100.00",
      source_token: "usdc",
      source_network: "polygon",
      destination_currency: "usd",
      destination_payment_rails: "ach",
    });

    const transfer = await align.transfers.createOfframpTransfer(
      customerId,
      quote.quote_id,
      {
        destination_external_account_id: "ext_123",
        transfer_purpose: "personal_expenses",
      }
    );

    console.log("Transfer ID:", transfer.id);
    ```
  </Tab>
</Tabs>

***

## Onramp Transfer (Fiat → Crypto)

Convert fiat to cryptocurrency and send to a wallet.

### Method Signature

```typescript theme={null}
align.transfers.createOnrampTransfer(
  customerId: string,
  quoteId: string,
  data: CreateOnrampTransferRequest
): Promise<Transfer>
```

### Parameters

<ParamField path="customerId" type="string" required>
  The unique customer identifier (UUID format)
</ParamField>

<ParamField path="quoteId" type="string" required>
  Quote ID from a previous `createOnrampQuote` call
</ParamField>

<ParamField body="destination_address" type="string" required>
  Wallet address to receive the cryptocurrency
</ParamField>

### Example

```typescript theme={null}
// Step 1: Get a quote
const quote = await align.transfers.createOnrampQuote(customerId, {
  source_amount: "100.00",
  source_currency: "usd",
  source_payment_rails: "ach",
  destination_token: "usdc",
  destination_network: "polygon",
});

// Step 2: Execute the transfer
const transfer = await align.transfers.createOnrampTransfer(
  customerId,
  quote.quote_id,
  {
    destination_address: "0x742d35Cc6634C0532925a3b844Bc9e7595f0aB42",
  }
);

console.log(`Transfer ID: ${transfer.id}`);
// Funds will be sent to the wallet once fiat is deposited
```

***

## Transfer Response

Calls return a `Transfer` object containing status and amounts.

## Transfer Statuses

| Status       | Description                           |
| ------------ | ------------------------------------- |
| `pending`    | Transfer initiated, waiting for funds |
| `processing` | Transfer is being processed           |
| `completed`  | Transfer completed successfully       |
| `failed`     | Transfer failed                       |
| `refunded`   | Transfer was refunded                 |

## Error Handling

```typescript theme={null}
import { AlignError, AlignValidationError } from "@tolbel/align";

try {
  const transfer = await align.transfers.createOfframpTransfer(
    customerId,
    quote.quote_id,
    {
      destination_external_account_id: "ext_123",
      transfer_purpose: "personal_expenses",
    }
  );
} catch (error) {
  if (error instanceof AlignError) {
    if (error.statusCode === 400) {
      console.error("Quote expired or invalid");
    } else if (error.statusCode === 403) {
      console.error("KYC verification required");
    }
  }
}
```

<Warning>
  Quotes expire after a short time. If you receive a "quote expired" error,
  request a new quote before creating the transfer.
</Warning>

## Related Methods

<CardGroup cols={2}>
  <Card title="Create Quote" icon="calculator" href="/docs/api/transfers/create-quote">
    Get a quote first
  </Card>

  <Card title="Get Offramp Transfer" icon="eye" href="/docs/api/transfers/get-offramp-transfer">
    Track transfer status
  </Card>

  <Card title="Complete Transfer" icon="check" href="/docs/api/transfers/complete-transfer">
    Complete offramp transfers
  </Card>
</CardGroup>
