API referenceAd Account Requests

Request ad account replacement

Asks the ad account partner to replace an ad account of the request that is not running, and returns the request with the replacement on that account (accounts[].replacement). Koast follows it through on its own: once the partner hands the new account over, Koast connects it to the brand the old one was on, moves the budget left on the old account to the new one (movedCents) and emails the person who requested the account. The request must be SHARED or READY. Refused with 409 conflict and reason account_running while the ad account is still running, replacement_open while a replacement is under way, already_replaced once it was replaced, request_not_replaceable before the account is shared, and replacement_refused when the partner refuses it. Another organization's request answers 404.

POST
/v1/ad-account-requests/{requestId}/accounts/{adAccountId}/replacement
bearerAuth
headerAuthorizationBearer <token>

An organization API key (koast_sk_…) with the API surface enabled, or an OAuth access token issued by Koast (koast_at_…) whose audience covers this API. REST access requires an active Agency plan.

requestId*string

The ad account request id, or its Koast reference (KST-…).

Length1 <= length <= 40
adAccountId*string

The ad account that stopped running, act_…: one of the request's accounts.

Length1 <= length <= 40
Idempotency-Key?string

Retrying with the same key within 24 hours returns the first response without acting again.

Lengthlength <= 255
application/json
  1. body
reason?string

What happened to the ad account, in the user's words, passed on to the ad account partner.

Lengthlength <= 500

Response Body

Request ad account replacement

application/json
  1. response
id*string
reference*string

The Koast reference shown in the app and in emails, KST-….

status*string

QUEUED and SUBMITTED while the request is sent, VERIFYING while the business is checked, CREATING while the account is created, SHARED once it is shared into the Business Manager, READY once it is connected in Koast, REJECTED (see rejectionReason) or CANCELLED. Funds can be added from SHARED.

Value in"QUEUED""SUBMITTED""VERIFYING""CREATING""SHARED""READY""REJECTED""CANCELLED"
accountName*string

The ad account name the customer asked for.

count*integer

How many ad accounts were requested.

Range-9007199254740991 <= value <= 9007199254740991
currency*string
createdAt*string
brandId*|

The Koast brand the first ad account was connected to, once connected.

adAccountIds*array<string>

The ad accounts connected in Koast, act_….

rejectionReason*string|null
stage*integer

The last stage reached: 1 request sent, 2 business verified, 3 account being created, 4 shared into your Business Manager, 5 connected in Koast, 6 funds added.

Range0 <= value <= 6
awaitingReview*boolean

True while Koast reviews the request before sending it on. It stays QUEUED at stage 1 until Koast approves it, or REJECTED with a rejectionReason.

accounts*array<>

The ad accounts created for the request, once shared.

topUps*array<>

Every top-up started for the request, oldest first.

curl -X POST "https://example.com/v1/ad-account-requests/string/accounts/string/replacement" \  -H "Authorization: Bearer koast_sk_..." \  -H "Content-Type: application/json" \  -d '{}'
{  "id": "string",  "reference": "string",  "status": "QUEUED",  "accountName": "string",  "count": -9007199254740991,  "currency": "string",  "createdAt": "string",  "brandId": -9007199254740991,  "adAccountIds": [    "string"  ],  "rejectionReason": "string",  "stage": 0,  "awaitingReview": true,  "accounts": [    {      "adAccountId": "string",      "name": "string",      "status": "string",      "replacement": {        "status": "requested",        "requestedAt": "string",        "reason": "string",        "newAdAccountId": "string",        "movedCents": -9007199254740991,        "completedAt": "string"      },      "replaces": "string"    }  ],  "topUps": [    {      "id": "string",      "adAccountId": "string",      "budgetCents": -9007199254740991,      "commissionCents": -9007199254740991,      "locationFeeCents": -9007199254740991,      "netCents": -9007199254740991,      "amountCents": -9007199254740991,      "currency": "string",      "status": "AWAITING_PAYMENT",      "paymentMethod": "card",      "createdAt": "string",      "paidAt": "string",      "creditedAt": "string"    }  ]}

Required scope: write. CLI: koast request-ad-account-replacement, see Ad Account Requests commands. Authentication, headers, errors and pagination work the same on every operation. See Conventions.