Batch Operations
Perform operations on multiple offers at once. This is more efficient than processing offers individually.
Batch Activate Offers
Activate multiple draft offers at once, making them visible to buyers.
Endpoint
PUT /v1/offers/activate
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
offers_ids | array | Yes | Array of offer UUIDs to activate |
Request Example
curl -X PUT "https://sellerapi.ggchest.com/v1/offers/activate" \
-H "X-API-KEY: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"offers_ids": [
"cc0e8400-e29b-41d4-a716-446655440030",
"cc0e8400-e29b-41d4-a716-446655440040",
"cc0e8400-e29b-41d4-a716-446655440050"
]
}'
Response
Returns 200 OK on success with no response body.
Batch Deactivate Offers
Deactivate multiple active offers at once, making them draft and hiding them from buyers.
Endpoint
PUT /v1/offers/draft
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
offers_ids | array | Yes | Array of offer UUIDs to deactivate |
Request Example
curl -X PUT "https://sellerapi.ggchest.com/v1/offers/draft" \
-H "X-API-KEY: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"offers_ids": [
"cc0e8400-e29b-41d4-a716-446655440030",
"cc0e8400-e29b-41d4-a716-446655440040"
]
}'
Response
Returns 200 OK on success with no response body.
Complete Example: Activate All Draft Offers for a Game
async function activateAllDraftOffersForGame(gameId) {
// Get all draft offers for the game
const response = await fetch(
`https://sellerapi.ggchest.com/v1/offers?filters[status]=draft&filters[game_id]=${gameId}`,
{
headers: {
'X-API-KEY': 'your-api-key-here'
}
}
);
const data = await response.json();
// Extract offer IDs
const offerIds = data.items.map(offer => offer.id);
if (offerIds.length === 0) {
console.log('No draft offers to activate');
return;
}
// Activate all draft offers
const activateResponse = await fetch(
'https://sellerapi.ggchest.com/v1/offers/activate',
{
method: 'PUT',
headers: {
'X-API-KEY': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
offers_ids: offerIds
})
}
);
if (!activateResponse.ok) {
throw new Error('Failed to activate offers');
}
console.log(`Activated ${offerIds.length} offers`);
}
Error Responses
400 Bad Request
Returned when the request is invalid (e.g., empty offers_ids array).
{
"message": "Bad request",
"errors": [
{
"property": "offers_ids",
"message": "At least one offer ID is required"
}
]
}
403 Forbidden
Returned when you don't have permission to perform the operation.
{
"message": "Forbidden"
}
422 Unprocessable Entity
Returned when the request is valid but cannot be processed (e.g., some offer IDs are invalid).
{
"message": "Unprocessable Entity",
"errors": [
{
"property": "offers_ids",
"message": "Some offers could not be processed"
}
]
}
Notes
- Batch operations are more efficient than processing offers individually
- All offer IDs in the request must be valid UUIDs
- Offers that are already in the target state will be skipped
- Deleted offers cannot be activated or deactivated
- Use batch operations when you need to manage multiple offers at once