---
title: "Push notifications · intentic sandbox API"
description: "So a finished turn can reach you when the tab is closed. Every route in the push notifications group of the intentic sandbox API, with its input, its answer and a playground."
url: "https://intentic.dev/api/push/"
---

The sandbox itself

# Push notifications

So a finished turn can reach you when the tab is closed

**On this page (4 sections)**

- [What a device needs to subscribe](#push-config)
- [Send notifications to this device](#push-subscribe)
- [Stop notifying a device](#push-unsubscribe)
- [Send a test notification](#push-test)

What a device needs in order to subscribe, subscribing and unsubscribing, and a test. The test earns its place because there are four separate places a notification can be lost that nobody can inspect from outside.

**GET`/push/config` What a device needs to subscribe**

The public key and settings a browser or app needs before it can register for notifications from this sandbox.

### What you send

| Field | Type | Where |
| --- | --- | --- |
| `id` Which device is asking | string | query |

### What comes back

| Field | Type |
| --- | --- |
| `publicKey` The key a browser needs in… | string |
| `subscribed` Whether the asking device is already… | boolean |

Try it answered in this tab

curl

```bash
curl "$SANDBOX/push/config" \
 -H "x-intentic-control: $INTENTIC_TOKEN"
```

TypeScript

```typescript
import { sandbox } from "@intentic/sandbox-client";

const result = await sandbox.push.config();
```

**POST`/push/subscribe` Send notifications to this device**

Registers one device. The sandbox only interrupts you on the three moments where attention is genuinely wanted: a turn has finished, the agent is stuck on a question, and something is waiting for approval.

### What you send

| Field | Type | Where |
| --- | --- | --- |
| `when kind is "webpush"` | shape | body |
| `endpoint` required Where that browser's push service accepts… | string | body |
| `keys` required What the browser handed you when… | object | body |
| `p256dh` required The browser's public key, for encrypting… | string | body |
| `auth` required The browser's secret, for the same | string | body |
| `when kind is "relay"` | shape | body |
| `url` required Where to post a send | string | body |
| `deviceId` required The device's id, which also identifies… | string | body |
| `secret` required Proof that this sandbox may notify… | string | body |

### What comes back

| Field | Type |
| --- | --- |
| `ok` Always true | true |

Try it answered in this tab

curl

```bash
curl -X POST "$SANDBOX/push/subscribe" \
 -H "x-intentic-control: $INTENTIC_TOKEN" \
 -H "content-type: application/json" \
 -d '{"kind":"webpush","endpoint":"https://sandbox-a1b2c3d4e5f6.intentic.dev","keys":{"p256dh":"…","auth":"…"}}'
```

TypeScript

```typescript
import { sandbox } from "@intentic/sandbox-client";

const result = await sandbox.push.subscribe({
 "kind": "webpush",
 "endpoint": "https://sandbox-a1b2c3d4e5f6.intentic.dev",
 "keys": {
 "p256dh": "…",
 "auth": "…"
 }
});
```

**POST`/push/unsubscribe` Stop notifying a device**

Removes one registered device. Others keep receiving.

### What you send

| Field | Type | Where |
| --- | --- | --- |
| `id` required Which device: a browser's push address,… | string | body |

### What comes back

| Field | Type |
| --- | --- |
| `ok` Always true | true |

Try it answered in this tab

curl

```bash
curl -X POST "$SANDBOX/push/unsubscribe" \
 -H "x-intentic-control: $INTENTIC_TOKEN" \
 -H "content-type: application/json" \
 -d '{"id":"a1b2c3d4"}'
```

TypeScript

```typescript
import { sandbox } from "@intentic/sandbox-client";

const result = await sandbox.push.unsubscribe({
 "id": "a1b2c3d4"
});
```

**POST`/push/test` Send a test notification**

Proves the whole chain end to end. Worth having, because there are four separate places a notification can be lost that nobody can inspect from the outside: the device's permission, its registration, the sandbox's key, and the delivery service.

### What you send

Nothing. Call it as it is.

### What comes back

| Field | Type |
| --- | --- |
| `delivered` How many devices actually accepted it | integer |

Try it answered in this tab

curl

```bash
curl -X POST "$SANDBOX/push/test" \
 -H "x-intentic-control: $INTENTIC_TOKEN"
```

TypeScript

```typescript
import { sandbox } from "@intentic/sandbox-client";

const result = await sandbox.push.test();
```

More in The sandbox itself

[Previous ← Logs](https://intentic.dev/api/logs/)
