Exchange a one-time invite code for a user token
POST
/v1/auth/redeem
const url = 'http://127.0.0.1:8080/v1/auth/redeem';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"code":"example","label":"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 http://127.0.0.1:8080/v1/auth/redeem \ --header 'Content-Type: application/json' \ --data '{ "code": "example", "label": "example" }'Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
code
required
Invite code, ztinv_ followed by 43 base62 characters.
string
label
Where the token will live, for example a laptop name.
string
Example generated
{ "code": "example", "label": "example"}Responses
Section titled “Responses”The user token. It is shown only in this response.
Media typeapplication/json
object
token
required
The user token. Shown only once.
string
token_info
required
object
id
required
string format: uuid
kind
required
string
display_prefix
required
The first characters of the token, safe to show.
string
label
required
string
user_id
string format: uuid
session_id
string format: uuid
project_id
string format: uuid
scopes
required
Array<string>
created_at
required
string format: date-time
expires_at
string format: date-time
last_used_at
string format: date-time
revoked_at
string format: date-time
user
required
object
id
required
string format: uuid
org_id
required
string format: uuid
handle
required
string
role
required
string
display_name
required
string
email
string
skill_level
string
created_at
required
string format: date-time
Example
{ "token_info": { "kind": "user" }, "user": { "role": "viewer", "skill_level": "plain" }}The request is malformed.
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
Example generated
{ "error": { "code": "example", "message": "example" }}No valid bearer token.
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
Example generated
{ "error": { "code": "example", "message": "example" }}A rate limit or quota stopped the request. Retry-After gives seconds to wait.
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
Example generated
{ "error": { "code": "example", "message": "example" }}Headers
Section titled “Headers”Retry-After
integer