Create Consumer API Key
curl --request POST \
--url https://api.truthlocks.com/v1/consumer/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "CI pipeline key"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'CI pipeline key'})
};
fetch('https://api.truthlocks.com/v1/consumer/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/consumer/api-keys"
payload = { "name": "CI pipeline key" }
headers = {
"Authorization": "Bearer <token>",
"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/consumer/api-keys"
payload := strings.NewReader("{\n \"name\": \"CI pipeline key\"\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))
}{
"key_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "CI pipeline key",
"prefix": "tlk_abcd1234",
"status": "active",
"scopes": [
"consumer:read",
"consumer:write",
"attestations:mint",
"attestations:read",
"verify:read"
],
"secret": "tlk_abcd1234abcd5678ef901234abcd5678ef901234abcd5678ef901234abcd5678",
"created_at": "2026-03-25T14:30:00Z",
"expires_at": "2026-06-23T14:30:00Z"
}{
"code": "VALIDATION_ERROR",
"message": "Maximum of 5 active API keys reached. Revoke an existing key first.",
"http_status": 400
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Consumer (B2C)
Create consumer API key
Creates a new personal API key. The full secret is returned once and cannot be retrieved again. Consumers may hold up to 5 active keys. Keys expire after 90 days. Requires an authenticated individual consumer session; a business session or workspace API key cannot substitute for the user identity.
POST
/
v1
/
consumer
/
api-keys
Create Consumer API Key
curl --request POST \
--url https://api.truthlocks.com/v1/consumer/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "CI pipeline key"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'CI pipeline key'})
};
fetch('https://api.truthlocks.com/v1/consumer/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/consumer/api-keys"
payload = { "name": "CI pipeline key" }
headers = {
"Authorization": "Bearer <token>",
"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/consumer/api-keys"
payload := strings.NewReader("{\n \"name\": \"CI pipeline key\"\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))
}{
"key_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "CI pipeline key",
"prefix": "tlk_abcd1234",
"status": "active",
"scopes": [
"consumer:read",
"consumer:write",
"attestations:mint",
"attestations:read",
"verify:read"
],
"secret": "tlk_abcd1234abcd5678ef901234abcd5678ef901234abcd5678ef901234abcd5678",
"created_at": "2026-03-25T14:30:00Z",
"expires_at": "2026-06-23T14:30:00Z"
}{
"code": "VALIDATION_ERROR",
"message": "Maximum of 5 active API keys reached. Revoke an existing key first.",
"http_status": 400
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Creates a new personal API key for the authenticated consumer. The full secret is returned once in the response and cannot be retrieved again — store it securely.
Each consumer can hold up to 5 active keys. Keys automatically expire after 90 days.
Responses
Response
API key created. The secret is shown only in this response.

