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

# API Overview

> Introduction to the NowRamp Onramp API

# API Overview

The NowRamp Onramp API lets you compare crypto purchase quotes across multiple payment gateways and process checkouts with the best available provider.

## Base URL

| Environment | Base URL                          | Description                     |
| ----------- | --------------------------------- | ------------------------------- |
| Production  | `https://api.nowramp.com`         | Live environment                |
| Sandbox     | `https://api.sandbox.nowramp.com` | Test environment with mock data |

## Authentication

The Onramp API endpoints are **public** — no API key is required. Pass your `projectId` as a query parameter (GET) or in the request body (POST).

```bash theme={null}
curl "https://api.nowramp.com/public/v1/onramp/supported?projectId=YOUR_PROJECT_ID"
```

Optionally include a public key (`pk_`) in the `X-API-Key` header for higher rate limits:

```bash theme={null}
curl "https://api.nowramp.com/public/v1/onramp/quotes?projectId=YOUR_PROJECT_ID&fiatCurrency=USD&cryptoCurrency=ETH&network=ethereum&fiatAmount=100" \
  -H "X-API-Key: pk_live_your_public_key"
```

<Warning>
  Never expose secret keys (`sk_`) in client-side code. Secret keys are only needed for partner dashboard operations, not for the Onramp API.
</Warning>

## Endpoints

### Sessions (authenticated)

| Endpoint                   | Method | Auth                   | Description                |
| -------------------------- | ------ | ---------------------- | -------------------------- |
| `/v1/sessions`             | POST   | `sk_`                  | Create a checkout session  |
| `/v1/sessions/:id`         | GET    | `pk_` or `sk_`         | Get session status         |
| `/v1/sessions/:id/confirm` | POST   | `pk_` + `clientSecret` | Confirm session parameters |
| `/v1/sessions/:id/order`   | POST   | `pk_` + `clientSecret` | Create order from session  |
| `/v1/sessions/:id/cancel`  | POST   | `sk_`                  | Cancel a session           |
| `/v1/sessions`             | GET    | `sk_`                  | List sessions              |

See the [Sessions API reference](/api/sessions) for full documentation.

### Onramp (public)

| Endpoint                             | Method | Auth | Description                                                        |
| ------------------------------------ | ------ | ---- | ------------------------------------------------------------------ |
| `/public/v1/onramp/supported`        | GET    | None | Aggregated provider config (gateways, currencies, payment methods) |
| `/public/v1/onramp/quotes`           | GET    | None | Multi-provider quotes ranked by best rate                          |
| `/public/v1/onramp/checkout-intent`  | POST   | None | Create checkout with selected provider                             |
| `/public/v1/onramp/transactions/:id` | GET    | None | Transaction status                                                 |

See the [Onramp API reference](/api/onramp) for full request/response documentation.

## Request Format

* All POST requests should use `Content-Type: application/json`
* Request bodies should be JSON-encoded
* All timestamps are in ISO 8601 format (UTC)

## Response Format

### Success Response

```json theme={null}
{
  "success": true,
  "data": {
    // Response data
  }
}
```

### Error Response

```json theme={null}
{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": [
      {
        "field": "fieldName",
        "message": "Field-specific error message"
      }
    ]
  }
}
```

See [Error Handling](/api/errors) for the full list of error codes.

## Rate Limiting

| Tier    | Requests per Minute | Description              |
| ------- | ------------------- | ------------------------ |
| Public  | 60                  | No API key               |
| Partner | 1000                | With `pk_` key in header |

### Rate Limit Headers

| Header                  | Description                               |
| ----------------------- | ----------------------------------------- |
| `X-RateLimit-Limit`     | Maximum requests allowed per window       |
| `X-RateLimit-Remaining` | Remaining requests in current window      |
| `X-RateLimit-Reset`     | Unix timestamp when the rate limit resets |

When you exceed the rate limit, the API returns `429 Too Many Requests`. Implement exponential backoff to handle this gracefully.

## Idempotency

For the `POST /checkout-intent` endpoint, include an `Idempotency-Key` header to prevent duplicate orders:

```bash theme={null}
curl -X POST https://api.nowramp.com/public/v1/onramp/checkout-intent \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: checkout_user123_1705123456" \
  -d '{"projectId": "...", "gateway": "...", ...}'
```

Idempotency keys are valid for **24 hours**. Requests with the same key return the cached response from the original request.

## SDKs

* [JavaScript SDK](/sdk/js-sdk) — `RampApi` client for programmatic API access
* [React Components](/sdk/form) — Drop-in checkout form with hooks for custom UIs

## Next Steps

* [Quickstart](/quickstart) — Get up and running in 5 minutes
* [Session-Based Checkout](/guides/session-checkout) — Secure server-side sessions with hosted checkout
* [Sessions API](/api/sessions) — Session endpoint reference
* [Onramp API](/api/onramp) — Onramp endpoint reference
* [Callback URLs](/guides/callback-urls) — Receive transaction notifications
