Creates a token (its value is only returned here)
POST
/tokensRequires: Cookie fret_session / Bearer
Request body
application/jsonobjectrequired
namestringrequired
Responses
201Createdobject
tokenApiTokenFields · 5
idintegernamestringprefixstringStart of the token, to recognise it
createdAtstring (date-time)lastUsedAtstring (date-time) | null
secretstring
Request
curl -X POST "http://localhost:8080/api/v1/tokens" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "string"}'const response = await fetch('http://localhost:8080/api/v1/tokens', { method: 'POST', headers: { Authorization: 'Bearer <TOKEN>', 'Content-Type': 'application/json', }, body: JSON.stringify({ "name": "string" }),});const data = await response.json();import requests
response = requests.post( "http://localhost:8080/api/v1/tokens", headers={ "Authorization": "Bearer <TOKEN>", }, json={ "name": "string", },)response.raise_for_status()print(response.json())Response
201
{ "token": { "id": 0, "name": "string", "prefix": "string", "createdAt": "2026-01-01T12:00:00Z", "lastUsedAt": "2026-01-01T12:00:00Z" }, "secret": "fret_q_lsMtbKa-…"}