curl --request POST \
--url https://app.bily.ai/api/customer/v1/platform/{resourceUrl}/actions/create-meta-campaign-package \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"adAccountId": "<string>",
"payload": {
"campaign": {
"name": "<string>",
"status": "PAUSED",
"specialAdCategories": [
"<string>"
],
"budget": 123,
"specialAdCategoryCountries": [
"<string>"
],
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z"
},
"adset": {
"name": "<string>",
"countries": [
"<string>"
],
"pixelId": "<string>",
"ageMin": 41,
"ageMax": 41
},
"ad": {
"pageId": "<string>",
"name": "<string>",
"primaryText": "<string>",
"destinationUrl": "<string>",
"imageBytes": "<string>",
"instagramActorId": "<string>",
"headline": "<string>",
"description": "<string>",
"callToActionType": "<string>",
"imageFileName": "<string>"
}
}
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
adAccountId: '<string>',
payload: {
campaign: {
name: '<string>',
status: 'PAUSED',
specialAdCategories: ['<string>'],
budget: 123,
specialAdCategoryCountries: ['<string>'],
startTime: '2023-11-07T05:31:56Z',
endTime: '2023-11-07T05:31:56Z'
},
adset: {
name: '<string>',
countries: ['<string>'],
pixelId: '<string>',
ageMin: 41,
ageMax: 41
},
ad: {
pageId: '<string>',
name: '<string>',
primaryText: '<string>',
destinationUrl: '<string>',
imageBytes: '<string>',
instagramActorId: '<string>',
headline: '<string>',
description: '<string>',
callToActionType: '<string>',
imageFileName: '<string>'
}
}
})
};
fetch('https://app.bily.ai/api/customer/v1/platform/{resourceUrl}/actions/create-meta-campaign-package', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.bily.ai/api/customer/v1/platform/{resourceUrl}/actions/create-meta-campaign-package"
payload = {
"adAccountId": "<string>",
"payload": {
"campaign": {
"name": "<string>",
"status": "PAUSED",
"specialAdCategories": ["<string>"],
"budget": 123,
"specialAdCategoryCountries": ["<string>"],
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z"
},
"adset": {
"name": "<string>",
"countries": ["<string>"],
"pixelId": "<string>",
"ageMin": 41,
"ageMax": 41
},
"ad": {
"pageId": "<string>",
"name": "<string>",
"primaryText": "<string>",
"destinationUrl": "<string>",
"imageBytes": "<string>",
"instagramActorId": "<string>",
"headline": "<string>",
"description": "<string>",
"callToActionType": "<string>",
"imageFileName": "<string>"
}
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}Create Complete Meta Campaign Package (Paused First)
Create one linked Meta Traffic or Sales campaign, ad set, creative, and image ad as a complete PAUSED package. Sales requires the exact dataset or pixel id. The result returns exact parent-linked ids and a cleanup receipt. Publishing is a separate explicit action and must update ad, then ad set, then campaign; never blindly retry an ambiguous platform mutation. This is an execution endpoint. For a reviewed user change, save its supported capability/body as an immutable action draft, review it, and explicitly publish that draft. Check action-jobs/capabilities before staging; a catalog entry alone does not make it stageable.
curl --request POST \
--url https://app.bily.ai/api/customer/v1/platform/{resourceUrl}/actions/create-meta-campaign-package \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"adAccountId": "<string>",
"payload": {
"campaign": {
"name": "<string>",
"status": "PAUSED",
"specialAdCategories": [
"<string>"
],
"budget": 123,
"specialAdCategoryCountries": [
"<string>"
],
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z"
},
"adset": {
"name": "<string>",
"countries": [
"<string>"
],
"pixelId": "<string>",
"ageMin": 41,
"ageMax": 41
},
"ad": {
"pageId": "<string>",
"name": "<string>",
"primaryText": "<string>",
"destinationUrl": "<string>",
"imageBytes": "<string>",
"instagramActorId": "<string>",
"headline": "<string>",
"description": "<string>",
"callToActionType": "<string>",
"imageFileName": "<string>"
}
}
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
adAccountId: '<string>',
payload: {
campaign: {
name: '<string>',
status: 'PAUSED',
specialAdCategories: ['<string>'],
budget: 123,
specialAdCategoryCountries: ['<string>'],
startTime: '2023-11-07T05:31:56Z',
endTime: '2023-11-07T05:31:56Z'
},
adset: {
name: '<string>',
countries: ['<string>'],
pixelId: '<string>',
ageMin: 41,
ageMax: 41
},
ad: {
pageId: '<string>',
name: '<string>',
primaryText: '<string>',
destinationUrl: '<string>',
imageBytes: '<string>',
instagramActorId: '<string>',
headline: '<string>',
description: '<string>',
callToActionType: '<string>',
imageFileName: '<string>'
}
}
})
};
fetch('https://app.bily.ai/api/customer/v1/platform/{resourceUrl}/actions/create-meta-campaign-package', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.bily.ai/api/customer/v1/platform/{resourceUrl}/actions/create-meta-campaign-package"
payload = {
"adAccountId": "<string>",
"payload": {
"campaign": {
"name": "<string>",
"status": "PAUSED",
"specialAdCategories": ["<string>"],
"budget": 123,
"specialAdCategoryCountries": ["<string>"],
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z"
},
"adset": {
"name": "<string>",
"countries": ["<string>"],
"pixelId": "<string>",
"ageMin": 41,
"ageMax": 41
},
"ad": {
"pageId": "<string>",
"name": "<string>",
"primaryText": "<string>",
"destinationUrl": "<string>",
"imageBytes": "<string>",
"instagramActorId": "<string>",
"headline": "<string>",
"description": "<string>",
"callToActionType": "<string>",
"imageFileName": "<string>"
}
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}{
"error": "Store not found",
"requestId": "<string>",
"details": "<unknown>",
"retryAfter": "<string>"
}Authorizations
A server-side Bily API key created under Settings > AI tools > Access keys. Select the intended workspace before creating it.
Headers
An organization ID returned by GET /context or GET /organizations. Omit it when a scoped key supplies the organization. Otherwise provide it when no organization is selected.
"org_01J8W7T9G3E6ZQ4M2K5N8P1R0S"
Path Parameters
Exact workspace URL returned by GET /context.
Response
Request completed. Inspect the returned state and any verification fields.
The response is of type object.