To generate a system token (system API key) programmatically, set the `PHOENIX_ADMIN_SECRET` environment variable at deploy time. This secret acts as a bearer token for authenticating API requests as the first system user. Use it in the `Authorization` header to call Phoenix's API endpoints and provision system keys without manual UI interaction. The secret must be at least 32 characters, include a digit and a lowercase letter, and differ from `PHOENIX_SECRET`βit is set via the environment, not generated by an API call itself.
After deployment, use the `PHOENIX_ADMIN_SECRET` as a bearer token in the `Authorization` header to authenticate API requests (e.g., to create a system API key via the REST or GraphQL API). For example, send a request with `Authorization: Bearer <PHOENIX_ADMIN_SECRET> ` to the appropriate endpoint. Once a system key is created, use that key for further automation and remove the admin secret from your deployment for security. There is no direct API to generate the admin secret itself; it must be set as an environment variable before starting Phoenix. For details, see the official provisioning and API key documentation.
Would you like more detail, such as example API calls or code snippets?
Sources:
- <https://arize.com/docs/phoenix/self-hosting/features/provisioning|Provisioning | Arize Phoenix>