Make a campaign on a connection, with a new URL key and one destination: a flow, a path or a URL
POST
/v1/buyer/campaigns
const url = 'https://example.com/v1/buyer/campaigns';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"bot_action":"flag","connection_id":1,"cost_amount":{"amount_micros":1,"currency":"example"},"cost_bps":1,"cost_model":"from_token","count_impressions":true,"expected_sequence":1,"flow_id":1,"name":"example","path":{"id":1,"landers":[{"id":1,"weight":1}],"name":"example","offers":[{"id":1,"weight":1}],"paused":true,"redirect_mode":"http","steps":[{"landers":[{"id":1,"weight":1}],"name":"example"}],"weight":1},"redirect_mode":"http","status":"active","tags":["example"],"url":"example","validate_only":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/buyer/campaigns \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "bot_action": "flag", "connection_id": 1, "cost_amount": { "amount_micros": 1, "currency": "example" }, "cost_bps": 1, "cost_model": "from_token", "count_impressions": true, "expected_sequence": 1, "flow_id": 1, "name": "example", "path": { "id": 1, "landers": [ { "id": 1, "weight": 1 } ], "name": "example", "offers": [ { "id": 1, "weight": 1 } ], "paused": true, "redirect_mode": "http", "steps": [ { "landers": [ { "id": 1, "weight": 1 } ], "name": "example" } ], "weight": 1 }, "redirect_mode": "http", "status": "active", "tags": [ "example" ], "url": "example", "validate_only": true }'Who: a workspace’s buyer, or its key. API keys with the buyer:write scope.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Idempotency-Key
string
Made once per action and sent again on every retry of it, so the service acts once: the request_id of the create or money-moving call; a new one when left out
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
bot_action
string | null
connection_id
integer format: int64
cost_amount
cost_bps
integer | null format: int32
cost_model
string | null
count_impressions
boolean | null
expected_sequence
integer | null format: int64
flow_id
integer | null format: int64
name
string | null
path
Any of:
object
id
integer format: int64
landers
required
Array<object>
object
id
required
integer format: int64
weight
required
integer format: int32
name
required
string
offers
required
Array<object>
object
id
required
integer format: int64
weight
required
integer format: int32
paused
required
boolean
redirect_mode
string
steps
Array<object>
object
landers
required
Array<object>
object
id
required
integer format: int64
weight
required
integer format: int32
name
required
string
weight
required
integer format: int32
null
redirect_mode
string | null
status
string | null
tags
Array<string> | null
url
string | null
validate_only
boolean
Responses
Section titled “Responses”Created
Media typeapplication/json
object
bot_action
required
string | null
connection
required
object
id
required
integer format: int64
name
string
cost_amount
required
cost_bps
required
integer format: int32
cost_model
required
string | null
count_impressions
required
boolean
count_impressions_since
required
string | null format: date-time
created_at
required
string format: date-time
id
required
integer format: int64
name
required
string
path
required
Any of:
object
id
required
integer format: int64
landers
required
Array<object>
object
id
required
integer format: int64
weight
required
integer format: int32
name
required
string
offers
required
Array<object>
object
id
required
integer format: int64
weight
required
integer format: int32
paused
required
boolean
redirect_mode
required
string | null
steps
required
Array<object>
object
landers
required
Array<object>
object
id
required
integer format: int64
weight
required
integer format: int32
name
required
string
weight
required
integer format: int32
null
redirect_mode
required
string | null
sequence
required
integer format: int64
status
required
string | null
tags
required
Array<string>
updated_at
required
string format: date-time
url
required
string | null
url_key
required
string
workspace_id
required
integer format: int64
Example
{ "bot_action": "flag", "cost_model": "from_token", "path": { "redirect_mode": "http" }, "redirect_mode": "http", "status": "active"}default
Section titled “default”An error, as go-commons apperr maps it
Media typeapplication/json
object
error
required
object
code
required
string
fields
object
key
additional properties
string
message
required
string
Example generated
{ "error": { "code": "example", "fields": { "additionalProperty": "example" }, "message": "example" }}