curl --request POST \
--url https://api.apostra.com/api/v2/buyer/campaigns/{campaignId}/execute \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"debug": true
}'import requests
url = "https://api.apostra.com/api/v2/buyer/campaigns/{campaignId}/execute"
payload = { "debug": True }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({debug: true})
};
fetch('https://api.apostra.com/api/v2/buyer/campaigns/{campaignId}/execute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"campaignId": "cmp_987654321",
"previousStatus": "DRAFT",
"newStatus": "DRAFT",
"success": true,
"mediaBuysExecuted": 2,
"mediaBuysAttempted": 4503599627370495,
"mediaBuysSucceeded": 4503599627370495,
"mediaBuysFailed": 4503599627370495,
"reason": "no_media_buys_to_execute",
"errors": [
{
"mediaBuyId": "<string>",
"salesAgentId": "<string>",
"message": "<string>",
"code": "<string>",
"recovery": "transient",
"scope3_partial_creation": {
"provider": "amazon",
"provider_account_id": "<string>",
"media_buy_id": "<string>",
"resource_type": "sp_campaign",
"failure_stage": "ad_group_create",
"disposition": "retained_paused",
"cleanup_required": true,
"retry_safe": false
},
"scope3_create_uncertain": {
"provider": "amazon",
"provider_account_id": "<string>",
"resource_type": "sp_campaign",
"operation": "create",
"disposition": "accepted_unknown",
"cleanup_required": true,
"retry_safe": false
},
"scope3_mutation_uncertain": {
"provider": "amazon",
"provider_account_id": "<string>",
"media_buy_id": "<string>",
"resource_type": "sp_campaign",
"disposition": "accepted_unconfirmed",
"cleanup_required": true,
"retry_safe": false,
"operation": "cancel",
"requested_state": "paused"
},
"cleanup_required": true,
"retry_safe": false,
"debug": {
"request": {},
"response": {},
"debugLogs": [
{}
],
"error": "<string>"
}
}
],
"warnings": [
{
"type": "creatives_dropped",
"mediaBuyId": "<string>",
"dropped": [
{
"creativeId": "<string>",
"formatId": "<string>",
"reason": "<string>"
}
]
}
]
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}Execute campaign
Launch/execute a campaign to start delivering ads. Pass debug: true in the request body to include detailed debug information in error responses.
curl --request POST \
--url https://api.apostra.com/api/v2/buyer/campaigns/{campaignId}/execute \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"debug": true
}'import requests
url = "https://api.apostra.com/api/v2/buyer/campaigns/{campaignId}/execute"
payload = { "debug": True }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({debug: true})
};
fetch('https://api.apostra.com/api/v2/buyer/campaigns/{campaignId}/execute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"campaignId": "cmp_987654321",
"previousStatus": "DRAFT",
"newStatus": "DRAFT",
"success": true,
"mediaBuysExecuted": 2,
"mediaBuysAttempted": 4503599627370495,
"mediaBuysSucceeded": 4503599627370495,
"mediaBuysFailed": 4503599627370495,
"reason": "no_media_buys_to_execute",
"errors": [
{
"mediaBuyId": "<string>",
"salesAgentId": "<string>",
"message": "<string>",
"code": "<string>",
"recovery": "transient",
"scope3_partial_creation": {
"provider": "amazon",
"provider_account_id": "<string>",
"media_buy_id": "<string>",
"resource_type": "sp_campaign",
"failure_stage": "ad_group_create",
"disposition": "retained_paused",
"cleanup_required": true,
"retry_safe": false
},
"scope3_create_uncertain": {
"provider": "amazon",
"provider_account_id": "<string>",
"resource_type": "sp_campaign",
"operation": "create",
"disposition": "accepted_unknown",
"cleanup_required": true,
"retry_safe": false
},
"scope3_mutation_uncertain": {
"provider": "amazon",
"provider_account_id": "<string>",
"media_buy_id": "<string>",
"resource_type": "sp_campaign",
"disposition": "accepted_unconfirmed",
"cleanup_required": true,
"retry_safe": false,
"operation": "cancel",
"requested_state": "paused"
},
"cleanup_required": true,
"retry_safe": false,
"debug": {
"request": {},
"response": {},
"debugLogs": [
{}
],
"error": "<string>"
}
}
],
"warnings": [
{
"type": "creatives_dropped",
"mediaBuyId": "<string>",
"dropped": [
{
"creativeId": "<string>",
"formatId": "<string>",
"reason": "<string>"
}
]
}
]
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}Authorizations
API key or access token
Path Parameters
Unique identifier for the campaign
1"cmp_987654321"
Body
Optional request body for executing a campaign. Unknown fields are rejected.
When true, includes detailed debug information in error responses from media buy execution
Response
Execute campaign
Response from executing or pausing a campaign
Campaign ID
"cmp_987654321"
Previous campaign status
DRAFT, ACTIVE, PAUSED, ENDING, COMPLETED, CANCELED, ARCHIVED New campaign status
DRAFT, ACTIVE, PAUSED, ENDING, COMPLETED, CANCELED, ARCHIVED Whether the status change was fully successful. False when any media buy execution failed.
Number of DRAFT media buys for which execution was attempted. Always present on execute responses; absent on pause responses. This existing field can include failed attempts; use mediaBuysSucceeded for successful executions.
0 <= x <= 90071992547409912
Number of DRAFT media buys for which execution was attempted. Always present on execute responses; absent on pause responses. This equals mediaBuysExecuted and mediaBuysSucceeded plus mediaBuysFailed.
0 <= x <= 9007199254740991Number of attempted media buys that executed successfully. Use this field to identify successful executions.
0 <= x <= 9007199254740991Number of attempted media buys that failed. Each failure has an entry in errors.
0 <= x <= 9007199254740991Machine-readable reason for a no-op execute. Present only when the campaign had no media buys to execute, in which case the campaign status is preserved rather than set to ACTIVE.
no_media_buys_to_execute Structured error details per failed media buy. Only present when there are failures.
Show child attributes
Show child attributes
Non-fatal outcomes from execution. creatives_dropped: a buy forwarded with a compatible creative subset (which may be empty). optimization_goals_dropped: a buy forwarded without optimization goals its product does not declare it can optimize to (the goals were still disclosed in the seller brief). pacing_not_applied: a buy launched without the campaign's asap or front_loaded pacing because the seller (Meta) does not accept a pacing instruction; it runs on the seller's standard even pacing. stale_draft: the existing DRAFT cart was retried as-is because discovery products were updated via add_discovery_products after the last staging run — call create_media_buys with replace: true to apply the new selection.
A non-fatal outcome from campaign execution
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes