Skip to content

Issue a token

POST
/api/v1/auth/tokens
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" ] }'
Idempotency-Key
string
/^[A-Za-z0-9_-]{8,255}$/
Media typeapplication/json
object
type
string
default: service
Allowed values: developer service agent provisioner
user_id
string
label
string
metadata
object
audience
Array<string>

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
nullable
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"
}