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(
    display_name="Customer Corp",
    billing_address={
        "name": "Customer Corp",
        "street-name": "Business Avenue",
        "building-number": "123",
        "city": "Zurich",
        "postal-code": "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: Organization representation. A dictionary with the following keys:

  • billing_address (dict): ISO 20022 Structured Billing Address.

  • client_id (str): Organization Client ID.

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

  • id (str): Organization ID.

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

Return type:

200

create_distributor_organization(*args, **kwargs)
Parameters:
  • billing_address (dict) – ISO 20022 Structured Billing Address.

  • client_id (str) – Organization Client ID.

  • display_name (str) – Organization Display Name.

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

Returns:

dict: Organization representation. A dictionary with the following keys:

  • billing_address (dict): ISO 20022 Structured Billing Address.

  • client_id (str): Organization Client ID.

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

  • id (str): Organization ID.

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

Return type:

200

get_distributor_organization(*args, **kwargs)
Parameters:

id (str)

Returns:

dict: Organization representation. A dictionary with the following keys:

  • billing_address (dict): ISO 20022 Structured Billing Address.

  • client_id (str): Organization Client ID.

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

  • id (str): Organization ID.

  • 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: Organization representation. A dictionary with the following keys:

  • billing_address (dict): ISO 20022 Structured Billing Address.

  • client_id (str): Organization Client ID.

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

  • id (str): Organization ID.

  • 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