Skip to content
Docs

API reference / Operations by tag

coupons

Coupon codes, batches, import and assignment to partners.

12 operations. Base URL https://api.metrixed.com/v1; see authentication, errors and pagination.

Operations

MethodPathSummary
GET/couponsList CouponCodes
POST/couponsCreate CouponCode
GET/coupons/{id}Get CouponCode
PATCH/coupons/{id}Update CouponCode
DELETE/coupons/{id}Delete CouponCode
POST/coupons/{id}/assignAssign / unassign partners (mode add|remove|replace)
POST/coupons/bulk/applyBulk edit apply
POST/coupons/bulk/deleteDelete up to 500 coupons in one transaction (dry_run: true previews without saving)
POST/coupons/bulk/previewBulk edit preview
POST/coupons/importBulk import coupons from CSV (multipart file or text/csv); dry_run=1 validates only
POST/coupons/searchSearch CouponCodes (advanced)
GET/coupons/usageCoupon usage counters (reporting conversions, falling back to usage_count)

GET /coupons

List CouponCodes

Operation getCoupons. Auth: API key (Bearer) or session cookie.

ParameterInTypeRequiredDescription
pagequeryintegerno
page_sizequeryintegerno
sortquerystringnofield or -field
includequerystringnocomma-separated relationships
filterqueryobject (free-form)no
qquerystringnofree-text search
StatusDescriptionBody
200okapplication/json CouponCodeList
defaulterrorapplication/json Error
bash
curl 'https://api.metrixed.com/v1/coupons?page=1&page_size=50' \
  -H "Authorization: Bearer $DT_API_KEY" \
  -H 'Accept: application/json'

Example 200 response:

json
{
  "data": [
    {}
  ],
  "page": {}
}

POST /coupons

Create CouponCode

Operation postCoupons. Auth: API key (Bearer) or session cookie.

Request body (application/json, required): CouponCodeCreate

FieldTypeFlagsDescription
codestringrequired
offer_idstringrequired
partner_idsarray of string
excluded_partner_idsarray of string
typeenum: generic, exclusive, one_time
descriptionstring
start_atstring (date-time)
end_atstring (date-time)
statusstring
payout_rulesarray of object (free-form)
attribution_modeenum: coupon_overrides_click, click_overrides_coupon, both
max_usesinteger
used_atstring (date-time)
StatusDescriptionBody
201okapplication/json CouponCode
defaulterrorapplication/json Error
bash
curl -X POST 'https://api.metrixed.com/v1/coupons' \
  -H "Authorization: Bearer $DT_API_KEY" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-raw '{"code":"","offer_id":""}'

Example 201 response:

json
{
  "external_ref": ""
}

GET /coupons/{id}

Get CouponCode

Operation getCouponsId. Auth: API key (Bearer) or session cookie.

ParameterInTypeRequiredDescription
idpathstringyes
StatusDescriptionBody
200okapplication/json CouponCode
defaulterrorapplication/json Error
bash
curl 'https://api.metrixed.com/v1/coupons/<id>' \
  -H "Authorization: Bearer $DT_API_KEY" \
  -H 'Accept: application/json'

Example 200 response:

json
{
  "external_ref": ""
}

PATCH /coupons/{id}

Update CouponCode

Operation patchCouponsId. Auth: API key (Bearer) or session cookie.

ParameterInTypeRequiredDescription
idpathstringyes

Request body (application/json, required): CouponCodeUpdate

FieldTypeFlagsDescription
codestring
offer_idstring
partner_idsarray of string
excluded_partner_idsarray of string
typeenum: generic, exclusive, one_time
descriptionstring
start_atstring (date-time)
end_atstring (date-time)
statusstring
payout_rulesarray of object (free-form)
attribution_modeenum: coupon_overrides_click, click_overrides_coupon, both
max_usesinteger
used_atstring (date-time)
StatusDescriptionBody
200okapplication/json CouponCode
defaulterrorapplication/json Error
bash
curl -X PATCH 'https://api.metrixed.com/v1/coupons/<id>' \
  -H "Authorization: Bearer $DT_API_KEY" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-raw '{"code":"","offer_id":"","partner_ids":[""],"excluded_partner_ids":[""]}'

Example 200 response:

json
{
  "external_ref": ""
}

DELETE /coupons/{id}

Delete CouponCode

Operation deleteCouponsId. Auth: API key (Bearer) or session cookie.

ParameterInTypeRequiredDescription
idpathstringyes
StatusDescriptionBody
204okapplication/json Ok
defaulterrorapplication/json Error
bash
curl -X DELETE 'https://api.metrixed.com/v1/coupons/<id>' \
  -H "Authorization: Bearer $DT_API_KEY" \
  -H 'Accept: application/json'

Example 204 response:

json
{
  "ok": false
}

POST /coupons/{id}/assign

