Bind a key to an agent or roles
Bind a key to a registered agent and/or restrict it to specific roles. Both fields are optional and independent.
curl -X PATCH "https://api.autopil.ai/v1/keys/example_string/binding" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"bound_agent_id": "fraud-analyst-prod-01",
"permitted_roles": [
"transaction_analyst",
"account_profiler"
]
}'
import requests
import json
url = "https://api.autopil.ai/v1/keys/example_string/binding"
headers = {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
data = {
"bound_agent_id": "fraud-analyst-prod-01",
"permitted_roles": [
"transaction_analyst",
"account_profiler"
]
}
response = requests.patch(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.autopil.ai/v1/keys/example_string/binding", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"bound_agent_id": "fraud-analyst-prod-01",
"permitted_roles": [
"transaction_analyst",
"account_profiler"
]
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"bound_agent_id": "fraud-analyst-prod-01",
"permitted_roles": [
"transaction_analyst",
"account_profiler"
]
}`)
req, err := http.NewRequest("PATCH", "https://api.autopil.ai/v1/keys/example_string/binding", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.autopil.ai/v1/keys/example_string/binding')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(uri)
request['Content-Type'] = 'application/json'
request['X-API-Key'] = 'YOUR_API_KEY'
request.body = '{
"bound_agent_id": "fraud-analyst-prod-01",
"permitted_roles": [
"transaction_analyst",
"account_profiler"
]
}'
response = http.request(request)
puts response.body
{
"status": "ok"
}
/v1/keys/{key_id}/bindingTarget server for requests. Edit to use your own host.
API key with admin, read, or evaluate scope. Missing key → 401; invalid or revoked key → 403.
admin, read, or evaluate scope. Missing key → 401; invalid or revoked key → 403.
The media type of the request body
The key will only accept evaluate calls that present this exact agent_id. Mismatched or missing → denied with policy_name="key_agent_binding".
The key will only accept evaluate calls that claim a role in this list.
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. API key with admin, read, or evaluate scope. Missing key → 401; invalid or revoked key → 403.
Path Parameters
Body
The key will only accept evaluate calls that present this exact agent_id. Mismatched or missing → denied with policy_name="key_agent_binding".
The key will only accept evaluate calls that claim a role in this list.