Skip to main content
Version: 2.0.0

Auto-populate Actions

Often, when creating a new resource, you want to set default actions that can be performed on that resource. The actions names can be custom, and not with the default CRUD naming that come configured within Permit.

Configuring custom default actions

Here is the endpoint you need to call:

https://api.permit.io/v2/projects/:project_id/envs/:env_id

For this endpoint, you can refer to this guide to fetch your project and environment id's, and this guide to get your API key.

As part of this request, you will need to pass in an object, defining your custom actions that you want populated for any new resource.

{
"settings": {
"default_resource_actions": ["read", "write", "allow-review"]
}
}
note

Please remember that any changes you are making are per environment, not the whole project, or workspace.

The cURL request

curl --location --request PATCH 'https://api.permit.io/v2/projects/:project_id/envs/:env_id' \
--header 'authority: api.permit.io' \
--header 'authorization: Bearer permit_env_api_key' \
--header 'origin: https://app.permit.io' \
--header 'Content-Type: application/json' \
--data-raw '{"settings":{"default_resource_actions":["read","write"]}}'