Validate an API key
curl --request POST \
--url https://app.outlit.ai/api/validate-api-key \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.outlit.ai/api/validate-api-key"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.outlit.ai/api/validate-api-key', 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://app.outlit.ai/api/validate-api-key",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://app.outlit.ai/api/validate-api-key"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.outlit.ai/api/validate-api-key")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.outlit.ai/api/validate-api-key")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"valid": true,
"organizationId": "<string>",
"createdById": "<string>",
"authorization": {
"grants": [
"customer_intelligence:read"
]
},
"organization": {
"id": "<string>",
"name": "<string>",
"slug": "<string>"
},
"createdBy": {
"id": "<string>",
"email": "<string>",
"name": "<string>"
},
"apiKey": {
"id": "<string>",
"name": "<string>",
"prefix": "<string>",
"keyType": "api",
"grants": [
"customer_intelligence:read"
],
"createdAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"totalRequests": 4503599627370495
}
}{
"valid": false,
"error": "<string>"
}{
"valid": false,
"error": "<string>"
}Validate an API key
Verify that an Outlit API key can authenticate Platform API requests.
POST
/
api
/
validate-api-key
Validate an API key
curl --request POST \
--url https://app.outlit.ai/api/validate-api-key \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.outlit.ai/api/validate-api-key"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.outlit.ai/api/validate-api-key', 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://app.outlit.ai/api/validate-api-key",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://app.outlit.ai/api/validate-api-key"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.outlit.ai/api/validate-api-key")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.outlit.ai/api/validate-api-key")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"valid": true,
"organizationId": "<string>",
"createdById": "<string>",
"authorization": {
"grants": [
"customer_intelligence:read"
]
},
"organization": {
"id": "<string>",
"name": "<string>",
"slug": "<string>"
},
"createdBy": {
"id": "<string>",
"email": "<string>",
"name": "<string>"
},
"apiKey": {
"id": "<string>",
"name": "<string>",
"prefix": "<string>",
"keyType": "api",
"grants": [
"customer_intelligence:read"
],
"createdAt": "2023-11-07T05:31:56Z",
"lastUsedAt": "2023-11-07T05:31:56Z",
"totalRequests": 4503599627370495
}
}{
"valid": false,
"error": "<string>"
}{
"valid": false,
"error": "<string>"
}Authentication
Pass an Outlit API key in theAuthorization header as Bearer ok_....
Request body
No request body is required when validating the API key from theAuthorization header.
Example
curl -X POST https://app.outlit.ai/api/validate-api-key \
-H "Authorization: Bearer ok_your_api_key"
Success response
{
"valid": true,
"organizationId": "org_123",
"createdById": "user_123",
"authorization": {
"grants": ["customer_intelligence:read"]
}
}
authorization.grants lists the key’s current capabilities. Only offer commands whose required
authority appears in this list. createdById is null when the creator is unavailable.
Error responses
Invalid or disabled keys return401:
{
"valid": false,
"error": "Invalid credentials"
}
503 with the same
failure envelope. Retry that response; it does not mean the key is invalid or revoked.Authorizations
Outlit API key (ok_...).
Was this page helpful?
