For Add-on Developers

API Documentation for Add-on Developers

The IPC API is still in the process of being developed and is not yet considered stable or ready for add-on developers to use. Please check back later in 2024 for updated information.

Communicating with KiCad

The IPC API is exposed over a UNIX socket. By default, that socket is created at /tmp/kicad/api.sock, but this may change on different platforms or if multiple instances of KiCad are running. When launching API plugins, KiCad will set the environment variable KICAD_API_SOCKET to the socket path, so that the plugin can unambiguously know the socket path to use.

All API requests are wrapped in an ApiRequest message that contains an ApiRequestHeader with some metadata about the request. The kicad_token is a random value generated by KiCad when it starts up. This token is provided to API plugins via the KICAD_API_TOKEN environment variable, and also in the response to all API requests. This can be used to detect if KiCad is restarted while a plugin or third-party application is still running (since the token will no longer match). The client_name is used to identify an instance of a given API client, to allow KiCad to tell multiple instances of a client apart, and should be generated in such a way that guarantees that each instance of the client will have a unique name.