POST
/
auth
/
user_token
JavaScript
import Hyperspell from 'hyperspell';

const client = new Hyperspell({
  apiKey: 'My API Key',
});

const token = await client.auth.userToken({ user_id: 'user_id' });

console.log(token.token);
{
  "token": "<string>",
  "expires_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

API Key or JWT User Token. If using an API Key, set the X-As-User header to act as a specific user. A JWT User Token is always scoped to a specific user.

Body

application/json
user_id
string
required
expires_in
string | null

Token lifetime, e.g., '30m', '2h', '1d'. Defaults to 24 hours if not provided.

Examples:

"30m"

"2h"

"1d"

Response

Successful Response

token
string
required
expires_at
string<date-time>
required