Create a value rule set
curl --request POST \
--url https://api.aisa.one/apis/v1/ads/value-rule-sets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"adAccountId": "act_1234567890",
"name": "Winter launch",
"rules": [
{
"adjustSign": "INCREASE",
"adjustValue": 10,
"criteria": [
{
"criteriaType": "AGE",
"criteriaValueTypes": [
"example"
],
"criteriaValues": [
"example"
],
"operator": "CONTAINS"
}
],
"name": "Winter launch"
}
]
}
'import requests
url = "https://api.aisa.one/apis/v1/ads/value-rule-sets"
payload = {
"adAccountId": "act_1234567890",
"name": "Winter launch",
"rules": [
{
"adjustSign": "INCREASE",
"adjustValue": 10,
"criteria": [
{
"criteriaType": "AGE",
"criteriaValueTypes": ["example"],
"criteriaValues": ["example"],
"operator": "CONTAINS"
}
],
"name": "Winter launch"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
adAccountId: 'act_1234567890',
name: 'Winter launch',
rules: [
{
adjustSign: 'INCREASE',
adjustValue: 10,
criteria: [
{
criteriaType: 'AGE',
criteriaValueTypes: ['example'],
criteriaValues: ['example'],
operator: 'CONTAINS'
}
],
name: 'Winter launch'
}
]
})
};
fetch('https://api.aisa.one/apis/v1/ads/value-rule-sets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/ads/value-rule-sets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'adAccountId' => 'act_1234567890',
'name' => 'Winter launch',
'rules' => [
[
'adjustSign' => 'INCREASE',
'adjustValue' => 10,
'criteria' => [
[
'criteriaType' => 'AGE',
'criteriaValueTypes' => [
'example'
],
'criteriaValues' => [
'example'
],
'operator' => 'CONTAINS'
]
],
'name' => 'Winter launch'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/ads/value-rule-sets"
payload := strings.NewReader("{\n \"adAccountId\": \"act_1234567890\",\n \"name\": \"Winter launch\",\n \"rules\": [\n {\n \"adjustSign\": \"INCREASE\",\n \"adjustValue\": 10,\n \"criteria\": [\n {\n \"criteriaType\": \"AGE\",\n \"criteriaValueTypes\": [\n \"example\"\n ],\n \"criteriaValues\": [\n \"example\"\n ],\n \"operator\": \"CONTAINS\"\n }\n ],\n \"name\": \"Winter launch\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/ads/value-rule-sets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"adAccountId\": \"act_1234567890\",\n \"name\": \"Winter launch\",\n \"rules\": [\n {\n \"adjustSign\": \"INCREASE\",\n \"adjustValue\": 10,\n \"criteria\": [\n {\n \"criteriaType\": \"AGE\",\n \"criteriaValueTypes\": [\n \"example\"\n ],\n \"criteriaValues\": [\n \"example\"\n ],\n \"operator\": \"CONTAINS\"\n }\n ],\n \"name\": \"Winter launch\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/ads/value-rule-sets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"adAccountId\": \"act_1234567890\",\n \"name\": \"Winter launch\",\n \"rules\": [\n {\n \"adjustSign\": \"INCREASE\",\n \"adjustValue\": 10,\n \"criteria\": [\n {\n \"criteriaType\": \"AGE\",\n \"criteriaValueTypes\": [\n \"example\"\n ],\n \"criteriaValues\": [\n \"example\"\n ],\n \"operator\": \"CONTAINS\"\n }\n ],\n \"name\": \"Winter launch\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"adAccountId": "<string>",
"valueRuleSetId": "<string>"
}{
"error": {
"code": "<string>",
"details": {},
"message": "<string>",
"param": "<string>",
"retryHint": "<string>",
"retryable": true,
"type": "<string>"
}
}Campaigns
Create a value rule set
Ad Accounts. Changes the ad account without starting or raising spend; audited. Creates a Meta value rule set that raises or lowers bids for chosen audience segments, ready to attach to ad sets. Creates a value rule set on the ad account (Meta’s POST /act_X/value_rule_set). Attach the returned id to an ad set with valueRuleSetId on POST /apis/v1/ads/create or PUT /apis/v1/ads/ad-sets/{adSetId}. ### Rule order is semantic
POST
https://api.aisa.one
/
apis
/
v1
/
ads
/
value-rule-sets
Create a value rule set
curl --request POST \
--url https://api.aisa.one/apis/v1/ads/value-rule-sets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"adAccountId": "act_1234567890",
"name": "Winter launch",
"rules": [
{
"adjustSign": "INCREASE",
"adjustValue": 10,
"criteria": [
{
"criteriaType": "AGE",
"criteriaValueTypes": [
"example"
],
"criteriaValues": [
"example"
],
"operator": "CONTAINS"
}
],
"name": "Winter launch"
}
]
}
'import requests
url = "https://api.aisa.one/apis/v1/ads/value-rule-sets"
payload = {
"adAccountId": "act_1234567890",
"name": "Winter launch",
"rules": [
{
"adjustSign": "INCREASE",
"adjustValue": 10,
"criteria": [
{
"criteriaType": "AGE",
"criteriaValueTypes": ["example"],
"criteriaValues": ["example"],
"operator": "CONTAINS"
}
],
"name": "Winter launch"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
adAccountId: 'act_1234567890',
name: 'Winter launch',
rules: [
{
adjustSign: 'INCREASE',
adjustValue: 10,
criteria: [
{
criteriaType: 'AGE',
criteriaValueTypes: ['example'],
criteriaValues: ['example'],
operator: 'CONTAINS'
}
],
name: 'Winter launch'
}
]
})
};
fetch('https://api.aisa.one/apis/v1/ads/value-rule-sets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/ads/value-rule-sets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'adAccountId' => 'act_1234567890',
'name' => 'Winter launch',
'rules' => [
[
'adjustSign' => 'INCREASE',
'adjustValue' => 10,
'criteria' => [
[
'criteriaType' => 'AGE',
'criteriaValueTypes' => [
'example'
],
'criteriaValues' => [
'example'
],
'operator' => 'CONTAINS'
]
],
'name' => 'Winter launch'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/ads/value-rule-sets"
payload := strings.NewReader("{\n \"adAccountId\": \"act_1234567890\",\n \"name\": \"Winter launch\",\n \"rules\": [\n {\n \"adjustSign\": \"INCREASE\",\n \"adjustValue\": 10,\n \"criteria\": [\n {\n \"criteriaType\": \"AGE\",\n \"criteriaValueTypes\": [\n \"example\"\n ],\n \"criteriaValues\": [\n \"example\"\n ],\n \"operator\": \"CONTAINS\"\n }\n ],\n \"name\": \"Winter launch\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/ads/value-rule-sets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"adAccountId\": \"act_1234567890\",\n \"name\": \"Winter launch\",\n \"rules\": [\n {\n \"adjustSign\": \"INCREASE\",\n \"adjustValue\": 10,\n \"criteria\": [\n {\n \"criteriaType\": \"AGE\",\n \"criteriaValueTypes\": [\n \"example\"\n ],\n \"criteriaValues\": [\n \"example\"\n ],\n \"operator\": \"CONTAINS\"\n }\n ],\n \"name\": \"Winter launch\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/ads/value-rule-sets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"adAccountId\": \"act_1234567890\",\n \"name\": \"Winter launch\",\n \"rules\": [\n {\n \"adjustSign\": \"INCREASE\",\n \"adjustValue\": 10,\n \"criteria\": [\n {\n \"criteriaType\": \"AGE\",\n \"criteriaValueTypes\": [\n \"example\"\n ],\n \"criteriaValues\": [\n \"example\"\n ],\n \"operator\": \"CONTAINS\"\n }\n ],\n \"name\": \"Winter launch\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"adAccountId": "<string>",
"valueRuleSetId": "<string>"
}{
"error": {
"code": "<string>",
"details": {},
"message": "<string>",
"param": "<string>",
"retryHint": "<string>",
"retryable": true,
"type": "<string>"
}
}Request contract
- Method and path: POST /apis/v1/ads/value-rule-sets
- Availability: enabled
- Request URL template:
https://api.aisa.one/apis/v1/ads/value-rule-sets - connectionId: query; required
{
"operationId": "post_aisa_ads_apis_v1_ads_value_rule_sets",
"method": "POST",
"path": "/apis/v1/ads/value-rule-sets",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [
{
"description": "The ads connection (adc_...) the request runs on: one of yours, from GET /apis/v1/ads/connections. On a request with a JSON body it may be sent as a top-level body member instead.",
"in": "query",
"name": "connectionId",
"required": true,
"schema": {
"pattern": "^adc_[0-9A-Za-z]+$",
"type": "string"
}
}
],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"example": {
"adAccountId": "act_1234567890",
"connectionId": "adc_7f3k2m9q",
"name": "Winter launch",
"rules": [
{
"adjustSign": "INCREASE",
"adjustValue": 10,
"criteria": [
{
"criteriaType": "AGE",
"criteriaValueTypes": [
"example"
],
"criteriaValues": [
"example"
],
"operator": "CONTAINS"
}
],
"name": "Winter launch"
}
]
},
"schema": {
"additionalProperties": true,
"properties": {
"adAccountId": {
"description": "Platform ad account id (Meta act_, Google customer id, LinkedIn account id, ...).",
"type": "string"
},
"connectionId": {
"description": "The ads connection (adc_...), when not sent as the connectionId query parameter.",
"pattern": "^adc_[0-9A-Za-z]+$",
"type": "string"
},
"name": {
"maxLength": 255,
"minLength": 1,
"type": "string"
},
"rules": {
"description": "Evaluated in order; the first matching rule wins.",
"items": {
"additionalProperties": false,
"description": "One bid-adjustment rule. Rules are evaluated in ARRAY ORDER and only the first matching rule adjusts the bid for an overlapping audience, so the order is semantic.",
"properties": {
"adjustSign": {
"description": "Direction of the adjustment. There is no signed value field.",
"enum": [
"INCREASE",
"DECREASE"
],
"type": "string"
},
"adjustValue": {
"description": "Unsigned percentage magnitude. `INCREASE` accepts 1-1000, `DECREASE` accepts 1-90. 0 is out of range on both.",
"maximum": 1000,
"minimum": 1,
"type": "integer"
},
"criteria": {
"description": "All criteria on a rule must match for the rule to fire.",
"items": {
"additionalProperties": false,
"description": "One matching condition inside a value rule. `criteriaValues` and `criteriaValueTypes` are POSITIONALLY paired: same length, same order.",
"properties": {
"criteriaType": {
"description": "The dimension being matched. `OMNI_CHANNEL` (conversion location: APP, INSTANT_FORM, PHONE_CALL, WEBSITE) is accepted even though Meta's own enum table omits it.",
"enum": [
"AGE",
"GENDER",
"OS_TYPE",
"DEVICE_PLATFORM",
"LOCATION",
"PLACEMENT",
"OMNI_CHANNEL",
"AUDIENCE_LABEL"
],
"type": "string"
},
"criteriaValueTypes": {
"description": "One entry per `criteriaValues` entry, in the same order.",
"items": {
"type": "string"
},
"minItems": 1,
"type": "array"
},
"criteriaValues": {
"description": "The values to match. `AGE`: ranges such as `18-24`, `18+` or a custom `18-26`. A range whose upper bound is 65 is NOT allowed (use `18+` instead of `18-65`). `LOCATION`: Targeting-Search keys.",
"items": {
"type": "string"
},
"minItems": 1,
"type": "array"
},
"id": {
"description": "Platform criterion id. Echo it on `PUT` to KEEP this criterion, omit it to CREATE a new one. A criterion left out of the array entirely is DELETED.",
"type": "string"
},
"operator": {
"description": "Required on every criterion. `CONTAINS` is currently the only value Meta supports.",
"enum": [
"CONTAINS"
],
"type": "string"
}
},
"required": [
"criteriaType",
"criteriaValueTypes",
"criteriaValues",
"operator"
],
"type": "object"
},
"maxItems": 4,
"minItems": 1,
"type": "array"
},
"id": {
"description": "Platform rule id. Echo it on `PUT` to KEEP this rule, omit it to CREATE a new one. A rule left out of the array entirely is DELETED.",
"type": "string"
},
"name": {
"maxLength": 255,
"minLength": 1,
"type": "string"
},
"status": {
"description": "Meta returns `ACTIVE` here but documents no enum for the field. Treat it as a passthrough: echo whatever the `GET` returned, and do not synthesize values.",
"type": "string"
}
},
"required": [
"adjustSign",
"adjustValue",
"criteria",
"name"
],
"type": "object"
},
"maxItems": 10,
"minItems": 1,
"type": "array"
}
},
"required": [
"adAccountId",
"name",
"rules"
],
"type": "object"
}
}
},
"required": true
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
Cost and request rules
No additional charge for this operation. Ad spend is billed separately by the ad platform to your connected ad account.Authorizations
Query Parameters
Body
application/json