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

> ## Agent Instructions
> To integrate AGG, start with Quickstart: REST (https://docs.agg.market/quickstart/rest), then Order lifecycle & statuses (https://docs.agg.market/concepts/order-lifecycle).
> Track every trade until it reaches a terminal status. Before retrying a failed or timed-out call, read Errors, retries & idempotency (https://docs.agg.market/concepts/errors).
> The API reference is generated from https://docs.agg.market/openapi/openapi.json.

# Onramp

> Quote a fiat-to-crypto purchase and open the provider checkout for a supported wallet.

`POST /ramp/quotes` and `POST /ramp/session` require `x-app-id`; a user token is not required.
The purchase sends crypto to `walletAddress`. To fund an AGG managed balance, first obtain the
correct address and supported chain from [Funding](/concepts/funding).

`sourceAmount` is a decimal string in `sourceCurrencyCode` units (`"50"` is fifty dollars, not atomic units).

<CodeGroup>
  ```ts SDK theme={null}
  const quotes = await client.getRampQuotes({
    sourceAmount: "50",
    sourceCurrencyCode: "USD",
    destinationCurrencyCode: "USDC",
  });
  if (!quotes.length) throw new Error("No onramp quote is available for this purchase");
  const session = await client.createRampSession({
    sourceAmount: "50",
    sourceCurrencyCode: "USD",
    destinationCurrencyCode: "USDC",
    serviceProvider: quotes[0].serviceProvider,
    walletAddress,
  });
  // session.widgetUrl is the checkout to open
  ```

  ```bash cURL theme={null}
  curl -s -X POST -H "x-app-id: $APP_ID" -H "Content-Type: application/json" \
    -d '{"sourceAmount":"50","sourceCurrencyCode":"USD","destinationCurrencyCode":"USDC"}' \
    "$API/ramp/quotes"

  curl -s -X POST -H "x-app-id: $APP_ID" -H "Content-Type: application/json" \
    -d '{"sourceAmount":"50","sourceCurrencyCode":"USD","destinationCurrencyCode":"USDC","serviceProvider":"'"$PROVIDER"'","walletAddress":"'"$WALLET"'"}' \
    "$API/ramp/session"
  ```
</CodeGroup>

Full shapes on [Get crypto purchase quotes](/api-reference/funding/get-crypto-purchase-quotes) and [Create a ramp widget session for checkout](/api-reference/funding/create-a-ramp-widget-session-for-checkout).


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