Skip to main content
POST
/
v1
/
policies
/
{id}
/
versions
/
publish
Publish policy version
curl --request POST \
  --url https://api.trycomp.ai/v1/policies/{id}/versions/publish \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "versionId": "pv_abc123def456",
  "setAsActive": true,
  "changelog": "Updated access controls section"
}
'
const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
versionId: 'pv_abc123def456',
setAsActive: true,
changelog: 'Updated access controls section'
})
};

fetch('https://api.trycomp.ai/v1/policies/{id}/versions/publish', 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/publish"

payload = {
"versionId": "pv_abc123def456",
"setAsActive": True,
"changelog": "Updated access controls section"
}
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

X-API-Key
string
header
required

API key for authentication

Headers

X-Organization-Id
string

Organization ID (required for session auth, optional for API key auth)

Path Parameters

id
string
required

Policy ID

Example:

"pol_abc123def456"

Body

application/json

Publish a new policy version

versionId
string

Version ID to publish. PASS THIS after update-version to publish your edits — omitting it publishes stale draftContent (loses your changes).

Example:

"pv_abc123def456"

setAsActive
boolean

Whether to set this version as the active version

Example:

true

changelog
string

Optional changelog to associate with the published version

Example:

"Updated access controls section"

Response

Version published

versionId
string
version
number