Skip to main content
The signup and async_signup functions allow you to create new Avala accounts programmatically without requiring an existing API key.

signup

Create a new Avala account synchronously.
from avala import signup

response = signup(
    email="[email protected]",
    password="secure-password",
    first_name="Jane",
    last_name="Doe"
)

print(f"Account created: {response.user.email}")
print(f"API key: {response.api_key}")
email
str
required
The user’s email address
password
str
required
The desired password for the account
first_name
str
User’s first name
last_name
str
User’s last name
base_url
str
Override the API base URL. Defaults to https://api.avala.ai/api/v1 or the AVALA_BASE_URL environment variable
timeout
float
Request timeout in seconds (default: 30.0)

Response

Returns a SignupResponse object with the following fields:
user
User
The created user object
user.uid
str
Unique identifier for the user
user.email
str
User’s email address
user.first_name
str
User’s first name
user.last_name
str
User’s last name
api_key
str
The API key for the newly created account

Example

from avala import signup, Client

# Create a new account
response = signup(
    email="[email protected]",
    password="MySecurePassword123!",
    first_name="John",
    last_name="Smith"
)

# Use the returned API key to create a client
client = Client(api_key=response.api_key)

# Now you can use the client
datasets = client.datasets.list()
print(f"User {response.user.email} has {len(datasets.items)} datasets")

async_signup

Asynchronous version of the signup function.
from avala import async_signup

async def create_account():
    response = await async_signup(
        email="[email protected]",
        password="secure-password",
        first_name="Jane",
        last_name="Doe"
    )
    return response

# In an async context
response = await create_account()
print(f"API key: {response.api_key}")
email
str
required
The user’s email address
password
str
required
The desired password for the account
first_name
str
User’s first name
last_name
str
User’s last name
base_url
str
Override the API base URL
timeout
float
Request timeout in seconds (default: 30.0)

Response

Returns a SignupResponse object with the same structure as the synchronous version.

Example with AsyncClient

from avala import async_signup, AsyncClient

async def setup_new_user():
    # Create account
    response = await async_signup(
        email="[email protected]",
        password="SecurePass456!",
        first_name="Alice",
        last_name="Johnson"
    )
    
    # Use the API key with AsyncClient
    async with AsyncClient(api_key=response.api_key) as client:
        datasets = await client.datasets.list()
        print(f"Account created with {len(datasets.items)} datasets")
    
    return response

import asyncio
asyncio.run(setup_new_user())

Error handling

Both functions raise the same error types as the client:
from avala import signup
from avala.errors import ValidationError, AvalaError

try:
    response = signup(
        email="invalid-email",
        password="short"
    )
except ValidationError as e:
    print(f"Validation error: {e.message}")
    if e.details:
        for detail in e.details:
            print(f"  - {detail}")
except AvalaError as e:
    print(f"API error: {e.message}")
These functions do not require an existing API key, making them ideal for automated account creation workflows.
Store the returned API key securely. It will only be returned once during account creation.

Build docs developers (and LLMs) love