Publish policy version
POST
/v1/policies/{id}/versions/publish
const url = 'https://api.varman.io/v1/policies/pol_abc123def456/versions/publish';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"versionId":"pv_abc123def456","setAsActive":true,"changelog":"Updated access controls section"}'};
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/versions/publish \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "versionId": "pv_abc123def456", "setAsActive": true, "changelog": "Updated access controls section" }'Publishes a draft policy version, making it the active/current version of the policy. Pass the versionId of the draft you want to publish — for example one created via create-policy-version and then edited.
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”Publish a new policy version
Media typeapplication/json
object
versionId
Version ID to publish. PASS THIS after update-version to publish your edits — omitting it publishes stale draftContent (loses your changes).
string
Example
pv_abc123def456setAsActive
Whether to set this version as the active version
boolean
Example
truechangelog
Optional changelog to associate with the published version
string
Example
Updated access controls sectionResponses
Section titled “Responses”Version published
Media typeapplication/json
object
versionId
string
version
number
Example generated
{ "versionId": "example", "version": 1}Invalid request
Media typeapplication/json
object
message
string
Example
{ "message": "Invalid request"}Unauthorized
Media typeapplication/json
object
message
string
Example
{ "message": "Unauthorized"}Resource not found
Media typeapplication/json
object
message
string
Example
{ "message": "Resource not found"}