Create policy version
curl --request POST \
--url https://api.trycomp.ai/v1/policies/{id}/versions \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"sourceVersionId": "pv_abc123def456",
"changelog": "Initial draft for quarterly updates"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sourceVersionId: 'pv_abc123def456',
changelog: 'Initial draft for quarterly updates'
})
};
fetch('https://api.trycomp.ai/v1/policies/{id}/versions', 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}/versions"
payload = {
"sourceVersionId": "pv_abc123def456",
"changelog": "Initial draft for quarterly updates"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"versionId": "<string>",
"version": 123
}{
"message": "Invalid request"
}{
"message": "Unauthorized"
}{
"message": "Resource not found"
}Policies
Create policy version | Comp AI API
Creates a new draft version of a policy, cloned from the policy’s newest version — an unpublished draft included, a version awaiting approval skipped.
POST
/
v1
/
policies
/
{id}
/
versions
Create policy version
curl --request POST \
--url https://api.trycomp.ai/v1/policies/{id}/versions \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"sourceVersionId": "pv_abc123def456",
"changelog": "Initial draft for quarterly updates"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sourceVersionId: 'pv_abc123def456',
changelog: 'Initial draft for quarterly updates'
})
};
fetch('https://api.trycomp.ai/v1/policies/{id}/versions', 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}/versions"
payload = {
"sourceVersionId": "pv_abc123def456",
"changelog": "Initial draft for quarterly updates"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"versionId": "<string>",
"version": 123
}{
"message": "Invalid request"
}{
"message": "Unauthorized"
}{
"message": "Resource not found"
}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
Create a new policy version draft
Version ID to base the new version on. Defaults to the policy's newest version, skipping one awaiting approval — pass the live version's ID to start from what is published instead.
Example:
"pv_abc123def456"
Optional changelog to associate with the new version
Example:
"Initial draft for quarterly updates"
Was this page helpful?

