Ad
Overview
Resource Group ¶
POST Create ad ¶
POST Create adPOST/brands/:brand/ads
body
(string) body for ad
name
(string) name for facebook campaign
callToActionLink
(string) link for callToAction
customer
(uuid) stripe id
title
(string) ad title
startTime
(number) start time of campaign
endTime
(number) end time of campaign
facebookPage
(uuid) facebook page id in rechat
ads[]
(ad[]) array of ads
{
dailyBudget (number)
lifeTimeBudget (number)
facebookPositions (string[] feed | story)
instagramPositions (string[] explore | stream)
listing (uuid) id of listing in rechat
templateInstance (uuid) id of templateInstance in rechat
publisherPlatforms (string[] facebook | instagram)
locations (location[] {lat: number, long: number, radius: number})
}
Example URI
POST /brands/:brand/ads
URI Parameters
- brand
string
(required) Example: dc8b22c0-d595-46f2-ba8e-1edc75521e9f- associations
string
(required) Example: ad_campaign,ad_campaign.ads
Request
Body
{
"body": "body",
"name": "test",
"callToActionLink": "http://test.com",
"customer": "e89607b4-8600-4b1d-bf36-96b6bebca468",
"title": "title",
"startTime": 1760124334699,
"endTime": 1760383534699,
"facebookPage": "982940d8-cc3b-4333-93e2-db0c31db29a0",
"ads": [
{
"facebookPositions": [
"feed"
],
"lifeTimeBudget": 6000,
"listing": "edb5195a-f7ec-11e4-bc76-0a95648eeb58",
"templateInstance": "199af13e-194a-4705-bff2-bd6129c45496",
"publisherPlatforms": [
"facebook"
],
"locations": [
{
"lat": 41.40338,
"long": 2.17403,
"radius": 20
},
{
"lat": 2.40338,
"long": 22.17403,
"radius": 20
}
]
},
{
"instagramPositions": [
"story"
],
"lifeTimeBudget": 7000,
"listing": "edb5195a-f7ec-11e4-bc76-0a95648eeb58",
"templateInstance": "199af13e-194a-4705-bff2-bd6129c45496",
"publisherPlatforms": [
"instagram"
],
"locations": [
{
"lat": 41.40338,
"long": 2.17403,
"radius": 15
}
]
}
]
}
Response
200
Body
{
"code": "OK",
"data": {
"id": "b8053826-422c-47e4-a1f2-359cccefde33",
"brand": "dc8b22c0-d595-46f2-ba8e-1edc75521e9f",
"name": "test",
"stripe_customer": "e89607b4-8600-4b1d-bf36-96b6bebca468",
"facebook_campaign_id": null,
"retry": 3,
"call_to_action_link": "http://test.com",
"body": "body",
"title": "title",
"status": "INITIAL",
"type": "ad_campaign",
"created_at": 1760469934.746262,
"updated_at": 1760469934.746262,
"deleted_at": null,
"due_at": 1760124334.699,
"executed_at": null,
"start_time": 1760124334.699,
"end_time": 1760383534.699,
"paused_at": null,
"last_insight_fetch": null,
"failure": null,
"failed_at": null,
"ads": [
{
"id": "d6dd9e26-8d43-4a23-b4ca-6f6d3c086794",
"ad_campaign": "b8053826-422c-47e4-a1f2-359cccefde33",
"daily_budget": null,
"lifetime_budget": 6000,
"failure": null,
"type": "ad_campaign_ad",
"locations": [
{
"long": 2.17403,
"lat": 41.40338,
"radius": 20
},
{
"long": 22.17403,
"lat": 2.40338,
"radius": 20
}
],
"failed_at": null,
"executed_at": null
},
{
"id": "a7e5165e-7dc1-446d-b238-ef9f08a56ef3",
"ad_campaign": "b8053826-422c-47e4-a1f2-359cccefde33",
"daily_budget": null,
"lifetime_budget": 7000,
"failure": null,
"type": "ad_campaign_ad",
"locations": [
{
"long": 2.17403,
"lat": 41.40338,
"radius": 15
}
],
"failed_at": null,
"executed_at": null
}
],
"lead_count": "0",
"total_lifetime_budget": "13000",
"client_status": "SCHEDULED"
}
}
Pause a campaign ¶
Pause a campaignPUT/brands/:brand/ads/:campaignId/status
status
(ACTIVE | PAUSED)
Example URI
PUT /brands/:brand/ads/:campaignId/status
URI Parameters
- brand
string
(required) Example: dc8b22c0-d595-46f2-ba8e-1edc75521e9f- id
string
(required) Example: b8053826-422c-47e4-a1f2-359cccefde33
Request
Body
{
"status": "PAUSED"
}
Response
200
Body
{
"code": "OK",
"data": {
"id": "b8053826-422c-47e4-a1f2-359cccefde33",
"brand": "dc8b22c0-d595-46f2-ba8e-1edc75521e9f",
"name": "test",
"stripe_customer": "e89607b4-8600-4b1d-bf36-96b6bebca468",
"facebook_campaign_id": "campaignId",
"retry": 3,
"call_to_action_link": "http://test.com",
"body": "body",
"title": "title",
"status": "DONE",
"type": "ad_campaign",
"created_at": 1760469934.746262,
"updated_at": 1760469934.746262,
"deleted_at": null,
"due_at": 1760124334.699,
"executed_at": 1760469929.680955,
"start_time": 1760124334.699,
"end_time": 1760383534.699,
"paused_at": 1760469929.680955,
"last_insight_fetch": 1760469929.680955,
"failure": null,
"failed_at": null,
"lead_count": "0",
"total_lifetime_budget": "13000",
"client_status": "FINISHED"
}
}
Delete scheduled ad campaign ¶
Delete scheduled ad campaignDELETE/brands/:brand/ads/:campaignId
Example URI
DELETE /brands/:brand/ads/:campaignId
URI Parameters
- brand
string
(required) Example: dc8b22c0-d595-46f2-ba8e-1edc75521e9f- id
string
(required) Example: d88c913c-93cf-4487-899d-60a8425cfd96
Response
204
GET ad estimate ¶
GET ad estimateGET/brands/:brand/ads/estimate
Example URI
GET /brands/:brand/ads/estimate
URI Parameters
- brand
string
(required) Example: dc8b22c0-d595-46f2-ba8e-1edc75521e9f- geo_locations: `{custom_locations
string
(required) Example: [{latitude: 25.820742, longitude:80.2048393, radius: 15}]}` (string, required)
- publisher_platforms
string
(required) Example: ['facebook','instagram']
Response
200
Body
{
"code": "OK",
"data": {
"users_lower_bound": 1900000,
"users_upper_bound": 2300000,
"estimate_ready": true
}
}
Get Ad campaigns of brand ¶
Get Ad campaigns of brandGET/brands/:brand/ads
brand
(uuid) ID of the brand
user
(uuid) ID of the user (optional)
executed
(boolean) true means get the executed posts
start
(number) number of rows to skip before starting to return rows
limit
(number) limited number of records
Example URI
GET /brands/:brand/ads
URI Parameters
- brand
string
(required) Example: dc8b22c0-d595-46f2-ba8e-1edc75521e9f
Response
200
Body
{
"code": "OK",
"data": [
{
"id": "b8053826-422c-47e4-a1f2-359cccefde33",
"brand": "dc8b22c0-d595-46f2-ba8e-1edc75521e9f",
"name": "test",
"stripe_customer": "e89607b4-8600-4b1d-bf36-96b6bebca468",
"facebook_campaign_id": "campaignId",
"retry": 3,
"call_to_action_link": "http://test.com",
"body": "body",
"title": "title",
"status": "DONE",
"type": "ad_campaign",
"created_at": 1760469934.746262,
"updated_at": 1760469934.746262,
"deleted_at": null,
"due_at": 1760124334.699,
"executed_at": 1760469929.680955,
"start_time": 1760124334.699,
"end_time": 1760383534.699,
"paused_at": null,
"last_insight_fetch": 1760469929.680955,
"failure": null,
"failed_at": null,
"lead_count": "0",
"total_lifetime_budget": "13000",
"client_status": "FINISHED"
}
],
"info": {
"count": 1,
"total": 1
}
}