---
title: "Creates a customer notification for an event."
---

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

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

## Authentication

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

## Path parameters

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

## Header parameters

- `Idempotency-Key` (`createNotification.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._

- `event` (`createNotification.event`; string, required)
  - one of `"products.unlocked"`, `"request.received"`, `"request.waitlisted"`, `"request.approved"`, `"request.declined"`, `"request.expired"`, `"request.payment_due"`, `"discounts.unlocked"`, `"refund.processed"`, `"affiliate.earned"`, `"subscription.created"`, `"subscription.renewed"`, `"subscription.reminder"`, `"subscription.plan_changed"`, `"subscription.payment_failed"`, `"subscription.past_due"`, `"subscription.unpaid"`, `"subscription.canceled"`, `"subscription.reactivated"`, `"event.registered"`, `"event.updated"`, `"event.canceled"`, `"event.purchase_canceled"`, `"event.refund_failed"`
- `target` (`createNotification.target`; any of, optional)
  - any of: `object`, `null`
- `locale` (`createNotification.locale`; string, optional)
  - minLength 1; maxLength 5; pattern `^[a-z]{2}(?:-[A-Z]{2})?$`
- `channel` (`createNotification.channel`; string, optional) — Only `email`: `webhook` is refused, since webhooks are endpoints of their own.
  - one of `"email"`, `"webhook"`
- `enabled` (`createNotification.enabled`; boolean, optional)

## Example request

```json
{
  "event": "products.unlocked",
  "target": {
    "kind": "product",
    "id": "string"
  },
  "locale": "strin",
  "channel": "email",
  "enabled": true
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sherpo.io/merchant/v1/stores/<store>/notifications' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "event": "products.unlocked",
  "target": {
    "kind": "product",
    "id": "string"
  },
  "locale": "strin",
  "channel": "email",
  "enabled": true
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/merchant/v1/stores/<store>/notifications';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    event: 'products.unlocked',
    target: {kind: 'product', id: 'string'},
    locale: 'strin',
    channel: 'email',
    enabled: true
  })
};

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>/notifications"

payload = {
    "event": "products.unlocked",
    "target": {
        "kind": "product",
        "id": "string"
    },
    "locale": "strin",
    "channel": "email",
    "enabled": True
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 201

Creates a customer notification for an event.

#### Example

```json
{
  "id": "string",
  "event": "string",
  "target": {
    "kind": "string",
    "id": "string"
  },
  "locale": "string",
  "channel": "string",
  "enabled": true,
  "in_effect": true
}
```

- `id` (`createNotification.response.201.id`; string, required)
- `event` (`createNotification.response.201.event`; string, required)
- `target` (`createNotification.response.201.target`; any of, required)
  - any of: `object`, `null`
- `locale` (`createNotification.response.201.locale`; string, required)
- `channel` (`createNotification.response.201.channel`; string, required)
- `enabled` (`createNotification.response.201.enabled`; boolean, required)
- `in_effect` (`createNotification.response.201.in_effect`; boolean, required)

### 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` (`createNotification.response.default.type`; string, required)
  - format `uri`
- `title` (`createNotification.response.default.title`; string, required)
- `status` (`createNotification.response.default.status`; integer, required)
- `detail` (`createNotification.response.default.detail`; string, required)
- `code` (`createNotification.response.default.code`; string, optional)
- `context` (`createNotification.response.default.context`; object, optional)
- `reached_core` (`createNotification.response.default.reached_core`; boolean, optional)
- `core_answer` (`createNotification.response.default.core_answer`; string, optional)


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