Guides
Accounts

Accounts and Pages

Business Manager, owned and client ad accounts, account status, creating accounts, and Pages with Page access tokens.

After login, the application discovers what the user can use: the Business Managers, the ad accounts and the Pages. Campaigns, creatives and Insights come from an ad account (act_{id}); ads are published on a Page, and lead forms live there.

text
User ─────┬── Business Manager ──┬── owned accounts (owned_ad_accounts)
          │                      ├── client accounts (client_ad_accounts)
          │                      └── Pages (owned_pages)
          ├── /me/adaccounts (accounts where the user has a role)
          └── /me/accounts (Pages with a Page access token)

Business Manager

bash
curl --url 'https://meta-ads.mimicr.dev/v27.0/me/businesses?fields=id,name' \
  --header 'Authorization: Bearer <token>'
json
{ "data": [{ "id": "842989790016191", "name": "BM Meta Ads QA" }], "paging": { "cursors": { "before": "MAZDZD", "after": "MAZDZD" } } }

Requires business_management. The no_business persona gets data: [], and so does no_accounts.

Ad accounts

bash
curl --url 'https://meta-ads.mimicr.dev/v27.0/me/adaccounts?fields=id,name,currency,timezone_name,account_status&limit=200' \
  --header 'Authorization: Bearer <token>'
json
{
  "data": [
    { "id": "act_100539998049706", "name": "Meta Ads QA (principal)", "currency": "BRL", "timezone_name": "America/Sao_Paulo", "account_status": 1 },
    { "id": "act_100539998049707", "name": "Meta Ads QA (desativada)", "currency": "BRL", "timezone_name": "America/Sao_Paulo", "account_status": 2 }
  ],
  "paging": { "cursors": { "before": "MAZDZD", "after": "MQZDZD" } }
}

Only the accounts the person left checked in the dialog come back. With a Business Manager, complete the list with owned_ad_accounts and client_ad_accounts and follow paging.next to the end.

account_status says whether the account can run ads:

ValueMeaningIn Mimicr
1ACTIVENormal delivery
2DISABLEDReads work; writes answer (#200) The ad account is disabled
3UNSETTLEDPending billing: ads in PENDING_BILLING_INFO, no delivery
7, 8PENDING_RISK_REVIEW, PENDING_SETTLEMENT
9IN_GRACE_PERIODNormal delivery
100, 101PENDING_CLOSURE, CLOSED101 blocks writes like 2
201, 202ANY_ACTIVE, ANY_CLOSEDFilter values

Change the status with the account.set_status action, and simulate billing with account.billing_failure and account.billing_restore.

To read an account:

bash
curl --url 'https://meta-ads.mimicr.dev/v27.0/act_100539998049706?fields=id,name,account_status,currency,timezone_id,timezone_name,amount_spent,spend_cap,business{id,name}' \
  --header 'Authorization: Bearer <token>'

amount_spent comes from the same delivery model as Insights. POST /act_{id} changes name and spend_cap (up to 10 cap changes per day, then 17/1885172).

Create an account

bash
curl -s "https://meta-ads.mimicr.dev/v27.0/842989790016191/adaccount" \
  -H 'Authorization: Bearer <token>' \
  -F name='Loja Centro' -F currency=BRL -F timezone_id=25 \
  -F end_advertiser=NONE -F media_agency=NONE -F partner=NONE
json
{ "id": "act_100539998049711", "account_id": "100539998049711", "business_id": "842989790016191", "end_advertiser_id": "NONE", "media_agency_id": "NONE", "partner_id": "NONE" }

Requires business_management and ads_management. In Mimicr, the Business Manager accepts up to maxAdAccounts owned accounts (default 5, counting the two initial ones); after that, or with [limite-contas] in the name, the response is 3979. An invalid currency answers 2607. The new account already has a payment method, unless you turn on requirePaymentMethod.

Pages

bash
curl --url 'https://meta-ads.mimicr.dev/v27.0/me/accounts?fields=id,name,picture{url},access_token,tasks&limit=100' \
  --header 'Authorization: Bearer <token>'

Each Page comes with a Page access_token. Store it: lead forms, test leads and installing the app on the Page (subscribed_apps) require the Page access token, and without it the response is (#210) A page access token is required. Page access tokens derived from a long-lived user token don't expire.

To find out whether a Page can have click-to-WhatsApp ads:

bash
curl --url 'https://meta-ads.mimicr.dev/v27.0/100539998049709?fields=id,name,whatsapp_number,has_whatsapp_number' \
  --header 'Authorization: Bearer <token>'

In Mimicr, the first Page gets the number of the linked WhatsApp sandbox (see Click-to-WhatsApp). The second never has WhatsApp, which is useful for testing error 2446880.