Create quota
Create audience quotas to control recruitment distribution by demographic criteria (e.g., age, gender, income). Quotas automatically stop recruitment for a segment once its target is met.
curl --request POST \
--url https://api-staging.respondent.io/v1/projects/{projectId}/quota \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-api-secret: <x-api-secret>' \
--data '{}'import requests
url = "https://api-staging.respondent.io/v1/projects/{projectId}/quota"
payload = {}
headers = {
"x-api-key": "<x-api-key>",
"x-api-secret": "<x-api-secret>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-api-secret': '<x-api-secret>',
'Content-Type': 'application/json'
},
body: JSON.stringify({})
};
fetch('https://api-staging.respondent.io/v1/projects/{projectId}/quota', 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-staging.respondent.io/v1/projects/{projectId}/quota",
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([
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>",
"x-api-secret: <x-api-secret>"
],
]);
$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-staging.respondent.io/v1/projects/{projectId}/quota"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("x-api-secret", "<x-api-secret>")
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-staging.respondent.io/v1/projects/{projectId}/quota")
.header("x-api-key", "<x-api-key>")
.header("x-api-secret", "<x-api-secret>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-staging.respondent.io/v1/projects/{projectId}/quota")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["x-api-secret"] = '<x-api-secret>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"progress": {
"1": {
"currentCount": 10,
"targetCount": 25
},
"2": {
"currentCount": 15,
"targetCount": 30
}
},
"id": "<string>",
"projectId": "<string>",
"version": "v1",
"totalTarget": 2,
"criteria": {
"category": "gender",
"segments": [
{
"value": "male",
"percentage": 50,
"id": "1"
}
]
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}Path Parameters
Body
v1 Quota criteria details
Hide child attributes
Hide child attributes
The category this quota applies to
age, gender, ethnicity, location "gender"
Array of quota segments. Must contain at least one segment.
Hide child attributes
Hide child attributes
The value for this segment (e.g., "Male" for gender, "18-24" for age, "USA" for location). Type depends on category.
male, female, other, nonbinary, transmale, transfemale, prefernottoanswer, 18-20, 21-29, 30-39, 40-54, 55+, americanindianalaskannative, hispaniclatino, blackorafricanamerican, asianpacificislander, whitecaucasian, middleeastern, multipleethnicity, prefernotdisclose, AX, AL, DZ, AS, AD, AI, AQ, AG, AR, AM, AW, AU, AT, BS, BH, BD, BB, BY, BE, BZ, BJ, BM, BT, BO, BA, BW, BV, BR, VG, IO, BN, BG, BF, BI, CV, CM, CA, KY, CF, TD, CL, CX, CC, CO, KM, CG, CK, CR, HR, CU, CW, CY, CZ, CI, CD, DK, DJ, DM, EC, EG, SV, GQ, ER, EE, SZ, ET, FK, FO, FJ, FI, FR, GF, PF, TF, GA, GM, GE, DE, GI, GR, GL, GD, GP, GU, GT, GG, GN, GW, GY, HT, HM, VA, HN, HK, HU, IS, IN, ID, IR, IQ, IE, IM, IL, IT, JM, JP, JE, JO, KZ, KE, KI, LA, LV, LB, LR, LY, LI, LT, LU, MG, MW, MY, MV, ML, MT, MH, MQ, MR, MU, YT, MX, FM, MD, MC, MN, ME, MS, MA, MZ, NA, NR, NP, NL, NC, NZ, NI, NE, NU, NF, KP, MK, MP, NO, OM, PW, PA, PG, PY, PE, PH, PN, PL, PT, PR, QA, RO, RW, RE, SH, KN, LC, PM, VC, WS, SM, ST, SA, RS, SC, SL, SG, SK, SI, SB, SO, ZA, GS, KR, ES, LK, SR, SJ, SE, CH, TZ, TW, TH, TL, TG, TK, TO, TT, TN, TR, TM, TC, TV, VI, UG, AE, GB, UM, US, UY, VU, VE, VN, WF, EH, ZM, ZW, all "male"
The target percentage for this segment (0-100)
0 <= x <= 10050
Response
Quota progress by segment ID
{
"1": { "currentCount": 10, "targetCount": 25 },
"2": { "currentCount": 15, "targetCount": 30 }
}
v1 x >= 1IN_PROGRESS, FILLED Hide child attributes
Hide child attributes
The category this quota applies to
age, gender, ethnicity, location "gender"
Array of quota segments
Hide child attributes
Hide child attributes
The value for this segment (e.g., "Male" for gender, "18-24" for age, "USA" for location). Type depends on category.
male, female, other, nonbinary, transmale, transfemale, prefernottoanswer, 18-20, 21-29, 30-39, 40-54, 55+, americanindianalaskannative, hispaniclatino, blackorafricanamerican, asianpacificislander, whitecaucasian, middleeastern, multipleethnicity, prefernotdisclose, AX, AL, DZ, AS, AD, AI, AQ, AG, AR, AM, AW, AU, AT, BS, BH, BD, BB, BY, BE, BZ, BJ, BM, BT, BO, BA, BW, BV, BR, VG, IO, BN, BG, BF, BI, CV, CM, CA, KY, CF, TD, CL, CX, CC, CO, KM, CG, CK, CR, HR, CU, CW, CY, CZ, CI, CD, DK, DJ, DM, EC, EG, SV, GQ, ER, EE, SZ, ET, FK, FO, FJ, FI, FR, GF, PF, TF, GA, GM, GE, DE, GI, GR, GL, GD, GP, GU, GT, GG, GN, GW, GY, HT, HM, VA, HN, HK, HU, IS, IN, ID, IR, IQ, IE, IM, IL, IT, JM, JP, JE, JO, KZ, KE, KI, LA, LV, LB, LR, LY, LI, LT, LU, MG, MW, MY, MV, ML, MT, MH, MQ, MR, MU, YT, MX, FM, MD, MC, MN, ME, MS, MA, MZ, NA, NR, NP, NL, NC, NZ, NI, NE, NU, NF, KP, MK, MP, NO, OM, PW, PA, PG, PY, PE, PH, PN, PL, PT, PR, QA, RO, RW, RE, SH, KN, LC, PM, VC, WS, SM, ST, SA, RS, SC, SL, SG, SK, SI, SB, SO, ZA, GS, KR, ES, LK, SR, SJ, SE, CH, TZ, TW, TH, TL, TG, TK, TO, TT, TN, TR, TM, TC, TV, VI, UG, AE, GB, UM, US, UY, VU, VE, VN, WF, EH, ZM, ZW, all "male"
The target percentage for this segment (0-100)
0 <= x <= 10050
Unique identifier for the segment
"1"
Was this page helpful?
curl --request POST \
--url https://api-staging.respondent.io/v1/projects/{projectId}/quota \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-api-secret: <x-api-secret>' \
--data '{}'import requests
url = "https://api-staging.respondent.io/v1/projects/{projectId}/quota"
payload = {}
headers = {
"x-api-key": "<x-api-key>",
"x-api-secret": "<x-api-secret>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-api-secret': '<x-api-secret>',
'Content-Type': 'application/json'
},
body: JSON.stringify({})
};
fetch('https://api-staging.respondent.io/v1/projects/{projectId}/quota', 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-staging.respondent.io/v1/projects/{projectId}/quota",
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([
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>",
"x-api-secret: <x-api-secret>"
],
]);
$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-staging.respondent.io/v1/projects/{projectId}/quota"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("x-api-secret", "<x-api-secret>")
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-staging.respondent.io/v1/projects/{projectId}/quota")
.header("x-api-key", "<x-api-key>")
.header("x-api-secret", "<x-api-secret>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-staging.respondent.io/v1/projects/{projectId}/quota")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["x-api-secret"] = '<x-api-secret>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"progress": {
"1": {
"currentCount": 10,
"targetCount": 25
},
"2": {
"currentCount": 15,
"targetCount": 30
}
},
"id": "<string>",
"projectId": "<string>",
"version": "v1",
"totalTarget": 2,
"criteria": {
"category": "gender",
"segments": [
{
"value": "male",
"percentage": 50,
"id": "1"
}
]
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}