generate api key
curl --request POST \
--url https://api.example.com/api/v1/apikey \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"label": "<string>",
"tenantId": 123,
"lifetime": 123
}
'import requests
url = "https://api.example.com/api/v1/apikey"
payload = {
"label": "<string>",
"tenantId": 123,
"lifetime": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({label: '<string>', tenantId: 123, lifetime: 123})
};
fetch('https://api.example.com/api/v1/apikey', 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.example.com/api/v1/apikey",
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([
'label' => '<string>',
'tenantId' => 123,
'lifetime' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.example.com/api/v1/apikey"
payload := strings.NewReader("{\n \"label\": \"<string>\",\n \"tenantId\": 123,\n \"lifetime\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/api/v1/apikey")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"<string>\",\n \"tenantId\": 123,\n \"lifetime\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/apikey")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"label\": \"<string>\",\n \"tenantId\": 123,\n \"lifetime\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"createdAt": 123,
"updatedAt": 123,
"status": "ACTIVE",
"tenantId": 123,
"apiKey": "<string>",
"label": "<string>",
"lifetime": 123,
"expiresAt": 123,
"jti": "<string>"
}Api Key Route
generate api key
POST
/
api
/
v1
/
apikey
generate api key
curl --request POST \
--url https://api.example.com/api/v1/apikey \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"label": "<string>",
"tenantId": 123,
"lifetime": 123
}
'import requests
url = "https://api.example.com/api/v1/apikey"
payload = {
"label": "<string>",
"tenantId": 123,
"lifetime": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({label: '<string>', tenantId: 123, lifetime: 123})
};
fetch('https://api.example.com/api/v1/apikey', 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.example.com/api/v1/apikey",
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([
'label' => '<string>',
'tenantId' => 123,
'lifetime' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.example.com/api/v1/apikey"
payload := strings.NewReader("{\n \"label\": \"<string>\",\n \"tenantId\": 123,\n \"lifetime\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/api/v1/apikey")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"<string>\",\n \"tenantId\": 123,\n \"lifetime\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/apikey")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"label\": \"<string>\",\n \"tenantId\": 123,\n \"lifetime\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"createdAt": 123,
"updatedAt": 123,
"status": "ACTIVE",
"tenantId": 123,
"apiKey": "<string>",
"label": "<string>",
"lifetime": 123,
"expiresAt": 123,
"jti": "<string>"
}Authorizations
Authentication
Body
application/json
The label that's assigned to the key.
Pattern:
\SStatus of the entity. Default: 'ACTIVE'
Available options:
ACTIVE, DISABLED, DELETED The id of a tenant that owns the key. Only accepted if request from admin role or if matches auth tenant id.
The duration in seconds, after which the key expires.
Response
200 - application/json
OK
Unique identifier of the entity
Example:
1
Time when entity was created
Time when entity was updated
Status of the entity. Default: 'ACTIVE'
Available options:
ACTIVE, DISABLED, DELETED The id of a tenant that owns the key. Only accepted if request from admin role or if matches auth tenant id.
The api key (JWT token).
The label that's assigned to the key.
The duration in seconds, after which the key expires.
The time when api key was / will be expired.
The unique identifier of an api key (JWT token).