Skip to content
AdCrunch
Esc
↑↓navigate↵open⌘Jpreview

Attach an advertiser

Attaches an advertiser to a Brand. An agent that works on that advertiser can then find this brand context. Send the same call again for the same result: the pair is the key, so a second attach writes nothing and still answers 201. AdCrunch reads the provider from the advertiser. It does not take the provider from you. A Brand takes several advertisers, and an advertiser takes several Brands.

POST/context/brands/{slug}/advertisers
Authorization
AuthorizationBearer token · headerrequired

Send Authorization: Bearer <credential>.

Use an API key (acr_…), from the AdCrunch console under Settings → API keys.

The credential names the organization, and no operation takes an organization parameter.

See https://docs.adcrunch.dev/api/authentication.

Path parameters
slugstringrequired
Request body
requiredapplication/json
advertiser_idstringrequired
matches ^acc_[\s\S]{0,}$
Responses
201

Attached. Idempotent: attaching an account that is already attached answers the same way. provider is what AdCrunch resolved from the advertiser, never what you sent.

advertiserIdstringrequired
providerstringrequired

Resolved from the ad account, never taken from the caller. That resolution is also the ownership check.

400

The request does not match the schema of this operation: a field is missing or has the wrong type, or the body is not valid JSON. error is invalid_request, and issues names each field. Nothing was changed.

issuesobject[]required

One entry for each field that does not match.

Show properties
Array of object
instringrequired

The part of the request that holds the field.

Allowed:bodycookieheadersparamsquery
messagestringrequired

A sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.

pathstringrequired

A JSON Pointer into that part of the request, such as /filename. An empty string is the whole part.

errorstringrequired

A stable code for the failure. This is the field to branch on. It does not change for a given failure.

Allowed:invalid_request
messagestringrequired

A sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.

401

No API key, or one that does not resolve. See the security scheme. error is unauthorized.

errorstringrequired

A stable code for the failure. This is the field to branch on. It does not change for a given failure.

Allowed:unauthorized
messagestringrequired

A sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.

403

The caller does not hold brand:write. error is forbidden.

errorstringrequired

A stable code for the failure. This is the field to branch on. It does not change for a given failure.

Allowed:forbidden
messagestringrequired

A sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.

404

No Brand with that slug. error is not_found.

errorstringrequired

A stable code for the failure. This is the field to branch on. It does not change for a given failure.

messagestringrequired

A sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.

422

That advertiser is not connected to this organization. error is advertiser_not_owned. Ownership is checked against the integration database at write time, because there is no foreign key across databases.

errorstringrequired

A stable code for the failure. This is the field to branch on. It does not change for a given failure.

messagestringrequired

A sentence to show a person. Written to say what to do next. Reworded whenever it can be said better, so never branch on it.

Request
curl -X POST "https://api.pr-701.adcrunch.dev/context/brands/string/advertisers" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "advertiser_id": "acc_1203456789012345"
}'
Response
{
  "advertiserId": "acc_1203456789012345",
  "provider": "meta"
}