Skip to main content
The Admin API lets you query request history and account stats programmatically. It is the same data that powers the built-in admin UI at /admin, accessible as JSON so you can integrate it into your own scripts or monitoring tools.

Access control

Access rules differ based on where requests originate: When ADMIN_TOKEN is set on the server, pass it in one of these headers: Tokens in URL query parameters are not supported.
If you see 403 Forbidden, the admin API is restricted to localhost and ADMIN_TOKEN is not set. If you see 401 Unauthorized, ADMIN_TOKEN is set but the request did not include a valid token.

GET /api/admin/meta

Returns metadata about the request history database, including the database file path and retention settings.
Example response:

GET /api/admin/accounts

Lists accounts with their runtime status. Pass include_stats=1 to include aggregated request statistics for each account.
Example response with include_stats=1:

GET /api/admin/requests

Queries request logs with optional filters and cursor-based pagination.

Query parameters

Response fields

Examples


GET /api/admin/requests/:requestId

Returns a single request log entry by its ID.
Example response:


GET /api/admin/config

Returns the current server configuration. You can also use POST /api/admin/config to update configuration values without restarting the server. Changes made via the API are validated and applied immediately.
Unknown keys are rejected. Only fields documented in the configuration reference are accepted.

Data storage and retention

Request history is stored in admin.sqlite in the app data directory:
  • Linux / macOS: ~/.local/share/copilot-api/admin.sqlite
  • Windows: %USERPROFILE%\.local\share\copilot-api\admin.sqlite
The proxy stores metadata only — no GitHub or Copilot tokens, and no request or response content. Logs are retained for 14 days and the database is capped at 200,000 rows. Older entries are cleaned up automatically.