Update key
curl --request PUT \
--url https://api.datkey.dev/keys/{id} \
--header 'Content-Type: application/json' \
--data '
{
"expires_at": 123,
"verification_limit": 123
}
'import requests
url = "https://api.datkey.dev/keys/{id}"
payload = {
"expires_at": 123,
"verification_limit": 123
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({expires_at: 123, verification_limit: 123})
};
fetch('https://api.datkey.dev/keys/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'expires_at' => 123,
'verification_limit' => 123
]),
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/{id}"
payload := strings.NewReader("{\n \"expires_at\": 123,\n \"verification_limit\": 123\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.datkey.dev/keys/{id}")
.header("Content-Type", "application/json")
.body("{\n \"expires_at\": 123,\n \"verification_limit\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datkey.dev/keys/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"expires_at\": 123,\n \"verification_limit\": 123\n}"
response = http.request(request)
puts response.read_body{
"key": {
"id": "<key_id>",
"name": "<key_name>",
"key": "flox_sk_05ad2bf*********",
"prefix": "flox_sk",
"length": 16,
"verifications": 10,
"verification_limit": 12,
"expires_at": 1733237153,
"meta": null,
"created_at": "2023-12-05T11:31:23.000000Z",
"updated_at": "2023-12-05T13:03:24.000000Z"
}
}{
"message": "key not found"
}{
"message": "key expiry cannot be back dated"
}Endpoints
Update key
PUT
/
keys
/
{id}
Update key
curl --request PUT \
--url https://api.datkey.dev/keys/{id} \
--header 'Content-Type: application/json' \
--data '
{
"expires_at": 123,
"verification_limit": 123
}
'import requests
url = "https://api.datkey.dev/keys/{id}"
payload = {
"expires_at": 123,
"verification_limit": 123
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({expires_at: 123, verification_limit: 123})
};
fetch('https://api.datkey.dev/keys/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'expires_at' => 123,
'verification_limit' => 123
]),
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/{id}"
payload := strings.NewReader("{\n \"expires_at\": 123,\n \"verification_limit\": 123\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.datkey.dev/keys/{id}")
.header("Content-Type", "application/json")
.body("{\n \"expires_at\": 123,\n \"verification_limit\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datkey.dev/keys/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"expires_at\": 123,\n \"verification_limit\": 123\n}"
response = http.request(request)
puts response.read_body{
"key": {
"id": "<key_id>",
"name": "<key_name>",
"key": "flox_sk_05ad2bf*********",
"prefix": "flox_sk",
"length": 16,
"verifications": 10,
"verification_limit": 12,
"expires_at": 1733237153,
"meta": null,
"created_at": "2023-12-05T11:31:23.000000Z",
"updated_at": "2023-12-05T13:03:24.000000Z"
}
}{
"message": "key not found"
}{
"message": "key expiry cannot be back dated"
}Headers
your workspace API key
Path Parameters
your key ID
Body
application/json
Response
OK
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
⌘I