Tyk v2.2 Documentation Components

HomeTyk v2.2 Documentation ComponentsTutorial: Create a Policy (CE)

Tutorial: Create a Policy (CE)

Adding a policy to a file-based (Community Edition) Tyk Gateway is very easy – Polices are loaded into memory on load and so need to be specified in advanced in a file called policies.json, to add a policy, simply create or edit the /policies/policies.json file and add the policy object to the object array:


    "POLICYID": {
        "access_rights": {
            "{API-ID}": {
                "allowed_urls": [],
                "api_id": "{API-ID}",
                "api_name": "{API-NAME}",
                "versions": [
        "active": true,
        "name": "POLICY NAME",
        "rate": 100,
        "per": 1,
        "quota_max": 10000,
        "quota_renewal_rate": 3600,
        "tags": ["Startup Users"]

The above creates a new policy with a Policy ID that you can define, with the rate limits, and security profile that grants access to the APIs listed in the access_rights section.

Was this article helpful to you? Yes No