---
title: Access API examples · Cloudflare Zero Trust docs
description: You can use the Cloudflare Access API to create policies, including individual rule blocks inside of group or policy bodies. For example, this policy allows all Cloudflare email account users to reach the application with the exception of one account:
lastUpdated: 2024-08-22T18:02:52.000Z
source_url:
  html: https://77261bbd.preview.developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/index.md
  md: https://77261bbd.preview.developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/
---

You can use the Cloudflare Access API to create policies, including individual rule blocks inside of group or policy bodies. For example, this policy allows all Cloudflare email account users to reach the application with the exception of one account:

```json
{
  "name": "allow cloudflare employees",
  "decision": "allow",
  "include": [
    {
      "email_domain": {
        "domain": "cloudflare.com"
      }
    }
  ],
  "exclude": [
    {
      "email": {
        "email": "notthisperson@cloudflare.com"
      }
    }
  ],
  "require": []
}
```

## Example rule configurations

[Any valid service token](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/any-service-token/)

The request will need to present the headers for any service token created for this account.

[Authentication method](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/authentication-method/)

Allow access based on the "amr" identifier.

[Common name](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/common-name/)

The request will need to present a valid certificate with an expected common name.

[Country Code](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/country-code/)

Allow a specific country.

[Email](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/email/)

Allow a specific email address.

[Email domain](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/email-domain/)

Allow an entire email domain.

[Everyone](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/everyone/)

Allow anyone to log in.

[G Suite Group](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/gsuite-group/)

Allow members of a specific G Suite group.

[GitHub™ Organization](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/github-org/)

Allow members of a specific GitHub organization.

[IP range](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/ip-range/)

Allow an IP range.

[Microsoft Entra Group](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/entra-group/)

Allow members of a Microsoft Entra group. The ID is the group UUID (`id`) in Microsoft Entra ID.

[mTLS certificate](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/mtls-certificate/)

The request will need to present a valid certificate.

[Okta Group](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/okta-group/)

Allow members of an Okta Group.

[Rule group](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/access-group/)

Use a pre-existing rule group.

[SAML Attribute](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/saml-attribute/)

Allow users with specific SAML attributes.

[Service token](https://developers.cloudflare.com/cloudflare-one/api-terraform/access-api-examples/service-token/)

The request will need to present the correct service token headers.
