Create API Key
curl --request POST \
--url https://api.truthlocks.com/v1/api-keys \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Production API Key"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Production API Key'})
};
fetch('https://api.truthlocks.com/v1/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/api-keys"
payload = { "name": "Production API Key" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/api-keys"
payload := strings.NewReader("{\n \"name\": \"Production API Key\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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))
}{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Production API Key",
"secret": "tl_live_abc123xyz789..."
}API Keys
Create API Key
Creates a new API key. The secret is returned once and cannot be retrieved again.
POST
/
v1
/
api-keys
Create API Key
curl --request POST \
--url https://api.truthlocks.com/v1/api-keys \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Production API Key"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Production API Key'})
};
fetch('https://api.truthlocks.com/v1/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/api-keys"
payload = { "name": "Production API Key" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/api-keys"
payload := strings.NewReader("{\n \"name\": \"Production API Key\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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))
}{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Production API Key",
"secret": "tl_live_abc123xyz789..."
}Creates a new API key for the authenticated organization. The secret is returned ONCE and cannot be retrieved again. Store it securely.
Responses
Authorizations
APIKeyBearerAuth
API key for machine-to-machine authentication
Body
application/json

