Adding and Managing Policies
You attach policies to an API proxy from the API Control Plane. The self-hosted gateway runs those policies on the traffic it handles in your infrastructure. Attach a policy at the API level to apply it to every resource, or at the resource level to apply it to one resource. If you attach more than one, you can drag them to change the order they run in.
Saving the API records the policies. Deploy the API afterward so the self-hosted gateway starts enforcing them.
You can attach Policy Hub policies and your organization's custom policies. To build a policy of your own into the self-hosted gateway, see Adding Custom Policies.
Attach an API Level Policy
An API level policy applies to every resource in the API proxy. To attach one, follow the steps given below.
-
Sign in to the API Control Plane Console.
-
In the header, select the project from the Projects list and the API from the APIs list. The API must be one that you deploy to your self-hosted gateway.
-
In the left navigation menu, click Develop, then click Policies.

-
In the Available policies pane, find the policy you want to attach. You can type a policy name in Search policies, or select a category from the All list to filter the policies.
tipEach policy shows its version. To view the details and configuration of a policy, click Policy Hub at the top of the pane. The Policy Hub lists the policies you can attach.
-
Drag the policy and drop it in the Global policies section.
-
Configure the policy parameters, if any, and click Add.
-
To attach more policies, repeat steps 4 to 6. The policies run in the order they appear in the section, and you can drag them to change the order.
-
Click Save to apply the policies to the API.
Attach a Resource Level Policy
A resource level policy applies only to the resource you attach it to. To attach one, follow the steps given below.
-
Sign in to the API Control Plane Console.
-
In the header, select the project from the Projects list and the API from the APIs list.
-
In the left navigation menu, click Develop, then click Policies.
-
In the Resource policies section, find the resource you want to attach a policy to. You can type a path in Search resources by path, or select an HTTP method from the All methods list to filter the resources.
-
Click the resource to expand it.

-
In the Available policies pane, find the policy you want to attach by searching for it or filtering by category.
-
Drag the policy from the Available policies pane and drop it in the area below the resource.
-
Configure the policy parameters, if any, and click Add.
-
To attach more policies to the resource, repeat steps 6 to 8. To attach policies to other resources, repeat steps 4 to 8.
-
Click Save to apply the policies to the API.
Deploy the API to the Self-Hosted Gateway
The policies stay inactive until you deploy the API. Deploy it so the self-hosted gateway receives the updated policy chain. For the steps, see Deploy the API to the Self-Hosted Gateway.
When the deployment is active, the gateway runs the policies in the order you arranged them.
Was this page helpful?