Skip to main content
POST
/
v1
/
policies
Create a new policy
curl --request POST \
  --url https://api.app.chainloop.dev/v1/policies \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "policy": {
    "metadata": {
      "organization": "organization",
      "name": "name",
      "description": "description",
      "annotations": {
        "key": "annotations"
      },
      "display_name": "display_name"
    },
    "kind": "kind",
    "api_version": "api_version",
    "spec": {
      "path": "path",
      "auto_match": {
        "path": "path",
        "embedded": "embedded"
      },
      "inputs": [
        {
          "default": "default",
          "name": "name",
          "description": "description",
          "required": true
        },
        {
          "default": "default",
          "name": "name",
          "description": "description",
          "required": true
        }
      ],
      "policies": [
        {
          "path": "path",
          "kind": "kind",
          "embedded": "embedded"
        },
        {
          "path": "path",
          "kind": "kind",
          "embedded": "embedded"
        }
      ],
      "type": "type",
      "embedded": "embedded"
    }
  },
  "raw_schema": "<string>"
}
'
{}

Authorizations

Authorization
string
header
required

Bearer token for authentication

Body

application/json

Request to create a new policy

Request to create a new policy

policy
Policy · object

A policy that can be applied to materials in Chainloop to validate compliance with specific requirements

Example:
{
  "metadata": {
    "organization": "organization",
    "name": "name",
    "description": "description",
    "annotations": { "key": "annotations" },
    "display_name": "display_name"
  },
  "kind": "kind",
  "api_version": "api_version",
  "spec": {
    "path": "path",
    "auto_match": { "path": "path", "embedded": "embedded" },
    "inputs": [
      {
        "default": "default",
        "name": "name",
        "description": "description",
        "required": true
      },
      {
        "default": "default",
        "name": "name",
        "description": "description",
        "required": true
      }
    ],
    "policies": [
      {
        "path": "path",
        "kind": "kind",
        "embedded": "embedded"
      },
      {
        "path": "path",
        "kind": "kind",
        "embedded": "embedded"
      }
    ],
    "type": "type",
    "embedded": "embedded"
  }
}
raw_schema
string

Base64 raw representation of the policy schema in JSON, YAML, or CUE format

Response

A successful response.

Response for the policy creation request