Skip to main content

Create a Policy Version

Creates a new version of the policy by snapshotting its current recipe. This is useful for tracking changes over time and enabling rollback.
POST /v1/docks/:dockId/policies/:policyId/versions

Path Parameters

ParameterTypeDescription
dockIdstringThe dock ID
policyIdstringThe policy ID

Request Body

ParameterTypeRequiredDescription
changelogstringOptionalA description of what changed in this version

Example Request

curl -X POST https://api.docyard.io/v1/docks/dock_01HQ3K.../policies/pol_01HQ3P.../versions \
  -H "Authorization: Bearer dk_live_a1b2c3d4..." \
  -H "Content-Type: application/json" \
  -d '{
    "changelog": "Added endorsement artifact type and extended expiry to 120 days"
  }'

Response

{
  "version": 4,
  "policyId": "pol_01HQ3P...",
  "recipe": {
    "access": "read",
    "artifactTypes": ["declaration-page", "coi", "endorsement"],
    "requireFactors": ["email_verified"],
    "expiresInDays": 120
  },
  "changelog": "Added endorsement artifact type and extended expiry to 120 days",
  "createdAt": "2025-01-25T08:30:00.000Z"
}

Error Handling

StatusCondition
401Missing or invalid API key
404Policy or dock not found
Versions are immutable once created. The version number auto-increments. To revert to a previous recipe, use the Rollback endpoint.