Assign / unassign partners (mode add|remove|replace)

Operation postCouponsIdAssign. Auth: API key (Bearer) or session cookie.

ParameterInTypeRequiredDescription
idpathstringyes

Request body (application/json, required): Ok

FieldTypeFlagsDescription
okboolean
StatusDescriptionBody
200okapplication/json CouponCode
defaulterrorapplication/json Error
bash
curl -X POST 'https://api.metrixed.com/v1/coupons/<id>/assign' \
  -H "Authorization: Bearer $DT_API_KEY" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-raw '{"ok":false}'

Example 200 response:

json
{
  "external_ref": ""
}

POST /coupons/bulk/apply

Bulk edit apply

Operation postCouponsBulkApply. Auth: API key (Bearer) or session cookie.

Request body (application/json, required): BulkPatch

FieldTypeFlagsDescription
idsarray of stringrequired
patchesarray of objectrequired
StatusDescriptionBody
200okapplication/json BulkPreview
defaulterrorapplication/json Error
bash
curl -X POST 'https://api.metrixed.com/v1/coupons/bulk/apply' \
  -H "Authorization: Bearer $DT_API_KEY" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-raw '{"ids":[""],"patches":[{"field":"","value":{}}]}'

Example 200 response:

json
{
  "affected": 0,
  "changes": [
    {}
  ],
  "warnings": [
    ""
  ],
  "token": ""
}

POST /coupons/bulk/delete

Delete up to 500 coupons in one transaction (dry_run: true previews without saving)

Operation postCouponsBulkDelete. Auth: API key (Bearer) or session cookie.

Request body (application/json, required): BulkDeleteRequest

StatusDescriptionBody
200okapplication/json BulkActionResult
defaulterrorapplication/json Error
bash
curl -X POST 'https://api.metrixed.com/v1/coupons/bulk/delete' \
  -H "Authorization: Bearer $DT_API_KEY" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-raw '{}'

Example 200 response:

json
{}

POST /coupons/bulk/preview

Bulk edit preview

Operation postCouponsBulkPreview. Auth: API key (Bearer) or session cookie.

Request body (application/json, required): BulkPatch

FieldTypeFlagsDescription
idsarray of stringrequired
patchesarray of objectrequired
StatusDescriptionBody
200okapplication/json BulkPreview
defaulterrorapplication/json Error
bash
curl -X POST 'https://api.metrixed.com/v1/coupons/bulk/preview' \
  -H "Authorization: Bearer $DT_API_KEY" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-raw '{"ids":[""],"patches":[{"field":"","value":{}}]}'

Example 200 response:

json
{
  "affected": 0,
  "changes": [
    {}
  ],
  "warnings": [
    ""
  ],
  "token": ""
}

POST /coupons/import

Bulk import coupons from CSV (multipart file or text/csv); dry_run=1 validates only

Operation postCouponsImport. Auth: API key (Bearer) or session cookie.

ParameterInTypeRequiredDescription
offer_idquerystringno
dry_runquerybooleanno

Request body (application/json, required): any

StatusDescriptionBody
201okapplication/json Ok
defaulterrorapplication/json Error
bash
curl -X POST 'https://api.metrixed.com/v1/coupons/import' \
  -H "Authorization: Bearer $DT_API_KEY" \
  -H 'Accept: application/json'

Example 201 response:

json
{
  "ok": false
}

POST /coupons/search

Search CouponCodes (advanced)

Operation postCouponsSearch. Auth: API key (Bearer) or session cookie.

Request body (application/json, required): SearchRequest

FieldTypeFlagsDescription
filtersarray of object
searchstring
sortarray of object (free-form)
pageinteger
page_sizeinteger
includearray of string
StatusDescriptionBody
200okapplication/json CouponCodeList
defaulterrorapplication/json Error
bash
curl -X POST 'https://api.metrixed.com/v1/coupons/search' \
  -H "Authorization: Bearer $DT_API_KEY" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data-raw '{"filters":[{}],"search":"","sort":[{}],"page":0}'

Example 200 response:

json
{
  "data": [
    {}
  ],
  "page": {}
}

GET /coupons/usage

Coupon usage counters (reporting conversions, falling back to usage_count) Coupon usage counters (reporting conversions, falling back to usage_count). WP-67: paged; q matches the code.

Operation getCouponsUsage. Auth: API key (Bearer) or session cookie.

ParameterInTypeRequiredDescription
offer_idquerystringno
qquerystringno
pagequerystringno
page_sizequerystringno
sortquerystringno
StatusDescriptionBody
200okapplication/json Ok
defaulterrorapplication/json Error
bash
curl 'https://api.metrixed.com/v1/coupons/usage?page=1&page_size=50' \
  -H "Authorization: Bearer $DT_API_KEY" \
  -H 'Accept: application/json'

Example 200 response:

json
{
  "ok": false
}