Перейти к содержимому

Create a redirect rule

POST
/api/v1/links/{code}/rules
curl --request POST \
--url https://example.com/api/v1/links/example/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "ruleType": "geo", "targetUrl": "https://example.com/target", "priority": 0, "weight": 100, "conditions": { "countries": [ "US", "GB" ] }, "schema": "redirect", "redirectType": "301", "flowConfig": { "landings": [ { "id": "landing-uuid", "weight": 100 } ], "offers": [ { "id": "offer-uuid-1", "weight": 70 }, { "id": "offer-uuid-2", "weight": 30 } ] }, "flowType": "forced", "isActive": true }'
code
required
string

Short code or custom alias

Media typeapplication/json
object
ruleType
required
string
Allowed values: geo device ab_test rotation
targetUrl

Required when schema is “redirect” (the default). Ignored for “landing_offer” and “action” — see flowConfig.

string

Example

https://example.com/target
priority
number

Example

0
weight
number

Example

100
conditions

Legacy shorthand (“countries”/“excludeCountries”/“devices”) is still accepted, but the general filter engine ({ match, filters }) supports far more: country, city, device, os, browser, language, ip (exact/CIDR/mask), referer, empty_referer, bot, param, sub_id, timetable, date_between — each with exact/mask/regex/@empty matching.

object
schema

“redirect” (default): targetUrl wins, exactly as before. “landing_offer”: flowConfig holds independently weighted landing/offer sets — an empty landings list goes straight to the offer. “action”: flowConfig describes a non-redirect response (show_html, show_text, http_404, do_nothing, send_to_campaign).

string
Allowed values: redirect landing_offer action
redirectType

How the redirect is delivered. Defaults to a plain 302.

string
Allowed values: 301 302 307 meta_refresh double_meta js iframe
flowConfig

Required for schema “landing_offer” ({ landings: [{id,weight}], offers: [{id,weight}] }) and schema “action” ({ actionType, html?, text?, campaignCode? }). Ignored for “redirect”.

object
flowType

Processing order: forced rules win outright when their filters match, then regular rules (existing geo/device/ab_test/rotation logic), then default as fallback.

string
Allowed values: forced regular default
isActive
boolean
Media typeapplication/json
object
id
required
string
linkId
required
string
ruleType
required
string
Allowed values: geo device ab_test rotation
priority
required
number
conditions
required
object
targetUrl
object
weight
required
number
schema
required
string
Allowed values: redirect landing_offer action
redirectType
required
string
Allowed values: 301 302 307 meta_refresh double_meta js iframe
flowConfig
object
flowType
required
string
Allowed values: forced regular default
isActive
required
boolean
createdAt
required
string

Example

{
"ruleType": "geo",
"schema": "redirect",
"redirectType": "301",
"flowType": "forced"
}