Skip to main content
The Execution API lets you programmatically purchase precious metals on the Pure marketplace. It follows a quote-then-execute pattern: you request a quote to preview pricing, then execute it to finalize the order and charge payment.

How It Works

1

Get a Quote

Send your desired items and payment method to the quote endpoint. You’ll receive a quoteId along with a full pricing breakdown — line items, fees, and total. The payment method is needed so the quote includes accurate payment-method-specific fees. Quotes expire in 30 seconds.
2

Review Pricing

Inspect the quote response to confirm line items, fees, and total. If needed, call the GET endpoint with your quoteId to refresh pricing at current spot rates — this also resets the 30-second expiration window.
3

Execute the Buy

Send your quoteId, the total from the quote as expectedTotal, your payment method, and shipping address to the execute endpoint. Pure verifies the current total does not exceed your expectedTotal — if the price has increased, the request is rejected with a 409 so you are never charged more than you agreed to.

Quotes

Quotes are pricing snapshots that include accurate fees based on the payment method you provide. Each quote includes:
  • Line items with per-item pricing and availability status
  • Fees (processing, shipping, etc.) — calculated for your chosen payment method
  • Total in cents — pass this as expectedTotal when executing
  • Expiration timestamp — quotes expire in 30 seconds
When creating a quote, you must provide a paymentMethod. This ensures the quoted total matches what you’ll be charged at execution time. If you need different items, create a new quote. If you need refreshed pricing on the same items, call GET /execution/buy/quote/v1 with your quoteId — this returns a fresh pricing snapshot and a new 30-second window.
Quotes can contain multiple items (up to 50 per quote). Each item is a listing ID and quantity pair.

Price Protection

When executing a buy, you must pass expectedTotal — the total value from the quote response. Pure will reject the order with a 409 Conflict if the current total exceeds your expectedTotal. This guarantees you are never charged more than the price you agreed to. If you receive a 409, create a new quote to get updated pricing and retry.

Payment Methods

Before executing a buy, you’ll need a valid Stripe payment method. Use the List Payment Methods endpoint to retrieve your organization’s payment methods. Each method includes:
  • id — the Stripe payment method ID to pass when executing
  • paymentMethod — the payment method type (stripe_ach, stripe, or wire_transfer) to pass when executing
  • isDefault — whether this is your organization’s default

Sandbox Environment

Pure provides a sandbox environment for testing the Execution API without using real money.

Sandbox API

Base URL: https://sandbox.api.collectpure.comAll sandbox requests use the same endpoints and schemas as production — just point to the sandbox base URL.

Sandbox API Keys

Generate a sandbox API key from your API Keys dashboard.Select Sandbox environment when creating the key.

Getting Started with Sandbox

1

Create a Sandbox API Key

Go to collectpure.com/dashboard/api-keys and create a new API key. Select the Sandbox environment.
2

Sandbox Data is Created For You

When you create a sandbox key, Pure automatically provisions test data for your organization — including products, listings, and payment methods. You can start making API calls immediately.
3

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.
4

Test the Full Flow

Fetch test listings, create quotes, review pricing, and execute buys — all in a safe testing environment with no real money involved.
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.

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 quotes.
ParameterTypeDefaultDescription
limitnumber50Max listings to return (1–250)
offsetnumber0Number of listings to skip (pagination)
Response fields:
FieldTypeDescription
listingIdstringThe listing ID — pass this to the quote endpoint
productIdstringThe product ID
variantIdstringThe variant ID
productTitlestringProduct name
skustringProduct SKU
materialstringMaterial (Gold, Silver, etc.)
quantitynumberAvailable quantity
pricenumberPrice in cents
priceDollarsnumberPrice in dollars
spotPremiumnumberPremium over spot (%)
spotPremiumDollarnumberPremium over spot ($)
expiresAtstringISO 8601 listing expiration

Sandbox Example

# 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"
    }
  }'
Start by calling GET /sandbox/listings/get/v1 to discover available listings and their IDs. Pick any listingId from the response to use in your quote and buy requests.

Error Handling

The Execution API returns structured errors. Common scenarios:
StatusMeaningWhat to Do
404Quote not found or expiredCreate a new quote
409Price increased beyond expectedTotalCreate a new quote to get updated pricing, then retry
410Quote has expiredCreate a new quote
422Validation failed (listing unavailable, insufficient inventory)Check the error message and adjust your request
500Processing failedRetry with a new quote. If unrecoverable, contact support
Partial completions are possible — if some items in a multi-item quote succeed but others fail, you’ll receive a "partial" status with the order IDs for the items that were processed.