Transactions
You can retrieve a one or more footprinted transactions using the Transaction and Transactions endpoints. Let’s start by fetching a single transaction. Note: make sure you use an actual transaction id, which you can get by footprinting a product.
Get a Specific Transaction
Parameters
KEY
TYPE
DESCRIPTION
id
string
transaction id
Response
{
"id": "0f958fc5-e786-4d81-88ea-9bd8811d39e4",
"items": [
{
"id": "b4435ef8-f17e-480e-b247-3394f4befa78",
"submission": {
"id": "e30191b7-15fe-4dcd-aeaf-d9f5d96d61fa",
"zip": "02062",
"sku": null,
"currency": "USD",
"manufacturer": null,
"title": "Samsung A7 Galaxy",
"price": 500,
"category": null,
"description": "Samsung A7 Galaxy",
"isUsed": false
},
"footprint": {
"id": "27eb7a5c-10d2-4549-9abb-5a8142ff3e47",
"currency": "USD",
"expiresAt": "2025-01-15T21:11:19.401Z",
"carbonFootprint": 108,
"carbonFootprintSavings": null
}
}
],
"dateCreated": "2025-01-08T21:11:19.114Z",
"dateUpdated": "2025-01-08T21:11:19.114Z"
}
Code Examples
Javascript
// Define the API endpoint and headers
const transactionId = "e03304b0-ba04-4a28-b66e-dcfbc1a62c22"; // Replace with your own transaction ID
const apiUrl = `https://api.cooler.dev/v1/transactions/${transactionId}`;
const headers = {
"Cooler-Api-Key": "cooler_test_acaf38b8-5d04-4aa4-87fe-91a67fc13a05",
};
// Make the GET request using fetch
fetch(apiUrl, {
method: "GET",
headers: headers,
})
.then((response) => response.json()) // Parse the JSON response
.then((data) => console.log(data)) // Log the response data
.catch((error) => console.error("Error:", error)); // Log any errors
Curl
curl -X 'GET' \
'https://api.cooler.dev/v1/transactions/0f958fc5-e786-4d81-88ea-9bd8811d39e4' \
-H 'accept: */*' \
-H 'COOLER-API-KEY: cooler_test_acaf38b8-5d04-4aa4-87fe-91a67fc13a05'
Get Multiple Transactions
Get one or more transactions.
Parameters
KEY
TYPE
DESCRIPTION
skip
number
the number of transactions to skip before returning transactions
limit
number
the maximum number of transactions to return
env
string
dev environment; either “sandbox” or “production”
Response
Code Examples
// Define the API endpoint and headers
const apiUrl = "https://api.cooler.dev/v1/transactions";
const headers = {
"Cooler-Api-Key": "cooler_test_acaf38b8-5d04-4aa4-87fe-91a67fc13a05",
};
// Define query parameters
const queryParams = new URLSearchParams({
skip: 0, // Number of records to skip (pagination)
limit: 10, // Number of records to return
env: "sandbox", // Environment filter (optional)
}).toString();
// Make the GET request using fetch
fetch(`${apiUrl}?${queryParams}`, {
method: "GET",
headers: headers,
})
.then((response) => response.json()) // Parse the JSON response
.then((data) => console.log("Transactions:", data)) // Log the response data
.catch((error) => console.error("Error:", error)); // Log any errors
Let’s try that in curl:
curl -X GET "https://api.cooler.dev/v1/transactions?skip=0&limit=10&env=sandbox" \
-H "Cooler-Api-Key: cooler_test_acaf38b8-5d04-4aa4-87fe-91a67fc13a05"
Last updated