Umfang erstellen
curl --request POST \
--url https://api.truthlocks.com/v1/scopes \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"action": "<string>",
"resource": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({action: '<string>', resource: '<string>'})
};
fetch('https://api.truthlocks.com/v1/scopes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/scopes"
payload = {
"action": "<string>",
"resource": "<string>"
}
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/scopes"
payload := strings.NewReader("{\n \"action\": \"<string>\",\n \"resource\": \"<string>\"\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": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scope": "<string>",
"resource": "<string>",
"action": "<string>",
"display_name": "<string>",
"description": "<string>",
"category": "<string>",
"is_builtin": true,
"created_at": "2023-11-07T05:31:56Z"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Agentensitzungen & Tools
Umfang erstellen
Erstellen Sie einen benutzerdefinierten, mandantenbezogenen Berechtigungsumfang für eine fein granulare Zugriffssteuerung für Agenten.
POST
/
v1
/
scopes
Umfang erstellen
curl --request POST \
--url https://api.truthlocks.com/v1/scopes \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"action": "<string>",
"resource": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({action: '<string>', resource: '<string>'})
};
fetch('https://api.truthlocks.com/v1/scopes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/scopes"
payload = {
"action": "<string>",
"resource": "<string>"
}
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/scopes"
payload := strings.NewReader("{\n \"action\": \"<string>\",\n \"resource\": \"<string>\"\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": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scope": "<string>",
"resource": "<string>",
"action": "<string>",
"display_name": "<string>",
"description": "<string>",
"category": "<string>",
"is_builtin": true,
"created_at": "2023-11-07T05:31:56Z"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Scope erstellen
POST /v1/scopes
Erstellt einen benutzerdefinierten Berechtigungsumfang für den authentifizierten Mandanten. Benutzerdefinierte Umfänge erweitern das integrierte Umfangsregister um mandantenspezifische Berechtigungen. Die Umfangszeichenfolge wird automatisch aus den Feldern resource und action im Format resource:action zusammengesetzt.
Benutzerdefinierte Scopes werden anhand der MAIP-Scope-Formatregeln validiert: nur alphanumerische Zeichen, Punkte, Unterstriche, Bindestriche und Sternchen.
Benutzerdefinierte Bereiche sind mandantenisoliert. Sie erscheinen nicht in den Bereichslisten anderer Mandanten.
Registrierungen. Eingebaute Plattform-Scopes können nicht überschrieben oder dupliziert werden.
Authentifizierung
ErfordertX-API-Key Header oder Bearer JWT Token. Der Arbeitsbereich wird aus den authentifizierten Anmeldeinformationen abgeleitet; senden Sie X-Tenant-ID nicht.
Antwort
Beispiel
curl -X POST https://api.truthlocks.com/v1/scopes \
-H "X-API-Key: tl_live_..." \
-H "Content-Type: application/json" \
-d '{
"resource": "crm",
"action": "contact.enrich",
"display_name": "CRM Contact Enrichment",
"description": "Allows agents to enrich CRM contact records via third-party providers",
"category": "integration"
}'
Zuweisen benutzerdefinierter Bereiche zu Agenten
Nachdem Sie einen benutzerdefinierten Bereich erstellt haben, weisen Sie ihn Agenten während der Registrierung oder über die Delegation zu:curl -X POST https://api.truthlocks.com/v1/agents \
-H "X-API-Key: tl_live_..." \
-H "Content-Type: application/json" \
-d '{
"agent_type": "pipeline",
"display_name": "CRM Enrichment Pipeline",
"scopes": ["crm:contact.enrich", "data:read"]
}'
Autorisierungen
Body
application/json

