๐Ÿ‘€API reference

See the ZenML API reference.

The ZenML server is a FastAPI application, therefore the OpenAPI-compliant docs are available at /docs or /redoc of your ZenML server:

In the local case (i.e. using zenml up, the docs are available on

Using a bearer token to access the API programmatically

If you are using the ZenML server API using the above pages, it is enough to be logged in to your ZenML account in the same browser session. However, in order to do this programmatically, the following steps need to be followed:

  1. Create a service account:

zenml service-account create myserviceaccount

This will print out the <ZENML_API_KEY>, you can use in the next command.

  1. Get an access token by using the /api/v1/login endpoint:

curl -X 'POST' \
  '<YOUR_ZENML_SERVER_URL>/api/v1/login' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=zenml-api-key&username=&password=<ZENML_API_KEY>'\''&client_id=&device_code='

This will return a response like this:

  "token_type": "bearer",
  "expires_in": 3600,
  "refresh_token": null,
  "scope": null
  1. Use the access token to make subsequent curl commands:

curl -X 'GET' \
  '<YOUR_ZENML_SERVER_URL>/api/v1/pipelines?hydrate=false&name=training&version=45' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <ACCESS_TOKEN>'

Last updated