Chat with AI about a policy
curl --request POST \
--url https://api.trycomp.ai/v1/policies/{id}/ai-chat \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"instructions": "Update the data retention section to specify a 7-year retention period"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
instructions: 'Update the data retention section to specify a 7-year retention period'
})
};
fetch('https://api.trycomp.ai/v1/policies/{id}/ai-chat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.trycomp.ai/v1/policies/{id}/ai-chat"
payload = { "instructions": "Update the data retention section to specify a 7-year retention period" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)"<string>"Policies
Chat with AI about a policy | Comp AI API
Ask policy-specific questions and request draft improvements while preserving human review before policy changes are applied.
POST
/
v1
/
policies
/
{id}
/
ai-chat
Chat with AI about a policy
curl --request POST \
--url https://api.trycomp.ai/v1/policies/{id}/ai-chat \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"instructions": "Update the data retention section to specify a 7-year retention period"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
instructions: 'Update the data retention section to specify a 7-year retention period'
})
};
fetch('https://api.trycomp.ai/v1/policies/{id}/ai-chat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.trycomp.ai/v1/policies/{id}/ai-chat"
payload = { "instructions": "Update the data retention section to specify a 7-year retention period" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)"<string>"Authorizations
API key for authentication
Headers
Organization ID (required for session auth, optional for API key auth)
Path Parameters
Policy ID
Example:
"pol_abc123def456"
Body
application/json
User instructions about what changes to make to the policy
Example:
"Update the data retention section to specify a 7-year retention period"
Chat history for context (array of messages with role and content)
Show child attributes
Show child attributes
Example:
[ { "role": "user", "content": "Update the data retention policy" }, { "role": "assistant", "content": "I can help with that..." } ]
Response
Streaming AI response
The response is of type string.
Was this page helpful?

