Aiven Client Library

4.13.0 · active · verified Thu Apr 16

The aiven-client library provides both a command-line client (`avn`) and a Python API for interacting with Aiven.io services. It's actively maintained with frequent minor releases, currently at version 4.13.0, introducing new features and deprecating older ones regularly.

Common errors

Warnings

Install

Imports

Quickstart

Initialize the AivenClient using an API token from an environment variable and list your Aiven projects.

import os
from aiven.client import AivenClient

aiven_api_token = os.environ.get("AIVEN_TOKEN", "")

if not aiven_api_token:
    print("Please set the AIVEN_TOKEN environment variable with your Aiven API token.")
else:
    try:
        client = AivenClient(auth_token=aiven_api_token)
        projects = client.get_projects()
        print(f"Successfully connected to Aiven. Found {len(projects)} projects:")
        for project in projects:
            print(f"  - {project['project_name']}")
    except Exception as e:
        print(f"Error connecting or listing projects: {e}")

view raw JSON →