# `Polarex.Public`
[🔗](https://github.com/giusdp/polarex/blob/main/lib/polarex/operations/public.ex#L1)

Provides API endpoints related to public

# `benefit_grants_list`

```elixir
@spec benefit_grants_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceBenefitGrant.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Benefit Grants

List benefit grants across all benefits accessible to the authenticated subject.

**Scopes**: `benefits:read` `benefits:write`

## Options

  * `organization_id`: Filter by organization ID.
  * `customer_id`: Filter by customer ID.
  * `external_customer_id`: Filter by customer external ID.
  * `is_granted`: Filter by granted status. If `true`, only granted benefits will be returned. If `false`, only revoked benefits will be returned. 
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `benefits_create`

```elixir
@spec benefits_create(
  body ::
    Polarex.BenefitCustomCreate.t()
    | Polarex.BenefitDiscordCreate.t()
    | Polarex.BenefitDownloadablesCreate.t()
    | Polarex.BenefitFeatureFlagCreate.t()
    | Polarex.BenefitGitHubRepositoryCreate.t()
    | Polarex.BenefitLicenseKeysCreate.t()
    | Polarex.BenefitMeterCreditCreate.t(),
  opts :: keyword()
) ::
  {:ok,
   Polarex.BenefitCustom.t()
   | Polarex.BenefitDiscord.t()
   | Polarex.BenefitDownloadables.t()
   | Polarex.BenefitFeatureFlag.t()
   | Polarex.BenefitGitHubRepository.t()
   | Polarex.BenefitLicenseKeys.t()
   | Polarex.BenefitMeterCredit.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

Create Benefit

Create a benefit.

**Scopes**: `benefits:write`

## Request Body

**Content Types**: `application/json`

# `benefits_delete`

```elixir
@spec benefits_delete(id :: String.t(), opts :: keyword()) ::
  :ok
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.NotPermitted.t()
     | Polarex.ResourceNotFound.t()}
```

Delete Benefit

Delete a benefit.

> [!WARNING]
> Every grants associated with the benefit will be revoked.
> Users will lose access to the benefit.

**Scopes**: `benefits:write`

# `benefits_get`

```elixir
@spec benefits_get(id :: String.t(), opts :: keyword()) ::
  {:ok,
   Polarex.BenefitCustom.t()
   | Polarex.BenefitDiscord.t()
   | Polarex.BenefitDownloadables.t()
   | Polarex.BenefitFeatureFlag.t()
   | Polarex.BenefitGitHubRepository.t()
   | Polarex.BenefitLicenseKeys.t()
   | Polarex.BenefitMeterCredit.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Benefit

Get a benefit by ID.

**Scopes**: `benefits:read` `benefits:write`

# `benefits_grants`

```elixir
@spec benefits_grants(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.ListResourceBenefitGrant.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

List Benefit Grants

List the individual grants for a benefit.

It's especially useful to check if a user has been granted a benefit.

**Scopes**: `benefits:read` `benefits:write`

## Options

  * `is_granted`: Filter by granted status. If `true`, only granted benefits will be returned. If `false`, only revoked benefits will be returned. 
  * `customer_id`: Filter by customer.
  * `member_id`: Filter by member.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.

# `benefits_list`

```elixir
@spec benefits_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceBenefit.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Benefits

List benefits.

**Scopes**: `benefits:read` `benefits:write`

## Options

  * `organization_id`: Filter by organization ID.
  * `type`: Filter by benefit type.
  * `id`: Filter by benefit IDs.
  * `exclude_id`: Exclude benefits with these IDs.
  * `query`: Filter by description.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.
  * `metadata`: Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`.

# `benefits_update`

```elixir
@spec benefits_update(
  id :: String.t(),
  body ::
    Polarex.BenefitCustomUpdate.t()
    | Polarex.BenefitDiscordUpdate.t()
    | Polarex.BenefitDownloadablesUpdate.t()
    | Polarex.BenefitFeatureFlagUpdate.t()
    | Polarex.BenefitGitHubRepositoryUpdate.t()
    | Polarex.BenefitLicenseKeysUpdate.t()
    | Polarex.BenefitMeterCreditUpdate.t(),
  opts :: keyword()
) ::
  {:ok,
   Polarex.BenefitCustom.t()
   | Polarex.BenefitDiscord.t()
   | Polarex.BenefitDownloadables.t()
   | Polarex.BenefitFeatureFlag.t()
   | Polarex.BenefitGitHubRepository.t()
   | Polarex.BenefitLicenseKeys.t()
   | Polarex.BenefitMeterCredit.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Update Benefit

Update a benefit.

**Scopes**: `benefits:write`

## Request Body

**Content Types**: `application/json`

# `checkout_links_create`

```elixir
@spec checkout_links_create(
  body ::
    Polarex.CheckoutLinkCreateProduct.t()
    | Polarex.CheckoutLinkCreateProductPrice.t()
    | Polarex.CheckoutLinkCreateProducts.t(),
  opts :: keyword()
) :: {:ok, Polarex.CheckoutLink.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Create Checkout Link

Create a checkout link.

**Scopes**: `checkout_links:write`

## Request Body

**Content Types**: `application/json`

# `checkout_links_delete`

```elixir
@spec checkout_links_delete(id :: String.t(), opts :: keyword()) ::
  :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Delete Checkout Link

Delete a checkout link.

**Scopes**: `checkout_links:write`

# `checkout_links_get`

```elixir
@spec checkout_links_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CheckoutLink.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Checkout Link

Get a checkout link by ID.

**Scopes**: `checkout_links:read` `checkout_links:write`

# `checkout_links_list`

```elixir
@spec checkout_links_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceCheckoutLink.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Checkout Links

List checkout links.

**Scopes**: `checkout_links:read` `checkout_links:write`

## Options

  * `organization_id`: Filter by organization ID.
  * `product_id`: Filter by product ID.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `checkout_links_update`

```elixir
@spec checkout_links_update(
  id :: String.t(),
  body :: Polarex.CheckoutLinkUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CheckoutLink.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Update Checkout Link

Update a checkout link.

**Scopes**: `checkout_links:write`

## Request Body

**Content Types**: `application/json`

# `checkouts_client_confirm`

```elixir
@spec checkouts_client_confirm(
  client_secret :: String.t(),
  body :: Polarex.CheckoutConfirmStripe.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CheckoutPublicConfirmed.t()}
  | {:error,
     Polarex.AlreadyActiveSubscriptionError.t()
     | Polarex.ExpiredCheckoutError.t()
     | Polarex.HTTPValidationError.t()
     | Polarex.NotOpenCheckout.t()
     | Polarex.PaymentError.t()
     | Polarex.PaymentNotReady.t()
     | Polarex.ResourceNotFound.t()
     | Polarex.TrialAlreadyRedeemed.t()}
```

Confirm Checkout Session from Client

Confirm a checkout session by client secret.

Orders and subscriptions will be processed.

## Request Body

**Content Types**: `application/json`

# `checkouts_client_get`

```elixir
@spec checkouts_client_get(client_secret :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CheckoutPublic.t()}
  | {:error,
     Polarex.ExpiredCheckoutError.t()
     | Polarex.HTTPValidationError.t()
     | Polarex.ResourceNotFound.t()}
```

Get Checkout Session from Client

Get a checkout session by client secret.

# `checkouts_client_update`

```elixir
@spec checkouts_client_update(
  client_secret :: String.t(),
  body :: Polarex.CheckoutUpdatePublic.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CheckoutPublic.t()}
  | {:error,
     Polarex.AlreadyActiveSubscriptionError.t()
     | Polarex.ExpiredCheckoutError.t()
     | Polarex.HTTPValidationError.t()
     | Polarex.NotOpenCheckout.t()
     | Polarex.PaymentNotReady.t()
     | Polarex.ResourceNotFound.t()
     | Polarex.TrialAlreadyRedeemed.t()}
```

Update Checkout Session from Client

Update a checkout session by client secret.

## Request Body

**Content Types**: `application/json`

# `checkouts_create`

```elixir
@spec checkouts_create(body :: Polarex.CheckoutProductsCreate.t(), opts :: keyword()) ::
  {:ok, Polarex.Checkout.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Create Checkout Session

Create a checkout session.

**Scopes**: `checkouts:write`

## Request Body

**Content Types**: `application/json`

# `checkouts_get`

```elixir
@spec checkouts_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.Checkout.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Checkout Session

Get a checkout session by ID.

**Scopes**: `checkouts:read` `checkouts:write`

# `checkouts_list`

```elixir
@spec checkouts_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceCheckout.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Checkout Sessions

List checkout sessions.

**Scopes**: `checkouts:read` `checkouts:write`

## Options

  * `organization_id`: Filter by organization ID.
  * `product_id`: Filter by product ID.
  * `customer_id`: Filter by customer ID.
  * `external_customer_id`: Filter by customer external ID.
  * `status`: Filter by checkout session status.
  * `query`: Filter by customer email.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `checkouts_update`

```elixir
@spec checkouts_update(
  id :: String.t(),
  body :: Polarex.CheckoutUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.Checkout.t()}
  | {:error,
     Polarex.AlreadyActiveSubscriptionError.t()
     | Polarex.HTTPValidationError.t()
     | Polarex.NotOpenCheckout.t()
     | Polarex.PaymentNotReady.t()
     | Polarex.ResourceNotFound.t()
     | Polarex.TrialAlreadyRedeemed.t()}
```

Update Checkout Session

Update a checkout session.

**Scopes**: `checkouts:write`

## Request Body

**Content Types**: `application/json`

# `custom_fields_create`

```elixir
@spec custom_fields_create(
  body ::
    Polarex.CustomFieldCreateCheckbox.t()
    | Polarex.CustomFieldCreateDate.t()
    | Polarex.CustomFieldCreateNumber.t()
    | Polarex.CustomFieldCreateSelect.t()
    | Polarex.CustomFieldCreateText.t(),
  opts :: keyword()
) ::
  {:ok,
   Polarex.CustomFieldCheckbox.t()
   | Polarex.CustomFieldDate.t()
   | Polarex.CustomFieldNumber.t()
   | Polarex.CustomFieldSelect.t()
   | Polarex.CustomFieldText.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

Create Custom Field

Create a custom field.

**Scopes**: `custom_fields:write`

## Request Body

**Content Types**: `application/json`

# `custom_fields_delete`

```elixir
@spec custom_fields_delete(id :: String.t(), opts :: keyword()) ::
  :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Delete Custom Field

Delete a custom field.

**Scopes**: `custom_fields:write`

# `custom_fields_get`

```elixir
@spec custom_fields_get(id :: String.t(), opts :: keyword()) ::
  {:ok,
   Polarex.CustomFieldCheckbox.t()
   | Polarex.CustomFieldDate.t()
   | Polarex.CustomFieldNumber.t()
   | Polarex.CustomFieldSelect.t()
   | Polarex.CustomFieldText.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Custom Field

Get a custom field by ID.

**Scopes**: `custom_fields:read` `custom_fields:write`

# `custom_fields_list`

```elixir
@spec custom_fields_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceCustomField.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Custom Fields

List custom fields.

**Scopes**: `custom_fields:read` `custom_fields:write`

## Options

  * `organization_id`: Filter by organization ID.
  * `query`: Filter by custom field name or slug.
  * `type`: Filter by custom field type.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `custom_fields_update`

```elixir
@spec custom_fields_update(
  id :: String.t(),
  body ::
    Polarex.CustomFieldUpdateCheckbox.t()
    | Polarex.CustomFieldUpdateDate.t()
    | Polarex.CustomFieldUpdateNumber.t()
    | Polarex.CustomFieldUpdateSelect.t()
    | Polarex.CustomFieldUpdateText.t(),
  opts :: keyword()
) ::
  {:ok,
   Polarex.CustomFieldCheckbox.t()
   | Polarex.CustomFieldDate.t()
   | Polarex.CustomFieldNumber.t()
   | Polarex.CustomFieldSelect.t()
   | Polarex.CustomFieldText.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Update Custom Field

Update a custom field.

**Scopes**: `custom_fields:write`

## Request Body

**Content Types**: `application/json`

# `customer_meters_get`

```elixir
@spec customer_meters_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerMeter.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Customer Meter

Get a customer meter by ID.

**Scopes**: `customer_meters:read`

# `customer_meters_list`

```elixir
@spec customer_meters_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceCustomerMeter.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Customer Meters

List customer meters.

**Scopes**: `customer_meters:read`

## Options

  * `organization_id`: Filter by organization ID.
  * `customer_id`: Filter by customer ID.
  * `external_customer_id`: Filter by external customer ID.
  * `meter_id`: Filter by meter ID.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `customer_portal_benefit_grants_get`

```elixir
@spec customer_portal_benefit_grants_get(id :: String.t(), opts :: keyword()) ::
  {:ok,
   Polarex.CustomerBenefitGrantCustom.t()
   | Polarex.CustomerBenefitGrantDiscord.t()
   | Polarex.CustomerBenefitGrantDownloadables.t()
   | Polarex.CustomerBenefitGrantFeatureFlag.t()
   | Polarex.CustomerBenefitGrantGitHubRepository.t()
   | Polarex.CustomerBenefitGrantLicenseKeys.t()
   | Polarex.CustomerBenefitGrantMeterCredit.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Benefit Grant

Get a benefit grant by ID for the authenticated customer.

**Scopes**: `customer_portal:read` `customer_portal:write`

# `customer_portal_benefit_grants_list`

```elixir
@spec customer_portal_benefit_grants_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceCustomerBenefitGrant.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Benefit Grants

List benefits grants of the authenticated customer.

**Scopes**: `customer_portal:read` `customer_portal:write`

## Options

  * `query`: Filter by benefit description.
  * `type`: Filter by benefit type.
  * `benefit_id`: Filter by benefit ID.
  * `checkout_id`: Filter by checkout ID.
  * `order_id`: Filter by order ID.
  * `subscription_id`: Filter by subscription ID.
  * `member_id`: Filter by member ID.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `customer_portal_benefit_grants_update`

```elixir
@spec customer_portal_benefit_grants_update(
  id :: String.t(),
  body ::
    Polarex.CustomerBenefitGrantCustomUpdate.t()
    | Polarex.CustomerBenefitGrantDiscordUpdate.t()
    | Polarex.CustomerBenefitGrantDownloadablesUpdate.t()
    | Polarex.CustomerBenefitGrantFeatureFlagUpdate.t()
    | Polarex.CustomerBenefitGrantGitHubRepositoryUpdate.t()
    | Polarex.CustomerBenefitGrantLicenseKeysUpdate.t()
    | Polarex.CustomerBenefitGrantMeterCreditUpdate.t(),
  opts :: keyword()
) ::
  {:ok,
   Polarex.CustomerBenefitGrantCustom.t()
   | Polarex.CustomerBenefitGrantDiscord.t()
   | Polarex.CustomerBenefitGrantDownloadables.t()
   | Polarex.CustomerBenefitGrantFeatureFlag.t()
   | Polarex.CustomerBenefitGrantGitHubRepository.t()
   | Polarex.CustomerBenefitGrantLicenseKeys.t()
   | Polarex.CustomerBenefitGrantMeterCredit.t()}
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.NotPermitted.t()
     | Polarex.ResourceNotFound.t()}
```

Update Benefit Grant

Update a benefit grant for the authenticated customer.

**Scopes**: `customer_portal:write`

## Request Body

**Content Types**: `application/json`

# `customer_portal_customer_meters_get`

```elixir
@spec customer_portal_customer_meters_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerCustomerMeter.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Customer Meter

Get a meter by ID for the authenticated customer.

**Scopes**: `customer_portal:read` `customer_portal:write`

# `customer_portal_customer_meters_list`

```elixir
@spec customer_portal_customer_meters_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceCustomerCustomerMeter.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Meters

List meters of the authenticated customer.

**Scopes**: `customer_portal:read` `customer_portal:write`

## Options

  * `meter_id`: Filter by meter ID.
  * `query`: Filter by meter name.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `customer_portal_customer_session_get_authenticated_user`

```elixir
@spec customer_portal_customer_session_get_authenticated_user(opts :: keyword()) ::
  {:ok, Polarex.PortalAuthenticatedUser.t()} | :error
```

Get Authenticated Portal User

Get information about the currently authenticated portal user.

**Scopes**: `customer_portal:read` `customer_portal:write`

# `customer_portal_customer_session_introspect`

```elixir
@spec customer_portal_customer_session_introspect(opts :: keyword()) ::
  {:ok, Polarex.CustomerCustomerSession.t()} | :error
```

Introspect Customer Session

Introspect the current session and return its information.

**Scopes**: `customer_portal:read` `customer_portal:write`

# `customer_portal_customers_add_payment_method`

```elixir
@spec customer_portal_customers_add_payment_method(
  body :: Polarex.CustomerPaymentMethodCreate.t(),
  opts :: keyword()
) ::
  {:ok,
   Polarex.CustomerPaymentMethodCreateRequiresActionResponse.t()
   | Polarex.CustomerPaymentMethodCreateSucceededResponse.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

Add Customer Payment Method

Add a payment method to the authenticated customer.

## Request Body

**Content Types**: `application/json`

# `customer_portal_customers_check_email_update`

```elixir
@spec customer_portal_customers_check_email_update(opts :: keyword()) ::
  :ok | {:error, Polarex.HTTPValidationError.t()}
```

Check Email Change Token

Check if an email change verification token is still valid.

## Options

  * `token`

# `customer_portal_customers_confirm_payment_method`

```elixir
@spec customer_portal_customers_confirm_payment_method(
  body :: Polarex.CustomerPaymentMethodConfirm.t(),
  opts :: keyword()
) ::
  {:ok,
   Polarex.CustomerPaymentMethodCreateRequiresActionResponse.t()
   | Polarex.CustomerPaymentMethodCreateSucceededResponse.t()}
  | {:error, Polarex.CustomerNotReady.t() | Polarex.HTTPValidationError.t()}
```

Confirm Customer Payment Method

Confirm a payment method for the authenticated customer.

## Request Body

**Content Types**: `application/json`

# `customer_portal_customers_delete_payment_method`

```elixir
@spec customer_portal_customers_delete_payment_method(
  id :: String.t(),
  opts :: keyword()
) ::
  :ok
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.PaymentMethodInUseByActiveSubscription.t()
     | Polarex.ResourceNotFound.t()}
```

Delete Customer Payment Method

Delete a payment method from the authenticated customer.

# `customer_portal_customers_get`

```elixir
@spec customer_portal_customers_get(opts :: keyword()) ::
  {:ok, Polarex.CustomerPortalCustomer.t()} | :error
```

Get Customer

Get authenticated customer.

**Scopes**: `customer_portal:read` `customer_portal:write`

# `customer_portal_customers_list_payment_methods`

```elixir
@spec customer_portal_customers_list_payment_methods(opts :: keyword()) ::
  {:ok, Polarex.ListResourceCustomerPaymentMethod.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Customer Payment Methods

Get saved payment methods of the authenticated customer.

## Options

  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.

# `customer_portal_customers_request_email_update`

```elixir
@spec customer_portal_customers_request_email_update(
  body :: Polarex.CustomerEmailUpdateRequest.t(),
  opts :: keyword()
) :: {:ok, map()} | {:error, Polarex.HTTPValidationError.t()}
```

Request Email Change

Request an email change for the authenticated customer.

## Request Body

**Content Types**: `application/json`

# `customer_portal_customers_update`

```elixir
@spec customer_portal_customers_update(
  body :: Polarex.CustomerPortalCustomerUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CustomerPortalCustomer.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

Update Customer

Update authenticated customer.

## Request Body

**Content Types**: `application/json`

# `customer_portal_customers_verify_email_update`

```elixir
@spec customer_portal_customers_verify_email_update(
  body :: Polarex.CustomerEmailUpdateVerifyRequest.t(),
  opts :: keyword()
) :: {:ok, Polarex.CustomerEmailUpdateVerifyResponse.t()} | :error
```

Verify Email Change

Verify an email change using the token from the verification email.

## Request Body

**Content Types**: `application/json`

# `customer_portal_downloadables_list`

```elixir
@spec customer_portal_downloadables_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceDownloadableRead.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Downloadables

**Scopes**: `customer_portal:read` `customer_portal:write`

## Options

  * `benefit_id`: Filter by benefit ID.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.

# `customer_portal_license_keys_activate`

```elixir
@spec customer_portal_license_keys_activate(
  body :: Polarex.LicenseKeyActivate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.LicenseKeyActivationRead.t()}
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.NotPermitted.t()
     | Polarex.ResourceNotFound.t()}
```

Activate License Key

Activate a license key instance.

> This endpoint doesn't require authentication and can be safely used on a public
> client, like a desktop application or a mobile app.
> If you plan to validate a license key on a server, use the `/v1/license-keys/activate`
> endpoint instead.

## Request Body

**Content Types**: `application/json`

# `customer_portal_license_keys_deactivate`

```elixir
@spec customer_portal_license_keys_deactivate(
  body :: Polarex.LicenseKeyDeactivate.t(),
  opts :: keyword()
) ::
  :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Deactivate License Key

Deactivate a license key instance.

> This endpoint doesn't require authentication and can be safely used on a public
> client, like a desktop application or a mobile app.
> If you plan to validate a license key on a server, use the `/v1/license-keys/deactivate`
> endpoint instead.

## Request Body

**Content Types**: `application/json`

# `customer_portal_license_keys_get`

```elixir
@spec customer_portal_license_keys_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.LicenseKeyWithActivations.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get License Key

Get a license key.

**Scopes**: `customer_portal:read` `customer_portal:write`

# `customer_portal_license_keys_list`

```elixir
@spec customer_portal_license_keys_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceLicenseKeyRead.t()}
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.ResourceNotFound.t()
     | Polarex.Unauthorized.t()}
```

List License Keys

**Scopes**: `customer_portal:read` `customer_portal:write`

## Options

  * `benefit_id`: Filter by a specific benefit
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.

# `customer_portal_license_keys_validate`

```elixir
@spec customer_portal_license_keys_validate(
  body :: Polarex.LicenseKeyValidate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.ValidatedLicenseKey.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Validate License Key

Validate a license key.

> This endpoint doesn't require authentication and can be safely used on a public
> client, like a desktop application or a mobile app.
> If you plan to validate a license key on a server, use the `/v1/license-keys/validate`
> endpoint instead.

## Request Body

**Content Types**: `application/json`

# `customer_portal_members_add_member`

```elixir
@spec customer_portal_members_add_member(
  body :: Polarex.CustomerPortalMemberCreate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CustomerPortalMember.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

Add Member

Add a new member to the customer's team.

Only available to owners and billing managers of team customers.

Rules:
- Cannot add a member with the owner role (there must be exactly one owner)
- If a member with this email already exists, the existing member is returned

## Request Body

**Content Types**: `application/json`

# `customer_portal_members_list_members`

```elixir
@spec customer_portal_members_list_members(opts :: keyword()) ::
  {:ok, Polarex.ListResourceCustomerPortalMember.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Members

List all members of the customer's team.

Only available to owners and billing managers of team customers.

## Options

  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.

# `customer_portal_members_remove_member`

```elixir
@spec customer_portal_members_remove_member(id :: String.t(), opts :: keyword()) ::
  :ok | {:error, Polarex.HTTPValidationError.t()}
```

Remove Member

Remove a member from the team.

Only available to owners and billing managers of team customers.

Rules:
- Cannot remove yourself
- Cannot remove the only owner

# `customer_portal_members_update_member`

```elixir
@spec customer_portal_members_update_member(
  id :: String.t(),
  body :: Polarex.CustomerPortalMemberUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CustomerPortalMember.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

Update Member

Update a member's role.

Only available to owners and billing managers of team customers.

Rules:
- Cannot modify your own role (to prevent self-demotion)
- Customer must have exactly one owner at all times

## Request Body

**Content Types**: `application/json`

# `customer_portal_orders_confirm_retry_payment`

```elixir
@spec customer_portal_orders_confirm_retry_payment(
  id :: String.t(),
  body :: Polarex.CustomerOrderConfirmPayment.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CustomerOrderPaymentConfirmation.t()}
  | {:error,
     Polarex.ManualRetryLimitExceeded.t()
     | Polarex.OrderNotEligibleForRetry.t()
     | Polarex.PaymentAlreadyInProgress.t()
     | Polarex.ResourceNotFound.t()}
```

Confirm Retry Payment

Confirm a retry payment using a Stripe confirmation token.

## Request Body

**Content Types**: `application/json`

# `customer_portal_orders_generate_invoice`

```elixir
@spec customer_portal_orders_generate_invoice(id :: String.t(), opts :: keyword()) ::
  {:ok, map()}
  | {:error,
     Polarex.MissingInvoiceBillingDetails.t() | Polarex.NotPaidOrder.t()}
```

Generate Order Invoice

Trigger generation of an order's invoice.

# `customer_portal_orders_get`

```elixir
@spec customer_portal_orders_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerOrder.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Order

Get an order by ID for the authenticated customer.

# `customer_portal_orders_get_payment_status`

```elixir
@spec customer_portal_orders_get_payment_status(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerOrderPaymentStatus.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Order Payment Status

Get the current payment status for an order.

# `customer_portal_orders_invoice`

```elixir
@spec customer_portal_orders_invoice(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerOrderInvoice.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Order Invoice

Get an order's invoice data.

# `customer_portal_orders_list`

```elixir
@spec customer_portal_orders_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceCustomerOrder.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Orders

List orders of the authenticated customer.

## Options

  * `product_id`: Filter by product ID.
  * `product_billing_type`: Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases.
  * `subscription_id`: Filter by subscription ID.
  * `query`: Search by product or organization name.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `customer_portal_orders_receipt`

```elixir
@spec customer_portal_orders_receipt(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerOrderReceipt.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Order Receipt

Get a presigned URL to download an order's receipt PDF.

# `customer_portal_orders_update`

```elixir
@spec customer_portal_orders_update(
  id :: String.t(),
  body :: Polarex.CustomerOrderUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CustomerOrder.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Update Order

Update an order for the authenticated customer.

## Request Body

**Content Types**: `application/json`

# `customer_portal_organizations_get`

```elixir
@spec customer_portal_organizations_get(slug :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerOrganizationData.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Organization

Get a customer portal's organization by slug.

# `customer_portal_seats_assign_seat`

```elixir
@spec customer_portal_seats_assign_seat(
  body :: Polarex.SeatAssign.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CustomerSeat.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Assign Seat

## Request Body

**Content Types**: `application/json`

# `customer_portal_seats_list_claimed_subscriptions`

```elixir
@spec customer_portal_seats_list_claimed_subscriptions(opts :: keyword()) ::
  {:ok, Polarex.ListResourceCustomerSubscription.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Claimed Subscriptions

List all subscriptions where the authenticated customer has claimed a seat.

**Scopes**: `customer_portal:read` `customer_portal:write`

## Options

  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.

# `customer_portal_seats_list_seats`

```elixir
@spec customer_portal_seats_list_seats(opts :: keyword()) ::
  {:ok, Polarex.SeatsList.t()} | {:error, Polarex.HTTPValidationError.t()}
```

List Seats

**Scopes**: `customer_portal:read` `customer_portal:write`

## Options

  * `subscription_id`: Subscription ID
  * `order_id`: Order ID

# `customer_portal_seats_resend_invitation`

```elixir
@spec customer_portal_seats_resend_invitation(
  seat_id :: String.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CustomerSeat.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Resend Invitation

# `customer_portal_seats_revoke_seat`

```elixir
@spec customer_portal_seats_revoke_seat(seat_id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerSeat.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Revoke Seat

# `customer_portal_subscriptions_cancel`

```elixir
@spec customer_portal_subscriptions_cancel(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerSubscription.t()}
  | {:error,
     Polarex.AlreadyCanceledSubscription.t()
     | Polarex.HTTPValidationError.t()
     | Polarex.ResourceNotFound.t()}
```

Cancel Subscription

Cancel a subscription of the authenticated customer.

# `customer_portal_subscriptions_get`

```elixir
@spec customer_portal_subscriptions_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerSubscription.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Subscription

Get a subscription for the authenticated customer.

**Scopes**: `customer_portal:read` `customer_portal:write`

# `customer_portal_subscriptions_list`

```elixir
@spec customer_portal_subscriptions_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceCustomerSubscription.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Subscriptions

List subscriptions of the authenticated customer.

**Scopes**: `customer_portal:read` `customer_portal:write`

## Options

  * `product_id`: Filter by product ID.
  * `active`: Filter by active or cancelled subscription.
  * `query`: Search by product or organization name.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `customer_portal_subscriptions_update`

```elixir
@spec customer_portal_subscriptions_update(
  id :: String.t(),
  body ::
    Polarex.CustomerSubscriptionCancel.t()
    | Polarex.CustomerSubscriptionUpdateClear.t()
    | Polarex.CustomerSubscriptionUpdateProduct.t()
    | Polarex.CustomerSubscriptionUpdateSeats.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CustomerSubscription.t()}
  | {:error,
     Polarex.AlreadyCanceledSubscription.t()
     | Polarex.HTTPValidationError.t()
     | Polarex.PaymentFailed.t()
     | Polarex.ResourceNotFound.t()}
```

Update Subscription

Update a subscription of the authenticated customer.

## Request Body

**Content Types**: `application/json`

# `customer_portal_wallets_get`

```elixir
@spec customer_portal_wallets_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerWallet.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Wallet

Get a wallet by ID for the authenticated customer.

# `customer_portal_wallets_list`

```elixir
@spec customer_portal_wallets_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceCustomerWallet.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Wallets

List wallets of the authenticated customer.

## Options

  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `customer_seats_assign_seat`

```elixir
@spec customer_seats_assign_seat(body :: Polarex.SeatAssign.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerSeat.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Assign Seat

**Scopes**: `customer_seats:write`

## Request Body

**Content Types**: `application/json`

# `customer_seats_claim_seat`

```elixir
@spec customer_seats_claim_seat(body :: Polarex.SeatClaim.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerSeatClaimResponse.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

Claim Seat

## Request Body

**Content Types**: `application/json`

# `customer_seats_get_claim_info`

```elixir
@spec customer_seats_get_claim_info(invitation_token :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.SeatClaimInfo.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Get Claim Info

# `customer_seats_list_seats`

```elixir
@spec customer_seats_list_seats(opts :: keyword()) ::
  {:ok, Polarex.SeatsList.t()} | {:error, Polarex.HTTPValidationError.t()}
```

List Seats

**Scopes**: `customer_seats:write`

## Options

  * `subscription_id`
  * `order_id`

# `customer_seats_resend_invitation`

```elixir
@spec customer_seats_resend_invitation(seat_id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerSeat.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Resend Invitation

**Scopes**: `customer_seats:write`

# `customer_seats_revoke_seat`

```elixir
@spec customer_seats_revoke_seat(seat_id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerSeat.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Revoke Seat

**Scopes**: `customer_seats:write`

# `customer_sessions_create`

```elixir
@spec customer_sessions_create(
  body ::
    Polarex.CustomerSessionCustomerExternalIDCreate.t()
    | Polarex.CustomerSessionCustomerIDCreate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CustomerSession.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Create Customer Session

Create a customer session.

For organizations with `member_model_enabled`, this will automatically
create a member session for the owner member of the customer.

**Scopes**: `customer_sessions:write`

## Request Body

**Content Types**: `application/json`

# `customers_create`

```elixir
@spec customers_create(
  body :: Polarex.CustomerIndividualCreate.t() | Polarex.CustomerTeamCreate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CustomerIndividual.t() | Polarex.CustomerTeam.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

Create Customer

Create a customer.

**Scopes**: `customers:write`

## Request Body

**Content Types**: `application/json`

# `customers_delete`

```elixir
@spec customers_delete(id :: String.t(), opts :: keyword()) ::
  :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Delete Customer

Delete a customer.

This action cannot be undone and will immediately:
- Cancel any active subscriptions for the customer
- Revoke all their benefits
- Clear any `external_id`

Use it only in the context of deleting a user within your
own service. Otherwise, use more granular API endpoints to cancel
a specific subscription or revoke certain benefits.

Note: The customers information will nonetheless be retained for historic
orders and subscriptions.

Set `anonymize=true` to also anonymize PII for GDPR compliance.

**Scopes**: `customers:write`

## Options

  * `anonymize`: If true, also anonymize the customer's personal data for GDPR compliance. This replaces email with a hashed version, hashes name and billing name (name preserved for businesses with tax_id), clears billing address, and removes OAuth account data.

# `customers_delete_external`

```elixir
@spec customers_delete_external(external_id :: String.t(), opts :: keyword()) ::
  :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Delete Customer by External ID

Delete a customer by external ID.

Immediately cancels any active subscriptions and revokes any active benefits.

Set `anonymize=true` to also anonymize PII for GDPR compliance.

**Scopes**: `customers:write`

## Options

  * `anonymize`: If true, also anonymize the customer's personal data for GDPR compliance.

# `customers_export`

```elixir
@spec customers_export(opts :: keyword()) ::
  {:ok, map() | String.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Export Customers

Export customers as a CSV file.

**Scopes**: `customers:read` `customers:write`

## Options

  * `organization_id`: Filter by organization ID.

# `customers_get`

```elixir
@spec customers_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerIndividual.t() | Polarex.CustomerTeam.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Customer

Get a customer by ID.

**Scopes**: `customers:read` `customers:write`

# `customers_get_external`

```elixir
@spec customers_get_external(external_id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerIndividual.t() | Polarex.CustomerTeam.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Customer by External ID

Get a customer by external ID.

**Scopes**: `customers:read` `customers:write`

# `customers_get_state`

```elixir
@spec customers_get_state(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerStateIndividual.t() | Polarex.CustomerStateTeam.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Customer State

Get a customer state by ID.

The customer state includes information about
the customer's active subscriptions and benefits.

It's the ideal endpoint to use when you need to get a full overview
of a customer's status.

**Scopes**: `customers:read` `customers:write`

# `customers_get_state_external`

```elixir
@spec customers_get_state_external(external_id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CustomerStateIndividual.t() | Polarex.CustomerStateTeam.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Customer State by External ID

Get a customer state by external ID.

The customer state includes information about
the customer's active subscriptions and benefits.

It's the ideal endpoint to use when you need to get a full overview
of a customer's status.

**Scopes**: `customers:read` `customers:write`

# `customers_list`

```elixir
@spec customers_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceCustomer.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Customers

List customers.

**Scopes**: `customers:read` `customers:write`

## Options

  * `organization_id`: Filter by organization ID.
  * `email`: Filter by exact email.
  * `query`: Filter by name, email, or external ID.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.
  * `metadata`: Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`.

# `customers_update`

```elixir
@spec customers_update(
  id :: String.t(),
  body :: Polarex.CustomerUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CustomerIndividual.t() | Polarex.CustomerTeam.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Update Customer

Update a customer.

**Scopes**: `customers:write`

## Request Body

**Content Types**: `application/json`

# `customers_update_external`

```elixir
@spec customers_update_external(
  external_id :: String.t(),
  body :: Polarex.CustomerUpdateExternalID.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.CustomerIndividual.t() | Polarex.CustomerTeam.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Update Customer by External ID

Update a customer by external ID.

**Scopes**: `customers:write`

## Request Body

**Content Types**: `application/json`

# `discounts_create`

```elixir
@spec discounts_create(
  body :: Polarex.DiscountFixedCreate.t() | Polarex.DiscountPercentageCreate.t(),
  opts :: keyword()
) ::
  {:ok,
   Polarex.DiscountFixedOnceForeverDuration.t()
   | Polarex.DiscountFixedRepeatDuration.t()
   | Polarex.DiscountPercentageOnceForeverDuration.t()
   | Polarex.DiscountPercentageRepeatDuration.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

Create Discount

Create a discount.

**Scopes**: `discounts:write`

## Request Body

**Content Types**: `application/json`

# `discounts_delete`

```elixir
@spec discounts_delete(id :: String.t(), opts :: keyword()) ::
  :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Delete Discount

Delete a discount.

**Scopes**: `discounts:write`

# `discounts_get`

```elixir
@spec discounts_get(id :: String.t(), opts :: keyword()) ::
  {:ok,
   Polarex.DiscountFixedOnceForeverDuration.t()
   | Polarex.DiscountFixedRepeatDuration.t()
   | Polarex.DiscountPercentageOnceForeverDuration.t()
   | Polarex.DiscountPercentageRepeatDuration.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Discount

Get a discount by ID.

**Scopes**: `discounts:read` `discounts:write`

# `discounts_list`

```elixir
@spec discounts_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceDiscount.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Discounts

List discounts.

**Scopes**: `discounts:read` `discounts:write`

## Options

  * `organization_id`: Filter by organization ID.
  * `query`: Filter by name.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `discounts_update`

```elixir
@spec discounts_update(
  id :: String.t(),
  body :: Polarex.DiscountUpdate.t(),
  opts :: keyword()
) ::
  {:ok,
   Polarex.DiscountFixedOnceForeverDuration.t()
   | Polarex.DiscountFixedRepeatDuration.t()
   | Polarex.DiscountPercentageOnceForeverDuration.t()
   | Polarex.DiscountPercentageRepeatDuration.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Update Discount

Update a discount.

**Scopes**: `discounts:write`

## Request Body

**Content Types**: `application/json`

# `disputes_get`

```elixir
@spec disputes_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.Dispute.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Dispute

Get a dispute by ID.

**Scopes**: `disputes:read`

# `disputes_list`

```elixir
@spec disputes_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceDispute.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Disputes

List disputes.

**Scopes**: `disputes:read`

## Options

  * `organization_id`: Filter by organization ID.
  * `order_id`: Filter by order ID.
  * `status`: Filter by dispute status.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `event_types_list`

```elixir
@spec event_types_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceEventTypeWithStats.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Event Types

List event types with aggregated statistics.

**Scopes**: `events:read` `events:write`

## Options

  * `organization_id`: Filter by organization ID.
  * `customer_id`: Filter by customer ID.
  * `external_customer_id`: Filter by external customer ID.
  * `query`: Query to filter event types by name or label.
  * `root_events`: When true, only return event types with root events (parent_id IS NULL).
  * `parent_id`: Filter by specific parent event ID.
  * `source`: Filter by event source (system or user).
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `event_types_update`

```elixir
@spec event_types_update(
  id :: String.t(),
  body :: Polarex.EventTypeUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.EventType.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Update Event Type

Update an event type's label.

**Scopes**: `events:write`

## Request Body

**Content Types**: `application/json`

# `events_get`

```elixir
@spec events_get(id :: String.t(), opts :: keyword()) ::
  {:ok, map() | Polarex.UserEvent.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Event

Get an event by ID.

**Scopes**: `events:read` `events:write`

# `events_ingest`

```elixir
@spec events_ingest(body :: Polarex.EventsIngest.t(), opts :: keyword()) ::
  {:ok, Polarex.EventsIngestResponse.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

Ingest Events

Ingest batch of events.

**Scopes**: `events:write`

## Request Body

**Content Types**: `application/json`

# `events_list`

```elixir
@spec events_list(opts :: keyword()) ::
  {:ok,
   Polarex.ListResourceEvent.t()
   | Polarex.ListResourceWithCursorPaginationEvent.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Events

List events.

**Scopes**: `events:read` `events:write`

## Options

  * `filter`: Filter events following filter clauses. JSON string following the same schema a meter filter clause. 
  * `start_timestamp`: Filter events after this timestamp.
  * `end_timestamp`: Filter events before this timestamp.
  * `organization_id`: Filter by organization ID.
  * `customer_id`: Filter by customer ID.
  * `external_customer_id`: Filter by external customer ID.
  * `meter_id`: Filter by a meter filter clause.
  * `name`: Filter by event name.
  * `source`: Filter by event source.
  * `query`: Query to filter events.
  * `parent_id`: When combined with depth, use this event as the anchor instead of root events.
  * `depth`: Fetch descendants up to this depth. When set: 0=root events only, 1=roots+children, etc. Max 5. When not set, returns all events.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.
  * `metadata`: Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`.

# `events_list_names`

```elixir
@spec events_list_names(opts :: keyword()) ::
  {:ok, Polarex.ListResourceEventName.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Event Names

List event names.

**Scopes**: `events:read` `events:write`

## Options

  * `organization_id`: Filter by organization ID.
  * `customer_id`: Filter by customer ID.
  * `external_customer_id`: Filter by external customer ID.
  * `source`: Filter by event source.
  * `query`: Query to filter event names.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `files_create`

```elixir
@spec files_create(
  body ::
    Polarex.DownloadableFileCreate.t()
    | Polarex.OrganizationAvatarFileCreate.t()
    | Polarex.ProductMediaFileCreate.t(),
  opts :: keyword()
) :: {:ok, Polarex.FileUpload.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Create File

Create a file.

**Scopes**: `files:write`

## Request Body

**Content Types**: `application/json`

# `files_delete`

```elixir
@spec files_delete(id :: String.t(), opts :: keyword()) ::
  :ok
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.NotPermitted.t()
     | Polarex.ResourceNotFound.t()}
```

Delete File

Delete a file.

**Scopes**: `files:write`

# `files_list`

```elixir
@spec files_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceFileRead.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Files

List files.

**Scopes**: `files:read` `files:write`

## Options

  * `organization_id`: Filter by organization ID.
  * `ids`: Filter by file ID.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.

# `files_update`

```elixir
@spec files_update(id :: String.t(), body :: Polarex.FilePatch.t(), opts :: keyword()) ::
  {:ok,
   Polarex.DownloadableFileRead.t()
   | Polarex.OrganizationAvatarFileRead.t()
   | Polarex.ProductMediaFileRead.t()}
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.NotPermitted.t()
     | Polarex.ResourceNotFound.t()}
```

Update File

Update a file.

**Scopes**: `files:write`

## Request Body

**Content Types**: `application/json`

# `files_uploaded`

```elixir
@spec files_uploaded(
  id :: String.t(),
  body :: Polarex.FileUploadCompleted.t(),
  opts :: keyword()
) ::
  {:ok,
   Polarex.DownloadableFileRead.t()
   | Polarex.OrganizationAvatarFileRead.t()
   | Polarex.ProductMediaFileRead.t()}
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.NotPermitted.t()
     | Polarex.ResourceNotFound.t()}
```

Complete File Upload

Complete a file upload.

**Scopes**: `files:write`

## Request Body

**Content Types**: `application/json`

# `license_keys_activate`

```elixir
@spec license_keys_activate(body :: Polarex.LicenseKeyActivate.t(), opts :: keyword()) ::
  {:ok, Polarex.LicenseKeyActivationRead.t()}
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.NotPermitted.t()
     | Polarex.ResourceNotFound.t()}
```

Activate License Key

Activate a license key instance.

**Scopes**: `license_keys:write`

## Request Body

**Content Types**: `application/json`

# `license_keys_deactivate`

```elixir
@spec license_keys_deactivate(
  body :: Polarex.LicenseKeyDeactivate.t(),
  opts :: keyword()
) ::
  :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Deactivate License Key

Deactivate a license key instance.

**Scopes**: `license_keys:write`

## Request Body

**Content Types**: `application/json`

# `license_keys_get`

```elixir
@spec license_keys_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.LicenseKeyWithActivations.t()}
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.ResourceNotFound.t()
     | Polarex.Unauthorized.t()}
```

Get License Key

Get a license key.

**Scopes**: `license_keys:read` `license_keys:write`

# `license_keys_get_activation`

```elixir
@spec license_keys_get_activation(
  id :: String.t(),
  activation_id :: String.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.LicenseKeyActivationRead.t()}
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.ResourceNotFound.t()
     | Polarex.Unauthorized.t()}
```

Get Activation

Get a license key activation.

**Scopes**: `license_keys:read` `license_keys:write`

# `license_keys_list`

```elixir
@spec license_keys_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceLicenseKeyRead.t()}
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.ResourceNotFound.t()
     | Polarex.Unauthorized.t()}
```

List License Keys

Get license keys connected to the given organization & filters.

**Scopes**: `license_keys:read` `license_keys:write`

## Options

  * `organization_id`: Filter by organization ID.
  * `benefit_id`: Filter by benefit ID.
  * `status`: Filter by license key status.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.

# `license_keys_update`

```elixir
@spec license_keys_update(
  id :: String.t(),
  body :: Polarex.LicenseKeyUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.LicenseKeyRead.t()}
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.ResourceNotFound.t()
     | Polarex.Unauthorized.t()}
```

Update License Key

Update a license key.

**Scopes**: `license_keys:write`

## Request Body

**Content Types**: `application/json`

# `license_keys_validate`

```elixir
@spec license_keys_validate(body :: Polarex.LicenseKeyValidate.t(), opts :: keyword()) ::
  {:ok, Polarex.ValidatedLicenseKey.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Validate License Key

Validate a license key.

**Scopes**: `license_keys:write`

## Request Body

**Content Types**: `application/json`

# `members_create_member`

```elixir
@spec members_create_member(body :: Polarex.MemberCreate.t(), opts :: keyword()) ::
  {:ok, Polarex.Member.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Create Member

Create a new member for a customer.

Only B2B customers with the member management feature enabled can add members.
The authenticated user or organization must have access to the customer's organization.

**Scopes**: `members:write`

## Request Body

**Content Types**: `application/json`

# `members_delete_member`

```elixir
@spec members_delete_member(id :: String.t(), opts :: keyword()) ::
  :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Delete Member

Delete a member.

The authenticated user or organization must have access to the member's organization.

**Scopes**: `members:write`

# `members_delete_member_by_external_id`

```elixir
@spec members_delete_member_by_external_id(
  external_id :: String.t(),
  opts :: keyword()
) ::
  :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Delete Member by External ID

Delete a member by external ID. One of customer_id or external_customer_id must be specified.

**Scopes**: `members:write`

## Options

  * `customer_id`: The customer ID.
  * `external_customer_id`: The customer external ID.

# `members_get_member`

```elixir
@spec members_get_member(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.Member.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Member

Get a member by ID.

The authenticated user or organization must have access to the member's organization.

**Scopes**: `members:read` `members:write`

# `members_get_member_by_external_id`

```elixir
@spec members_get_member_by_external_id(external_id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.Member.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Member by External ID

Get a member by external ID. One of customer_id or external_customer_id must be specified.

**Scopes**: `members:read` `members:write`

## Options

  * `customer_id`: The customer ID.
  * `external_customer_id`: The customer external ID.

# `members_list_members`

```elixir
@spec members_list_members(opts :: keyword()) ::
  {:ok, Polarex.ListResourceMember.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Members

List members with optional customer ID filter.

**Scopes**: `members:read` `members:write`

## Options

  * `customer_id`: Filter by customer ID.
  * `external_customer_id`: Filter by customer external ID.
  * `role`: Filter by member role.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `members_update_member`

```elixir
@spec members_update_member(
  id :: String.t(),
  body :: Polarex.MemberUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.Member.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Update Member

Update a member.

Only name and role can be updated.
The authenticated user or organization must have access to the member's organization.

**Scopes**: `members:write`

## Request Body

**Content Types**: `application/json`

# `members_update_member_by_external_id`

```elixir
@spec members_update_member_by_external_id(
  external_id :: String.t(),
  body :: Polarex.MemberUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.Member.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Update Member by External ID

Update a member by external ID. One of customer_id or external_customer_id must be specified.

**Scopes**: `members:write`

## Options

  * `customer_id`: The customer ID.
  * `external_customer_id`: The customer external ID.

## Request Body

**Content Types**: `application/json`

# `meters_create`

```elixir
@spec meters_create(body :: Polarex.MeterCreate.t(), opts :: keyword()) ::
  {:ok, Polarex.Meter.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Create Meter

Create a meter.

**Scopes**: `meters:write`

## Request Body

**Content Types**: `application/json`

# `meters_get`

```elixir
@spec meters_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.Meter.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Meter

Get a meter by ID.

**Scopes**: `meters:read` `meters:write`

# `meters_list`

```elixir
@spec meters_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceMeter.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Meters

List meters.

**Scopes**: `meters:read` `meters:write`

## Options

  * `organization_id`: Filter by organization ID.
  * `query`: Filter by name.
  * `is_archived`: Filter on archived meters.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.
  * `metadata`: Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`.

# `meters_quantities`

```elixir
@spec meters_quantities(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.MeterQuantities.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Meter Quantities

Get quantities of a meter over a time period.

**Scopes**: `meters:read` `meters:write`

## Options

  * `start_timestamp`: Start timestamp.
  * `end_timestamp`: End timestamp.
  * `interval`: Interval between two timestamps.
  * `timezone`: Timezone to use for the timestamps. Default is UTC.
  * `customer_id`: Filter by customer ID.
  * `external_customer_id`: Filter by external customer ID.
  * `customer_aggregation_function`: If set, will first compute the quantities per customer before aggregating them using the given function. If not set, the quantities will be aggregated across all events.
  * `metadata`: Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`.

# `meters_update`

```elixir
@spec meters_update(
  id :: String.t(),
  body :: Polarex.MeterUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.Meter.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Update Meter

Update a meter.

**Scopes**: `meters:write`

## Request Body

**Content Types**: `application/json`

# `metrics_create_dashboard`

```elixir
@spec metrics_create_dashboard(
  body :: Polarex.MetricDashboardCreate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.MetricDashboardSchema.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

Create Metric Dashboard

Create a user-defined metric dashboard.

**Scopes**: `metrics:write`

## Request Body

**Content Types**: `application/json`

# `metrics_delete_dashboard`

```elixir
@spec metrics_delete_dashboard(id :: String.t(), opts :: keyword()) ::
  :ok | {:error, Polarex.HTTPValidationError.t()}
```

Delete Metric Dashboard

Delete a user-defined metric dashboard.

**Scopes**: `metrics:write`

# `metrics_export`

```elixir
@spec metrics_export(opts :: keyword()) ::
  {:ok, map() | String.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Export Metrics

Export metrics as a CSV file.

**Scopes**: `metrics:read`

## Options

  * `start_date`: Start date.
  * `end_date`: End date.
  * `timezone`: Timezone to use for the timestamps. Default is UTC.
  * `interval`: Interval between two timestamps.
  * `organization_id`: Filter by organization ID.
  * `product_id`: Filter by product ID.
  * `billing_type`: Filter by billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases.
  * `customer_id`: Filter by customer ID.
  * `metrics`: List of metric slugs to include in the export. If not provided, all metrics are exported.

# `metrics_get`

```elixir
@spec metrics_get(opts :: keyword()) ::
  {:ok, Polarex.MetricsResponse.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Get Metrics

Get metrics about your orders and subscriptions.

Currency values are output in cents.

**Scopes**: `metrics:read`

## Options

  * `start_date`: Start date.
  * `end_date`: End date.
  * `timezone`: Timezone to use for the timestamps. Default is UTC.
  * `interval`: Interval between two timestamps.
  * `organization_id`: Filter by organization ID.
  * `product_id`: Filter by product ID.
  * `billing_type`: Filter by billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases.
  * `customer_id`: Filter by customer ID.
  * `metrics`: List of metric slugs to focus on. When provided, only the queries needed for these metrics will be executed, improving performance. If not provided, all metrics are returned.

# `metrics_get_dashboard`

```elixir
@spec metrics_get_dashboard(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.MetricDashboardSchema.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

Get Metric Dashboard

Get a user-defined metric dashboard by ID.

**Scopes**: `metrics:read`

# `metrics_limits`

```elixir
@spec metrics_limits(opts :: keyword()) :: {:ok, Polarex.MetricsLimits.t()} | :error
```

Get Metrics Limits

Get the interval limits for the metrics endpoint.

**Scopes**: `metrics:read`

# `metrics_list_dashboards`

```elixir
@spec metrics_list_dashboards(opts :: keyword()) ::
  {:ok, [Polarex.MetricDashboardSchema.t()]}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Metric Dashboards

List user-defined metric dashboards.

**Scopes**: `metrics:read`

## Options

  * `organization_id`: Filter by organization ID.

# `metrics_update_dashboard`

```elixir
@spec metrics_update_dashboard(
  id :: String.t(),
  body :: Polarex.MetricDashboardUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.MetricDashboardSchema.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

Update Metric Dashboard

Update a user-defined metric dashboard.

**Scopes**: `metrics:write`

## Request Body

**Content Types**: `application/json`

# `oauth2_authorize`

```elixir
@spec oauth2_authorize(opts :: keyword()) ::
  {:ok,
   Polarex.AuthorizeResponseOrganization.t() | Polarex.AuthorizeResponseUser.t()}
  | :error
```

Authorize

# `oauth2_clients_oauth2_create_client`

```elixir
@spec oauth2_clients_oauth2_create_client(
  body :: Polarex.OAuth2ClientConfiguration.t(),
  opts :: keyword()
) :: {:ok, map()} | {:error, Polarex.HTTPValidationError.t()}
```

Create Client

Create an OAuth2 client.

## Request Body

**Content Types**: `application/json`

# `oauth2_clients_oauth2_delete_client`

```elixir
@spec oauth2_clients_oauth2_delete_client(client_id :: String.t(), opts :: keyword()) ::
  {:ok, map()} | {:error, Polarex.HTTPValidationError.t()}
```

Delete Client

Delete an OAuth2 client.

# `oauth2_clients_oauth2_get_client`

```elixir
@spec oauth2_clients_oauth2_get_client(client_id :: String.t(), opts :: keyword()) ::
  {:ok, map()} | {:error, Polarex.HTTPValidationError.t()}
```

Get Client

Get an OAuth2 client by Client ID.

# `oauth2_clients_oauth2_update_client`

```elixir
@spec oauth2_clients_oauth2_update_client(
  client_id :: String.t(),
  body :: Polarex.OAuth2ClientConfigurationUpdate.t(),
  opts :: keyword()
) :: {:ok, map()} | {:error, Polarex.HTTPValidationError.t()}
```

Update Client

Update an OAuth2 client.

## Request Body

**Content Types**: `application/json`

# `oauth2_introspect_token`

```elixir
@spec oauth2_introspect_token(
  body :: Polarex.IntrospectTokenRequest.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.IntrospectTokenResponse.t()} | :error
```

Introspect Token

Get information about an access token.

## Request Body

**Content Types**: `application/x-www-form-urlencoded`

# `oauth2_request_token`

```elixir
@spec oauth2_request_token(
  body ::
    Polarex.AuthorizationCodeTokenRequest.t()
    | Polarex.RefreshTokenRequest.t()
    | Polarex.WebTokenRequest.t(),
  opts :: keyword()
) :: {:ok, Polarex.TokenResponse.t()} | :error
```

Request Token

Request an access token using a valid grant.

## Request Body

**Content Types**: `application/x-www-form-urlencoded`

# `oauth2_revoke_token`

```elixir
@spec oauth2_revoke_token(body :: Polarex.RevokeTokenRequest.t(), opts :: keyword()) ::
  {:ok, map()} | :error
```

Revoke Token

Revoke an access token or a refresh token.

## Request Body

**Content Types**: `application/x-www-form-urlencoded`

# `oauth2_userinfo`

```elixir
@spec oauth2_userinfo(opts :: keyword()) ::
  {:ok, Polarex.UserInfoOrganization.t() | Polarex.UserInfoUser.t()} | :error
```

Get User Info

Get information about the authenticated user.

# `orders_export`

```elixir
@spec orders_export(opts :: keyword()) ::
  {:ok, map() | String.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Export Orders

Export orders as a CSV file.

**Scopes**: `orders:read`

## Options

  * `organization_id`: Filter by organization ID.
  * `product_id`: Filter by product ID.

# `orders_generate_invoice`

```elixir
@spec orders_generate_invoice(id :: String.t(), opts :: keyword()) ::
  {:ok, map()}
  | {:error,
     Polarex.MissingInvoiceBillingDetails.t() | Polarex.NotPaidOrder.t()}
```

Generate Order Invoice

Trigger generation of an order's invoice.

**Scopes**: `orders:read`

# `orders_get`

```elixir
@spec orders_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.Order.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Order

Get an order by ID.

**Scopes**: `orders:read`

# `orders_invoice`

```elixir
@spec orders_invoice(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.OrderInvoice.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Order Invoice

Get an order's invoice data.

**Scopes**: `orders:read`

# `orders_list`

```elixir
@spec orders_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceOrder.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Orders

List orders.

**Scopes**: `orders:read`

## Options

  * `organization_id`: Filter by organization ID.
  * `product_id`: Filter by product ID.
  * `product_billing_type`: Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases.
  * `discount_id`: Filter by discount ID.
  * `customer_id`: Filter by customer ID.
  * `external_customer_id`: Filter by customer external ID.
  * `checkout_id`: Filter by checkout ID.
  * `subscription_id`: Filter by subscription ID.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.
  * `metadata`: Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`.

# `orders_receipt`

```elixir
@spec orders_receipt(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.OrderReceipt.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Order Receipt

Get a presigned URL to download an order's receipt PDF.

**Scopes**: `orders:read`

# `orders_update`

```elixir
@spec orders_update(
  id :: String.t(),
  body :: Polarex.OrderUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.Order.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Update Order

Update an order.

**Scopes**: `orders:write`

## Request Body

**Content Types**: `application/json`

# `organization_access_tokens_create`

```elixir
@spec organization_access_tokens_create(
  body :: Polarex.OrganizationAccessTokenCreate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.OrganizationAccessTokenCreateResponse.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

Create

**Scopes**: `organization_access_tokens:write`

## Request Body

**Content Types**: `application/json`

# `organization_access_tokens_delete`

```elixir
@spec organization_access_tokens_delete(id :: String.t(), opts :: keyword()) ::
  :ok | {:error, Polarex.HTTPValidationError.t()}
```

Delete

**Scopes**: `organization_access_tokens:write`

# `organization_access_tokens_list`

```elixir
@spec organization_access_tokens_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceOrganizationAccessToken.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List

List organization access tokens.

**Scopes**: `organization_access_tokens:read` `organization_access_tokens:write`

## Options

  * `organization_id`: Filter by organization ID.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `organization_access_tokens_update`

```elixir
@spec organization_access_tokens_update(
  id :: String.t(),
  body :: Polarex.OrganizationAccessTokenUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.OrganizationAccessToken.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

Update

**Scopes**: `organization_access_tokens:write`

## Request Body

**Content Types**: `application/json`

# `organizations_create`

```elixir
@spec organizations_create(body :: Polarex.OrganizationCreate.t(), opts :: keyword()) ::
  {:ok, Polarex.Organization.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Create Organization

Create an organization.

**Scopes**: `organizations:write`

## Request Body

**Content Types**: `application/json`

# `organizations_get`

```elixir
@spec organizations_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.Organization.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Organization

Get an organization by ID.

# `organizations_list`

```elixir
@spec organizations_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceOrganization.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Organizations

List organizations.

**Scopes**: `organizations:read` `organizations:write`

## Options

  * `slug`: Filter by slug.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `organizations_update`

```elixir
@spec organizations_update(
  id :: String.t(),
  body :: Polarex.OrganizationUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.Organization.t()}
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.NotPermitted.t()
     | Polarex.ResourceNotFound.t()}
```

Update Organization

Update an organization.

## Request Body

**Content Types**: `application/json`

# `payments_get`

```elixir
@spec payments_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.CardPayment.t() | Polarex.GenericPayment.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Payment

Get a payment by ID.

**Scopes**: `payments:read`

# `payments_list`

```elixir
@spec payments_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourcePayment.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Payments

List payments.

**Scopes**: `payments:read`

## Options

  * `organization_id`: Filter by organization ID.
  * `checkout_id`: Filter by checkout ID.
  * `order_id`: Filter by order ID.
  * `status`: Filter by payment status.
  * `method`: Filter by payment method.
  * `customer_email`: Filter by customer email.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `products_create`

```elixir
@spec products_create(
  body :: Polarex.ProductCreateOneTime.t() | Polarex.ProductCreateRecurring.t(),
  opts :: keyword()
) :: {:ok, Polarex.Product.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Create Product

Create a product.

**Scopes**: `products:write`

## Request Body

**Content Types**: `application/json`

# `products_get`

```elixir
@spec products_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.Product.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Product

Get a product by ID.

**Scopes**: `products:read` `products:write`

# `products_list`

```elixir
@spec products_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceProduct.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Products

List products.

**Scopes**: `products:read` `products:write`

## Options

  * `id`: Filter by product ID.
  * `organization_id`: Filter by organization ID.
  * `query`: Filter by product name.
  * `is_archived`: Filter on archived products.
  * `is_recurring`: Filter on recurring products. If `true`, only subscriptions tiers are returned. If `false`, only one-time purchase products are returned. 
  * `benefit_id`: Filter products granting specific benefit.
  * `visibility`: Filter by visibility.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.
  * `metadata`: Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`.

# `products_update`

```elixir
@spec products_update(
  id :: String.t(),
  body :: Polarex.ProductUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.Product.t()}
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.NotPermitted.t()
     | Polarex.ResourceNotFound.t()}
```

Update Product

Update a product.

**Scopes**: `products:write`

## Request Body

**Content Types**: `application/json`

# `products_update_benefits`

```elixir
@spec products_update_benefits(
  id :: String.t(),
  body :: Polarex.ProductBenefitsUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.Product.t()}
  | {:error,
     Polarex.HTTPValidationError.t()
     | Polarex.NotPermitted.t()
     | Polarex.ResourceNotFound.t()}
```

Update Product Benefits

Update benefits granted by a product.

**Scopes**: `products:write`

## Request Body

**Content Types**: `application/json`

# `refunds_create`

```elixir
@spec refunds_create(body :: Polarex.RefundCreate.t(), opts :: keyword()) ::
  {:ok, Polarex.Refund.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.RefundedAlready.t()}
```

Create Refund

Create a refund.

**Scopes**: `refunds:write`

## Request Body

**Content Types**: `application/json`

# `refunds_list`

```elixir
@spec refunds_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceRefund.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Refunds

List refunds.

**Scopes**: `refunds:read` `refunds:write`

## Options

  * `id`: Filter by refund ID.
  * `organization_id`: Filter by organization ID.
  * `order_id`: Filter by order ID.
  * `subscription_id`: Filter by subscription ID.
  * `customer_id`: Filter by customer ID.
  * `external_customer_id`: Filter by customer external ID.
  * `succeeded`: Filter by `succeeded`.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.

# `subscriptions_create`

```elixir
@spec subscriptions_create(
  body ::
    Polarex.SubscriptionCreateCustomer.t()
    | Polarex.SubscriptionCreateExternalCustomer.t(),
  opts :: keyword()
) :: {:ok, Polarex.Subscription.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Create Subscription

Create a subscription programmatically.

This endpoint only allows to create subscription on free products.
For paid products, use the checkout flow.

No initial order will be created and no confirmation email will be sent.

**Scopes**: `subscriptions:write`

## Request Body

**Content Types**: `application/json`

# `subscriptions_export`

```elixir
@spec subscriptions_export(opts :: keyword()) ::
  {:ok, map() | String.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Export Subscriptions

Export subscriptions as a CSV file.

**Scopes**: `subscriptions:read` `subscriptions:write`

## Options

  * `organization_id`: Filter by organization ID.

# `subscriptions_get`

```elixir
@spec subscriptions_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.Subscription.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Subscription

Get a subscription by ID.

**Scopes**: `subscriptions:read` `subscriptions:write`

# `subscriptions_list`

```elixir
@spec subscriptions_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceSubscription.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Subscriptions

List subscriptions.

**Scopes**: `subscriptions:read` `subscriptions:write`

## Options

  * `organization_id`: Filter by organization ID.
  * `product_id`: Filter by product ID.
  * `customer_id`: Filter by customer ID.
  * `external_customer_id`: Filter by customer external ID.
  * `discount_id`: Filter by discount ID.
  * `active`: Filter by active or inactive subscription.
  * `cancel_at_period_end`: Filter by subscriptions that are set to cancel at period end.
  * `customer_cancellation_reason`: Filter by customer cancellation reason.
  * `canceled_at_after`: Filter by cancellation date (after or equal to).
  * `canceled_at_before`: Filter by cancellation date (before or equal to).
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.
  * `sorting`: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.
  * `metadata`: Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`.

# `subscriptions_revoke`

```elixir
@spec subscriptions_revoke(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.Subscription.t()}
  | {:error,
     Polarex.AlreadyCanceledSubscription.t()
     | Polarex.HTTPValidationError.t()
     | Polarex.ResourceNotFound.t()
     | Polarex.SubscriptionLocked.t()}
```

Revoke Subscription

Revoke a subscription, i.e cancel immediately.

**Scopes**: `subscriptions:write`

# `subscriptions_update`

```elixir
@spec subscriptions_update(
  id :: String.t(),
  body ::
    Polarex.SubscriptionCancel.t()
    | Polarex.SubscriptionRevoke.t()
    | Polarex.SubscriptionUpdateBillingPeriod.t()
    | Polarex.SubscriptionUpdateClear.t()
    | Polarex.SubscriptionUpdateDiscount.t()
    | Polarex.SubscriptionUpdateProduct.t()
    | Polarex.SubscriptionUpdateSeats.t()
    | Polarex.SubscriptionUpdateTrial.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.Subscription.t()}
  | {:error,
     Polarex.AlreadyCanceledSubscription.t()
     | Polarex.HTTPValidationError.t()
     | Polarex.PaymentFailed.t()
     | Polarex.ResourceNotFound.t()
     | Polarex.SubscriptionLocked.t()}
```

Update Subscription

Update a subscription.

**Scopes**: `subscriptions:write`

## Request Body

**Content Types**: `application/json`

# `webhooks_create_webhook_endpoint`

```elixir
@spec webhooks_create_webhook_endpoint(
  body :: Polarex.WebhookEndpointCreate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.WebhookEndpoint.t()} | {:error, Polarex.HTTPValidationError.t()}
```

Create Webhook Endpoint

Create a webhook endpoint.

**Scopes**: `webhooks:write`

## Request Body

**Content Types**: `application/json`

# `webhooks_delete_webhook_endpoint`

```elixir
@spec webhooks_delete_webhook_endpoint(id :: String.t(), opts :: keyword()) ::
  :ok | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Delete Webhook Endpoint

Delete a webhook endpoint.

**Scopes**: `webhooks:write`

# `webhooks_get_webhook_endpoint`

```elixir
@spec webhooks_get_webhook_endpoint(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.WebhookEndpoint.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Get Webhook Endpoint

Get a webhook endpoint by ID.

**Scopes**: `webhooks:read` `webhooks:write`

# `webhooks_list_webhook_deliveries`

```elixir
@spec webhooks_list_webhook_deliveries(opts :: keyword()) ::
  {:ok, Polarex.ListResourceWebhookDelivery.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Webhook Deliveries

List webhook deliveries.

Deliveries are all the attempts to deliver a webhook event to an endpoint.

**Scopes**: `webhooks:read` `webhooks:write`

## Options

  * `endpoint_id`: Filter by webhook endpoint ID.
  * `start_timestamp`: Filter deliveries after this timestamp.
  * `end_timestamp`: Filter deliveries before this timestamp.
  * `succeeded`: Filter by delivery success status.
  * `query`: Query to filter webhook deliveries.
  * `http_code_class`: Filter by HTTP response code class (2xx, 3xx, 4xx, 5xx).
  * `event_type`: Filter by webhook event type.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.

# `webhooks_list_webhook_endpoints`

```elixir
@spec webhooks_list_webhook_endpoints(opts :: keyword()) ::
  {:ok, Polarex.ListResourceWebhookEndpoint.t()}
  | {:error, Polarex.HTTPValidationError.t()}
```

List Webhook Endpoints

List webhook endpoints.

**Scopes**: `webhooks:read` `webhooks:write`

## Options

  * `organization_id`: Filter by organization ID.
  * `page`: Page number, defaults to 1.
  * `limit`: Size of a page, defaults to 10. Maximum is 100.

# `webhooks_redeliver_webhook_event`

```elixir
@spec webhooks_redeliver_webhook_event(id :: String.t(), opts :: keyword()) ::
  {:ok, map()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Redeliver Webhook Event

Schedule the re-delivery of a webhook event.

**Scopes**: `webhooks:write`

# `webhooks_reset_webhook_endpoint_secret`

```elixir
@spec webhooks_reset_webhook_endpoint_secret(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.WebhookEndpoint.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Reset Webhook Endpoint Secret

Regenerate a webhook endpoint secret.

**Scopes**: `webhooks:write`

# `webhooks_update_webhook_endpoint`

```elixir
@spec webhooks_update_webhook_endpoint(
  id :: String.t(),
  body :: Polarex.WebhookEndpointUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.WebhookEndpoint.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}
```

Update Webhook Endpoint

Update a webhook endpoint.

**Scopes**: `webhooks:write`

## Request Body

**Content Types**: `application/json`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
