Create office
curl --request POST \
--url https://{publisher_host}/v1/offices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Torshov"
}
'import requests
url = "https://{publisher_host}/v1/offices"
payload = { "name": "Torshov" }
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({name: 'Torshov'})
};
fetch('https://{publisher_host}/v1/offices', 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://{publisher_host}/v1/offices",
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([
'name' => 'Torshov'
]),
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://{publisher_host}/v1/offices"
payload := strings.NewReader("{\n \"name\": \"Torshov\"\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://{publisher_host}/v1/offices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Torshov\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{publisher_host}/v1/offices")
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 \"name\": \"Torshov\"\n}"
response = http.request(request)
puts response.read_body{
"office_id": "off_8k2mQx",
"name": "Torshov"
}Offices
Create office
Create a broker or advertiser office; the publisher generates office_id
POST
/
offices
Create office
curl --request POST \
--url https://{publisher_host}/v1/offices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Torshov"
}
'import requests
url = "https://{publisher_host}/v1/offices"
payload = { "name": "Torshov" }
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({name: 'Torshov'})
};
fetch('https://{publisher_host}/v1/offices', 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://{publisher_host}/v1/offices",
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([
'name' => 'Torshov'
]),
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://{publisher_host}/v1/offices"
payload := strings.NewReader("{\n \"name\": \"Torshov\"\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://{publisher_host}/v1/offices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Torshov\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{publisher_host}/v1/offices")
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 \"name\": \"Torshov\"\n}"
response = http.request(request)
puts response.read_body{
"office_id": "off_8k2mQx",
"name": "Torshov"
}Overview
Create an office in the publisher system so ads can be attributed and billed correctly. You generateoffice_id. Targeter stores that id and sends it on later ad calls.
If an office with the same name already exists, return 200 with the existing office instead of creating a duplicate.
Request
Headers
Authorization: Bearer {token}(required)Content-Type: application/json
Body Parameters
string
required
Office display name as used in Targeter (for example a brokerage office)
Example Request
curl -X POST "https://publisher.example.com/v1/offices" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Torshov"
}'
Response
Success (201 — new office)
string
Publisher-generated office id
string
Office display name
{
"office_id": "off_8k2mQx",
"name": "Torshov"
}
Success (200 — existing office)
Same body as 201 whenname already exists.
Error Responses
400 - Invalid request payload
{
"error": "Invalid request payload",
"details": [
{
"path": ["name"],
"message": "Invalid input: expected string, received undefined"
}
]
}
401 - Unauthorized
{
"error": "Missing or invalid Authorization header"
}
500 - Server Error
{
"error": "Unexpected server error. Please try again later."
}
Authorizations
API token issued to Targeter during integration setup. Send as Authorization: Bearer <token>.
Body
application/json
Office display name as used in Targeter
Example:
"Torshov"