curl --request GET \
--url https://plainrouter.com/api/v1/agent/context \
--header 'Authorization: Bearer <token>'import requests
url = "https://plainrouter.com/api/v1/agent/context"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://plainrouter.com/api/v1/agent/context', 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://plainrouter.com/api/v1/agent/context",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://plainrouter.com/api/v1/agent/context"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://plainrouter.com/api/v1/agent/context")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://plainrouter.com/api/v1/agent/context")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"meta_connected": true,
"agent": {
"id": "<string>",
"name": "<string>",
"scopes": [
"<string>"
],
"authentication": "personal_access_token"
},
"platform_ad_account": {
"id": 123,
"external_id": "<string>",
"name": "<string>",
"platform": "<string>",
"currency": "<string>",
"timezone": "<string>",
"workspace": {
"id": 123,
"name": "<string>"
}
},
"next_steps": [
"<string>"
]
}{
"message": "<string>"
}{
"error": "<string>",
"error_description": "<string>"
}{
"error": "<string>",
"error_description": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Get agent context
Read the authenticated agent and authorized account. With no active account, returns null and connection next steps.
curl --request GET \
--url https://plainrouter.com/api/v1/agent/context \
--header 'Authorization: Bearer <token>'import requests
url = "https://plainrouter.com/api/v1/agent/context"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://plainrouter.com/api/v1/agent/context', 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://plainrouter.com/api/v1/agent/context",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://plainrouter.com/api/v1/agent/context"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://plainrouter.com/api/v1/agent/context")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://plainrouter.com/api/v1/agent/context")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"meta_connected": true,
"agent": {
"id": "<string>",
"name": "<string>",
"scopes": [
"<string>"
],
"authentication": "personal_access_token"
},
"platform_ad_account": {
"id": 123,
"external_id": "<string>",
"name": "<string>",
"platform": "<string>",
"currency": "<string>",
"timezone": "<string>",
"workspace": {
"id": 123,
"name": "<string>"
}
},
"next_steps": [
"<string>"
]
}{
"message": "<string>"
}{
"error": "<string>",
"error_description": "<string>"
}{
"error": "<string>",
"error_description": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Authorizations
Workspace key with read ability, ad-account.read permission and the agent.context grant.
Query Parameters
Optional positive account ID. A bound key may name only its own account; a different ID returns 422. An unbound key requires exactly one active available advertising account with an active connection; omission uses that account and a supplied ID must match it. Multiple active accounts return 422 even when account_id is supplied. With no active available account, a valid account_id is ignored and platform_ad_account is null.
x >= 1Optional workspace grant selector. Required for credentials with multiple workspace grants; it must identify an authorized workspace.
x >= 1