# Customers

## List customers

> Get a paginated list of customers with optional filtering

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["customers:read"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"PaginatedResponse-CustomerReply":{"properties":{"data":{"items":{"$ref":"#/components/schemas/CustomerReply"},"type":"array"},"end_cursor":{"type":"string"},"has_next_page":{"type":"boolean"},"has_previous_page":{"type":"boolean"},"start_cursor":{"type":"string"}},"type":"object"},"CustomerReply":{"properties":{"city":{"type":"string"},"country":{"type":"string"},"created_at":{"type":"string"},"customer_integration_id":{"type":"string"},"default_payment_method_id":{"type":"string"},"ein":{"type":"string"},"email":{"type":"string"},"external_id":{"type":"string"},"id":{"type":"string"},"legal_name":{"type":"string"},"name":{"type":"string"},"postal_code":{"type":"string"},"state":{"type":"string"},"street_address":{"type":"string"},"sub_premise":{"type":"string"}},"type":"object"}}},"paths":{"/customers":{"get":{"description":"Get a paginated list of customers with optional filtering","operationId":"listCustomers","parameters":[{"schema":{"type":"integer","default":100},"description":"Number of items to return","in":"query","name":"limit"},{"schema":{"type":"string"},"description":"Specifies the cursor after which to start returning results. For the first page, this should be left empty. For subsequent pages, use the value of the end_cursor field from the previous response.","in":"query","name":"after"},{"schema":{"type":"string"},"description":"Specifies the cursor before which to return results. Use this to paginate backwards. For example, to load the previous page, provide the value of the start_cursor field from the last response.","in":"query","name":"before"},{"schema":{"type":"string"},"description":"Filter by creation date start (RFC3339 format)","in":"query","name":"created_at_start"},{"schema":{"type":"string"},"description":"Filter by creation date end (RFC3339 format)","in":"query","name":"created_at_end"},{"schema":{"type":"string"},"description":"Filter by customer name","in":"query","name":"company_name"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse-CustomerReply"}}}}},"summary":"List customers","tags":["Customers"]}}}}
```

## Create a customer

> Create a new customer with the provided information

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["customers:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"CustomerReply":{"properties":{"city":{"type":"string"},"country":{"type":"string"},"created_at":{"type":"string"},"customer_integration_id":{"type":"string"},"default_payment_method_id":{"type":"string"},"ein":{"type":"string"},"email":{"type":"string"},"external_id":{"type":"string"},"id":{"type":"string"},"legal_name":{"type":"string"},"name":{"type":"string"},"postal_code":{"type":"string"},"state":{"type":"string"},"street_address":{"type":"string"},"sub_premise":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"CreateCustomerInput":{"description":"Customer information","properties":{"city":{"type":"string"},"country":{"type":"string"},"ein":{"type":"string"},"email":{"type":"string"},"external_id":{"type":"string"},"legal_name":{"type":"string"},"name":{"type":"string"},"postal_code":{"type":"string"},"state":{"type":"string"},"street_address":{"type":"string"},"sub_premise":{"type":"string"}},"type":"object"}}},"paths":{"/customers":{"post":{"description":"Create a new customer with the provided information","operationId":"createCustomer","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerReply"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Create a customer","tags":["Customers"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCustomerInput"}}},"description":"Customer information","required":true}}}}}
```

## Get a customer

> Get customer details by ID

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["customers:read"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"CustomerReply":{"properties":{"city":{"type":"string"},"country":{"type":"string"},"created_at":{"type":"string"},"customer_integration_id":{"type":"string"},"default_payment_method_id":{"type":"string"},"ein":{"type":"string"},"email":{"type":"string"},"external_id":{"type":"string"},"id":{"type":"string"},"legal_name":{"type":"string"},"name":{"type":"string"},"postal_code":{"type":"string"},"state":{"type":"string"},"street_address":{"type":"string"},"sub_premise":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/customers/{id}":{"get":{"description":"Get customer details by ID","operationId":"getCustomer","parameters":[{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"id","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerReply"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Get a customer","tags":["Customers"]}}}}
```

## Archive a customer

> Archive a customer

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["customers:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"CustomerReply":{"properties":{"city":{"type":"string"},"country":{"type":"string"},"created_at":{"type":"string"},"customer_integration_id":{"type":"string"},"default_payment_method_id":{"type":"string"},"ein":{"type":"string"},"email":{"type":"string"},"external_id":{"type":"string"},"id":{"type":"string"},"legal_name":{"type":"string"},"name":{"type":"string"},"postal_code":{"type":"string"},"state":{"type":"string"},"street_address":{"type":"string"},"sub_premise":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/customers/{id}":{"delete":{"description":"Archive a customer","operationId":"archiveCustomer","parameters":[{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"id","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerReply"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Archive a customer","tags":["Customers"]}}}}
```

## Patch customer

> Patch customer information (company, legal name, EIN, street address, sub-premise, city, state, postal code, country)

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["customers:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"CustomerReply":{"properties":{"city":{"type":"string"},"country":{"type":"string"},"created_at":{"type":"string"},"customer_integration_id":{"type":"string"},"default_payment_method_id":{"type":"string"},"ein":{"type":"string"},"email":{"type":"string"},"external_id":{"type":"string"},"id":{"type":"string"},"legal_name":{"type":"string"},"name":{"type":"string"},"postal_code":{"type":"string"},"state":{"type":"string"},"street_address":{"type":"string"},"sub_premise":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"PatchCustomerRequest":{"description":"Request body for patching customer information","properties":{"city":{"type":"string"},"country":{"type":"string"},"ein":{"type":"string"},"legal_name":{"type":"string"},"name":{"type":"string"},"postal_code":{"type":"string"},"state":{"type":"string"},"street_address":{"type":"string"},"sub_premise":{"type":"string"}},"type":"object"}}},"paths":{"/customers/{id}":{"patch":{"description":"Patch customer information (company, legal name, EIN, street address, sub-premise, city, state, postal code, country)","operationId":"updateCustomer","parameters":[{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"id","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerReply"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Patch customer","tags":["Customers"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchCustomerRequest"}}},"description":"Customer patch information","required":true}}}}}
```

## List payment methods

> Get payment methods associated with a customer

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["customers:read"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"GetPaymentMethodsReply":{"properties":{"data":{"items":{"$ref":"#/components/schemas/PaymentMethod"},"type":"array"}},"type":"object"},"PaymentMethod":{"properties":{"brand":{"type":"string"},"created_at":{"type":"string"},"default":{"type":"boolean"},"exp_month":{"type":"string"},"exp_year":{"type":"string"},"id":{"type":"string"},"last4":{"type":"string"},"type":{"$ref":"#/components/schemas/MethodType"}},"type":"object"},"MethodType":{"enum":["card","ach"],"type":"string"}}},"paths":{"/customers/{id}/payment-methods":{"get":{"description":"Get payment methods associated with a customer","operationId":"listPaymentMethods","parameters":[{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"id","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetPaymentMethodsReply"}}}}},"summary":"List payment methods","tags":["Customers"]}}}}
```

## Get payment method by ID

> Get a specific payment method associated with a customer by payment method ID

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["customers:read"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"PaymentMethod":{"properties":{"brand":{"type":"string"},"created_at":{"type":"string"},"default":{"type":"boolean"},"exp_month":{"type":"string"},"exp_year":{"type":"string"},"id":{"type":"string"},"last4":{"type":"string"},"type":{"$ref":"#/components/schemas/MethodType"}},"type":"object"},"MethodType":{"enum":["card","ach"],"type":"string"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/customers/{id}/payment-methods/{method_id}":{"get":{"description":"Get a specific payment method associated with a customer by payment method ID","operationId":"getPaymentMethod","parameters":[{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"id","required":true},{"schema":{"type":"string"},"description":"Payment Method ID","in":"path","name":"method_id","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethod"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Get payment method by ID","tags":["Customers"]}}}}
```

## Restore a customer

> Restore a customer

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["customers:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"CustomerReply":{"properties":{"city":{"type":"string"},"country":{"type":"string"},"created_at":{"type":"string"},"customer_integration_id":{"type":"string"},"default_payment_method_id":{"type":"string"},"ein":{"type":"string"},"email":{"type":"string"},"external_id":{"type":"string"},"id":{"type":"string"},"legal_name":{"type":"string"},"name":{"type":"string"},"postal_code":{"type":"string"},"state":{"type":"string"},"street_address":{"type":"string"},"sub_premise":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"}}},"paths":{"/customers/{id}/restore":{"post":{"description":"Restore a customer","operationId":"restoreCustomer","parameters":[{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"id","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerReply"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Restore a customer","tags":["Customers"]}}}}
```

## List customer users

> Get a paginated list of users from a customer

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["customers:read"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"PaginatedResponse-CustomerUser":{"properties":{"data":{"items":{"$ref":"#/components/schemas/CustomerUser"},"type":"array"},"end_cursor":{"type":"string"},"has_next_page":{"type":"boolean"},"has_previous_page":{"type":"boolean"},"start_cursor":{"type":"string"}},"type":"object"},"CustomerUser":{"properties":{"created_at":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string"},"id":{"type":"string"},"job_title":{"type":"string"},"last_name":{"type":"string"},"phone":{"type":"string"}},"type":"object"}}},"paths":{"/customers/{id}/users":{"get":{"description":"Get a paginated list of users from a customer","operationId":"listCustomerUsers","parameters":[{"schema":{"type":"integer","default":100},"description":"Number of items to return","in":"query","name":"limit"},{"schema":{"type":"string"},"description":"Specifies the cursor after which to start returning results. For the first page, this should be left empty. For subsequent pages, use the value of the end_cursor field from the previous response.","in":"query","name":"after"},{"schema":{"type":"string"},"description":"Specifies the cursor before which to return results. Use this to paginate backwards. For example, to load the previous page, provide the value of the start_cursor field from the last response.","in":"query","name":"before"},{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"id","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse-CustomerUser"}}}}},"summary":"List customer users","tags":["Customers"]}}}}
```

## Create a customer user

> Create a new customer user with the provided information

```json
{"openapi":"3.1.1","info":{"title":"Alternative Payments","version":"1.1.0"},"servers":[{"url":"http://public-api.alternativepayments.io"}],"security":[{"OAuth2ClientCredentials":["customers:write"]}],"components":{"securitySchemes":{"OAuth2ClientCredentials":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"/oauth/token","scopes":{"read":"Read access","write":"Write access"}}}}},"schemas":{"CustomerUser":{"properties":{"created_at":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string"},"id":{"type":"string"},"job_title":{"type":"string"},"last_name":{"type":"string"},"phone":{"type":"string"}},"type":"object"},"HttpError":{"properties":{"code":{"type":"string"},"message":{"type":"string"},"validation_errors":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"CreateCustomerUserInput":{"properties":{"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"}},"type":"object"}}},"paths":{"/customers/{id}/users":{"post":{"description":"Create a new customer user with the provided information","operationId":"createCustomerUser","parameters":[{"schema":{"type":"string"},"description":"Customer ID","in":"path","name":"id","required":true}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerUser"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpError"}}}}},"summary":"Create a customer user","tags":["Customers"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCustomerUserInput"}}},"description":"Customer user information","required":true}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.alternativepayments.io/api-reference/customers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
