API action reference

Duplicate a policy

Duplicate a policy. This action uses the same domain service from REST and MCP, so successful calls produce the same canonical domain result.

Authorization and availability

Required scope: policies:write. Available in Test and Live. REST operation: POST /v1/policies/{id}/duplicate. Equivalent MCP tool: veltor_duplicate_policy.

Request schema

Unknown fields are rejected. Path values shown in the route are combined with the JSON body or query input before validation.

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "key": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]{0,63}$"
    }
  },
  "required": [
    "id",
    "name",
    "key"
  ],
  "additionalProperties": false
}

Example request payload

{
  "id": "00000000-0000-4000-8000-000000000001",
  "name": "Signup protection copy",
  "key": "signup_protection_copy"
}

Response schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "propertyNames": {
    "type": "string"
  },
  "additionalProperties": {}
}

Example success response

REST returns this canonical domain result as JSON. MCP returns the same value in structuredContent and adds only its transport request ID.

{
  "id": "00000000-0000-4000-8000-000000000001",
  "status": "available"
}

Errors and recovery

Relevant errors include invalid input (422), missing scope or organization access (403), missing resources (404), revision or idempotency conflicts (409), rate limits (429), and deadline exhaustion (504). Use the returned request ID when investigating a failure.

Idempotency, retries, and timeout

Send a stable idempotency key and reuse it only for an exact retry of this mutation. The server deadline is 5 seconds. Retry only when the error reports retryable true.

cURL

curl -X POST https://veltor.dev/v1/policies/RESOURCE_ID/duplicate \
  -H "Authorization: Bearer $VELTOR_SECRET_KEY" \
  -H "Veltor-Organization: $VELTOR_ORGANIZATION" \
  -H "Idempotency-Key: operation_123" \
  -H "Content-Type: application/json" \
  --data '{"name":"Signup protection copy","key":"signup_protection_copy"}'

Node SDK

const result = await veltor.call("/v1/policies/RESOURCE_ID/duplicate", {
  method: "POST",
  input: {"id":"00000000-0000-4000-8000-000000000001","name":"Signup protection copy","key":"signup_protection_copy"},
  idempotencyKey: "operation_123",
});

MCP

veltor_duplicate_policy({
  "id": "00000000-0000-4000-8000-000000000001",
  "name": "Signup protection copy",
  "key": "signup_protection_copy",
  "idempotency_key": "operation_123"
})