# WebSocket API

> The API of Home Assistant Core that the frontend and the companion apps use, over one open connection, to read states, perform actions, and get updates as they happen.

Source: https://contributors.home-assistant.io/glossary/websocket-api/

- In code: `websocket_api`, `/api/websocket`, `home-assistant-js-websocket`

A client connects to `/api/websocket`, logs in with an access token, and then sends commands as JSON messages. Integrations can add their own commands with the `websocket_api` integration. The frontend talks to it through the home-assistant-js-websocket library.

See [the WebSocket API](https://contributors.home-assistant.io/core/internals/websocket-api/) for the messages and how to add a command.

## Related terms

- [Frontend](https://contributors.home-assistant.io/glossary/frontend/): The web interface of Home Assistant, built with Lit and TypeScript, in the home-assistant/frontend repository.
- [Companion app](https://contributors.home-assistant.io/glossary/companion-app/): The Home Assistant app for Android, iOS, and macOS. It shows the frontend, and adds sensors, notifications, and widgets from the device.
- [Home Assistant Core](https://contributors.home-assistant.io/glossary/core/): The Python application at the heart of Home Assistant, with all its integrations, in the home-assistant/core repository.
