---
title: "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.

Path: Sherpo merchant API › transaction

`POST /v1/stores/{store}/revocations`

## Authentication

- `bearer`, http, header `Authorization`, scopes: `transaction:write`

## Path parameters

- `store` (`createRevocation.path.store`; string, required) — The store's id.

## Header parameters

- `Idempotency-Key` (`createRevocation.header.Idempotency-Key`; string, optional) — Repeats within 24 hours answer the first result; the same key with other arguments is a conflict.
  - minLength 1; maxLength 255; pattern `^[\x21-\x7E]+$`

## Request body

_Required._

- `cause` (`createRevocation.cause`; string, required)
  - one of `"other"`, `"terms_violation"`, `"fraud"`, `"chargeback"`, `"abuse"`
- `text_format` (`createRevocation.text_format`; string, optional) — 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.
  - one of `"html"`, `"markdown"`; default `"html"`
- `order` (`createRevocation.order`; object, optional) — The purchase whose products the customer loses; give this or `grant`.
  - `id` (`createRevocation.order.id`; string, required)
    - minLength 1; maxLength 512
- `grant` (`createRevocation.grant`; object, optional) — The grant whose product the customer loses; give this or `order`.
  - `id` (`createRevocation.grant.id`; string, required)
    - minLength 1; maxLength 512
- `note` (`createRevocation.note`; any of, optional) — Staff's own words, never shown to the customer.
  - any of: `string`, `null`
- `message` (`createRevocation.message`; any of, optional) — 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.
  - any of: `string`, `null`
- `refund` (`createRevocation.refund`; any of, optional) — Money given back with it; without one, none moves.
  - any of: `object`, `null`

## Example request

```json
{
  "text_format": "html",
  "order": {
    "id": "string"
  },
  "grant": {
    "id": "string"
  },
  "cause": "other",
  "note": "string",
  "message": "string",
  "refund": {
    "amount": 1,
    "via": "stripe",
    "settlement": {
      "id": "string"
    },
    "processor_ref": "string"
  }
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sherpo.io/merchant/v1/stores/<store>/revocations' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "text_format": "html",
  "order": {
    "id": "string"
  },
  "grant": {
    "id": "string"
  },
  "cause": "other",
  "note": "string",
  "message": "string",
  "refund": {
    "amount": 1,
    "via": "stripe",
    "settlement": {
      "id": "string"
    },
    "processor_ref": "string"
  }
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/merchant/v1/stores/<store>/revocations';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    text_format: 'html',
    order: {id: 'string'},
    grant: {id: 'string'},
    cause: 'other',
    note: 'string',
    message: 'string',
    refund: {amount: 1, via: 'stripe', settlement: {id: 'string'}, processor_ref: 'string'}
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sherpo.io/merchant/v1/stores/<store>/revocations"

payload = {
    "text_format": "html",
    "order": { "id": "string" },
    "grant": { "id": "string" },
    "cause": "other",
    "note": "string",
    "message": "string",
    "refund": {
        "amount": 1,
        "via": "stripe",
        "settlement": { "id": "string" },
        "processor_ref": "string"
    }
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

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.

#### Example

```json
{
  "id": "string",
  "customer_id": "string",
  "order_id": "string",
  "grant_id": "string",
  "product_ids": [
    "string"
  ],
  "cause": "string",
  "note": "string",
  "message": "string",
  "refund": {
    "via": "string",
    "amount": 0,
    "currency": "string",
    "exponent": 0,
    "settlement_id": "string",
    "refund_id": "string",
    "status": "string"
  },
  "revoked_by": "string",
  "token_id": "string",
  "created_at": "string"
}
```

- `id` (`createRevocation.response.201.id`; string, required)
- `customer_id` (`createRevocation.response.201.customer_id`; string, required)
- `order_id` (`createRevocation.response.201.order_id`; any of, required)
  - any of: `string`, `null`
- `grant_id` (`createRevocation.response.201.grant_id`; any of, required)
  - any of: `string`, `null`
- `product_ids` (`createRevocation.response.201.product_ids`; array<string>, required)
- `cause` (`createRevocation.response.201.cause`; string, required)
- `note` (`createRevocation.response.201.note`; any of, required)
  - any of: `string`, `null`
- `message` (`createRevocation.response.201.message`; any of, required)
  - any of: `string`, `null`
- `refund` (`createRevocation.response.201.refund`; any of, required)
  - any of: `object`, `null`
- `revoked_by` (`createRevocation.response.201.revoked_by`; any of, required)
  - any of: `string`, `null`
- `token_id` (`createRevocation.response.201.token_id`; any of, required)
  - any of: `string`, `null`
- `created_at` (`createRevocation.response.201.created_at`; any of, required)
  - any of: `string`, `null`

### default

A problem; see https://api.sherpo.io/merchant/docs/errors.

#### Example

```json
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "context": {},
  "reached_core": true,
  "core_answer": "string"
}
```

- `type` (`createRevocation.response.default.type`; string, required)
  - format `uri`
- `title` (`createRevocation.response.default.title`; string, required)
- `status` (`createRevocation.response.default.status`; integer, required)
- `detail` (`createRevocation.response.default.detail`; string, required)
- `code` (`createRevocation.response.default.code`; string, optional)
- `context` (`createRevocation.response.default.context`; object, optional)
- `reached_core` (`createRevocation.response.default.reached_core`; boolean, optional)
- `core_answer` (`createRevocation.response.default.core_answer`; string, optional)


Source: https://docs.sherpo.io/merchant-api/reference/create-revocation/index.md
