curl -X POST https://api.linquid.io/api/rules \
-H "X-API-Key: lw_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"linkId": "link_abc123",
"name": "Mobile iOS Users in US",
"destinationUrl": "https://apps.apple.com/app/myapp",
"conditions": [
{
"field": "deviceType",
"operator": "equals",
"value": "mobile"
},
{
"field": "os",
"operator": "equals",
"value": "iOS"
},
{
"field": "country",
"operator": "equals",
"value": "US"
}
],
"conditionLogic": "AND",
"priority": 1
}'
const response = await fetch('https://api.linquid.io/api/rules', {
method: 'POST',
headers: {
'X-API-Key': 'lw_your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
linkId: 'link_abc123',
name: 'Mobile iOS Users in US',
destinationUrl: 'https://apps.apple.com/app/myapp',
conditions: [
{ field: 'deviceType', operator: 'equals', value: 'mobile' },
{ field: 'os', operator: 'equals', value: 'iOS' },
{ field: 'country', operator: 'equals', value: 'US' },
],
conditionLogic: 'AND',
priority: 1,
}),
});
import requests
response = requests.post(
'https://api.linquid.io/api/rules',
headers={
'X-API-Key': 'lw_your_api_key_here',
'Content-Type': 'application/json',
},
json={
'linkId': 'link_abc123',
'name': 'Mobile iOS Users in US',
'destinationUrl': 'https://apps.apple.com/app/myapp',
'conditions': [
{'field': 'deviceType', 'operator': 'equals', 'value': 'mobile'},
{'field': 'os', 'operator': 'equals', 'value': 'iOS'},
{'field': 'country', 'operator': 'equals', 'value': 'US'},
],
'conditionLogic': 'AND',
'priority': 1,
}
)
{
"success": true,
"data": {
"id": "rule_def456",
"linkId": "link_abc123",
"name": "Mobile iOS Users in US",
"destinationUrl": "https://apps.apple.com/app/myapp",
"conditions": [
{ "field": "deviceType", "operator": "equals", "value": "mobile" },
{ "field": "os", "operator": "equals", "value": "iOS" },
{ "field": "country", "operator": "equals", "value": "US" }
],
"conditionLogic": "AND",
"priority": 1,
"enabled": true,
"createdAt": "2024-01-15T10:30:00.000Z"
}
}
Links and Rules
Create Rule
Create a new routing rule for a link
POST
/
api
/
rules
curl -X POST https://api.linquid.io/api/rules \
-H "X-API-Key: lw_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"linkId": "link_abc123",
"name": "Mobile iOS Users in US",
"destinationUrl": "https://apps.apple.com/app/myapp",
"conditions": [
{
"field": "deviceType",
"operator": "equals",
"value": "mobile"
},
{
"field": "os",
"operator": "equals",
"value": "iOS"
},
{
"field": "country",
"operator": "equals",
"value": "US"
}
],
"conditionLogic": "AND",
"priority": 1
}'
const response = await fetch('https://api.linquid.io/api/rules', {
method: 'POST',
headers: {
'X-API-Key': 'lw_your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
linkId: 'link_abc123',
name: 'Mobile iOS Users in US',
destinationUrl: 'https://apps.apple.com/app/myapp',
conditions: [
{ field: 'deviceType', operator: 'equals', value: 'mobile' },
{ field: 'os', operator: 'equals', value: 'iOS' },
{ field: 'country', operator: 'equals', value: 'US' },
],
conditionLogic: 'AND',
priority: 1,
}),
});
import requests
response = requests.post(
'https://api.linquid.io/api/rules',
headers={
'X-API-Key': 'lw_your_api_key_here',
'Content-Type': 'application/json',
},
json={
'linkId': 'link_abc123',
'name': 'Mobile iOS Users in US',
'destinationUrl': 'https://apps.apple.com/app/myapp',
'conditions': [
{'field': 'deviceType', 'operator': 'equals', 'value': 'mobile'},
{'field': 'os', 'operator': 'equals', 'value': 'iOS'},
{'field': 'country', 'operator': 'equals', 'value': 'US'},
],
'conditionLogic': 'AND',
'priority': 1,
}
)
{
"success": true,
"data": {
"id": "rule_def456",
"linkId": "link_abc123",
"name": "Mobile iOS Users in US",
"destinationUrl": "https://apps.apple.com/app/myapp",
"conditions": [
{ "field": "deviceType", "operator": "equals", "value": "mobile" },
{ "field": "os", "operator": "equals", "value": "iOS" },
{ "field": "country", "operator": "equals", "value": "US" }
],
"conditionLogic": "AND",
"priority": 1,
"enabled": true,
"createdAt": "2024-01-15T10:30:00.000Z"
}
}
Request Body
string
required
The link to attach this rule to
string
required
Display name for the rule
string
required
URL to redirect when rule matches
array
required
Array of condition objects
string
default:"AND"
How to combine conditions:
AND or ORnumber
Evaluation order (lower = higher priority)
boolean
default:"true"
Whether the rule is active
string
Optional description
Condition Object
Each condition has the following structure:| Field | Type | Description |
|---|---|---|
field | string | Targeting field to evaluate |
operator | string | Comparison operator |
value | string/array | Value(s) to compare against |
Available Fields
Location
country, region, city, timezone, isp, asn, latitude, longitude
Device
deviceType, os, osVersion, browser, browserVersion, deviceBrand
Network
vpn, proxy, tor, datacenter, bot, isCrawler
Traffic
referrer, referrerDomain, utmSource, utmMedium, utmCampaign, utmTerm, utmContent
Time
hour, dayOfWeek
Visitor
isNewVisitor, isReturning
Operators
| Operator | Description | Example |
|---|---|---|
equals | Exact match | country equals "US" |
not_equals | Does not match | country not_equals "CN" |
contains | String contains | referrer contains "google" |
not_contains | String doesn’t contain | referrer not_contains "spam" |
in | Value in array | country in ["US", "CA", "UK"] |
not_in | Value not in array | country not_in ["CN", "RU"] |
greater_than | Numeric comparison | hour greater_than 17 |
less_than | Numeric comparison | hour less_than 9 |
is_true | Boolean true | vpn is_true |
is_false | Boolean false | bot is_false |
curl -X POST https://api.linquid.io/api/rules \
-H "X-API-Key: lw_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"linkId": "link_abc123",
"name": "Mobile iOS Users in US",
"destinationUrl": "https://apps.apple.com/app/myapp",
"conditions": [
{
"field": "deviceType",
"operator": "equals",
"value": "mobile"
},
{
"field": "os",
"operator": "equals",
"value": "iOS"
},
{
"field": "country",
"operator": "equals",
"value": "US"
}
],
"conditionLogic": "AND",
"priority": 1
}'
const response = await fetch('https://api.linquid.io/api/rules', {
method: 'POST',
headers: {
'X-API-Key': 'lw_your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
linkId: 'link_abc123',
name: 'Mobile iOS Users in US',
destinationUrl: 'https://apps.apple.com/app/myapp',
conditions: [
{ field: 'deviceType', operator: 'equals', value: 'mobile' },
{ field: 'os', operator: 'equals', value: 'iOS' },
{ field: 'country', operator: 'equals', value: 'US' },
],
conditionLogic: 'AND',
priority: 1,
}),
});
import requests
response = requests.post(
'https://api.linquid.io/api/rules',
headers={
'X-API-Key': 'lw_your_api_key_here',
'Content-Type': 'application/json',
},
json={
'linkId': 'link_abc123',
'name': 'Mobile iOS Users in US',
'destinationUrl': 'https://apps.apple.com/app/myapp',
'conditions': [
{'field': 'deviceType', 'operator': 'equals', 'value': 'mobile'},
{'field': 'os', 'operator': 'equals', 'value': 'iOS'},
{'field': 'country', 'operator': 'equals', 'value': 'US'},
],
'conditionLogic': 'AND',
'priority': 1,
}
)
{
"success": true,
"data": {
"id": "rule_def456",
"linkId": "link_abc123",
"name": "Mobile iOS Users in US",
"destinationUrl": "https://apps.apple.com/app/myapp",
"conditions": [
{ "field": "deviceType", "operator": "equals", "value": "mobile" },
{ "field": "os", "operator": "equals", "value": "iOS" },
{ "field": "country", "operator": "equals", "value": "US" }
],
"conditionLogic": "AND",
"priority": 1,
"enabled": true,
"createdAt": "2024-01-15T10:30:00.000Z"
}
}
Was this page helpful?

