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.
This guide will help you get started with the Pure API v2 quickly. Follow these steps to make your first API request and start integrating with Pure’s precious metals marketplace.
Prerequisites
Before you begin, make sure you have:
- An API key from Pure — create one from your API Keys dashboard
- A tool for making HTTP requests (like cURL, Postman, or your preferred programming language)
Want to test the Execution API? Create a Sandbox API key from your
dashboard and use
https://sandbox.api.collectpure.com as the base URL. Sandbox data is
provisioned automatically. See the Execution API
guide for details.
Authentication
The Pure API v2 uses API key authentication. Include your key in the x-api-key header with each request:
curl -X GET "https://api.collectpure.com/v1/protected" \
-H "x-api-key: YOUR_API_KEY"
Making Your First Request
Let’s verify your authentication is working by making a request to the API information endpoint:
curl -X GET "https://api.collectpure.com/" \
-H "x-api-key: YOUR_API_KEY"
If successful, you should receive a response like:
{
"name": "Pure Public API",
"version": "2.0.0",
"description": "Public API for accessing Pure marketplace data",
"documentation": "https://docs.collectpure.com",
"endpoints": {
"swagger": "https://api.collectpure.com/documentation/json",
"health": "https://api.collectpure.com/health"
}
}
Code Examples
JavaScript/Node.js
const axios = require("axios");
const API_KEY = "YOUR_API_KEY";
const BASE_URL = "https://api.collectpure.com";
async function getProducts(productIds) {
try {
const response = await axios.get(`${BASE_URL}/products/get-products/v1`, {
headers: {
"x-api-key": API_KEY,
},
params: {
ids: productIds.join(","),
},
});
console.log(response.data);
return response.data;
} catch (error) {
console.error(
"Error fetching products:",
error.response?.data || error.message
);
}
}
async function searchProducts({ query, limit, offset, filter_by } = {}) {
try {
const params = {};
if (query) params.query = query;
if (limit) params.limit = limit;
if (offset) params.offset = offset;
if (filter_by) params.filter_by = filter_by;
const response = await axios.get(`${BASE_URL}/products/search/v1`, {
headers: {
"x-api-key": API_KEY,
},
params,
});
console.log(response.data);
return response.data;
} catch (error) {
console.error(
"Error searching products:",
error.response?.data || error.message
);
}
}
async function getSpotPrices() {
try {
const response = await axios.get(
`${BASE_URL}/marketplace/get-spot-price/v1`,
{
headers: {
"x-api-key": API_KEY,
},
}
);
console.log(response.data);
return response.data;
} catch (error) {
console.error(
"Error fetching spot prices:",
error.response?.data || error.message
);
}
}
async function getSaleOrders({ status, limit, offset } = {}) {
try {
const params = {};
if (status) params.status = status;
if (limit) params.limit = limit;
if (offset) params.offset = offset;
const response = await axios.get(`${BASE_URL}/orders/get-sale-orders/v1`, {
headers: {
"x-api-key": API_KEY,
},
params,
});
console.log(response.data);
return response.data;
} catch (error) {
console.error(
"Error fetching orders:",
error.response?.data || error.message
);
}
}
// Usage
getProducts(["product-id-1", "product-id-2"]);
searchProducts({ query: "gold coin" }); // Search with query
searchProducts({ limit: 20 }); // Browse all products
searchProducts({ query: "silver", limit: 5, offset: 10 }); // Paginated search
searchProducts({ filter_by: "category:=Coins && material:=Gold" }); // Filtered browse
getSpotPrices();
getSaleOrders({ limit: 10 }); // List sale orders
getSaleOrders({ status: "order_complete" }); // Completed sale orders
Python
import requests
API_KEY = 'YOUR_API_KEY'
BASE_URL = 'https://api.collectpure.com'
def get_products(product_ids):
headers = {
'x-api-key': API_KEY
}
params = {
'ids': ','.join(product_ids)
}
response = requests.get(f'{BASE_URL}/products/get-products/v1', headers=headers, params=params)
if response.status_code == 200:
return response.json()
else:
print(f"Error: {response.status_code}")
print(response.json())
return None
def search_products(query=None, limit=None, offset=None, filter_by=None):
headers = {
'x-api-key': API_KEY
}
params = {}
if query:
params['query'] = query
if limit:
params['limit'] = limit
if offset:
params['offset'] = offset
if filter_by:
params['filter_by'] = filter_by
response = requests.get(f'{BASE_URL}/products/search/v1', headers=headers, params=params)
if response.status_code == 200:
return response.json()
else:
print(f"Error: {response.status_code}")
print(response.json())
return None
def get_spot_prices():
headers = {
'x-api-key': API_KEY
}
response = requests.get(f'{BASE_URL}/marketplace/get-spot-price/v1', headers=headers)
if response.status_code == 200:
return response.json()
else:
print(f"Error: {response.status_code}")
print(response.json())
return None
def get_sale_orders(status=None, limit=None, offset=None):
headers = {
'x-api-key': API_KEY
}
params = {}
if status:
params['status'] = status
if limit:
params['limit'] = limit
if offset:
params['offset'] = offset
response = requests.get(f'{BASE_URL}/orders/get-sale-orders/v1', headers=headers, params=params)
if response.status_code == 200:
return response.json()
else:
print(f"Error: {response.status_code}")
print(response.json())
return None
# Usage
products = get_products(["product-id-1", "product-id-2"])
search_results = search_products(query="gold coin") # Search with query
all_products = search_products(limit=20) # Browse all products
paginated = search_products(query="silver", limit=5, offset=10) # Paginated search
filtered = search_products(filter_by="category:=Coins && material:=Gold") # Filtered browse
spot_prices = get_spot_prices()
sale_orders = get_sale_orders(limit=10) # List sale orders
completed = get_sale_orders(status="order_complete") # Completed sale orders
Error Handling
The API returns structured error responses. Here’s how to handle them:
try {
const response = await axios.get(`${BASE_URL}/products/get-products/v1`, {
headers: { "x-api-key": API_KEY },
params: { ids: "invalid-id" },
});
} catch (error) {
if (error.response) {
// Server responded with error status
console.error("Error:", error.response.data.error);
console.error("Code:", error.response.data.code);
console.error("Suggestion:", error.response.data.suggestion);
} else {
// Network or other error
console.error("Network error:", error.message);
}
}
Next Steps
Now that you’ve made your first API requests, you can:
- Explore the API Reference to learn about all available endpoints
- Check out the Authentication Guide for detailed auth information
- Try the Execution - Buy or Execution - Sell guides to programmatically trade precious metals (use a sandbox key to test)
- Integrate the API into your application
- Contact us at [email protected] if you have any questions or need assistance
API Endpoints
The v2 API provides comprehensive access to Pure’s marketplace data through our OpenAPI specification. All endpoints are documented in the interactive API reference above, including:
- Products: Get products by IDs, search with full-text and filters, enriched product details, analytics, activity, order book data, and catalog metadata
- Execution: Programmatically buy precious metals — get quotes, review pricing, and execute orders
- Orders: List sale orders, purchase orders, or both with status filtering and pagination
- Organization: Retrieve and update organization settings such as vacation mode and payout method
- Reference Data: Categories, subcategories, manufacturers, attributes, and materials
- Marketplace: Spot prices, marketplace stats, and shipping information
- Authentication: Secure API key-based authentication
For the complete API specification, refer to the OpenAPI documentation in the API Reference tab.