appstore account can also hold an Apple Search Ads API key. The private key stays in your config, next to the App Store Connect key, and appstore search-ads call sends any Campaign Management API (v5) request with it. Appeeky Spec reads Search Ads through the same account.
Create the API user
- In Apple Search Ads, invite a user with an API role (for example API Account Read Only) under Account Settings → User Management.
- Sign in as that user and open Account Settings → API.
-
Make an EC key pair and upload the public key:
- Apple shows a client id, team id and key id. Keep the private key file outside the repo.
Save it on an account
accounts list shows which accounts have Search Ads. The config keeps the path, not the key:
accounts add:
Environment variables
Without a saved account (in CI, for example):
As with the
ASC_* variables, the environment wins over the default account. --account always uses that account’s key. ASA_ORG_ID fills in the org when the account has none.
Calls
- The CLI gets an access token and adds
X-AP-Context: orgId=…./api/v5/aclsis sent without it. - The org comes from
--org-id, then the account (orASA_ORG_ID), then the only org the key reaches. With several orgs and none set, the command fails and lists them. - Reports and
…/findqueries are reads. OtherPOST,PUTandDELETEcalls need--confirm;--read-onlyblocks them. - On success, stdout is Apple’s JSON body, for example
{"data": [...], "pagination": {...}, "error": null}.
Errors
On failure the exit code is 1 and stderr has one line, for exampleApple Search Ads 400: endTime is invalid (field: endTime) on POST /api/v5/reports/campaigns. With --json, stdout also gets:
code AUTH_ERROR or VALIDATION_ERROR and no status.
