> ## 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.

# Get Customers

> This method returns the list of customers. Use ModelVersion=2 or ModelVersion=3 to include each customer's secret. By default, it preserves the legacy ordering. If SortByCreatedDescending=true, the newest customers...

Assumed ModelVersion: 3 (highest documented version at generation time)

This method returns the list of customers. Use `ModelVersion=2` or `ModelVersion=3` to include each customer's secret. By default, it preserves the legacy ordering. If `SortByCreatedDescending=true`, the newest customers will be shown first.

This method is accessed by [https://api.cryptolens.io/api/customer/GetCustomers](https://api.cryptolens.io/api/customer/GetCustomers)

### Parameters

| **Parameter** | **Description** | **Remarks** |
| - | - | - |
| Search | By default, if either the Name, Company, Email or the Secret matches the search string, it will be returned. If `IncludeIdInSearch=true`, then a numeric Search value can also match the customer Id. | optional |
| IncludeIdInSearch | When set to `true`, a numeric Search value can also match the customer Id. By default, this is `false` to preserve the existing Search behavior. | optional. default is false. |
| CustomerId | If this is set, you can use the CustomerId field to find a specific customer based on their integer Id. This remains a dedicated exact-Id filter and is independent from the opt-in Search behavior above. | optional |
| Limit | Specifies how many customers will be returned. If not set, all customers will be returned. | optional. disabled by default. |
| SortByCreatedDescending | When set to `true`, customers are ordered by creation date descending, with newer customers returned first. By default, this is `false` to preserve the existing paging and ordering behavior. | optional. default is false. |
| ModelVersion | The model that will be returned. In comparison to method version, this only affects what fields and information will be returned and does not impact the way the method works. A changelog can be found in the [end of this page](/api-reference/generated/GetCustomers#model-versions). | optional. by default, it's 1. |
| v | Method version. | optional. by default, it's 1. |

### Results

| **Parameter** | **Description** | **Remarks** |
| - | - | - |
| Customers | A list of [Customer](/api-reference/generated/model/Customer) objects. | always returned |
| ResellerCustomers | A list of [Customer](/api-reference/generated/model/Customer) objects. These customers belong to a different user but you can still edit some of the fields. | always returned |
| VisibleCustomers | A list of [Customer](/api-reference/generated/model/Customer) objects. These customers belong to a different user but you can still view them. | always returned |
| Result | This is either **0**(=success) or **1**(=error). | always returned |
| Message | The message that provides additional information about the result. | always returned. |

### Example results

The following example uses `ModelVersion=1`, which does not include the customer secret.

```text theme={null}
{"customers":[{"id":1234,"name":"Bob","email":"bob@example.com","companyName":"SKM","created":"2015-09-04T16:11:14.453"}],"result":0,"message":null}
```

### Errors

| **Error** |
| - |
| Access denied. |

### Model Versions

This changelog list changes of the returned fields given the model version.

3. Version 3 adds `Notes` to the version 2 customer fields, including `Secret`.
4. Version 2 includes `Secret` and returns the same [customer fields](/api-reference/generated/model/Customer) in all three customer lists.
5. Version 1 is the original model and the default. It does not include `Secret`.

### FAQ

#### Can I retrieve a customer secret through the API?

Yes. Call `GetCustomers` with `ModelVersion=2` and the exact `CustomerId`.
Use an access token with the `GetCustomers` permission. The token's account must have access to that customer.
The default version 1 omits `Secret`; versions 2 and 3 include it.

This POST example retrieves an existing customer's secret. Replace `YOUR_GETCUSTOMERS_ACCESS_TOKEN` with your token
and `YOUR_CUSTOMER_ID` with the customer's integer ID. Run this administrative request from your backend.
The customer filter selects the response; it does not restrict the token's permissions.

```text theme={null}
curl -X POST https://api.cryptolens.io/api/customer/GetCustomers \
  --data-urlencode "token=YOUR_GETCUSTOMERS_ACCESS_TOKEN" \
  --data-urlencode "CustomerId=YOUR_CUSTOMER_ID" \
  --data-urlencode "ModelVersion=2"
```

Abbreviated version 2 response for an owned customer; `1234` is an example ID and the secret is a placeholder:

```text theme={null}
{
  "customers": [{ "id": 1234, "secret": "CUSTOMER_SECRET_PLACEHOLDER" }],
  "result": 0,
  "message": null
}
```

Check `result` and find the matching customer before reading `secret`.
An owned customer appears in `customers`; reseller or shared customers can appear in
`resellerCustomers` or `visibleCustomers` instead. An empty result does not establish that the API cannot return secrets.
The `CustomerId` filter is an exact match; the `Search` parameter is a broader search.

To use a secret you already have to retrieve that customer's licenses, call
[GetCustomerLicensesBySecret](/api-reference/generated/GetCustomerLicenses) with its separate
`GetCustomerLicensesBySecret` permission. That operation does not retrieve the secret itself.
