---
title: "Revoke access"
description: "Revokes a customer's access to a purchase's products, or a grant's, for cause: their access ends at once, their subscriptions to them stop, the customer is mailed with an optional message, and an optional refund is sent through Stripe or recorded."
---

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

# Revoke access

Needs the transaction:write scope.

Rich text (message) is HTML in a closed format: p, h1 to h3, br, strong, em, u, s, sup, sub, code, a (href), span (style color, background-color), text-align on p and h1 to h3, ul, ol, li (data-checked), table rows and cells, pre with code, blockquote, hr, details with summary, figure with figcaption, and <block type="…" props="{…}" /> for images, videos, audio, slideshows, formulas, diagrams and other blocks, their props as getBodySchema lists them; anything else is refused with its path and reason. E.g. <h2>Intro</h2><p>Read <strong>this</strong> first.</p> Set text\_format to "markdown" to write Markdown instead.

## Call

- Tool: `create_revocation`
- Scope: `transaction:write`
- Writes, adding without changing what is there.
- Acts on a store.

## Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `store` | `string` | No | The store to act on. |
| `text_format` | `"html" or "markdown"` | No | The format the rich text fields are written in: the rich text format’s HTML, or Markdown converted into it before it is validated. A text already stored in the format (starting with `<rich-text`) is kept as it is either way. |
| `order` | `object` | No | The purchase whose products the customer loses; give this or `grant`. |
| `grant` | `object` | No | The grant whose product the customer loses; give this or `order`. |
| `cause` | `"other" or "terms_violation" or "fraud" or "chargeback" or "abuse"` | Yes |  |
| `note` | `string or null` | No | Staff's own words, never shown to the customer. |
| `message` | `string or null` | No | The seller's words to the customer, added to the mail that always tells them: a rich text with no blocks, stored in its canonical form in 16 KiB of UTF-8; empty sends none. |
| `refund` | `object or null` | No | Money given back with it; without one, none moves. |

```json
{
  "type": "object",
  "properties": {
    "store": {
      "type": "string",
      "description": "The store to act on."
    },
    "text_format": {
      "type": "string",
      "enum": [
        "html",
        "markdown"
      ],
      "default": "html",
      "description": "The format the rich text fields are written in: the rich text format’s HTML, or Markdown converted into it before it is validated. A text already stored in the format (starting with `<rich-text`) is kept as it is either way."
    },
    "order": {
      "description": "The purchase whose products the customer loses; give this or `grant`.",
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      },
      "required": [
        "id"
      ],
      "additionalProperties": false
    },
    "grant": {
      "description": "The grant whose product the customer loses; give this or `order`.",
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512
        }
      },
      "required": [
        "id"
      ],
      "additionalProperties": false
    },
    "cause": {
      "type": "string",
      "enum": [
        "other",
        "terms_violation",
        "fraud",
        "chargeback",
        "abuse"
      ]
    },
    "note": {
      "description": "Staff's own words, never shown to the customer.",
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        },
        {
          "type": "null"
        }
      ]
    },
    "message": {
      "description": "The seller's words to the customer, added to the mail that always tells them: a rich text with no blocks, stored in its canonical form in 16 KiB of UTF-8; empty sends none.",
      "anyOf": [
        {
          "type": "string",
          "maxLength": 16384
        },
        {
          "type": "null"
        }
      ],
      "x-rich-text": "text"
    },
    "refund": {
      "description": "Money given back with it; without one, none moves.",
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "amount": {
              "type": "integer",
              "minimum": 1
            },
            "via": {
              "description": "Sent through Stripe, or recorded as given back elsewhere.",
              "type": "string",
              "enum": [
                "stripe",
                "recorded"
              ]
            },
            "settlement": {
              "description": "The payment it comes off; the order's only one, or the grant's, when left out.",
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 512
                }
              },
              "required": [
                "id"
              ],
              "additionalProperties": false
            },
            "processor_ref": {
              "description": "The processor's own id of a refund made elsewhere.",
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "amount",
            "via"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "cause"
  ],
  "additionalProperties": false
}
```

## Answer

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes |  |
| `customer_id` | `string` | Yes |  |
| `order_id` | `string or null` | Yes |  |
| `grant_id` | `string or null` | Yes |  |
| `product_ids` | `array of string` | Yes |  |
| `cause` | `string` | Yes |  |
| `note` | `string or null` | Yes |  |
| `message` | `string or null` | Yes |  |
| `refund` | `object or null` | Yes |  |
| `revoked_by` | `string or null` | Yes |  |
| `token_id` | `string or null` | Yes |  |
| `created_at` | `string or null` | Yes |  |

The answer's full shape is on [its API reference page](/merchant-api/reference/create-revocation).

## Errors

A refused call is a tool error. Its `structuredContent` holds a `code` and its `context`, except for `client-fault`. This tool may answer:

- `invalid`: an argument is malformed; `context.path` names it.
- `invalid` at `["store"]`: `store` is missing while the connection reaches more than one store, or names a store it doesn't reach.
- `not_found`: nothing matches a reference given.
- `conflict`: the call clashes with the current state; `context` names the field and, where it helps, its current value, and for a `from`, `live`, `expect` or version that no longer matches, the argument (`path`) and what it takes (`reason`).
- `not_permitted`: this connection may not make this call. When `context.reason` is `limit`, too many calls: `retry_after` says when to try again.
- `internal` or `unavailable`: the call failed inside Sherpo, and the write may have landed. This write takes no idempotency key, so read the state back before trying again.
- `client-fault`: the server failed around the call. `core_answer` `ok` means the write landed, so don't send it again. When `reached_core` is false, nothing happened and the call may be made again. Otherwise, this write takes no idempotency key, so read the state back before trying again.
- HTTP 403 with `insufficient_scope`: the connection lacks the scope this tool needs.
- HTTP 401 with `invalid_token`: the access token expired or the connection ended. Refresh the token, and connect again if the refresh fails or the new token is refused too.

Any other code may come back too, such as a `conflict` when the state changed under the call. When the answer was already streaming, a 401 or 403 comes back as a tool error with only its text. See [Errors](/merchant-mcp/errors) for every code and its context.

Source: https://docs.sherpo.io/merchant-mcp/tools/create_revocation/index.mdx
