---
title: "Ban customers"
description: "Keep an email domain, an address or a pattern of addresses from buying, claiming, requesting, joining a waitlist or signing in, on one store or across a business."
---

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

# Ban customers

A ban keeps an address from becoming or acting as your customer: it can't buy, claim a free product, request one, join a waitlist, be granted access or sign in. Each store keeps its own list, and the business keeps one that every store applies beside its own. This guide adds bans and finds the customers one would reach. It uses the `sherpo` helper from [your first call](/merchant-api/first-call) and a token with `customer:read`, `customer:write` and `customer:delete` for a store's list, and `organization:read`, `organization:write` and `organization:delete` for the business's.

## Ban an address

<a href="/merchant-api/reference/create-customer-ban/">`POST /customer_bans`</a> adds a ban to the store's list:

```bash
curl -X POST 'https://api.sherpo.io/merchant/v1/stores/STORE_ID/customer_bans' \
  -H "Authorization: Bearer $SHERPO_TOKEN" \
  -H 'Idempotency-Key: ban-resold' \
  -H 'Content-Type: application/json' \
  -d '{
  "kind": "domain",
  "value": "resold.example",
  "note": "Resold access against the terms."
}'
```

```js
const answer = await sherpo('POST', '/v1/stores/STORE_ID/customer_bans', {
  body: {
    "kind": "domain",
    "value": "resold.example",
    "note": "Resold access against the terms."
  },
  key: 'ban-resold',
});
```

Answers `201`, abridged:

```json
{
  "id": "5f6a7b8c-9d0e-4f1a-8b2c-3d4e5f6a7b8c",
  "kind": "domain",
  "value": "resold.example",
  "note": "Resold access against the terms.",
  "created_at": "2026-11-17T10:00:00.000Z",
  "updated_at": "2026-11-17T10:00:00.000Z"
}
```

- **`kind`** is what the ban names: `domain`, `email` or `pattern`. It stays what it was created with.
- **`value`** is the domain, the address or the pattern. A domain bans every address at it and at its subdomains, so `resold.example` also bans `ana@mail.resold.example`, but not `ana@notresold.example`. An address bans that address alone, so `ana+shop@resold.example` is another one: ban the domain or write a pattern to reach both. Domains and addresses are kept in lowercase, a leading `@` dropped, and an internationalized domain in its ASCII form.
- **`note`** says why, for your team alone. No customer ever sees it.

A ban already on the list answers `conflict` on `value`. A list holds up to 500 bans.

## Ban a pattern of addresses

A **`pattern`** is a regular expression the whole address must match, in lowercase, so `reseller[0-9]+@.+` bans `reseller7@mail.example` and every address like it:

```bash
curl -X POST 'https://api.sherpo.io/merchant/v1/stores/STORE_ID/customer_bans' \
  -H "Authorization: Bearer $SHERPO_TOKEN" \
  -H 'Idempotency-Key: ban-pattern' \
  -H 'Content-Type: application/json' \
  -d '{
  "kind": "pattern",
  "value": "reseller[0-9]+@.+"
}'
```

```js
const answer = await sherpo('POST', '/v1/stores/STORE_ID/customer_bans', {
  body: {
    "kind": "pattern",
    "value": "reseller[0-9]+@.+"
  },
  key: 'ban-pattern',
});
```

Answers `201`, abridged:

```json
{
  "id": "6a7b8c9d-0e1f-4a2b-9c3d-4e5f6a7b8c9d",
  "kind": "pattern",
  "value": "reseller[0-9]+@.+",
  "note": null,
  "created_at": "2026-11-17T10:02:00.000Z",
  "updated_at": "2026-11-17T10:02:00.000Z"
}
```

