Chat with AI about a policy
POST
/v1/policies/{id}/ai-chat
const url = 'https://api.varman.io/v1/policies/pol_abc123def456/ai-chat';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"instructions":"Update the data retention section to specify a 7-year retention period","chatHistory":[{"role":"user","content":"Update the data retention policy"},{"role":"assistant","content":"I can help with that..."}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.varman.io/v1/policies/pol_abc123def456/ai-chat \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "instructions": "Update the data retention section to specify a 7-year retention period", "chatHistory": [ { "role": "user", "content": "Update the data retention policy" }, { "role": "assistant", "content": "I can help with that..." } ] }'Ask policy-specific questions and request draft improvements while preserving human review before policy changes are applied.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”id
required
string
Example
pol_abc123def456Policy ID
Header Parameters
Section titled “Header Parameters”X-Organization-Id
string
Organization ID (required for session auth, optional for API key auth)
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
instructions
required
User instructions about what changes to make to the policy
string
Example
Update the data retention section to specify a 7-year retention periodchatHistory
Chat history for context (array of messages with role and content)
Array<object>
object
role
string
content
string
Example
[ { "role": "user", "content": "Update the data retention policy" }, { "role": "assistant", "content": "I can help with that..." }]Responses
Section titled “Responses”Streaming AI response
Media typetext/event-stream
string
Unauthorized
Policy not found