Create new API key
curl --request POST \
--url http://localhost:3000/api/v1/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "My API Key",
"rateLimit": 1000,
"scopes": [
"export:read",
"translations:read"
]
}
'import requests
url = "http://localhost:3000/api/v1/api-keys"
payload = {
"name": "My API Key",
"rateLimit": 1000,
"scopes": ["export:read", "translations:read"]
}
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({
name: 'My API Key',
rateLimit: 1000,
scopes: ['export:read', 'translations:read']
})
};
fetch('http://localhost:3000/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_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/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([
'name' => 'My API Key',
'rateLimit' => 1000,
'scopes' => [
'export:read',
'translations:read'
]
]),
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 := "http://localhost:3000/api/v1/api-keys"
payload := strings.NewReader("{\n \"name\": \"My API Key\",\n \"rateLimit\": 1000,\n \"scopes\": [\n \"export:read\",\n \"translations:read\"\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("http://localhost:3000/api/v1/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My API Key\",\n \"rateLimit\": 1000,\n \"scopes\": [\n \"export:read\",\n \"translations:read\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/v1/api-keys")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My API Key\",\n \"rateLimit\": 1000,\n \"scopes\": [\n \"export:read\",\n \"translations:read\"\n ]\n}"
response = http.request(request)
puts response.read_body{}{
"error": "<string>",
"details": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"details": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"details": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}API Keys
Create new API key
Create a new API key with specified permissions and rate limits
POST
/
api
/
v1
/
api-keys
Create new API key
curl --request POST \
--url http://localhost:3000/api/v1/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "My API Key",
"rateLimit": 1000,
"scopes": [
"export:read",
"translations:read"
]
}
'import requests
url = "http://localhost:3000/api/v1/api-keys"
payload = {
"name": "My API Key",
"rateLimit": 1000,
"scopes": ["export:read", "translations:read"]
}
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({
name: 'My API Key',
rateLimit: 1000,
scopes: ['export:read', 'translations:read']
})
};
fetch('http://localhost:3000/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_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/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([
'name' => 'My API Key',
'rateLimit' => 1000,
'scopes' => [
'export:read',
'translations:read'
]
]),
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 := "http://localhost:3000/api/v1/api-keys"
payload := strings.NewReader("{\n \"name\": \"My API Key\",\n \"rateLimit\": 1000,\n \"scopes\": [\n \"export:read\",\n \"translations:read\"\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("http://localhost:3000/api/v1/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My API Key\",\n \"rateLimit\": 1000,\n \"scopes\": [\n \"export:read\",\n \"translations:read\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/v1/api-keys")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My API Key\",\n \"rateLimit\": 1000,\n \"scopes\": [\n \"export:read\",\n \"translations:read\"\n ]\n}"
response = http.request(request)
puts response.read_body{}{
"error": "<string>",
"details": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"details": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"details": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}Authorizations
BearerAuthOAuth2
Enter your API key in the format: Bearer <api_key>
Query Parameters
Maximum number of items to return (default: 10, max: 100)
Number of items to skip for pagination (default: 0)
Body
application/json
API key creation data
Name for the API key
Example:
"My API Key"
Rate limit in requests per hour
Required range:
1 <= x <= 10000Example:
1000
Permissions for the API key
Available options:
export:read, translations:read, translations:write, admin Example:
["export:read", "translations:read"]
Response
Successful response
The response is of type object.
Was this page helpful?
⌘I