curl --request POST \
--url https://api.trycomp.ai/v1/policies/{id}/extract-document \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"versionId": "pv_abc123def456"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({versionId: 'pv_abc123def456'})
};
fetch('https://api.trycomp.ai/v1/policies/{id}/extract-document', 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}/extract-document"
payload = { "versionId": "pv_abc123def456" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"queued": true,
"versionId": "pv_abc123def456",
"reason": null
}Re-read an attached policy document into the | Comp AI API
Queues a fresh read of the PDF already attached to a policy, storing its text as the version’s editor content. Use when an uploaded policy still reads as.
curl --request POST \
--url https://api.trycomp.ai/v1/policies/{id}/extract-document \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"versionId": "pv_abc123def456"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({versionId: 'pv_abc123def456'})
};
fetch('https://api.trycomp.ai/v1/policies/{id}/extract-document', 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}/extract-document"
payload = { "versionId": "pv_abc123def456" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"queued": true,
"versionId": "pv_abc123def456",
"reason": null
}Authorizations
API key for authentication
Headers
Organization ID (required for session auth, optional for API key auth)
Path Parameters
Policy ID
"pol_abc123def456"
Body
Optional version ID whose attached document should be read. Omit to use the policy's current version.
"pv_abc123def456"
Response
True when a read of the attached document was queued. False when no read will happen — see reason.
true
The version the read targets, or null when the policy has no version to read into.
"pv_abc123def456"
Null when the read was queued. Otherwise why it was not, so a caller never waits for text that is not coming: no_version / no_document (nothing to read), already_has_content (the version already has text), pending_approval or published_version (the target may not be written to), document_replaced (the attached file changed), queue_unavailable (the job could not be scheduled — retry).
null
Was this page helpful?

