Issue a token
POST
/api/v1/auth/tokens
const url = 'https://api.pkgplease.com/api/v1/auth/tokens';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"type":"developer","user_id":"example","label":"example","metadata":{},"audience":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.pkgplease.com/api/v1/auth/tokens \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "type": "developer", "user_id": "example", "label": "example", "metadata": {}, "audience": [ "example" ] }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Idempotency-Key
string
Request Body
Section titled “Request Body”Media typeapplication/json
object
type
string
user_id
string
label
string
metadata
object
audience
Array<string>
Responses
Section titled “Responses”Idempotent replay of a prior request with the same Idempotency-Key — token is null and token_unavailable is true
Media typeapplication/json
object
token
string
token_unavailable
boolean
Examplegenerated
{ "token": "example", "token_unavailable": true}Token issued (prefix depends on type — developer pkgpls_dev_, agent pkgpls_agt_, provisioner pkgpls_prv_, else pkgpls_svc_)
Media typeapplication/json
object
token
string
Examplegenerated
{ "token": "example"}Invalid audience
Media typeapplication/json
object
error
required
string
Examplegenerated
{ "error": "example"}Not permitted to mint this token type
Media typeapplication/json
object
error
required
string
Examplegenerated
{ "error": "example"}