Register an existing credential as a buyer agent
curl --request POST \
--url https://api.interchange.io/api/v2/buyer-agent-principals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"displayName": "<string>",
"credential": {
"type": "workos_m2m",
"subject": "<string>"
}
}
'import requests
url = "https://api.interchange.io/api/v2/buyer-agent-principals"
payload = {
"displayName": "<string>",
"credential": {
"type": "workos_m2m",
"subject": "<string>"
}
}
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({displayName: '<string>', credential: {type: 'workos_m2m', subject: '<string>'}})
};
fetch('https://api.interchange.io/api/v2/buyer-agent-principals', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"principalId": "<string>",
"principalKind": "buyer_agent",
"displayName": "<string>",
"lifecycleState": "active",
"authority": {
"advertiserAccountIds": [
"<unknown>"
],
"permissions": [
"<unknown>"
]
},
"canonicalAgentUrl": "<string>",
"access": {
"accessRevision": 4503599627370495,
"advertisers": [
{
"advertiserId": "<string>",
"name": "<string>",
"role": "READ"
}
]
}
},
"error": null
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}Buyer Agent Principals
Register an existing credential as a buyer agent
A directly authenticated WorkOS organization administrator registers an active, organization-owned or issued, never-before-bound API key or WorkOS M2M client. A key that has already resolved to the organization operator cannot be reclassified: use a distinct eligible credential. The service derives organization and issuer identity from the authenticated context, never accepts a caller-selected principal ID, and adds no advertiser, account, spend, payment, or Terms authority. An idempotent retry returns the existing principal; no credential can be registered to another principal or replayed after retirement, and registration does not alter the credential’s pre-existing authentication permissions.
POST
/
buyer-agent-principals
Register an existing credential as a buyer agent
curl --request POST \
--url https://api.interchange.io/api/v2/buyer-agent-principals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"displayName": "<string>",
"credential": {
"type": "workos_m2m",
"subject": "<string>"
}
}
'import requests
url = "https://api.interchange.io/api/v2/buyer-agent-principals"
payload = {
"displayName": "<string>",
"credential": {
"type": "workos_m2m",
"subject": "<string>"
}
}
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({displayName: '<string>', credential: {type: 'workos_m2m', subject: '<string>'}})
};
fetch('https://api.interchange.io/api/v2/buyer-agent-principals', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"principalId": "<string>",
"principalKind": "buyer_agent",
"displayName": "<string>",
"lifecycleState": "active",
"authority": {
"advertiserAccountIds": [
"<unknown>"
],
"permissions": [
"<unknown>"
]
},
"canonicalAgentUrl": "<string>",
"access": {
"accessRevision": 4503599627370495,
"advertisers": [
{
"advertiserId": "<string>",
"name": "<string>",
"role": "READ"
}
]
}
},
"error": null
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}{
"data": null,
"error": {
"code": "<string>",
"message": "<string>",
"field": "<string>",
"details": {}
}
}Authorizations
API key or access token
Body
application/json