Create
POST
/api/tokens
const url = 'https://kelpie.example.com/api/tokens';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"name":"example","role":"viewer","expires_in_days":90}'};
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://kelpie.example.com/api/tokens \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "role": "viewer", "expires_in_days": 90 }'Create a token for yourself. Its value is in the response and can’t be shown again.
The token acts as you, with no role higher than role.
Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “Responses”Successful Response
Media typeapplication/json
TokenCreated
object
id
required
Id
string format: uuid
name
required
Name
string
prefix
required
Prefix
string
role
required
Role
string
username
required
Username
string
created_at
required
Created At
string format: date-time
token
required
Token
string
Example
{ "role": "viewer"}Validation Error
Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Example generated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}