policy_engine

Create Policy Version

Create a new draft version of a policy. Copies all fields from the source. Source is current production if source_policy_id is not provided.

post/policies/name/{policy_name}/versions

Request

  • Base URL: https://docs.litellm.com.cn (the document declares no server; this is the origin it was published from)
  • URL: https://docs.litellm.com.cn/policies/name/{policy_name}/versions
  • Auth: API key in header x-litellm-api-key

Path parameters

policy_namestring required

Request body

source_policy_idstring nullable

Policy ID to clone from. If None, clone from current production version.

Response

Successful Response

conditionobject nullable

Policy condition.

created_atstring date-time nullable

When the policy was created.

created_bystring nullable

Who created the policy.

definition_location'db' | 'config'

Where this policy is defined: 'db' (database) or 'config' (config.yaml).

descriptionstring nullable

Policy description.

guardrails_addstring[]

Guardrails to add.

guardrails_removestring[]

Guardrails to remove.

inheritstring nullable

Parent policy name.

is_latestboolean

True if this is the latest version by version_number.

parent_version_idstring nullable

Policy ID this version was cloned from.

pipelineobject nullable

Optional guardrail pipeline.

policy_idstring required

Unique ID of the policy.

policy_namestring required

Name of the policy.

production_atstring date-time nullable

When this version was promoted to production.

published_atstring date-time nullable

When this version was published.

updated_atstring date-time nullable

When the policy was last updated.

updated_bystring nullable

Who last updated the policy.

version_numberinteger

Version number of this policy.

version_statusstring

One of: draft, published, production.

Changes

No recorded changes to this operation across all 1 revision of this API.