---
title: "Add Cloudflare account"
method: POST
path: "/api/v2/integrations/cloudflare/accounts"
tags: ["Cloudflare Integration"]
---

# Add Cloudflare account

`POST /api/v2/integrations/cloudflare/accounts`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts`
- Auth: API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`

Create a Cloudflare account.

## Request body

- CloudflareAccountCreateRequest: Payload schema when adding a Cloudflare account.
  - `data` CloudflareAccountCreateRequestData, required: Data object for creating a Cloudflare account.
    - `attributes` CloudflareAccountCreateRequestAttributes, required: Attributes object for creating a Cloudflare account.
      - `api_key` string, required: The API key (or token) for the Cloudflare account.
      - `email` string: The email associated with the Cloudflare account. If an API key is provided (and not a token), this field is also required.
      - `name` string, required: The name of the Cloudflare account.
      - `resources` string[]: An allowlist of resources to restrict pulling metrics for including `'web', 'dns', 'lb' (load balancer), 'worker'`.
      - `zones` string[]: An allowlist of zones to restrict pulling metrics for.
    - `type` 'cloudflare-accounts', required: The JSON:API type for this API. Should always be `cloudflare-accounts`.

## Response `201`

CREATED

- CloudflareAccountResponse: The expected response schema when getting a Cloudflare account.
  - `data` CloudflareAccountResponseData: Data object of a Cloudflare account.
    - `attributes` CloudflareAccountResponseAttributes, required: Attributes object of a Cloudflare account.
      - `email` string: The email associated with the Cloudflare account.
      - `name` string, required: The name of the Cloudflare account.
      - `resources` string[]: An allowlist of resources, such as `web`, `dns`, `lb` (load balancer), `worker`, that restricts pulling metrics from those resources.
      - `zones` string[]: An allowlist of zones to restrict pulling metrics for.
    - `id` string, required: The ID of the Cloudflare account, a hash of the account name.
    - `type` 'cloudflare-accounts', required: The JSON:API type for this API. Should always be `cloudflare-accounts`.

## Other responses

- `400`: Bad Request
- `403`: Forbidden
- `404`: Not Found
- `429`: Too many requests

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/da68bf029e4c?raw)
