Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

Conditional Policy Enforcement

This sample demonstrates conditional policy enforcement on the Apigee API Platform. Conditional policy enforcement enables you to execute a policy based on a condition defined on a flow.

The condition in this sample evaluates a custom HTTP header called “responsetime”. When “true”, a Python script is executed, which populates custom response headers with metrics from the Apigee gateway.

For a complete list of redefined variables that you can use to build conditional logic, please see:

For instructions on constructing conditional statement with those variables, please see:

Set up

  • The username and password that you use to login to
  • The name of the organization in which you have an account. Login to and check account settings.

You can obtain a free account at


Update /setup/ with your environment details

Import and deploy sample project

To deploy, run $ sh

To test, run $ sh

Get help

For assistance, please use Apigee Support.

Copyright © 2014, 2015 Apigee Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Something went wrong with that request. Please try again.