Create Api Key
curl --request POST \
--url https://api.example.com/api/v1/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"label": "<string>",
"status": "active",
"expires_at": "2023-11-07T05:31:56Z",
"permissions": [
"<string>"
],
"ip_whitelist": [
"<string>"
],
"collections": [
"<string>"
]
}
'import requests
url = "https://api.example.com/api/v1/api-keys"
payload = {
"label": "<string>",
"status": "active",
"expires_at": "2023-11-07T05:31:56Z",
"permissions": ["<string>"],
"ip_whitelist": ["<string>"],
"collections": ["<string>"]
}
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>',
status: 'active',
expires_at: '2023-11-07T05:31:56Z',
permissions: ['<string>'],
ip_whitelist: ['<string>'],
collections: ['<string>']
})
};
fetch('https://api.example.com/api/v1/api-keys', 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/api-keys",
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>',
'status' => 'active',
'expires_at' => '2023-11-07T05:31:56Z',
'permissions' => [
'<string>'
],
'ip_whitelist' => [
'<string>'
],
'collections' => [
'<string>'
]
]),
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/api-keys"
payload := strings.NewReader("{\n \"label\": \"<string>\",\n \"status\": \"active\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"permissions\": [\n \"<string>\"\n ],\n \"ip_whitelist\": [\n \"<string>\"\n ],\n \"collections\": [\n \"<string>\"\n ]\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/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"<string>\",\n \"status\": \"active\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"permissions\": [\n \"<string>\"\n ],\n \"ip_whitelist\": [\n \"<string>\"\n ],\n \"collections\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/api-keys")
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 \"status\": \"active\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"permissions\": [\n \"<string>\"\n ],\n \"ip_whitelist\": [\n \"<string>\"\n ],\n \"collections\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"key": "<string>",
"label": "<string>",
"workspace_id": "<string>",
"id": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"hashed_secret": "<string>",
"status": "active",
"last_used_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"permissions": [
"<string>"
],
"ip_whitelist": [
"<string>"
],
"collections": [
"<string>"
],
"created_by": "<string>",
"secret": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}API Keys
Create Api Key
Create new API key.
POST
/
api
/
v1
/
api-keys
Create Api Key
curl --request POST \
--url https://api.example.com/api/v1/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"label": "<string>",
"status": "active",
"expires_at": "2023-11-07T05:31:56Z",
"permissions": [
"<string>"
],
"ip_whitelist": [
"<string>"
],
"collections": [
"<string>"
]
}
'import requests
url = "https://api.example.com/api/v1/api-keys"
payload = {
"label": "<string>",
"status": "active",
"expires_at": "2023-11-07T05:31:56Z",
"permissions": ["<string>"],
"ip_whitelist": ["<string>"],
"collections": ["<string>"]
}
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>',
status: 'active',
expires_at: '2023-11-07T05:31:56Z',
permissions: ['<string>'],
ip_whitelist: ['<string>'],
collections: ['<string>']
})
};
fetch('https://api.example.com/api/v1/api-keys', 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/api-keys",
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>',
'status' => 'active',
'expires_at' => '2023-11-07T05:31:56Z',
'permissions' => [
'<string>'
],
'ip_whitelist' => [
'<string>'
],
'collections' => [
'<string>'
]
]),
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/api-keys"
payload := strings.NewReader("{\n \"label\": \"<string>\",\n \"status\": \"active\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"permissions\": [\n \"<string>\"\n ],\n \"ip_whitelist\": [\n \"<string>\"\n ],\n \"collections\": [\n \"<string>\"\n ]\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/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"<string>\",\n \"status\": \"active\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"permissions\": [\n \"<string>\"\n ],\n \"ip_whitelist\": [\n \"<string>\"\n ],\n \"collections\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/api-keys")
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 \"status\": \"active\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"permissions\": [\n \"<string>\"\n ],\n \"ip_whitelist\": [\n \"<string>\"\n ],\n \"collections\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"key": "<string>",
"label": "<string>",
"workspace_id": "<string>",
"id": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"hashed_secret": "<string>",
"status": "active",
"last_used_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"permissions": [
"<string>"
],
"ip_whitelist": [
"<string>"
],
"collections": [
"<string>"
],
"created_by": "<string>",
"secret": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
The workspace ID
Body
application/json
Schema for creating a new API key.
API key label/name
Required string length:
1 - 255API key status
API key expiration date
List of permissions granted to this API key
List of allowed IP addresses
List of collection IDs this API key can access
Response
Successful Response
Schema for reading API key data.
API key identifier
Required string length:
1 - 50API key label/name
Required string length:
1 - 255Reference to workspace
Hashed API key secret
API key status
When the API key was last used
API key expiration date
List of permissions granted to this API key
List of allowed IP addresses
List of collection IDs this API key can access
User who created the API key
API key secret
⌘I