Verify key
curl --request POST \
--url https://api.datkey.dev/keys/verify \
--header 'Content-Type: application/json' \
--data '
{
"api_id": "{api_id}",
"key": "key_xxxxxxxxxxxxxxxx"
}
'import requests
url = "https://api.datkey.dev/keys/verify"
payload = {
"api_id": "{api_id}",
"key": "key_xxxxxxxxxxxxxxxx"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({api_id: '{api_id}', key: 'key_xxxxxxxxxxxxxxxx'})
};
fetch('https://api.datkey.dev/keys/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://api.datkey.dev/keys/verify",
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([
'api_id' => '{api_id}',
'key' => 'key_xxxxxxxxxxxxxxxx'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.datkey.dev/keys/verify"
payload := strings.NewReader("{\n \"api_id\": \"{api_id}\",\n \"key\": \"key_xxxxxxxxxxxxxxxx\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
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.datkey.dev/keys/verify")
.header("Content-Type", "application/json")
.body("{\n \"api_id\": \"{api_id}\",\n \"key\": \"key_xxxxxxxxxxxxxxxx\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datkey.dev/keys/verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_id\": \"{api_id}\",\n \"key\": \"key_xxxxxxxxxxxxxxxx\"\n}"
response = http.request(request)
puts response.read_body{
"valid": true,
"key": {
"id": "<id>",
"name": "ACME INC",
"key": "flox_sk_05ad2bf*********",
"prefix": "flox_sk",
"length": 16,
"verifications": 5,
"verification_limit": 90,
"expires_at": 1733237153,
"meta": null,
"created_at": "2023-12-05T11:31:23.000000Z",
"updated_at": "2023-12-05T13:03:24.000000Z"
}
}{
"valid": false,
"status": "EXPIRED"
}Endpoints
Verify key
POST
/
keys
/
verify
Verify key
curl --request POST \
--url https://api.datkey.dev/keys/verify \
--header 'Content-Type: application/json' \
--data '
{
"api_id": "{api_id}",
"key": "key_xxxxxxxxxxxxxxxx"
}
'import requests
url = "https://api.datkey.dev/keys/verify"
payload = {
"api_id": "{api_id}",
"key": "key_xxxxxxxxxxxxxxxx"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({api_id: '{api_id}', key: 'key_xxxxxxxxxxxxxxxx'})
};
fetch('https://api.datkey.dev/keys/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://api.datkey.dev/keys/verify",
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([
'api_id' => '{api_id}',
'key' => 'key_xxxxxxxxxxxxxxxx'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.datkey.dev/keys/verify"
payload := strings.NewReader("{\n \"api_id\": \"{api_id}\",\n \"key\": \"key_xxxxxxxxxxxxxxxx\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
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.datkey.dev/keys/verify")
.header("Content-Type", "application/json")
.body("{\n \"api_id\": \"{api_id}\",\n \"key\": \"key_xxxxxxxxxxxxxxxx\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datkey.dev/keys/verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_id\": \"{api_id}\",\n \"key\": \"key_xxxxxxxxxxxxxxxx\"\n}"
response = http.request(request)
puts response.read_body{
"valid": true,
"key": {
"id": "<id>",
"name": "ACME INC",
"key": "flox_sk_05ad2bf*********",
"prefix": "flox_sk",
"length": 16,
"verifications": 5,
"verification_limit": 90,
"expires_at": 1733237153,
"meta": null,
"created_at": "2023-12-05T11:31:23.000000Z",
"updated_at": "2023-12-05T13:03:24.000000Z"
}
}{
"valid": false,
"status": "EXPIRED"
}Headers
your workspace API key
Body
application/json
Response
OK
Whether the key is valid or not. A key could be invalid for a number of reasons, for example if it has expired or has no more verifications left
Example:
true
If the key status is false this field will be set to the reason why it is invalid.
Possible values are:
- USAGE_EXCEEDED: the key has exceeded its validation limit
- EXPIRED: the key has expired,
Available options:
EXPIRED, USAGE_EXCEEDED The ID of the API the key belongs to
Example:
"{api_id}"
The name assigned to the key
Example:
"{api_name}"
The prefix assigned to the key
Example:
"prefix"
The length assigned to the key
Required range:
16 <= x <= 255extra details you passed via the meta attribute
Show child attributes
Show child attributes
Example:
{ "user_id": "123456" }
Unix timestamp of when the key expires, returns null when not set
maximum verification allowed for this key, returns null when not set