# Create push subscriptions

Record a browser's push subscription — the endpoint and the two keys the browser itself minted — so notifications can reach it when the app is closed. Idempotent on the endpoint and it re-attaches the browser to whoever is calling, so a client may send it on every enable.

Access class: `workspace`.

## Endpoint

`POST /v1/push/subscriptions`

## Request body

Content type: `application/json`.

```json
{
  "body": {
    "auth": "string",
    "endpoint": "string",
    "p256dh": "string",
    "user_agent": "string"
  },
  "params": {},
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "created_at": "string",
    "endpoint": "string",
    "id": 1.5,
    "user_agent": "string",
    "user_id": 1.5
  }
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
