> ## Documentation Index
> Fetch the complete documentation index at: https://plain-docs-orca-916-agent-docs-restructure.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch customers

> Fetch customers by ID, email, or external ID, or as a paginated collection.

There are five ways to fetch customers:

* [Get customers](#get-customers) (To fetch more than one customer at a time)
* [Get customer by ID](#get-customer-by-id)
* [Get customer by email](#get-customer-by-email)
* [Get customer by external ID](#get-customer-by-external-id)
* [Search for customers](#search-for-customers)

<Snippet file="graphql/sdk-note.mdx" />

These operations require the following permissions:

* `customer:read`

## Get customers

Our API allows you to fetch customers as a collection using the `customers` query in GraphQL. This endpoint supports [Pagination](/graphql/pagination).

This endpoint supports a range of filtering and sorting options, for full details try our [API explorer](https://app.plain.com/developer/api-explorer/).

<Snippet file="graphql/get-customers.mdx" />

## Get customer by ID

If you already have the ID of a customer from within Plain or one of our other endpoints you can fetch more details about them using the `customer` query in GraphQL.

<Snippet file="graphql/get-customer-by-id.mdx" />

## Get customer by email

To fetch a customer by email you can use the `customerByEmail` query in GraphQL.

<Snippet file="graphql/get-customer-by-email.mdx" />

## Get customer by external ID

If you store a stable identifier from your own system on Plain customers (for example your internal user ID), you can fetch the customer back by that value using the `customerByExternalId` query.

External IDs are unique within a workspace.

<Snippet file="graphql/get-customer-by-external-id.mdx" />

## Search for customers

The `searchCustomers` query lets you do a case-insensitive partial match across a customer's name, email, short name and external ID. This is the same search behavior as the customer picker in the Plain app and is best suited for human-driven lookups rather than precise programmatic resolution.

For exact lookups by email or external ID, prefer [`customerByEmail`](#get-customer-by-email) or [`customerByExternalId`](#get-customer-by-external-id).

<Snippet file="graphql/search-customers.mdx" />
