Skip to content
shadwshadw/Docs
GuidesAPIGetting Started
Dashboard
shadw REST APIOverviewErrors
  • POSTCreate an API key
  • GETList API keys
  • DELRevoke an API key
  • POSTMint a token
APIs & SDKs/shadw REST API/Mint a token

Mint a token

POSThttps://api.shadw.cloud/v1/token

Mint a JWT bearer token scoped to a team + role, valid for at most 1 hour. Requires HIVE_JWT_SECRET to be configured on the node (returns 400 otherwise); once it is set, minting is server-only (the request must carry the x-hive-internal header, else 403). When HIVE_JWT_SECRET is set, mutating requests must present a JWT or an API key.

Authentication

AuthorizationbearerToken

A platform API key (hive_…, created under Settings → API Keys) or a JWT of at most 1 hour from POST /v1/token, which is server-only once HIVE_JWT_SECRET is set. An API key scopes the request to the team it was created under.

Body parameters

substringOptional

Subject / user id embedded in the token (default "user").

tenantstringOptional

Team slug the token is scoped to (default "default").

role"owner" | "admin" | "member" | "viewer"Optional

Role embedded in the token. No default: a mint carries only the role you name, and a token without one acts as a viewer (read-only).

ts
const response = await fetch('https://api.shadw.cloud/v1/token', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY', // hive_… (Settings → API Keys)
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "sub": "sub",
    "tenant": "tenant",
    "role": "owner"
  }),
});

const data = await response.json();
console.log(data);
Response
json
{ "token": "eyJhbGciOiJIUzI1NiJ9…", "expires_in": 3600 }