> ## Documentation Index
> Fetch the complete documentation index at: https://velt.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Token

Use this API to generate a JWT token used by your client to authenticate with Velt. The token encodes user information and optional properties such as organization and admin status.

> [!NOTE]
>
> * JWT token expires in 48 hours.
> * For v1, `apiKey` and `authToken` are provided in the request body (not headers).

# Endpoint

`POST https://api.velt.dev/v1/auth/token/get`

# Headers

**Content-Type** `string` *required*

application/json

# Body

#### Params

**data** `object` *required*

**properties**

**apiKey** `string` *required*

Your Velt API Key.

**authToken** `string` *required*

Your Auth Token from the Velt console. See [Auth Tokens](https://velt.dev/docs/security/auth-tokens.md).

**userId** `string` *required*

Unique identifier for the user.

**userProperties** `object`

**properties**

**organizationId** `string` *required*

Organization ID. Should match the `organizationId` used in the `identify` call.

**isAdmin** `boolean`

Whether the user has admin privileges. This is the only supported way to set a user as admin. Do not set this in the `identify` call.

**email** `string`

User email. If provided, it is validated against the email used in the `identify` call.

## **Example Requests**

#### Generate token with organization and admin

```JSON theme={null}
{
  "data": {
    "apiKey": "YOUR_API_KEY",
    "authToken": "YOUR_AUTH_TOKEN",
    "userId": "yourUserId",
    "userProperties": {
      "isAdmin": true,
      "organizationId": "YOUR_ORGANIZATION_ID",
      "email": "user@example.com"
    }
  }
}
```

#### Minimal token request

```JSON theme={null}
{
  "data": {
    "apiKey": "YOUR_API_KEY",
    "authToken": "YOUR_AUTH_TOKEN",
    "userId": "yourUserId",
    "userProperties": {
      "organizationId": "YOUR_ORGANIZATION_ID"
    }
  }
}
```

# Response

> [!WARNING]
>
> Generate the JWT token on your server, not your client, to keep your secrets secure.

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Token generated successfully.",
    "data": {
      "token": "YOUR_JWT_TOKEN"
    }
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "Auth token not found.",
    "status": "INVALID_ARGUMENT"
  }
}
```

```js theme={null}
{
  "result": {
    "status": "success",
    "message": "Token generated successfully.",
    "data": {
      "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
    }
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.