Re-read an attached policy document into the editor
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
}Policies
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.
POST
/
v1
/
policies
/
{id}
/
extract-document
Re-read an attached policy document into the editor
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
}Headers
Body
application/json
Response
201 - application/json
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).
Example:
null
Was this page helpful?

