Accessing the ZenML Pro API
Learn how to use the ZenML Pro API.
ZenML Pro offers a powerful API that allows you to interact with your ZenML resources. Whether you're using the SaaS version or a self-hosted ZenML Pro instance, you can leverage this API to manage tenants, organizations, users, roles, and more.
The SaaS version of ZenML Pro API is hosted at https://cloudapi.zenml.io.
API Overview
The ZenML Pro API is a RESTful API that follows OpenAPI 3.1.0 specifications. It provides endpoints for various resources and operations, including:
Tenant management
Organization management
User management
Role-based access control (RBAC)
Authentication and authorization
Authentication
To use the ZenML Pro API, you need to authenticate your requests. If you are logged in to your ZenML Pro account, you can use the same browser window to authenticate requests to your ZenML Pro API, directly in the OpenAPI docs.
For example, for the SaaS variant, you can access the docs here: https://cloudapi.zenml.io. You can make requests by being logged into ZenML Pro at https://cloud.zenml.io.
Programmatic access with API tokens
API tokens provide a way to authenticate with the ZenML Pro API for temporary automation tasks. These tokens are scoped to your user account and are valid for 1 hour by default. You can use the generated API tokens for programmatic access to the ZenML Pro REST API.
To generate a new API token for the ZenML Pro API:
Navigate to the organization settings page in your ZenML Pro dashboard
Select "API Tokens" from the left sidebar
Click the "Create new token" button. Once generated, you'll see a dialog showing your new API token.
Simply use the API token as the bearer token in your HTTP requests. For example, you can use the following command to check your current user:
using curl:
using wget:
using python:
Important Notes
API tokens expire after 1 hour and cannot be retrieved after initial generation
Tokens are scoped to your user account and inherit your permissions
Tenant programmatic access
Programmatic access to the ZenML Pro tenant API is achieved essentially the same way as the ZenML OSS server API. You can use one of these two methods:
Please consult the indicated sections for more information.
Key API Endpoints
Here are some important endpoints you can use with the ZenML Pro API:
Tenant Management
List tenants:
GET /tenants
Create a tenant:
POST /tenants
Get tenant details:
GET /tenants/{tenant_id}
Update a tenant:
PATCH /tenants/{tenant_id}
Organization Management
List organizations:
GET /organizations
Create an organization:
POST /organizations
Get organization details:
GET /organizations/{organization_id}
Update an organization:
PATCH /organizations/{organization_id}
User Management
List users:
GET /users
Get current user:
GET /users/me
Update user:
PATCH /users/{user_id}
Role-Based Access Control
Create a role:
POST /roles
Assign a role:
POST /roles/{role_id}/assignments
Check permissions:
GET /permissions
Error Handling
The API uses standard HTTP status codes to indicate the success or failure of requests. In case of errors, the response body will contain more details about the error, including a message and sometimes additional information.
Rate Limiting
Be aware that the ZenML Pro API may have rate limiting in place to ensure fair usage. If you exceed the rate limit, you may receive a 429 (Too Many Requests) status code. Implement appropriate backoff and retry logic in your applications to handle this scenario.
Remember to refer to the complete API documentation available at https://cloudapi.zenml.io for detailed information about all available endpoints, request/response schemas, and additional features.
Last updated
Was this helpful?