@@ -5,42 +5,42 @@ OpenAPI spec. A handwritten runtime in `src/cli.ts` maps flags to HTTP requests.
55
66## Authentication
77
8- Authenticate via the OAuth device flow and save the result as a named profile.
9- Creating a profile is force-explicit — name it and pick its environment:
8+ Authenticate via the OAuth device flow and save the result as a profile. Omit
9+ ` --profile ` and the CLI targets ` default ` — the implicit profile used when you
10+ don't name one. Picking a region stays explicit:
1011
1112``` bash
12- amp auth login --profile prod --env prod
13+ amp auth login --region us
1314```
1415
15- That runs the device flow against the chosen environment 's Developer API, saves
16+ That runs the device flow against the chosen region 's Developer API, saves
1617the token to ` ~/.amplitude/amp/credentials.json ` (0600), and activates the
17- profile. A
18- profile binds a credential to an environment (` base_url ` ), so a staging token
19- can never be sent to prod.
18+ profile. A profile binds a credential to a region (` base_url ` ), so an EU
19+ token can never be sent to prod.
2020
2121``` bash
22- amp auth login --profile staging --env staging # activates staging
22+ amp auth login --profile eu --region eu # activates the EU profile
2323amp auth use prod # switch (no re-auth)
2424amp auth list # * marks the active profile
2525amp auth status # type, base URL, expiry
26- amp logout --profile staging # remove one
26+ amp logout --profile eu # remove one
2727amp logout --all # remove every profile
2828```
2929
30- A bare ` amp auth login ` re-authenticates the active profile in place (env from
31- its record). ` --env ` maps ` local|dev|staging|prod|prod-eu ` to a base URL; pass
32- ` --base-url <url> ` instead to target an arbitrary host.
30+ A bare ` amp auth login ` re-authenticates the active profile in place (region
31+ from its record). ` --region ` maps ` us|eu ` to a base URL.
3332
3433To use a Personal Access Token instead of the device flow:
3534
3635``` bash
37- echo " $PAT " | amp auth pat --with-token --profile ci --env prod # stdin
38- amp auth pat --with-token --profile ci --env prod # masked prompt at a TTY
36+ echo " $PAT " | amp auth pat --with-token --region us # stdin → "default" profile
37+ amp auth pat --with-token --profile ci --region us # name it; masked prompt at a TTY
3938```
4039
41- ` --with-token ` reads the PAT from stdin when piped (the agent / CI path) or a
42- masked prompt at a terminal (the human path). Same force-explicit create rule
43- and store as ` login ` ; the credential is saved as ` { "type": "pat" } ` .
40+ ` --with-token ` reads the PAT from stdin when piped, or from a masked prompt at a
41+ terminal. Same rules as ` login ` : ` --profile `
42+ is optional (defaults to ` default ` ) and ` --region ` is required to create a
43+ profile; the credential is saved as ` { "type": "pat" } ` .
4444
4545` --with-token ` is mandatory: it makes the supply-an-existing-PAT path explicit
4646and keeps the bare ` amp auth pat ` verb reserved.
@@ -54,7 +54,7 @@ profile; `amp auth status` announces when it is in effect.
5454
5555``` bash
5656export AMP_TOKEN=amp_... # one-off / CI; overrides stored profiles
57- export AMP_PROFILE=staging # select a stored profile by name
57+ export AMP_PROFILE=eu # select a stored profile by name
5858```
5959
6060Accepted forms for ` --token ` / ` AMP_TOKEN ` :
@@ -78,15 +78,27 @@ scopes below document what each command needs.
7878| ` context ` , ` projects list ` | ` read:projects ` |
7979| ` events * ` | ` read:taxonomy ` , ` write:taxonomy ` |
8080| ` flags * ` | ` read:flags ` , ` write:flags ` |
81+ | ` charts * ` | ` read:analytics ` |
8182
8283Route-level scopes are defined on each OpenAPI operation (` x-required-scopes ` ).
8384
85+ When adding new CLI scopes, ensure the OAuth client used for ` amp auth login `
86+ allows those scopes before default login requests them. This requires an
87+ out-of-band update on Amplitude's side — contact Amplitude if your integration
88+ needs additional scopes.
89+
90+ ## Developer API usage (server-side)
91+
92+ Authenticated requests to the Developer API (` amp projects list ` , `amp flags
93+ create`, and other API commands) are measured and logged ** server-side** as
94+ part of operating the service — route, HTTP status, your account/org, and client
95+ version (` User-Agent ` ).
96+
8497## Global flags
8598
8699| Flag / env | Purpose |
87100| --------------------------------------- | ------------------------------------------ |
88- | ` --base-url ` / ` AMP_API_BASE_URL ` | API host (default: prod) |
89- | ` --env <env> ` | Friendly env name → base URL |
101+ | ` --region <us\|eu> ` | Data region name → base URL |
90102| ` --profile <name> ` / ` AMP_PROFILE ` | Select a stored profile |
91103| ` --token ` / ` AMP_TOKEN ` / saved profile | Auth token |
92104| ` --json ` | Force raw JSON output (default when piped) |
@@ -97,7 +109,7 @@ Route-level scopes are defined on each OpenAPI operation (`x-required-scopes`).
97109## Help and output
98110
99111``` bash
100- amp help # product surfaces (context, projects, events, flags, …)
112+ amp help # product surfaces (context, projects, events, flags, charts, …)
101113amp help flags # commands within a surface
102114amp flags list --help # flags and examples for one command
103115amp version
@@ -125,19 +137,12 @@ Manual checklist:
1251373 . ** Projects** — ` amp projects list `
1261384 . ** Flags read** — ` amp flags list --project <id> --limit 5 `
1271395 . ** Flags write** — create → get → update description → archive dry-run → archive
128- 6 . ** Events** — list → create → update → (optional delete with ` --yes ` )
140+ 6 . ** Charts read** — ` amp charts list --project <id> --limit 5 `
141+ 7 . ** Events** — list → create → update → (optional delete with ` --yes ` )
129142
130143Known issue: ` flags update --enabled false ` fails for deployment-less flags.
131144Avoid that path in smoke tests until it is fixed.
132145
133- ## Local server
134-
135- Point at a running local server:
136-
137- ``` bash
138- amp --base-url http://localhost:3036 context
139- ```
140-
141146## Generated files
142147
143148Do not edit by hand:
0 commit comments