Create an access token
POST
/api/tokens
const url = 'https://api-dev.wrktr.com/api/tokens';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","expiresInDays":"Infinity"}'};
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-dev.wrktr.com/api/tokens \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "expiresInDays": "Infinity" }'Only from a signed-in web session (a token can’t create tokens): the CLI’s wrktr token create opens the browser for this. The token is returned once.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “Responses”NewToken
Media typeapplication/json
object
Example
{ "info": { "createdAt": "Infinity", "lastUsedAt": "Infinity", "expiresAt": "Infinity" }}Unauthorized
Media typeapplication/json
object
_tag
required
string
message
required
string
Example
{ "_tag": "Unauthorized"}Forbidden
Media typeapplication/json
object
_tag
required
string
message
required
string
Example
{ "_tag": "Forbidden"}