Skip to main content

Price Management

Update offer prices quickly without modifying other offer properties.

Update Offer Price

Update the price of a specific offer.

Endpoint

PUT /v1/offers/{id}/price

Path Parameters

ParameterTypeRequiredDescription
idstringYesOffer ID (UUID)

Request Body

FieldTypeRequiredDescription
pricestringYesNew price in USD (format: 66.32, max 19 chars, pattern: ^[0-9]{1,16}(\.[0-9]{1,2})?$)

Request Example

curl -X PUT "https://sellerapi.ggchest.com/v1/offers/cc0e8400-e29b-41d4-a716-446655440030/price" \
-H "X-API-KEY: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"price": "79.99"
}'

Response

Returns 200 OK on success with no response body.

Complete Example: Bulk Price Update

async function updatePricesForOffers(priceUpdates) {
// priceUpdates is an array of { offerId, price }
const results = await Promise.allSettled(
priceUpdates.map(({ offerId, price }) =>
updateOfferPrice(offerId, price)
)
);

const successful = results.filter(r => r.status === 'fulfilled').length;
const failed = results.filter(r => r.status === 'rejected').length;

console.log(`Updated ${successful} prices successfully`);
if (failed > 0) {
console.log(`Failed to update ${failed} prices`);
}

return results;
}

// Usage
await updatePricesForOffers([
{ offerId: 'cc0e8400-e29b-41d4-a716-446655440030', price: '79.99' },
{ offerId: 'cc0e8400-e29b-41d4-a716-446655440040', price: '49.99' },
{ offerId: 'cc0e8400-e29b-41d4-a716-446655440050', price: '29.99' }
]);

Complete Example: Apply Discount to All Active Offers

async function applyDiscountToAllActiveOffers(discountPercent) {
// Get all active offers
const response = await fetch(
'https://sellerapi.ggchest.com/v1/offers?filters[status]=active',
{
headers: {
'X-API-KEY': 'your-api-key-here'
}
}
);
const data = await response.json();

// Calculate new prices
const priceUpdates = data.items.map(offer => {
const currentPrice = parseFloat(offer.price);
const newPrice = (currentPrice * (1 - discountPercent / 100)).toFixed(2);
return {
offerId: offer.id,
price: newPrice
};
});

// Update all prices
await updatePricesForOffers(priceUpdates);
}

// Apply 10% discount to all active offers
await applyDiscountToAllActiveOffers(10);

Error Responses

400 Bad Request

Returned when the price format is invalid.

{
"message": "Bad request",
"errors": [
{
"property": "price",
"message": "Price must match pattern ^[0-9]{1,16}(\\.[0-9]{1,2})?$"
}
]
}

403 Forbidden

Returned when you don't have permission to update this offer.

{
"message": "Forbidden"
}

404 Not Found

Returned when the offer ID is invalid or the offer doesn't exist.

{
"message": "Page not found"
}

Notes

  • Price format must be a valid decimal number with up to 2 decimal places
  • Valid examples: 99.99, 100, 0.50, 1234.56
  • Invalid examples: $99.99, 99.999, abc
  • This endpoint only updates the price, leaving all other offer properties unchanged
  • Use this endpoint for quick price updates without fetching and updating the entire offer