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

# Sandbox Environment

> Test the Execution API without using real money

Pure provides a sandbox environment for testing the Execution API — both [buying](/api-reference/execution-buy) and [selling](/api-reference/execution-sell) — without using real money.

<CardGroup cols={2}>
  <Card title="Sandbox API" icon="flask">
    **Base URL:** `https://sandbox.api.collectpure.com`

    All sandbox requests use the same endpoints and schemas as production — just point to the sandbox base URL.
  </Card>

  <Card title="Sandbox API Keys" icon="key">
    Generate a sandbox API key from your [API Keys dashboard](https://www.collectpure.com/dashboard/api-keys).

    Select **Sandbox** environment when creating the key.
  </Card>
</CardGroup>

## Getting Started

<Steps>
  <Step title="Create a Sandbox API Key">
    Go to
    [collectpure.com/dashboard/api-keys](https://www.collectpure.com/dashboard/api-keys)
    and create a new API key. Select the **Sandbox** environment.
  </Step>

  <Step title="Sandbox Data is Created For You">
    When you create a sandbox key, Pure automatically provisions test data for
    your organization — including products, listings, offers, and payment
    methods. You can start making API calls immediately.
  </Step>

  <Step title="Use the Sandbox Base URL">
    Point all your requests to `https://sandbox.api.collectpure.com` instead of
    the production URL. Use your sandbox API key in the `x-api-key` header.
  </Step>

  <Step title="Test the Full Flow">
    Fetch test listings or offers, create quotes, review pricing, and execute
    orders — all in a safe testing environment with no real money involved.
  </Step>
</Steps>

<Warning>
  Sandbox API keys **cannot** be used against the production API, and production
  keys **cannot** be used in sandbox. Make sure you're using the correct key for
  the environment.
</Warning>

## Sandbox Endpoints

The sandbox environment exposes additional endpoints to help you discover test data. These endpoints are **only available in sandbox** and do not exist in production.

### `GET /sandbox/listings/get/v1` — Get test listings

Returns active listings available for testing. Use the `listingId` from the response to create buy quotes.

| Parameter | Type   | Default | Description                             |
| --------- | ------ | ------- | --------------------------------------- |
| `limit`   | number | 50      | Max listings to return (1–250)          |
| `offset`  | number | 0       | Number of listings to skip (pagination) |

**Response fields:**

| Field               | Type   | Description                                          |
| ------------------- | ------ | ---------------------------------------------------- |
| `listingId`         | string | The listing ID — pass this to the buy quote endpoint |
| `productId`         | string | The product ID                                       |
| `variantId`         | string | The variant ID                                       |
| `productTitle`      | string | Product name                                         |
| `sku`               | string | Product SKU                                          |
| `material`          | string | Material (Gold, Silver, etc.)                        |
| `quantity`          | number | Available quantity                                   |
| `price`             | number | Price in cents                                       |
| `priceDollars`      | number | Price in dollars                                     |
| `spotPremium`       | number | Premium over spot (%)                                |
| `spotPremiumDollar` | number | Premium over spot (\$)                               |
| `expiresAt`         | string | ISO 8601 listing expiration                          |

### `GET /sandbox/offers/get/v1` — Get test offers

Returns active buy offers available for testing. Use the `offerId` from the response to create sell quotes.

| Parameter | Type   | Default | Description                           |
| --------- | ------ | ------- | ------------------------------------- |
| `limit`   | number | 50      | Max offers to return (1–250)          |
| `offset`  | number | 0       | Number of offers to skip (pagination) |

**Response fields:**

| Field               | Type   | Description                                         |
| ------------------- | ------ | --------------------------------------------------- |
| `offerId`           | string | The offer ID — pass this to the sell quote endpoint |
| `productId`         | string | The product ID                                      |
| `variantId`         | string | The variant ID                                      |
| `productTitle`      | string | Product name                                        |
| `sku`               | string | Product SKU                                         |
| `material`          | string | Material (Gold, Silver, etc.)                       |
| `quantity`          | number | Available quantity                                  |
| `price`             | number | Price in cents                                      |
| `priceDollars`      | number | Price in dollars                                    |
| `spotPremium`       | number | Premium over spot (%)                               |
| `spotPremiumDollar` | number | Premium over spot (\$)                              |
| `expiresAt`         | string | ISO 8601 offer expiration                           |

## Buy Example

```bash theme={null}
# 1. Get your payment methods
curl -X GET https://sandbox.api.collectpure.com/execution/payment-methods/v1 \
  -H "x-api-key: YOUR_SANDBOX_KEY"

# 2. Fetch available test listings
curl -X GET "https://sandbox.api.collectpure.com/sandbox/listings/get/v1?limit=5" \
  -H "x-api-key: YOUR_SANDBOX_KEY"

# 3. Create a quote (include paymentMethod for accurate pricing)
curl -X POST https://sandbox.api.collectpure.com/execution/buy/quote/v1 \
  -H "x-api-key: YOUR_SANDBOX_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      { "listingId": "LISTING_ID_FROM_STEP_2", "quantity": 1 }
    ],
    "paymentMethod": "pm_XXXXX"
  }'

# 4. Execute the buy (pass the total from the quote as expectedTotal)
curl -X POST https://sandbox.api.collectpure.com/execution/buy/v1 \
  -H "x-api-key: YOUR_SANDBOX_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "quoteId": "QUOTE_ID_FROM_STEP_3",
    "expectedTotal": TOTAL_FROM_STEP_3,
    "paymentMethod": "pm_XXXXX",
    "shipping": {
      "name": "John Doe",
      "line1": "123 Main St",
      "city": "Austin",
      "state": "TX",
      "postalCode": "78701",
      "country": "US"
    }
  }'
```

## Sell Example

```bash theme={null}
# 1. Check your payout methods
curl -X GET https://sandbox.api.collectpure.com/execution/payout-methods/v1 \
  -H "x-api-key: YOUR_SANDBOX_KEY"

# 2. Fetch available test offers
curl -X GET "https://sandbox.api.collectpure.com/sandbox/offers/get/v1?limit=5" \
  -H "x-api-key: YOUR_SANDBOX_KEY"

# 3. Create a sell quote
curl -X POST https://sandbox.api.collectpure.com/execution/sell/quote/v1 \
  -H "x-api-key: YOUR_SANDBOX_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      { "offerId": "OFFER_ID_FROM_STEP_2", "quantity": 1 }
    ]
  }'

# 4. Execute the sell (pass the total from the quote as expectedTotal)
curl -X POST https://sandbox.api.collectpure.com/execution/sell/v1 \
  -H "x-api-key: YOUR_SANDBOX_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "quoteId": "QUOTE_ID_FROM_STEP_3",
    "expectedTotal": TOTAL_FROM_STEP_3
  }'
```

<Tip>
  Use `GET /sandbox/listings/get/v1` to discover test listings for buy flows,
  and `GET /sandbox/offers/get/v1` to discover test offers for sell flows. Pick
  any `listingId` or `offerId` from the response to use in your quote requests.
</Tip>
