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

# Managing Customers

> Learn how to update and manage customers using our API

## Get a customer

You can get a customer using the [GET customer](/api-reference/endpoint/get) endpoint.

<CodeGroup>
  ```ts TypeScript theme={null}
  const customer = await priceos.customers.get("customer_123");
  ```

  ```bash cURL theme={null}
  curl -X GET "https://api.priceos.com/v1/customers/customer_123" \
    -H "x-api-key: PRICEOS_API_KEY"
  ```
</CodeGroup>

<Tip>The customer object will have feature access info too. </Tip>

***

## Update a customer

You can use the [PUT customer](/api-reference/endpoint/update) endpoint to update customer info, add/remove custom products, and more.

<Tabs>
  <Tab title="Update Email/Name">
    <CodeGroup>
      ```ts TypeScript theme={null}
      const customer = await priceos.customers.update({
        customerId: "customer_123",
        name: "Alex Johnson",
        email: "alex@acme.com",
      });
      ```

      ```bash cURL theme={null}
      curl -X PUT "https://api.priceos.com/v1/customers/customer_123" \
        -H "x-api-key: PRICEOS_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "name": "Alex Johnson",
          "email": "alex@acme.com"
        }'
      ```
    </CodeGroup>

    <Warning>If the customer exists in Stripe, then any updates to name/email will be overwritten if updated again in Stripe. </Warning>
  </Tab>

  <Tab title="Add Custom Products">
    Use `customProductKeys` in `customers.update` to set custom product assignments.

    <CodeGroup>
      ```ts TypeScript theme={null}
      const customer = await priceos.customers.update({
        customerId: "customer_123",
        customProductKeys: ["custom_basic", "custom_addon"],
      });
      ```

      ```bash cURL theme={null}
      curl -X PUT "https://api.priceos.com/v1/customers/customer_123" \
        -H "x-api-key: PRICEOS_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "customProductKeys": ["custom_basic", "custom_addon"]
        }'
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Remove Custom Products">
    To remove one or more custom products, call update with the remaining `customProductKeys`.
    To remove all custom products, send an empty array.

    <CodeGroup>
      ```ts TypeScript theme={null}
      const customer = await priceos.customers.update({
        customerId: "customer_123",
        customProductKeys: [],
      });
      ```

      ```bash cURL theme={null}
      curl -X PUT "https://api.priceos.com/v1/customers/customer_123" \
        -H "x-api-key: PRICEOS_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "customProductKeys": []
        }'
      ```
    </CodeGroup>

    <Warning>
      This only applies to custom products. Stripe product access is removed in Stripe (cancel/update subscription).
    </Warning>
  </Tab>
</Tabs>

***

## Delete a customer

You can delete customers using the [DELETE customer](/api-reference/endpoint/delete) endpoint.

<CodeGroup>
  ```ts TypeScript theme={null}
  const result = await priceos.customers.delete("customer_123");
  ```

  ```bash cURL theme={null}
  curl -X DELETE "https://api.priceos.com/v1/customers/customer_123" \
    -H "x-api-key: PRICEOS_API_KEY"
  ```
</CodeGroup>

<Warning>If a customer exists in Stripe, you will need to delete the customer in Stripe - not PriceOS.</Warning>
