Skip to main content

Create Policy from Template

Creates a new policy in a dock using a pre-built platform template as the starting point. The template’s recipe is copied into the new policy, which can then be customized.
POST /v1/docks/:dockId/policies/from-template

Path Parameters

ParameterTypeDescription
dockIdstringThe dock ID

Request Body

ParameterTypeRequiredDescription
templateIdstringRequiredThe ID of the platform template to use
namestringOptionalCustom name for the policy (defaults to the template name)

Example Request

curl -X POST https://api.docyard.io/v1/docks/dock_01HQ3K.../policies/from-template \
  -H "Authorization: Bearer dk_live_a1b2c3d4..." \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "tpl_standard_mortgagee",
    "name": "Mortgagee Access - Custom"
  }'

Response

{
  "id": "pol_01HQ3Q...",
  "dockId": "dock_01HQ3K...",
  "name": "Mortgagee Access - Custom",
  "recipe": {
    "access": "read",
    "artifactTypes": ["declaration-page", "coi"],
    "requireFactors": ["email_verified"],
    "expiresInDays": 90
  },
  "status": "DRAFT",
  "currentVersion": 1,
  "createdAt": "2025-01-15T11:05:00.000Z"
}

Error Handling

StatusCondition
400templateId is missing or invalid
401Missing or invalid API key
404Dock or template not found
Use List Templates to browse available platform templates before creating a policy from one.