Patterns take the same safe subset as [registration questions](/merchant-api/guides/registration-questions#check-a-text-answers-format), up to 200 characters, and the matching takes time in step with the address whatever the pattern. A pattern outside the subset, or one too large to check against the longest address, answers `invalid` on `value` with the reason it can't be checked safely, and so does one with an uppercase letter, which a lowercased address would never match. A list holds up to 20 patterns.

## List, change and lift bans

<a href="/merchant-api/reference/list-customer-bans/">`GET /customer_bans`</a> lists the store's bans, newest first, searched by value and note:

```bash
curl 'https://api.sherpo.io/merchant/v1/stores/STORE_ID/customer_bans' \
  -H "Authorization: Bearer $SHERPO_TOKEN"
```

```js
const answer = await sherpo('GET', '/v1/stores/STORE_ID/customer_bans');
```

Answers `200`, abridged:

```json
{
  "items": [
    {
      "id": "6a7b8c9d-0e1f-4a2b-9c3d-4e5f6a7b8c9d",
      "kind": "pattern",
      "value": "reseller[0-9]+@.+",
      "note": null,
      "created_at": "2026-11-17T10:02:00.000Z",
      "updated_at": "2026-11-17T10:02:00.000Z"
    },
    {
      "id": "5f6a7b8c-9d0e-4f1a-8b2c-3d4e5f6a7b8c",
      "kind": "domain",
      "value": "resold.example",
      "note": "Resold access against the terms.",
      "created_at": "2026-11-17T10:00:00.000Z",
      "updated_at": "2026-11-17T10:00:00.000Z"
    }
  ],
  "cursor": null
}
```

<a href="/merchant-api/reference/update-customer-ban/">`PATCH /customer_bans/{ban}`</a> changes a ban's value or note, and <a href="/merchant-api/reference/delete-customer-ban/">`DELETE /customer_bans/{ban}`</a> lifts it: the address may become a customer again, unless the business bans it too.

## Ban across the business

<a href="/merchant-api/reference/create-business-ban/">`POST /business_bans`</a> adds a ban every store of the business applies, a store opened later included:

```bash
curl -X POST 'https://api.sherpo.io/merchant/v1/stores/STORE_ID/business_bans' \
  -H "Authorization: Bearer $SHERPO_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "kind": "email",
  "value": "chargebacks@mail.example",
  "note": "Disputed every order."
}'
```

```js
const answer = await sherpo('POST', '/v1/stores/STORE_ID/business_bans', {
  body: {
    "kind": "email",
    "value": "chargebacks@mail.example",
    "note": "Disputed every order."
  },
});
```

Answers `201`, abridged:

```json
{
  "id": "7b8c9d0e-1f2a-4b3c-8d4e-5f6a7b8c9d0e",
  "kind": "email",
  "value": "chargebacks@mail.example",
  "note": "Disputed every order.",
  "created_at": "2026-11-17T10:05:00.000Z",
  "updated_at": "2026-11-17T10:05:00.000Z"
}
```

It takes the same `kind`, `value` and `note`, with the same limits. <a href="/merchant-api/reference/list-business-bans/">`GET /business_bans`</a>, <a href="/merchant-api/reference/update-business-ban/">`PATCH /business_bans/{ban}`</a> and <a href="/merchant-api/reference/delete-business-ban/">`DELETE /business_bans/{ban}`</a> read, change and lift them. A change reaches every store shortly after it lands.

## What a banned address meets

A ban never tells the customer they are banned:

- Signing in by code answers as it always does, but no code is sent, and a code sent before the ban signs no one in. Signing in with Google or Apple, a passkey, or through your own app's accounts is refused as a sign-in that failed.
- Freezing or paying for a cart, claiming a free product, requesting one or joining a waitlist answers `not_entitled` on the product, as if it weren't available to them. A cart naming a banned guest for an event ticket is refused the same way. A payment started before the ban is called off when the store next reads it, unless the buyer already confirmed it with the payment provider, in which case it goes through.
- Your own grants, licenses, recorded sales and approvals of a request or a waitlist place answer `conflict` on `email` with the reason that the address is banned, so you see why.
- An automation that would unlock a product for a banned customer skips the run, with `customer banned` as its reason.

## Revoke the access already given

A ban never touches access a customer already holds: a session stays signed in, and what they bought, or paid for before the ban, stays theirs. <a href="/merchant-api/reference/match-customer-ban/">`GET /customer_bans/matches`</a> lists the customers holding access now whose address a ban would name, with the grants giving it (`more_grants` says when a customer holds more than are listed), so you can revoke them too:

```bash
curl 'https://api.sherpo.io/merchant/v1/stores/STORE_ID/customer_bans/matches?kind=domain&value=resold.example' \
  -H "Authorization: Bearer $SHERPO_TOKEN"
```

```js
const answer = await sherpo('GET', '/v1/stores/STORE_ID/customer_bans/matches', {
  query: [
    ['kind', 'domain'],
    ['value', 'resold.example'],
  ],
});
```

Answers `200`, abridged:

```json
{
  "customers": [
    {
      "id": "7e6d5c4b-3a29-4180-9f7e-6d5c4b3a2918",
      "display_name": "Ada Lovelace",
      "emails": [
        "ada@resold.example"
      ],
      "grants": [
        {
          "id": "4b3a2918-0f7e-4d6c-9b5a-4c3b2a190807",
          "product_id": "6f1c2a9e-4b7d-4e2a-9c51-0d3e8b7a1f42"
        }
      ]
    }
  ],
  "complete": true
}
```

It takes a `kind` and a `value` as a ban does, before or after you add it. It answers a page of them at most; `complete` is `false` when more may match. Revoke each grant with <a href="/merchant-api/reference/revoke-grant/">`POST /grants/{grant}/revoke`</a>, as [Customers' access](/merchant-api/guides/customer-access) shows.

Source: https://docs.sherpo.io/merchant-api/guides/ban-customers/index.mdx
