Skip to content

Ban customers

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.

Updated

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 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

POST /customer_bans adds a ban to the store’s list:

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."
}'
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:

{
  "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:

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]+@.+"
}'
const answer = await sherpo('POST', '/v1/stores/STORE_ID/customer_bans', {
  body: {
    "kind": "pattern",
    "value": "reseller[0-9]+@.+"
  },
  key: 'ban-pattern',
});

Answers 201, abridged:

{
  "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, 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

GET /customer_bans lists the store’s bans, newest first, searched by value and note:

curl 'https://api.sherpo.io/merchant/v1/stores/STORE_ID/customer_bans' \
  -H "Authorization: Bearer $SHERPO_TOKEN"
const answer = await sherpo('GET', '/v1/stores/STORE_ID/customer_bans');

Answers 200, abridged:

{
  "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
}

PATCH /customer_bans/{ban} changes a ban’s value or note, and DELETE /customer_bans/{ban} lifts it: the address may become a customer again, unless the business bans it too.

Ban across the business

POST /business_bans adds a ban every store of the business applies, a store opened later included:

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."
}'
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:

{
  "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. GET /business_bans, PATCH /business_bans/{ban} and DELETE /business_bans/{ban} 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. GET /customer_bans/matches 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:

curl 'https://api.sherpo.io/merchant/v1/stores/STORE_ID/customer_bans/matches?kind=domain&value=resold.example' \
  -H "Authorization: Bearer $SHERPO_TOKEN"
const answer = await sherpo('GET', '/v1/stores/STORE_ID/customer_bans/matches', {
  query: [
    ['kind', 'domain'],
    ['value', 'resold.example'],
  ],
});

Answers 200, abridged:

{
  "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 POST /grants/{grant}/revoke, as Customers’ access shows.

Type to search…

↑↓ navigate↵ selectEsc close