Create API Key
curl --request POST \
--url https://api.example.com/v1/api-keys \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"permissions": [
{}
],
"description": "<string>",
"rate_limit_tier": "<string>",
"expires_at": "<string>"
}
'import requests
url = "https://api.example.com/v1/api-keys"
payload = {
"name": "<string>",
"permissions": [{}],
"description": "<string>",
"rate_limit_tier": "<string>",
"expires_at": "<string>"
}
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({
name: '<string>',
permissions: [{}],
description: '<string>',
rate_limit_tier: '<string>',
expires_at: '<string>'
})
};
fetch('https://api.example.com/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/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' => '<string>',
'permissions' => [
[
]
],
'description' => '<string>',
'rate_limit_tier' => '<string>',
'expires_at' => '<string>'
]),
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.example.com/v1/api-keys"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"permissions\": [\n {}\n ],\n \"description\": \"<string>\",\n \"rate_limit_tier\": \"<string>\",\n \"expires_at\": \"<string>\"\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.example.com/v1/api-keys")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"permissions\": [\n {}\n ],\n \"description\": \"<string>\",\n \"rate_limit_tier\": \"<string>\",\n \"expires_at\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/api-keys")
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 \"name\": \"<string>\",\n \"permissions\": [\n {}\n ],\n \"description\": \"<string>\",\n \"rate_limit_tier\": \"<string>\",\n \"expires_at\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"key": "<string>",
"prefix": "<string>",
"name": "<string>",
"description": "<string>",
"permissions": [
{}
],
"rate_limit_tier": "<string>",
"expires_at": "<string>",
"created_at": "<string>"
}
}API Keys
Create API Key
Mint a new API key. The plaintext secret is returned only on this response.
POST
/
v1
/
api-keys
Create API Key
curl --request POST \
--url https://api.example.com/v1/api-keys \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"permissions": [
{}
],
"description": "<string>",
"rate_limit_tier": "<string>",
"expires_at": "<string>"
}
'import requests
url = "https://api.example.com/v1/api-keys"
payload = {
"name": "<string>",
"permissions": [{}],
"description": "<string>",
"rate_limit_tier": "<string>",
"expires_at": "<string>"
}
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({
name: '<string>',
permissions: [{}],
description: '<string>',
rate_limit_tier: '<string>',
expires_at: '<string>'
})
};
fetch('https://api.example.com/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/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' => '<string>',
'permissions' => [
[
]
],
'description' => '<string>',
'rate_limit_tier' => '<string>',
'expires_at' => '<string>'
]),
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.example.com/v1/api-keys"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"permissions\": [\n {}\n ],\n \"description\": \"<string>\",\n \"rate_limit_tier\": \"<string>\",\n \"expires_at\": \"<string>\"\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.example.com/v1/api-keys")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"permissions\": [\n {}\n ],\n \"description\": \"<string>\",\n \"rate_limit_tier\": \"<string>\",\n \"expires_at\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/api-keys")
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 \"name\": \"<string>\",\n \"permissions\": [\n {}\n ],\n \"description\": \"<string>\",\n \"rate_limit_tier\": \"<string>\",\n \"expires_at\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"key": "<string>",
"prefix": "<string>",
"name": "<string>",
"description": "<string>",
"permissions": [
{}
],
"rate_limit_tier": "<string>",
"expires_at": "<string>",
"created_at": "<string>"
}
}The plaintext
key is returned exactly once, in the response to this call. Store it immediately in a secure secret manager - it cannot be retrieved later. If it is lost, revoke the key and create a new one.Request
Headers
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
string
Strongly recommended. Same key returns the original result (including the plaintext secret) within 24 hours.
Body Parameters
string
required
Human-readable key name. 1 - 120 characters.
array
required
Array of scope strings. At least one is required. Examples:
read:contacts, write:contacts, read:deals, write:deals, write:email, write:ai, admin:api_keys, admin:webhooks.string
Optional description explaining the intended use of the key.
string
Optional override:
standard (default), high, or unmetered. unmetered is only available on enterprise plans.string
Optional ISO 8601 expiry timestamp. After this time, requests with the key return
401 invalid_key.Response
object
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and X-Request-ID.
curl -X POST \
https://data.leadlex.com/functions/v1/api-gateway/v1/api-keys \
-H "Authorization: Bearer wbk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Ingestion worker",
"permissions": ["read:contacts", "write:contacts"],
"description": "Used by the nightly ingestion job"
}'
import requests
API_KEY = "wbk_your_api_key_here"
BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"
payload = {
"name": "Ingestion worker",
"permissions": ["read:contacts", "write:contacts"],
"description": "Used by the nightly ingestion job",
}
r = requests.post(
f"{BASE_URL}/v1/api-keys",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json=payload,
)
key_info = r.json()["data"]
print("Store this immediately:", key_info["key"])
const res = await fetch(
'https://data.leadlex.com/functions/v1/api-gateway/v1/api-keys',
{
method: 'POST',
headers: {
'Authorization': 'Bearer wbk_your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Ingestion worker',
permissions: ['read:contacts', 'write:contacts'],
}),
}
);
const { data } = await res.json();
console.warn('Store this immediately:', data.key);
Example Response
{
"data": {
"id": "key_02HY2",
"key": "wbk_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
"prefix": "wbk_live",
"name": "Ingestion worker",
"description": "Used by the nightly ingestion job",
"permissions": ["read:contacts", "write:contacts"],
"rate_limit_tier": "standard",
"expires_at": null,
"created_at": "2026-04-17T11:20:00Z"
}
}
Errors
| Status | Code | Description |
|---|---|---|
| 400 | validation_error | Missing required fields or unknown permission scope |
| 401 | invalid_key | Invalid or expired API key |
| 403 | insufficient_permissions | Missing admin:api_keys permission |
| 409 | duplicate_name | Key name already in use (active keys only) |
| 429 | rate_limited | Rate limit exceeded |