Skip to main content
POST
/
v1
/
auth
/
token
/
get
Generate Token
curl --request POST \
  --url https://api.velt.dev/v1/auth/token/get \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "data": {
    "apiKey": "<string>",
    "authToken": "<string>",
    "userId": "<string>",
    "userProperties": {
      "organizationId": "<string>",
      "isAdmin": true,
      "email": "<string>"
    }
  }
}
'
import requests

url = "https://api.velt.dev/v1/auth/token/get"

payload = { "data": {
"apiKey": "<string>",
"authToken": "<string>",
"userId": "<string>",
"userProperties": {
"organizationId": "<string>",
"isAdmin": True,
"email": "<string>"
}
} }
headers = {"Content-Type": "<content-type>"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>'},
body: JSON.stringify({
data: {
apiKey: '<string>',
authToken: '<string>',
userId: '<string>',
userProperties: {organizationId: '<string>', isAdmin: true, email: '<string>'}
}
})
};

fetch('https://api.velt.dev/v1/auth/token/get', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.velt.dev/v1/auth/token/get",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'apiKey' => '<string>',
'authToken' => '<string>',
'userId' => '<string>',
'userProperties' => [
'organizationId' => '<string>',
'isAdmin' => true,
'email' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: <content-type>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.velt.dev/v1/auth/token/get"

payload := strings.NewReader("{\n \"data\": {\n \"apiKey\": \"<string>\",\n \"authToken\": \"<string>\",\n \"userId\": \"<string>\",\n \"userProperties\": {\n \"organizationId\": \"<string>\",\n \"isAdmin\": true,\n \"email\": \"<string>\"\n }\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "<content-type>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.velt.dev/v1/auth/token/get")
.header("Content-Type", "<content-type>")
.body("{\n \"data\": {\n \"apiKey\": \"<string>\",\n \"authToken\": \"<string>\",\n \"userId\": \"<string>\",\n \"userProperties\": {\n \"organizationId\": \"<string>\",\n \"isAdmin\": true,\n \"email\": \"<string>\"\n }\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.velt.dev/v1/auth/token/get")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request.body = "{\n \"data\": {\n \"apiKey\": \"<string>\",\n \"authToken\": \"<string>\",\n \"userId\": \"<string>\",\n \"userProperties\": {\n \"organizationId\": \"<string>\",\n \"isAdmin\": true,\n \"email\": \"<string>\"\n }\n }\n}"

response = http.request(request)
puts response.read_body
{
  "result": {
    "status": "success",
    "message": "Token generated successfully.",
    "data": {
      "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
    }
  }
}
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.
  • 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

Example Requests

Generate token with organization and admin

{
  "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

{
  "data": {
    "apiKey": "YOUR_API_KEY",
    "authToken": "YOUR_AUTH_TOKEN",
    "userId": "yourUserId",
    "userProperties": {
      "organizationId": "YOUR_ORGANIZATION_ID"
    }
  }
}

Response

Generate the JWT token on your server, not your client, to keep your secrets secure.

Success Response

{
  "result": {
    "status": "success",
    "message": "Token generated successfully.",
    "data": {
      "token": "YOUR_JWT_TOKEN"
    }
  }
}

Failure Response

{
  "error": {
    "message": "Auth token not found.",
    "status": "INVALID_ARGUMENT"
  }
}
{
  "result": {
    "status": "success",
    "message": "Token generated successfully.",
    "data": {
      "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
    }
  }
}