Consumer-API-Schlüssel erstellen
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:00.000Z",
"expires_at": "2026-06-23T14:30:00.000Z"
}{
"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
}Verbraucher (B2C)
Consumer-API-Schlüssel erstellen
Erstellt einen neuen persönlichen API-Schlüssel. Das vollständige Geheimnis wird einmal zurückgegeben und kann nicht erneut abgerufen werden. Verbraucher können bis zu 5 aktive Schlüssel besitzen. Schlüssel verfallen nach 90 Tagen. Erfordert eine authentifizierte individuelle Verbrauchersitzung; eine Geschäftssitzung oder ein Workspace-API-Schlüssel kann die Benutzeridentität nicht ersetzen.
POST
/
v1
/
consumer
/
api-keys
Consumer-API-Schlüssel erstellen
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:00.000Z",
"expires_at": "2026-06-23T14:30:00.000Z"
}{
"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
}Erstellt einen neuen persönlichen API-Schlüssel für den authentifizierten Verbraucher. Das vollständige Geheimnis wird einmal in der Antwort zurückgegeben und kann nicht erneut abgerufen werden – speichern Sie es sicher.
Jeder Verbraucher kann bis zu 5 aktive Schlüssel besitzen. Schlüssel verfallen automatisch nach 90 Tagen.
Antworten
Antwort
API-Schlüssel erstellt. Das Geheimnis wird nur in dieser Antwort angezeigt.

