A fresh token for an existing session: the id's owner must be the caller's install. The principal is the name the token will write as; the install vouches for it, as it did on dial.
GET
/sessions/{id}/token
const url = 'https://api.canopyhq.dev/sessions/000000000000000000000000000000000000000000000000000000000000000000000000/token?principal=example';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.canopyhq.dev/sessions/000000000000000000000000000000000000000000000000000000000000000000000000/token?principal=example' \ --header 'Authorization: Bearer <token>'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”id
required
A stream id: 72 hex chars, the shard then the owner digest.
string
The session to mint a token for.
Query Parameters
Section titled “Query Parameters”principal
required
string
The principal the session belongs to.
Responses
Section titled “Responses”A fresh token for the session.
Media typeapplication/json
object
expires
required
integer format: int64
session
required
A stream id: 72 hex chars, the shard then the owner digest.
string
token
required
string
Example
{ "session": "000000000000000000000000000000000000000000000000000000000000000000000000"}No principal, or an id that is not 64 hex chars.
No install key, or one no install answers.
No such session under this caller.