Criar Escopo
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
}Sessões e Ferramentas do Agente
Criar Escopo
Crie um escopo de permissão personalizado com escopo de inquilino para controle de acesso granular de agentes
POST
/
v1
/
scopes
Criar Escopo
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
}Criar Escopo
POST /v1/scopes
Cria um escopo de permissão personalizado para o inquilino autenticado. Escopos personalizados estendem o registro de escopo integrado com permissões específicas do inquilino. A string do escopo é composta automaticamente dos campos resource e action no formato resource:action.
Escopos personalizados são validados contra as regras de formato de escopo MAIP: apenas caracteres alfanuméricos, pontos, sublinhados, hífens e asteriscos.
Escopos personalizados são isolados por locatário. Eles não aparecem nos escopos de outros locatários
registros. Escopos de plataforma integrados não podem ser substituídos ou duplicados.
Autenticação
Requer cabeçalhoX-API-Key ou token JWT de portador. O espaço de trabalho é derivado da credencial autenticada; não envie X-Tenant-ID.
Resposta
Exemplo
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"
}'
Atribuindo Escopos Personalizados a Agentes
Após criar um escopo personalizado, atribua-o aos agentes durante o registro ou via delegação: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"]
}'
Corpo
application/json

