---
title: "Register an encrypted webpush, Slack, or email endpoint"
---

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

Path: Shiba public API › notifications

`POST /notifications/endpoints`

## Authentication

Requires one of the following:

- `bearerAuth`, http, header `Authorization`, format `API key`
- `cookieAuth`, apiKey, in cookie

## Request body

_Required._

- `channel` (`registerNotificationEndpoint.channel`; string, required)
  - one of `"webpush"`, `"slack"`, `"email"`
- `endpoint` (`registerNotificationEndpoint.endpoint`; string, required)
  - minLength 3; maxLength 4096
- `keys` (`registerNotificationEndpoint.keys`; object, optional)
  - `auth` (`registerNotificationEndpoint.keys.auth`; string, required)
    - minLength 8; maxLength 512
  - `p256dh` (`registerNotificationEndpoint.keys.p256dh`; string, required)
    - minLength 16; maxLength 1024
- `metadata` (`registerNotificationEndpoint.metadata`; map<unknown>, optional)

## Example request

```json
{
  "channel": "webpush",
  "endpoint": "string",
  "keys": {
    "auth": "stringst",
    "p256dh": "stringstringstri"
  },
  "metadata": {
    "property1": null,
    "property2": null
  }
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/api/v1/notifications/endpoints' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "channel": "webpush",
  "endpoint": "string",
  "keys": {
    "auth": "stringst",
    "p256dh": "stringstringstri"
  },
  "metadata": {
    "property1": null,
    "property2": null
  }
}
'
```

### TypeScript

```typescript
const url = '<base-url>/api/v1/notifications/endpoints';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    channel: 'webpush',
    endpoint: 'string',
    keys: {auth: 'stringst', p256dh: 'stringstringstri'},
    metadata: {property1: null, property2: null}
  })
};

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

### Python

```python
import requests

url = "<base-url>/api/v1/notifications/endpoints"

payload = {
    "channel": "webpush",
    "endpoint": "string",
    "keys": {
        "auth": "stringst",
        "p256dh": "stringstringstri"
    },
    "metadata": {
        "property1": None,
        "property2": None
    }
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

Endpoint registered

### 400

Invalid body

#### Example

```json
{
  "ok": false,
  "error": "string",
  "detail": "string",
  "code": "string"
}
```

- `error` (`registerNotificationEndpoint.response.400.error`; string, required)
- `ok` (`registerNotificationEndpoint.response.400.ok`; boolean, optional)
- `detail` (`registerNotificationEndpoint.response.400.detail`; string, optional)
- `code` (`registerNotificationEndpoint.response.400.code`; string, optional)

### 401

Unauthorized

#### Example

```json
{
  "ok": false,
  "error": "string",
  "detail": "string",
  "code": "string"
}
```

- `error` (`registerNotificationEndpoint.response.401.error`; string, required)
- `ok` (`registerNotificationEndpoint.response.401.ok`; boolean, optional)
- `detail` (`registerNotificationEndpoint.response.401.detail`; string, optional)
- `code` (`registerNotificationEndpoint.response.401.code`; string, optional)


Source: https://tryshiba.dev/reference/api/notifications/registerNotificationEndpoint/index.md
