Skip to content
Start here

Validate a custom page template

POST/accounts/{account_id}/access/custom_pages/validate

Validate a Liquid template and return its errors and warnings without persisting it.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Access: Custom Pages Write
Path ParametersExpand Collapse
account_id: string

Identifier.

maxLength32
Body ParametersJSONExpand Collapse
template: string

The Liquid template to validate.

type: "identity_denied" or "forbidden" or "login" or "interstitial"

Custom page type.

One of the following:
"identity_denied"
"forbidden"
"login"
"interstitial"
version: optional number

Contract version to validate against; omit for the latest.

ReturnsExpand Collapse
errors: array of object { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional object { pointer }
pointer: optional string
messages: array of object { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional object { pointer }
pointer: optional string
success: true

Whether the API call was successful.

result: optional object { errors, page_type, version, warnings }

The result of validating a template’s content.

errors: array of object { message, tier, ref }

Blocking findings; a non-empty list means the template cannot be published.

message: string

Human-readable description of the finding.

tier: string

The validation tier that produced the finding (e.g. html, liquid).

ref: optional string

Optional pointer to the part of the template the finding refers to.

page_type: "identity_denied" or "forbidden" or "login" or "interstitial"

Custom page type.

One of the following:
"identity_denied"
"forbidden"
"login"
"interstitial"
version: number

The contract version the template was validated against.

warnings: array of object { message, tier, ref }

Advisory findings that do not block publishing.

message: string

Human-readable description of the finding.

tier: string

The validation tier that produced the finding (e.g. html, liquid).

ref: optional string

Optional pointer to the part of the template the finding refers to.

Validate a custom page template

curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/access/custom_pages/validate \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    -d '{
          "template": "template",
          "type": "identity_denied"
        }'
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "errors": [
      {
        "message": "message",
        "tier": "tier",
        "ref": "ref"
      }
    ],
    "page_type": "identity_denied",
    "version": 0,
    "warnings": [
      {
        "message": "message",
        "tier": "tier",
        "ref": "ref"
      }
    ]
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "errors": [
      {
        "message": "message",
        "tier": "tier",
        "ref": "ref"
      }
    ],
    "page_type": "identity_denied",
    "version": 0,
    "warnings": [
      {
        "message": "message",
        "tier": "tier",
        "ref": "ref"
      }
    ]
  }
}