---
title: "CreatePolicyValidation"
method: POST
path: "/v1/namespaces/{tenant_meta.namespace}/policy/validate"
tags: ["PolicyValidationService"]
---

# CreatePolicyValidation

`POST /v1/namespaces/{tenant_meta.namespace}/policy/validate`

## Request

- Base URL: `https://api.endorlabs.com`
- URL: `https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/policy/validate`
- Auth: none declared

Creates a policy validation request.

## Path parameters

- `tenant_meta.namespace` string, required

## Request body

- PolicyValidationServiceCreatePolicyValidationBody: PolicyValidation represents a policy validation request and response.
  - `meta` V1Meta, required: Common fields for all Endor Labs resources.
    - `annotations` object: Annotations can be used to attach metadata to a resource message. Annotation values can be small or large, structured or unstructured, and may include characters not permitted by labels. The keys may contain alphanumerics, underscores (_), dots (.) and dashes (-). The values of an annotation must be 16384 bytes or smaller.
    - `create_time` string, date-time: Time the resource was created. Format: 2017-01-15T01:30:15.01Z RFC 3339: https://www.ietf.org/rfc/rfc3339.txt.
    - `created_by` string: Name and authentication source of the user who created the object, for example, ewok@endor.ai@google@api-key.
    - `description` string: Resource description. Must be less than 1024 bytes.
    - `index_data` V1IndexData: IndexData is used to index the resource for search. It's an internal object.
      - `data` string[]
      - `search_score` number, float: search_score is the score of the resource for search. Internal use only.
      - `tenant` string
      - `will_be_deleted_at` string, date-time: Time that the resource will be deleted.
    - `kind` string: Resource kind, for example, HelloResponse. Auto-generated using the protobuf message proto.MessageName().Name().
    - `name` string, required: Resource name. Must be 63 characters or less.
    - `parent_kind` string: Parent object resource kind, for example, Project.
    - `parent_uuid` string: Parent object UUID.
    - `references` object: Map of objects referenced in a query API.
    - `tags` string[]: List of tags attached to the resource. Tags can be used to select objects and to find collections of objects that satisfy certain conditions. A tag must be 255 characters or less.
    - `update_time` string, date-time: Time the resource was last updated. Note: Updated on all create/patch/delete operations. Format: 2017-01-15T01:30:15.01Z RFC 3339: https://www.ietf.org/rfc/rfc3339.txt.
    - `updated_by` string: Name and authentication source of the last user who updated the object, for example, vulnerabilityingestor@endor.ai@x509.
    - `upsert_time` string, date-time: Time the resource was last upserted. Note: create_time is only set the first time the resource is created. upsert_time is set every time the resource is upseted. Format: 2017-01-15T01:30:15.01Z RFC 3339: https://www.ietf.org/rfc/rfc3339.txt.
    - `version` string: Message version.
  - `spec` V1PolicyValidationSpec, required
    - `request` V1PolicyValidationRequest, required: PolicyValidationRequest represents a policy validation request. If no project is specified the policy is validated against all projects.
      - `disable_preview` boolean: Set to true to validate the policy without project data.
      - `policy_type` 'POLICY_TYPE_UNSPECIFIED' | 'POLICY_TYPE_ADMISSION' | 'POLICY_TYPE_NOTIFICATION' | 'POLICY_TYPE_FINDING' | 'POLICY_TYPE_FINDING_CFG' | 'POLICY_TYPE_ML_FINDING' | 'POLICY_TYPE_SYSTEM_FINDING' | 'POLICY_TYPE_USER_FINDING' | 'POLICY_TYPE_EXCEPTION' | 'POLICY_TYPE_REMEDIATION': - POLICY_TYPE_ADMISSION: POLICY_TYPE_ADMISSION will admit/reject pipeline runs. Admission policies operate on Findings and are run during a CI/CD pipeline. They may return data such as the uuids of findings that violate the policy. - POLICY_TYPE_NOTIFICATION: POLICY_TYPE_NOTIFICATION is for policies that generate notifications. - POLICY_TYPE_ML_FINDING: ML finding policies enable or disable algorithmic findings. Note that there is no input data for these policies, they always return output, and the allowed value is ignored. - POLICY_TYPE_SYSTEM_FINDING: A system finding policy is created from a system policy template. It processes data and creates new findings. System finding policies are run together with user and ML (a.k.a. algorithmic) findings. System finding policies can only be enabled, disabled, and edited. They cannot be created or deleted. - POLICY_TYPE_USER_FINDING: A user finding policy is created from scratch or from a customer policy template. It processes data and creates new findings. User finding policies are run together with system and ML (a.k.a. algorithmic) findings. User finding policies can be created, enabled, disabled, edited, and deleted. - POLICY_TYPE_EXCEPTION: An exception policy identifies findings which should be excluded from admission and notification policies. It is created from scratch or from an exception policy template. - POLICY_TYPE_REMEDIATION: A remediation policy identifies findings which should be remediated. It is created from scratch or from a remediation policy template.
      - `project_exceptions` string[]: The set of tags that projects that are matched with are excluded from the policy. Allows exceptions. Exceptions can be provided with or without selectors.
      - `project_selector` string[]
      - `project_uuid` string: The UUID of project to load data from [optional].
      - `query_statements` string[]: List of OPA query statements that must be executed to evaluate the policy (for example, "data.packagename.allow").
      - `resource_kinds` string[]: Identifies all resources that a policy requires. For example, "Project", "Repository", "RepositoryVersion", "PackageVersion", "DependencyMetadata", "Metric", "LinterResult", "Finding", etc. For the "Metric" resource you must also specify the corresponding parent resource kind.
      - `rule` string: Policy Rego rule in text format.
      - `target_kind` string: Repository, RepositoryVersion, or PackageVersion. This is usually the same as the finding parent kind. Only applicable to SYSTEM and USER_FINDING policies.
      - `template_uuid` string: The UUID of policy template from which the policy will be created.
      - `template_values` object: The map of key-value pairs for parameters used to customize the policy Rego rule.
    - `result` PolicyValidationResult: PolicyValidationResult represents a policy validation result.
      - `allow` boolean: True if input data is accepted by policy. False if input data is rejected by policy. Null if validation failed.
      - `evaluation_time` object: Time it took to evaluate the policy, in milliseconds, indexed by the project UUID.
      - `policy_output` object: Parsed policy output indexed by the project UUID.
      - `policy_rule` string, required: Policy rule from the request.
      - `query_statements` string[], required: List of policy query statements from the request.
      - `resource_kinds` string[]: List of resource kinds that the validated policy requires.
      - `valid_policy` boolean, required: Validation result. True if policy is valid. False if policy is not valid.
      - `validation_error` string: Validation error if applicable. Empty if policy is valid.
  - `tenant_meta` object, required: The tenant metadata restrict access to a specific tenant.
  - `uuid` string: The UUID of the resource.

