Partner API

The Partner API client provides access to distributor operations for managing sub-organizations in Exoscale.

Basic Usage

Creating a client

from exoscale.api.partner import Client

# Create client with API credentials
client = Client(
    key="EXO...",
    secret="..."
)

Managing Organizations

# List all distributor organizations
result = client.list_distributor_organizations()
for org in result['organizations']:
    print(f"{org['name']} - {org['id']}")

# Create a new organization
new_org = client.create_distributor_organization(
    organization={
        "name": "Customer Corp",
        "address": "123 Business Ave",
        "city": "Zurich",
        "postcode": "8001",
        "country": "CH",
        "owner-email": "admin@customer.com",
        "client-id": "internal-1234"  # Optional
    }
)

# Activate/Suspend organizations
client.activate_distributor_organization(id=org_id)
client.suspend_distributor_organization(id=org_id)

# Get usage information
usage = client.list_distributor_organization_usage(
    id=org_id,
    period="2025-01"
)

Error Handling

The Partner API client uses the same error handling as the V2 API:

from exoscale.api.exceptions import (
    ExoscaleAPIAuthException,
    ExoscaleAPIClientException,
    ExoscaleAPIServerException
)

try:
    client.get_distributor_organization(id="invalid")
except ExoscaleAPIClientException as e:
    print(f"Client error: {e}")
except ExoscaleAPIServerException as e:
    print(f"Server error: {e}")

API Reference

class exoscale.api.partner.Client(key, secret, *args, url=None, **kwargs)

Partner API client with Exoscale authentication.

This client provides access to distributor operations for managing sub-organizations. It uses the same authentication mechanism as the V2 API client.

Parameters:
  • key (str) – Exoscale API key

  • secret (str) – Exoscale API secret

  • url (str) – Override endpoint URL (optional)

  • zone (str) – Exoscale zone (optional)

Example

>>> from exoscale.api.partner import Client
>>> client = Client("EXO...", "secret")
>>> orgs = client.list_distributor_organizations()
activate_distributor_organization(*args, **kwargs)
Parameters:

id (str)

Returns:

dict: An Organization. A dictionnary with the following keys:

  • address (str): Organization Address.

  • city (str): Organization City.

  • client_id (str): Organization Client ID.

  • country (str): Organization Country. Format: ISO 3166-1 alpha-2.

  • id (str): Organization ID.

  • name (str): Organization Name.

  • owner_email (str): Email Address of the first Owner.

  • postcode (str): Organization Post Code.

  • status (str): Organization Status. Values are 'suspended', 'active', 'terminated'.

Return type:

200

create_distributor_organization(*args, **kwargs)
Parameters:
  • address (str) – Organization Address.

  • city (str) – Organization City.

  • client_id (str) – Organization Client ID.

  • country (str) – Organization Country. Format: ISO 3166-1 alpha-2.

  • id (str) – Organization ID.

  • name (str) – Organization Name.

  • owner_email (str) – Email Address of the first Owner.

  • postcode (str) – Organization Post Code.

  • status (str) – Organization Status. Must be one of 'suspended', 'active', 'terminated'.

Returns:

dict: An Organization. A dictionnary with the following keys:

  • address (str): Organization Address.

  • city (str): Organization City.

  • client_id (str): Organization Client ID.

  • country (str): Organization Country. Format: ISO 3166-1 alpha-2.

  • id (str): Organization ID.

  • name (str): Organization Name.

  • owner_email (str): Email Address of the first Owner.

  • postcode (str): Organization Post Code.

  • status (str): Organization Status. Values are 'suspended', 'active', 'terminated'.

Return type:

200

get_distributor_organization(*args, **kwargs)
Parameters:

id (str)

Returns:

dict: An Organization. A dictionnary with the following keys:

  • address (str): Organization Address.

  • city (str): Organization City.

  • client_id (str): Organization Client ID.

  • country (str): Organization Country. Format: ISO 3166-1 alpha-2.

  • id (str): Organization ID.

  • name (str): Organization Name.

  • owner_email (str): Email Address of the first Owner.

  • postcode (str): Organization Post Code.

  • status (str): Organization Status. Values are 'suspended', 'active', 'terminated'.

Return type:

200

list_distributor_organization_usage(*args, **kwargs)
Parameters:
  • id (str)

  • period (str)

Returns:

list

Return type:

200

list_distributor_organizations(*args, **kwargs)

Args:

Returns:

dict

Return type:

200

metering_transaction(*args, **kwargs)

Apply metering transaction

Parameters:
  • organization (str) – Target Org.

  • usage (list) – Usage data.

Returns:

dict

Return type:

204

schedule_purge_distributor_organization(*args, **kwargs)
Parameters:

id (str)

Returns:

dict 202: dict

Return type:

200

suspend_distributor_organization(*args, **kwargs)
Parameters:

id (str)

Returns:

dict: An Organization. A dictionnary with the following keys:

  • address (str): Organization Address.

  • city (str): Organization City.

  • client_id (str): Organization Client ID.

  • country (str): Organization Country. Format: ISO 3166-1 alpha-2.

  • id (str): Organization ID.

  • name (str): Organization Name.

  • owner_email (str): Email Address of the first Owner.

  • postcode (str): Organization Post Code.

  • status (str): Organization Status. Values are 'suspended', 'active', 'terminated'.

Return type:

200

terminate_distributor_organization(*args, **kwargs)
Parameters:

id (str)

Returns:

dict

Return type:

200