Skip to content

Commit 9f92783

Browse files
authored
Document how to use Pro API keys to access tghe Pro workspace API (#4066)
1 parent 240fb64 commit 9f92783

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

docs/book/getting-started/zenml-pro/service-accounts.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,33 @@ zenml login <your-workspace-name> --api-key
291291
# You will be prompted to enter your API key
292292
```
293293

294+
* for programmatic access:
295+
* the ZenML Pro API key needs first to be exchanged for a control plane API access token, as covered [in the previous section](./service-accounts.md#zenml-pro-api-programmatic-access):
296+
297+
```bash
298+
curl -X 'POST' \
299+
'https://cloudapi.zenml.io/auth/login' \
300+
-H 'Content-Type: application/x-www-form-urlencoded' \
301+
-d 'password=ZENPROKEY_eyJpZCI6I...'
302+
{"access_token":"eyJhbGciOiJIUzI1...","expires_in":3600,"token_type":"bearer","device_id":null,"device_metadata":null}
303+
```
304+
305+
* then this token can be exchanged for a workspace API access token:
306+
307+
```bash
308+
curl -X 'POST' \
309+
'https://1ca28d37-zenml.cloudinfra.zenml.io/api/v1/login' \
310+
-H "Authorization: Bearer eyJhbGciOiJIUzI1..."
311+
{"access_token":"iIsInR5cCI6Ik...","expires_in":3600,"token_type":"bearer","device_id":null,"device_metadata":null}
312+
```
313+
314+
* finally, the workspace API access token can be used to make calls to the workspace API:
315+
```bash
316+
curl -H "Authorization: Bearer iIsInR5cCI6Ik..." https://1ca28d37-zenml.cloudinfra.zenml.io/api/v1/current-user
317+
318+
{"body":{"created":"2025-10-16T15:08:11","updated":"2025-10-16T18:06:29","active":true,"activation_token":null,"full_name":"John","email_opted_in":false,"is_service_account":true,"is_admin":false,"default_project_id":null,"avatar_url":null},"metadata":{"email":null,"external_user_id":"d6ace281-5d7e-46db-9a11-d4452ece48ee","user_metadata":{}},"resources":null,"id":"667990c8-199b-45e7-98cd-4b30356ba5e7","permission_denied":false,"name":"john"}
319+
```
320+
294321
## Migration of workspace level service accounts
295322

296323
Service accounts and API keys at the workspace level are deprecated and will be removed in the future. You can migrate them to the organization level by following these steps:

0 commit comments

Comments
 (0)