Skip to content

Make a coupon: a code, exact or a prefix, that stands for a click of its campaign in a network's postback naming none

POST
/v1/buyer/coupons
curl --request POST \
--url https://example.com/v1/buyer/coupons \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "campaign_id": 1, "code": "example", "ends_at": "2026-04-15T12:00:00Z", "match": "exact", "note": "example", "offer_id": 1, "precedence": "click", "status": "active" }'

Who: a workspace’s buyer, or its key. API keys with the buyer:write scope.

Idempotency-Key
string
<= 64 characters

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

Media typeapplication/json
object
campaign_id
integer | null format: int64
code
string | null
ends_at
string | null format: date-time
match
string | null
Allowed values: exact prefix
note
string | null
offer_id
integer | null format: int64
precedence
string | null
Allowed values: click code
status
string | null
Allowed values: active paused archived

Created

Media typeapplication/json
object
campaign
required
object
id
required
integer format: int64
name
string
code
required
string
created_at
required
string format: date-time
ends_at
required
string | null format: date-time
id
required
integer format: int64
match
required
string | null
Allowed values: exact prefix
note
required
string
offer
required
Any of:
object
id
required
integer format: int64
name
string
precedence
required
string | null
Allowed values: click code
sequence
required
integer format: int64
status
required
string | null
Allowed values: active paused archived
updated_at
required
string format: date-time
workspace_id
required
integer format: int64

Example

{
"match": "exact",
"precedence": "click",
"status": "active"
}

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"
}
}