> ## Documentation Index
> Fetch the complete documentation index at: https://help.cryptolens.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Python 3: Customer

> Create customers and retrieve their associated licenses.

Python 3 package `licensing 0.54`. [Reviewed source revision](https://github.com/Cryptolens/cryptolens-python/tree/8f38b5a37580f2aba1c9374f581cdc85e251950f).

```python theme={null}
from licensing.methods import Customer
```

<a id="licensing.methods.Customer.add_customer" />

## add\_customer

Create a customer record.

```python theme={null}
Customer.add_customer(
    token,
    name='',
    email='',
    company_name='',
    enable_customer_association=False,
    allow_activation_management=False
)
```

### Parameters

| Parameter | Default | Meaning |
| - | - | - |
| `token` | Required | Your access token. It needs the permission required by the linked Web API method. |
| `name` | `''` | The customer name. |
| `email` | `''` | The customer's or user's email address. |
| `company_name` | `''` | The customer's company name. |
| `enable_customer_association` | `False` | Allow the customer to associate licenses through the customer portal. |
| `allow_activation_management` | `False` | Allow the customer to manage activations through the customer portal. |

### Result

Returns `(response_dict, '')`, including the API's customer fields.

Returns `(None, message)` for API rejection or a handled request failure. Malformed response data can raise an exception.

### Checks

The API checks the access token's permissions. This method does not verify a signed license response.

[Web API reference](/api-reference/generated/AddCustomer).

<a id="licensing.methods.Customer.get_customer_licenses" />

## get\_customer\_licenses

Retrieve licenses belonging to a customer ID.

```python theme={null}
Customer.get_customer_licenses(token, customer_id, detailed=False, metadata=False)
```

### Parameters

| Parameter | Default | Meaning |
| - | - | - |
| `token` | Required | Your access token. It needs the permission required by the linked Web API method. |
| `customer_id` | Required | The numeric customer ID; see the method reference for the meaning of `0`. |
| `detailed` | `False` | Request detailed license information from the API. |
| `metadata` | `False` | Whether to request metadata. See the result description for how this method returns it. |

### Result

Returns `(response_dict, '')`. The full response dictionary is returned, not just its list of licenses.

Returns `(None, message)` for API rejection or a handled request failure. Malformed response data can raise an exception.

### Checks

The API checks the access token's permissions. This method does not verify a signed license response.

[Web API reference](/api-reference/generated/GetCustomerLicenses).

<a id="licensing.methods.Customer.get_customer_licenses_by_secret" />

## get\_customer\_licenses\_by\_secret

Retrieve licenses using a customer secret you already have.

```python theme={null}
Customer.get_customer_licenses_by_secret(token, secret, detailed=False, metadata=False)
```

### Parameters

| Parameter | Default | Meaning |
| - | - | - |
| `token` | Required | Your access token. It needs the permission required by the linked Web API method. |
| `secret` | Required | The customer's existing secret. Treat it as a private credential. |
| `detailed` | `False` | Request detailed license information from the API. |
| `metadata` | `False` | Whether to request metadata. See the result description for how this method returns it. |

### Result

Returns `(response_dict, '')`. The full response dictionary is returned, not just its list of licenses.

Returns `(None, message)` for API rejection or a handled request failure. Malformed response data can raise an exception.

### Checks

The API checks the access token's permissions. This method does not verify a signed license response.

[Web API reference](/api-reference/generated/GetCustomerLicenses).

## FAQ

<AccordionGroup>
  <Accordion title="How Do I Retrieve an Existing Customer Secret?" id="how-do-i-retrieve-an-existing-customer-secret">
    Use the [GetCustomers Web API](/api-reference/generated/GetCustomers) with the **GetCustomers permission**, the customer's ID and `ModelVersion=2` or `3`. This Python SDK does not provide a `get_customers` wrapper. `get_customer_licenses_by_secret` uses an existing secret; it does not retrieve the secret.
  </Accordion>
</AccordionGroup>

[Python SDK Reference](/libraries/python-api)
