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

# Push notifications

> Send the owner an event from an app, read it in ego, and list what the app pushed.

This guide pushes a notification from an app, reads it in ego, and lists the app's pushed notifications from the API.

<Note>
  Notifications work in the app today. The API steps that push and list
  notifications are in preview.
</Note>

## Prerequisites

* An ego account with the app running. See the [project README](https://github.com/yasyf/ego) to run it locally.
* A token that carries the `notifications:write` and `notifications:read` scopes. Grant them on the consent screen.

## Push the notification

The app pushes a notification with `notifications:write`. Give it a title, a body, and a `type` to categorize it.

```bash theme={null}
curl https://api.myego.dev/api/notifications \
  -H "Authorization: Bearer $EGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Backup complete",
    "body": "The nightly backup finished in 4m12s.",
    "type": "backup",
    "data": { "durationMs": 252000 }
  }'
```

The call returns the notification's `id`:

```json theme={null}
{ "id": "k1799wxyz" }
```

## Read it in ego

Open the app and go to **Notifications**. The pushed notification shows its title, body, and type. Reading it there marks it read.

## List what the app pushed

The app lists its own pushed notifications with `notifications:read`:

```bash theme={null}
curl https://api.myego.dev/api/notifications \
  -H "Authorization: Bearer $EGO_API_KEY"
```

The response holds the app's notifications under `data`:

```json theme={null}
{
  "data": [
    {
      "_id": "k1799wxyz",
      "title": "Backup complete",
      "body": "The nightly backup finished in 4m12s.",
      "type": "backup",
      "data": { "durationMs": 252000 },
      "createdAt": 1735000000000
    }
  ]
}
```

An app sees only the notifications it pushed. ego also emits system events to the owner's inbox — `approval.created`, `approval.resolved`, `grant.revoked`, and `connection.error` — which never appear in this list.

## Next steps

<CardGroup cols={2}>
  <Card title="Request approvals" icon="circle-check" href="/guides/approvals">
    Have an app ask the owner to decide.
  </Card>

  <Card title="API reference" icon="code" href="/api-reference/introduction">
    The endpoints behind notifications.
  </Card>
</CardGroup>
