Skip to content
Start here

Retrieves security.txt

security_txt.get(SecurityTXTGetParams**kwargs) -> SecurityTXTGetResponse
GET/zones/{zone_id}/security-center/securitytxt

Retrieves the current security.txt file configuration for a zone, used for security vulnerability reporting.

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)
Zone Settings WriteZone Settings Read
ParametersExpand Collapse
zone_id: str

Identifier.

maxLength32
ReturnsExpand Collapse
class SecurityTXTGetResponse:
acknowledgments: Optional[List[str]]
canonical: Optional[List[str]]
contact: Optional[List[str]]
enabled: Optional[bool]
encryption: Optional[List[str]]
expires: Optional[datetime]
formatdate-time
hiring: Optional[List[str]]
policy: Optional[List[str]]
preferred_languages: Optional[str]

Retrieves security.txt

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
security_txt = client.security_txt.get(
    zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(security_txt.acknowledgments)
{
  "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": {
    "acknowledgments": [
      "https://example.com/hall-of-fame.html"
    ],
    "canonical": [
      "https://www.example.com/.well-known/security.txt"
    ],
    "contact": [
      "mailto:security@example.com",
      "tel:+1-201-555-0123",
      "https://example.com/security-contact.html"
    ],
    "enabled": true,
    "encryption": [
      "https://example.com/pgp-key.txt",
      "dns:5d2d37ab76d47d36._openpgpkey.example.com?type=OPENPGPKEY",
      "openpgp4fpr:5f2de5521c63a801ab59ccb603d49de44b29100f"
    ],
    "expires": "2019-12-27T18:11:19.117Z",
    "hiring": [
      "https://example.com/jobs.html"
    ],
    "policy": [
      "https://example.com/disclosure-policy.html"
    ],
    "preferred_languages": "en, es, fr"
  }
}
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": {
    "acknowledgments": [
      "https://example.com/hall-of-fame.html"
    ],
    "canonical": [
      "https://www.example.com/.well-known/security.txt"
    ],
    "contact": [
      "mailto:security@example.com",
      "tel:+1-201-555-0123",
      "https://example.com/security-contact.html"
    ],
    "enabled": true,
    "encryption": [
      "https://example.com/pgp-key.txt",
      "dns:5d2d37ab76d47d36._openpgpkey.example.com?type=OPENPGPKEY",
      "openpgp4fpr:5f2de5521c63a801ab59ccb603d49de44b29100f"
    ],
    "expires": "2019-12-27T18:11:19.117Z",
    "hiring": [
      "https://example.com/jobs.html"
    ],
    "policy": [
      "https://example.com/disclosure-policy.html"
    ],
    "preferred_languages": "en, es, fr"
  }
}