Batch get audience published versions
curl --request POST \
--url https://api.tryarchitect.com/v0/audiences/published_versions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"audienceIds": [
"<string>"
]
}
'import requests
url = "https://api.tryarchitect.com/v0/audiences/published_versions"
payload = { "audienceIds": ["<string>"] }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({audienceIds: ['<string>']})
};
fetch('https://api.tryarchitect.com/v0/audiences/published_versions', 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.tryarchitect.com/v0/audiences/published_versions",
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([
'audienceIds' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.tryarchitect.com/v0/audiences/published_versions"
payload := strings.NewReader("{\n \"audienceIds\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.tryarchitect.com/v0/audiences/published_versions")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"audienceIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryarchitect.com/v0/audiences/published_versions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"audienceIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"audienceId": "<string>",
"publishedVersion": {
"archivedAt": "2023-11-07T05:31:56Z",
"audienceId": "<string>",
"becameDraftAt": "2023-11-07T05:31:56Z",
"cancelledAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"isNewPageAgent": true,
"obsoleteAt": "2023-11-07T05:31:56Z",
"publishedAt": "2023-11-07T05:31:56Z",
"queueDurationMs": 123,
"queuedAt": "2023-11-07T05:31:56Z",
"supplementaryContext": "<string>",
"versionId": "<string>",
"versionNumber": 123
}
}
]
}{
"code": "VALIDATION_ERROR",
"detail": "body - name: Name is required; email: Invalid email address",
"details": [
{
"field": "body",
"issues": [
{
"code": "validation_failed",
"message": "name: Name is required",
"path": [
"name"
]
}
]
}
],
"requestId": "req_01j5k9m7n8p9q2r3s4t5v6w7x8",
"status": 400,
"title": "Bad Request",
"type": "https://api.tryarchitect.com/errors/validation_error"
}{
"code": "UNAUTHORIZED",
"detail": "Authentication is required",
"requestId": "req_01j5k9m7n8p9q2r3s4t5v6w7x8",
"status": 401,
"title": "Unauthorized",
"type": "https://api.tryarchitect.com/errors/unauthorized"
}{
"code": "FORBIDDEN",
"detail": "Multi-tenant API keys are not supported",
"requestId": "req_01j5k9m7n8p9q2r3s4t5v6w7x8",
"status": 403,
"title": "Forbidden",
"type": "https://api.tryarchitect.com/errors/forbidden"
}{
"code": "CONFLICT",
"detail": "Default topic titles cannot be updated",
"requestId": "req_01j5k9m7n8p9q2r3s4t5v6w7x8",
"status": 409,
"title": "Conflict",
"type": "https://api.tryarchitect.com/errors/conflict"
}{
"code": "RATE_LIMITED",
"detail": "Rate limit exceeded",
"details": {
"limit": 100,
"remaining": 0,
"resetTime": 1713225600000,
"retryAfter": 60
},
"requestId": "req_01j5k9m7n8p9q2r3s4t5v6w7x8",
"status": 429,
"title": "Too Many Requests",
"type": "https://api.tryarchitect.com/errors/rate_limited"
}{
"code": "INTERNAL",
"detail": "An unexpected error occurred",
"requestId": "req_01j5k9m7n8p9q2r3s4t5v6w7x8",
"status": 500,
"title": "Internal Server Error",
"type": "https://api.tryarchitect.com/errors/internal"
}{
"code": "SERVICE_UNAVAILABLE",
"detail": "The service is temporarily unavailable",
"requestId": "req_01j5k9m7n8p9q2r3s4t5v6w7x8",
"status": 503,
"title": "Service Unavailable",
"type": "https://api.tryarchitect.com/errors/service_unavailable"
}Audience Versions
Batch get audience published versions
Retrieve the published version for many audiences in a single request. Returns one entry per requested audience id, in the same order; publishedVersion is null when the audience has no published version. Use this instead of calling the per-audience versions endpoint in a loop.
POST
/
v0
/
audiences
/
published_versions
Batch get audience published versions
curl --request POST \
--url https://api.tryarchitect.com/v0/audiences/published_versions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"audienceIds": [
"<string>"
]
}
'import requests
url = "https://api.tryarchitect.com/v0/audiences/published_versions"
payload = { "audienceIds": ["<string>"] }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({audienceIds: ['<string>']})
};
fetch('https://api.tryarchitect.com/v0/audiences/published_versions', 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.tryarchitect.com/v0/audiences/published_versions",
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([
'audienceIds' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.tryarchitect.com/v0/audiences/published_versions"
payload := strings.NewReader("{\n \"audienceIds\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.tryarchitect.com/v0/audiences/published_versions")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"audienceIds\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryarchitect.com/v0/audiences/published_versions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"audienceIds\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"audienceId": "<string>",
"publishedVersion": {
"archivedAt": "2023-11-07T05:31:56Z",
"audienceId": "<string>",
"becameDraftAt": "2023-11-07T05:31:56Z",
"cancelledAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"isNewPageAgent": true,
"obsoleteAt": "2023-11-07T05:31:56Z",
"publishedAt": "2023-11-07T05:31:56Z",
"queueDurationMs": 123,
"queuedAt": "2023-11-07T05:31:56Z",
"supplementaryContext": "<string>",
"versionId": "<string>",
"versionNumber": 123
}
}
]
}{
"code": "VALIDATION_ERROR",
"detail": "body - name: Name is required; email: Invalid email address",
"details": [
{
"field": "body",
"issues": [
{
"code": "validation_failed",
"message": "name: Name is required",
"path": [
"name"
]
}
]
}
],
"requestId": "req_01j5k9m7n8p9q2r3s4t5v6w7x8",
"status": 400,
"title": "Bad Request",
"type": "https://api.tryarchitect.com/errors/validation_error"
}{
"code": "UNAUTHORIZED",
"detail": "Authentication is required",
"requestId": "req_01j5k9m7n8p9q2r3s4t5v6w7x8",
"status": 401,
"title": "Unauthorized",
"type": "https://api.tryarchitect.com/errors/unauthorized"
}{
"code": "FORBIDDEN",
"detail": "Multi-tenant API keys are not supported",
"requestId": "req_01j5k9m7n8p9q2r3s4t5v6w7x8",
"status": 403,
"title": "Forbidden",
"type": "https://api.tryarchitect.com/errors/forbidden"
}{
"code": "CONFLICT",
"detail": "Default topic titles cannot be updated",
"requestId": "req_01j5k9m7n8p9q2r3s4t5v6w7x8",
"status": 409,
"title": "Conflict",
"type": "https://api.tryarchitect.com/errors/conflict"
}{
"code": "RATE_LIMITED",
"detail": "Rate limit exceeded",
"details": {
"limit": 100,
"remaining": 0,
"resetTime": 1713225600000,
"retryAfter": 60
},
"requestId": "req_01j5k9m7n8p9q2r3s4t5v6w7x8",
"status": 429,
"title": "Too Many Requests",
"type": "https://api.tryarchitect.com/errors/rate_limited"
}{
"code": "INTERNAL",
"detail": "An unexpected error occurred",
"requestId": "req_01j5k9m7n8p9q2r3s4t5v6w7x8",
"status": 500,
"title": "Internal Server Error",
"type": "https://api.tryarchitect.com/errors/internal"
}{
"code": "SERVICE_UNAVAILABLE",
"detail": "The service is temporarily unavailable",
"requestId": "req_01j5k9m7n8p9q2r3s4t5v6w7x8",
"status": 503,
"title": "Service Unavailable",
"type": "https://api.tryarchitect.com/errors/service_unavailable"
}Was this page helpful?
⌘I

