Skip to main content
POST
/
api
/
v1
/
pub
/
{project_id}
/
auth
/
verify
Verify access token
curl --request POST \
  --url https://org-api.hexoforge.dev/api/v1/pub/{project_id}/auth/verify \
  --header 'X-API-Key: <api-key>'
import requests

url = "https://org-api.hexoforge.dev/api/v1/pub/{project_id}/auth/verify"

headers = {"X-API-Key": "<api-key>"}

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

print(response.text)
const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};

fetch('https://org-api.hexoforge.dev/api/v1/pub/{project_id}/auth/verify', 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://org-api.hexoforge.dev/api/v1/pub/{project_id}/auth/verify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);

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

curl_close($curl);

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

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

func main() {

url := "https://org-api.hexoforge.dev/api/v1/pub/{project_id}/auth/verify"

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

req.Header.Add("X-API-Key", "<api-key>")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://org-api.hexoforge.dev/api/v1/pub/{project_id}/auth/verify")
.header("X-API-Key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://org-api.hexoforge.dev/api/v1/pub/{project_id}/auth/verify")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "valid": true,
  "user_id": "<string>",
  "roles": [
    "<string>"
  ],
  "permissions": [
    "<string>"
  ]
}
Validates the access token in Authorization and returns claims. Requires X-API-Key and Bearer token.
Send both X-API-Key and Authorization: Bearer with the token under test.

Response

200 OK
{
  "valid": true,
  "user_id": "550e8400-e29b-41d4-a716-446655440000",
  "roles": ["user", "editor"],
  "permissions": ["read:posts", "write:posts"]
}
valid
boolean
Whether the token is currently valid.
user_id
string
Present when valid is true.
roles
string[]
Role slugs when valid.
permissions
string[]
Permission slugs when valid.

Status codes

CodeMeaning
200Body describes validity
401Token invalid, expired, or revoked