@krunal202/apple-search-ads-cli 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CREDENTIALS.md +63 -0
- package/LLM_GUIDE.md +2 -0
- package/README.md +3 -2
- package/package.json +3 -2
package/CREDENTIALS.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Getting Apple Search Ads API Credentials
|
|
2
|
+
|
|
3
|
+
This takes about 5 minutes in the Apple Search Ads web UI. At the end you will have the four values `asa login` needs:
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
asa login --client-id <SEARCHADS.xxxx> --team-id <id> --key-id <id> --key-file ./asa-private-key.p8
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## 1. Invite an API user
|
|
10
|
+
|
|
11
|
+
API credentials are only available to users with an **API role** — a plain Account Admin does not see the create option.
|
|
12
|
+
|
|
13
|
+
1. Sign in to [searchads.apple.com](https://searchads.apple.com)
|
|
14
|
+
2. Go to **Account Settings → User Management**
|
|
15
|
+
3. **Invite a user** — this can be your own email address
|
|
16
|
+
4. Assign the role **API Account Manager** (read + write) or **API Account Read Only** (reporting only)
|
|
17
|
+
5. Accept the invitation email and sign back in
|
|
18
|
+
|
|
19
|
+
If your account belongs to multiple organizations, switch to the correct org using the selector in the top bar before continuing.
|
|
20
|
+
|
|
21
|
+
## 2. Generate a key pair (private key never leaves your machine)
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
openssl ecparam -genkey -name prime256v1 -noout -out asa-private-key.p8
|
|
25
|
+
openssl ec -in asa-private-key.p8 -pubout -out asa-public-key.pem
|
|
26
|
+
chmod 600 asa-private-key.p8
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or just ask your LLM agent: *"generate an ES256 (prime256v1) key pair for Apple Search Ads"* — it runs the same two commands. The private key (`asa-private-key.p8`) stays on your machine; only the **public** key (`asa-public-key.pem`) is uploaded to Apple. Never commit the `.p8` file to git.
|
|
30
|
+
|
|
31
|
+
## 3. Create the API credentials and upload the public key
|
|
32
|
+
|
|
33
|
+
1. Go to **Account Settings → API**
|
|
34
|
+
2. Click **Create API Certificate / credentials**
|
|
35
|
+
3. Upload `asa-public-key.pem`
|
|
36
|
+
4. Apple shows three values — copy them:
|
|
37
|
+
|
|
38
|
+
| Value | Looks like |
|
|
39
|
+
|---|---|
|
|
40
|
+
| Client ID | `SEARCHADS.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` |
|
|
41
|
+
| Team ID | same format (often identical to the client ID) |
|
|
42
|
+
| Key ID | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` |
|
|
43
|
+
|
|
44
|
+
> The **Manage API Access** list on that page (Adapty, Branch, etc.) shows third-party providers you granted access to — those are not your credentials.
|
|
45
|
+
|
|
46
|
+
## 4. Log in
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
asa login \
|
|
50
|
+
--client-id SEARCHADS.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
|
|
51
|
+
--team-id SEARCHADS.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
|
|
52
|
+
--key-id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
|
|
53
|
+
--key-file ./asa-private-key.p8
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`asa` verifies the credentials immediately, lists your orgs, and caches the OAuth token. Run `asa whoami` any time to confirm.
|
|
57
|
+
|
|
58
|
+
## Troubleshooting
|
|
59
|
+
|
|
60
|
+
- **`invalid_client` on login** — you are using App Store Connect credentials (Issuer ID + `AuthKey_XXXX.p8`). Those belong to a different system. Create credentials in the **Apple Search Ads** UI as above.
|
|
61
|
+
- **No create option on the API tab** — your user lacks an API role. Go back to step 1.
|
|
62
|
+
- **Lost the private key** — generate a new pair (step 2) and replace the public key on the API tab, or revoke and recreate the credentials. Apple never sees or stores your private key.
|
|
63
|
+
- **HTTP 403 after login** — wrong org selected: `asa orgs list` then `asa orgs use <orgId>`.
|
package/LLM_GUIDE.md
CHANGED
|
@@ -46,6 +46,8 @@ Every mutating API call (create/update/delete/paste) is logged automatically wit
|
|
|
46
46
|
|
|
47
47
|
Create credentials in **Apple Search Ads UI → Account Settings → API**. This requires a user with an **API role** (API Account Manager for read/write) — plain Account Admin does not see the create option. Invite yourself via the User Management tab if needed. Apple issues a client ID (`SEARCHADS.…`), team ID, key ID, and you upload your own ES256 (prime256v1) public key; keep the matching `.p8` private key.
|
|
48
48
|
|
|
49
|
+
Full step-by-step walkthrough: [CREDENTIALS.md](CREDENTIALS.md).
|
|
50
|
+
|
|
49
51
|
Note: App Store Connect keys (Issuer ID + `AuthKey_XXXX.p8`) are a different system and return `invalid_client` for this API.
|
|
50
52
|
|
|
51
53
|
## Global options
|
package/README.md
CHANGED
|
@@ -20,8 +20,9 @@ Requires Node.js ≥ 18. Single runtime dependency: `commander`.
|
|
|
20
20
|
## Quickstart
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
# 1. Get API credentials
|
|
24
|
-
|
|
23
|
+
# 1. Get API credentials — full walkthrough: CREDENTIALS.md
|
|
24
|
+
# (Apple Search Ads UI → invite an API-role user → upload a public key)
|
|
25
|
+
asa login --client-id <id> --team-id <id> --key-id <id> --key-file ./asa-private-key.p8
|
|
25
26
|
|
|
26
27
|
asa orgs list && asa orgs use <orgId>
|
|
27
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krunal202/apple-search-ads-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "LLM-friendly CLI for the Apple Search Ads API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"bin",
|
|
14
14
|
"src",
|
|
15
|
-
"LLM_GUIDE.md"
|
|
15
|
+
"LLM_GUIDE.md",
|
|
16
|
+
"CREDENTIALS.md"
|
|
16
17
|
],
|
|
17
18
|
"scripts": {
|
|
18
19
|
"test": "node --test"
|