## Response `200`

A successful response.

- V1PolicyValidation: PolicyValidation represents a policy validation request and response.
  - `meta` V1Meta, required: Common fields for all Endor Labs resources.
    - `annotations` object: Annotations can be used to attach metadata to a resource message. Annotation values can be small or large, structured or unstructured, and may include characters not permitted by labels. The keys may contain alphanumerics, underscores (_), dots (.) and dashes (-). The values of an annotation must be 16384 bytes or smaller.
    - `create_time` string, date-time: Time the resource was created. Format: 2017-01-15T01:30:15.01Z RFC 3339: https://www.ietf.org/rfc/rfc3339.txt.
    - `created_by` string: Name and authentication source of the user who created the object, for example, ewok@endor.ai@google@api-key.
    - `description` string: Resource description. Must be less than 1024 bytes.
    - `index_data` V1IndexData: IndexData is used to index the resource for search. It's an internal object.
      - `data` string[]
      - `search_score` number, float: search_score is the score of the resource for search. Internal use only.
      - `tenant` string
      - `will_be_deleted_at` string, date-time: Time that the resource will be deleted.
    - `kind` string: Resource kind, for example, HelloResponse. Auto-generated using the protobuf message proto.MessageName().Name().
    - `name` string, required: Resource name. Must be 63 characters or less.
    - `parent_kind` string: Parent object resource kind, for example, Project.
    - `parent_uuid` string: Parent object UUID.
    - `references` object: Map of objects referenced in a query API.
    - `tags` string[]: List of tags attached to the resource. Tags can be used to select objects and to find collections of objects that satisfy certain conditions. A tag must be 255 characters or less.
    - `update_time` string, date-time: Time the resource was last updated. Note: Updated on all create/patch/delete operations. Format: 2017-01-15T01:30:15.01Z RFC 3339: https://www.ietf.org/rfc/rfc3339.txt.
    - `updated_by` string: Name and authentication source of the last user who updated the object, for example, vulnerabilityingestor@endor.ai@x509.
    - `upsert_time` string, date-time: Time the resource was last upserted. Note: create_time is only set the first time the resource is created. upsert_time is set every time the resource is upseted. Format: 2017-01-15T01:30:15.01Z RFC 3339: https://www.ietf.org/rfc/rfc3339.txt.
    - `version` string: Message version.
  - `spec` V1PolicyValidationSpec, required
    - `request` V1PolicyValidationRequest, required: PolicyValidationRequest represents a policy validation request. If no project is specified the policy is validated against all projects.
      - `disable_preview` boolean: Set to true to validate the policy without project data.
      - `policy_type` 'POLICY_TYPE_UNSPECIFIED' | 'POLICY_TYPE_ADMISSION' | 'POLICY_TYPE_NOTIFICATION' | 'POLICY_TYPE_FINDING' | 'POLICY_TYPE_FINDING_CFG' | 'POLICY_TYPE_ML_FINDING' | 'POLICY_TYPE_SYSTEM_FINDING' | 'POLICY_TYPE_USER_FINDING' | 'POLICY_TYPE_EXCEPTION' | 'POLICY_TYPE_REMEDIATION': - POLICY_TYPE_ADMISSION: POLICY_TYPE_ADMISSION will admit/reject pipeline runs. Admission policies operate on Findings and are run during a CI/CD pipeline. They may return data such as the uuids of findings that violate the policy. - POLICY_TYPE_NOTIFICATION: POLICY_TYPE_NOTIFICATION is for policies that generate notifications. - POLICY_TYPE_ML_FINDING: ML finding policies enable or disable algorithmic findings. Note that there is no input data for these policies, they always return output, and the allowed value is ignored. - POLICY_TYPE_SYSTEM_FINDING: A system finding policy is created from a system policy template. It processes data and creates new findings. System finding policies are run together with user and ML (a.k.a. algorithmic) findings. System finding policies can only be enabled, disabled, and edited. They cannot be created or deleted. - POLICY_TYPE_USER_FINDING: A user finding policy is created from scratch or from a customer policy template. It processes data and creates new findings. User finding policies are run together with system and ML (a.k.a. algorithmic) findings. User finding policies can be created, enabled, disabled, edited, and deleted. - POLICY_TYPE_EXCEPTION: An exception policy identifies findings which should be excluded from admission and notification policies. It is created from scratch or from an exception policy template. - POLICY_TYPE_REMEDIATION: A remediation policy identifies findings which should be remediated. It is created from scratch or from a remediation policy template.
      - `project_exceptions` string[]: The set of tags that projects that are matched with are excluded from the policy. Allows exceptions. Exceptions can be provided with or without selectors.
      - `project_selector` string[]
      - `project_uuid` string: The UUID of project to load data from [optional].
      - `query_statements` string[]: List of OPA query statements that must be executed to evaluate the policy (for example, "data.packagename.allow").
      - `resource_kinds` string[]: Identifies all resources that a policy requires. For example, "Project", "Repository", "RepositoryVersion", "PackageVersion", "DependencyMetadata", "Metric", "LinterResult", "Finding", etc. For the "Metric" resource you must also specify the corresponding parent resource kind.
      - `rule` string: Policy Rego rule in text format.
      - `target_kind` string: Repository, RepositoryVersion, or PackageVersion. This is usually the same as the finding parent kind. Only applicable to SYSTEM and USER_FINDING policies.
      - `template_uuid` string: The UUID of policy template from which the policy will be created.
      - `template_values` object: The map of key-value pairs for parameters used to customize the policy Rego rule.
    - `result` PolicyValidationResult: PolicyValidationResult represents a policy validation result.
      - `allow` boolean: True if input data is accepted by policy. False if input data is rejected by policy. Null if validation failed.
      - `evaluation_time` object: Time it took to evaluate the policy, in milliseconds, indexed by the project UUID.
      - `policy_output` object: Parsed policy output indexed by the project UUID.
      - `policy_rule` string, required: Policy rule from the request.
      - `query_statements` string[], required: List of policy query statements from the request.
      - `resource_kinds` string[]: List of resource kinds that the validated policy requires.
      - `valid_policy` boolean, required: Validation result. True if policy is valid. False if policy is not valid.
      - `validation_error` string: Validation error if applicable. Empty if policy is valid.
  - `tenant_meta` V1TenantMeta, required: Tenant related data for the tenant containing the resource.
    - `namespace` string, required: Namespaces are a way to organize organizational units into virtual groupings of resources. Namespaces must be a fully qualified name, for example, the child namespace of namespace "endor.prod" called "app" is called "endor.prod.app".
  - `uuid` string: The UUID of the resource.

## Other responses

- `default`: An unexpected error response.

## Changes

- **2026-11-03** `4acd9fe15140`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/endorlabs/apis/endor-labs-rest-api-reference/changes/v1/namespaces/:tenant_meta.namespace/policy/validate/post.md)

---

[API](https://skmtc.dev/endorlabs/apis/endor-labs-rest-api-reference.md) - [All operations](https://skmtc.dev/endorlabs/apis/endor-labs-rest-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/endorlabs/apis/endor-labs-rest-api-reference/revisions/4acd9fe15140?raw)
