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

# dApp API

> The Wallet Gateway's CIP-0103 dApp API, and where it is documented.

The dApp API is the [CIP-0103](https://github.com/canton-foundation/cips/blob/main/cip-0103/cip-0103.md)
JSON-RPC 2.0 API that dApps call to connect to a wallet, list accounts, and prepare and
execute transactions. The Wallet Gateway exposes it, but you almost never call it directly.

* **Base path**: `/api/v0/dapp` (configurable via `server.dappPath`)
* **Protocol**: JSON-RPC 2.0, per CIP-0103
* **Authentication**: JWT bearer token (obtained through a session)

<Note>
  Build dApps with the [dApp SDK](/sdks-tools/sdks/dapp-sdk/overview), which implements the
  dApp API and adds a high-level interface, session handling, wallet discovery, and multi-transport
  support. Use the raw API only for lower-level infrastructure. The SDK documentation is the
  reference for methods, events, and error handling.
</Note>

## Full specification

The complete OpenRPC specification is available at
[openrpc-dapp-api.json](https://github.com/canton-network/wallet-gateway/blob/main/api-specs/openrpc-dapp-api.json).

## Real-time events (SSE)

The dApp API supports Server-Sent Events for real-time notifications. Connect to the `/events`
path relative to the dApp API base URL (for example `/api/v0/dapp/events`), authenticating with
the JWT as the `token` query parameter (the `Authorization: Bearer` header is also supported):

```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const eventsUrl = new URL('events', dappApiUrl + '/')
eventsUrl.searchParams.set('token', jwtToken)
const eventSource = new EventSource(eventsUrl.toString())

eventSource.addEventListener('accountsChanged', (e) => {
    /* ... */
})
eventSource.addEventListener('statusChanged', (e) => {
    /* ... */
})
eventSource.addEventListener('connected', (e) => {
    /* ... */
})
eventSource.addEventListener('txChanged', (e) => {
    /* ... */
})
```

SSE connections deliver real-time updates about transaction status (`txChanged`), account
changes (`accountsChanged`), and session state (`connected`, `statusChanged`).

## See also

* [dApp SDK overview](/sdks-tools/sdks/dapp-sdk/overview)
* [dApp SDK events reference](/sdks-tools/sdks/dapp-sdk/reference/events)
* [User API](/integrations/wallet-gateway/reference/user-api)
