The session page URL in Phoenix uses a base64-encoded global ID for the session, following the format `/projects/<project_global_id> /sessions/<session_global_id> `. The `session_global_id` (e.g., `UHJvamVjdFNlc3Npb246MjUyNw%3D%3D`) is generated by combining the type name (`ProjectSession`) and the session's database ID, then encoding this string in base64. This is a standard Relay global ID pattern used throughout Phoenix's GraphQL API, where the format is `TypeName:ID` and then base64-encoded for use in URLs and queries.
For example, if the session's database ID is `2527`, the string `ProjectSession:2527` is base64-encoded to `UHJvamVjdFNlc3Npb246MjUyNw==`, which is then URL-encoded for the path. This approach ensures unique, opaque identifiers for sessions in the UI and API. For more, see the implementation in the <https://github.com/Arize-ai/phoenix/blob/main/src/phoenix/server/api/types/ProjectSession.py|ProjectSession GraphQL type> and related <https://github.com/Arize-ai/phoenix/blob/main/src/phoenix/server/api/types/Trace.py|Relay global ID usage>.
Would you like a step-by-step example of how to generate this ID in code?
Sources:
- <https://github.com/Arize-ai/phoenix/blob/main/src/phoenix/server/api/types/ProjectSession.py|ProjectSession GraphQL type>
- <https://github.com/Arize-ai/phoenix/blob/main/src/phoenix/server/api/types/Trace.py|Relay global ID usage>