Environments

Copy Environment

Changed on

Copy environment

This endpoint either duplicates an existing environment to a new environment in the same project, or copies from an existing environment to another existing environment.

The scope object controls which objects will be copied to the target environment.

To clone to a new environment, the user must have write permissions to the containing project. To clone into an existing environment, the user must have write permissions to the target environment, and, with delete_target_only_condition_sets, permission to delete its condition sets. In an environment protected by a policy guard, the copy is refused with 403 when it would change or delete an object the guard protects, and with 503 when the guard's decision point cannot be reached.

Copying environments across projects or organizations is not allowed.

post/v2/projects/{proj_id}/envs/{env_id}/copy

Request

  • Base URL
    https://api.permit.io (the document declares no server; this is the origin it was published from)
  • Auth
    HTTP bearer

Path parameters

proj_idstring required

Either the unique id of the project, or the URL-friendly key of the project (i.e: the "slug").

env_idstring required

Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the "slug").

Request body

conflict_strategy'fail' | 'overwrite'

An enumeration.

delete_target_only_condition_setsboolean

Only applies to copying into an existing environment. Delete the target environment's condition sets whose key the source environment does not have and that scope selects (with the same matching as the copy), together with their rules; a resource set is selected only when its resource is copied. Autogenerated condition sets are never deleted, and the copy fails with 409 instead of deleting a condition set that has a descendant which would not itself be deleted. Requires permission to delete condition sets in the target; in a policy-guarded target a guarded condition set is not deleted (the copy fails with 403, or 503 if the guard cannot be reached). Off by default: without it, neither conflict strategy deletes condition sets

Response

Successful Response

keystring required

A URL-friendly name of the environment (i.e: slug). You will be able to query later using this key instead of the id (UUID) of the environment.

idstring uuid required

Unique id of the environment

organization_idstring uuid required

Unique id of the organization that the environment belongs to.

project_idstring uuid required

Unique id of the project that the environment belongs to.

created_atstring date-time required

Date and time when the environment was created (ISO_8601 format).

updated_atstring date-time required

Date and time when the environment was last updated/modified (ISO_8601 format).

avp_policy_store_idstring
namestring required

The name of the environment

descriptionstring

an optional longer description of the environment

custom_branch_namestring

when using gitops feature, an optional branch name for the environment

settingsobject

the settings for this environment

jwks_unpinnedstring[]

Read-only. Which of jwks.issuer and jwks.audience this environment leaves unset: Elements login takes each of those from the token itself, so it checks nothing, and any application whose tokens the same JWKS signs can log in. On a JWKS that must pin both (Firebase Auth's always; a shared IdP host, such as Entra ID or Google, once the deployment refuses unpinned shared configs) Elements login and invite approval are refused instead. Empty when both are set or no JWKS is configured.

Changes

    • info

      added the new optional request property

    • info

      added the new optional request property //////

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property to the response with the status