This page is not yet available in Spanish. We are working on its translation.
If you have any questions or feedback about our current translation project, feel free to reach out to us!

Cloudflare Integration

Manage your Datadog Cloudflare integration directly through the Datadog API. See the Cloudflare integration page for more information.

GET https://api.ap1.datadoghq.com/api/v2/integrations/cloudflare/accountshttps://api.datadoghq.eu/api/v2/integrations/cloudflare/accountshttps://api.ddog-gov.com/api/v2/integrations/cloudflare/accountshttps://api.datadoghq.com/api/v2/integrations/cloudflare/accountshttps://api.us3.datadoghq.com/api/v2/integrations/cloudflare/accountshttps://api.us5.datadoghq.com/api/v2/integrations/cloudflare/accounts

Información general

List Cloudflare accounts. This endpoint requires the integrations_read permission.

Respuesta

OK

The expected response schema when getting Cloudflare accounts.

Expand All

Campo

Tipo

Descripción

data

[object]

The JSON:API data schema.

attributes [required]

object

Attributes object of a Cloudflare account.

email

string

The email associated with the Cloudflare account.

name [required]

string

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 [required]

string

The ID of the Cloudflare account, a hash of the account name.

type [required]

enum

The JSON:API type for this API. Should always be cloudflare-accounts. Allowed enum values: cloudflare-accounts

default: cloudflare-accounts

{
  "data": [
    {
      "attributes": {
        "email": "test-email@example.com",
        "name": "test-name",
        "resources": [
          "web",
          "dns",
          "lb",
          "worker"
        ],
        "zones": [
          "zone_id_1",
          "zone_id_2"
        ]
      },
      "id": "c1a8e059bfd1e911cf10b626340c9a54",
      "type": "cloudflare-accounts"
    }
  ]
}

Bad Request

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Ejemplo de código

"""
List Cloudflare accounts returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloudflare_integration_api import CloudflareIntegrationApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudflareIntegrationApi(api_client)
    response = api_instance.list_cloudflare_accounts()

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"

POST https://api.ap1.datadoghq.com/api/v2/integrations/cloudflare/accountshttps://api.datadoghq.eu/api/v2/integrations/cloudflare/accountshttps://api.ddog-gov.com/api/v2/integrations/cloudflare/accountshttps://api.datadoghq.com/api/v2/integrations/cloudflare/accountshttps://api.us3.datadoghq.com/api/v2/integrations/cloudflare/accountshttps://api.us5.datadoghq.com/api/v2/integrations/cloudflare/accounts

Información general

Create a Cloudflare account. This endpoint requires the manage_integrations permission.

Solicitud

Body Data (required)

Expand All

Campo

Tipo

Descripción

data [required]

object

Data object for creating a Cloudflare account.

attributes [required]

object

Attributes object for creating a Cloudflare account.

api_key [required]

string

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 [required]

string

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 [required]

enum

The JSON:API type for this API. Should always be cloudflare-accounts. Allowed enum values: cloudflare-accounts

default: cloudflare-accounts

{
  "data": {
    "attributes": {
      "api_key": "fakekey",
      "email": "dev@datadoghq.com",
      "name": "examplecloudflareintegration"
    },
    "type": "cloudflare-accounts"
  }
}

Respuesta

CREATED

The expected response schema when getting a Cloudflare account.

Expand All

Campo

Tipo

Descripción

data

object

Data object of a Cloudflare account.

attributes [required]

object

Attributes object of a Cloudflare account.

email

string

The email associated with the Cloudflare account.

name [required]

string

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 [required]

string

The ID of the Cloudflare account, a hash of the account name.

type [required]

enum

The JSON:API type for this API. Should always be cloudflare-accounts. Allowed enum values: cloudflare-accounts

default: cloudflare-accounts

{
  "data": {
    "attributes": {
      "email": "test-email@example.com",
      "name": "test-name",
      "resources": [
        "web",
        "dns",
        "lb",
        "worker"
      ],
      "zones": [
        "zone_id_1",
        "zone_id_2"
      ]
    },
    "id": "c1a8e059bfd1e911cf10b626340c9a54",
    "type": "cloudflare-accounts"
  }
}

Bad Request

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Ejemplo de código

"""
Add Cloudflare account returns "CREATED" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloudflare_integration_api import CloudflareIntegrationApi
from datadog_api_client.v2.model.cloudflare_account_create_request import CloudflareAccountCreateRequest
from datadog_api_client.v2.model.cloudflare_account_create_request_attributes import (
    CloudflareAccountCreateRequestAttributes,
)
from datadog_api_client.v2.model.cloudflare_account_create_request_data import CloudflareAccountCreateRequestData
from datadog_api_client.v2.model.cloudflare_account_type import CloudflareAccountType

body = CloudflareAccountCreateRequest(
    data=CloudflareAccountCreateRequestData(
        attributes=CloudflareAccountCreateRequestAttributes(
            api_key="fakekey",
            email="dev@datadoghq.com",
            name="examplecloudflareintegration",
        ),
        type=CloudflareAccountType.CLOUDFLARE_ACCOUNTS,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudflareIntegrationApi(api_client)
    response = api_instance.create_cloudflare_account(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"

GET https://api.ap1.datadoghq.com/api/v2/integrations/cloudflare/accounts/{account_id}https://api.datadoghq.eu/api/v2/integrations/cloudflare/accounts/{account_id}https://api.ddog-gov.com/api/v2/integrations/cloudflare/accounts/{account_id}https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/{account_id}https://api.us3.datadoghq.com/api/v2/integrations/cloudflare/accounts/{account_id}https://api.us5.datadoghq.com/api/v2/integrations/cloudflare/accounts/{account_id}

Información general

Get a Cloudflare account. This endpoint requires the integrations_read permission.

Argumentos

Parámetros de ruta

Nombre

Tipo

Descripción

account_id [required]

string

None

Respuesta

OK

The expected response schema when getting a Cloudflare account.

Expand All

Campo

Tipo

Descripción

data

object

Data object of a Cloudflare account.

attributes [required]

object

Attributes object of a Cloudflare account.

email

string

The email associated with the Cloudflare account.

name [required]

string

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 [required]

string

The ID of the Cloudflare account, a hash of the account name.

type [required]

enum

The JSON:API type for this API. Should always be cloudflare-accounts. Allowed enum values: cloudflare-accounts

default: cloudflare-accounts

{
  "data": {
    "attributes": {
      "email": "test-email@example.com",
      "name": "test-name",
      "resources": [
        "web",
        "dns",
        "lb",
        "worker"
      ],
      "zones": [
        "zone_id_1",
        "zone_id_2"
      ]
    },
    "id": "c1a8e059bfd1e911cf10b626340c9a54",
    "type": "cloudflare-accounts"
  }
}

Bad Request

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Ejemplo de código

"""
Get Cloudflare account returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloudflare_integration_api import CloudflareIntegrationApi

# there is a valid "cloudflare_account" in the system
CLOUDFLARE_ACCOUNT_DATA_ID = environ["CLOUDFLARE_ACCOUNT_DATA_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudflareIntegrationApi(api_client)
    response = api_instance.get_cloudflare_account(
        account_id=CLOUDFLARE_ACCOUNT_DATA_ID,
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"

PATCH https://api.ap1.datadoghq.com/api/v2/integrations/cloudflare/accounts/{account_id}https://api.datadoghq.eu/api/v2/integrations/cloudflare/accounts/{account_id}https://api.ddog-gov.com/api/v2/integrations/cloudflare/accounts/{account_id}https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/{account_id}https://api.us3.datadoghq.com/api/v2/integrations/cloudflare/accounts/{account_id}https://api.us5.datadoghq.com/api/v2/integrations/cloudflare/accounts/{account_id}

Información general

Update a Cloudflare account. This endpoint requires the manage_integrations permission.

Argumentos

Parámetros de ruta

Nombre

Tipo

Descripción

account_id [required]

string

None

Solicitud

Body Data (required)

Expand All

Campo

Tipo

Descripción

data [required]

object

Data object for updating a Cloudflare account.

attributes

object

Attributes object for updating a Cloudflare account.

api_key [required]

string

The API key of 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

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

enum

The JSON:API type for this API. Should always be cloudflare-accounts. Allowed enum values: cloudflare-accounts

default: cloudflare-accounts

{
  "data": {
    "attributes": {
      "api_key": "fakekey",
      "email": "dev@datadoghq.com",
      "zones": [
        "zone-id-3"
      ]
    },
    "type": "cloudflare-accounts"
  }
}

Respuesta

OK

The expected response schema when getting a Cloudflare account.

Expand All

Campo

Tipo

Descripción

data

object

Data object of a Cloudflare account.

attributes [required]

object

Attributes object of a Cloudflare account.

email

string

The email associated with the Cloudflare account.

name [required]

string

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 [required]

string

The ID of the Cloudflare account, a hash of the account name.

type [required]

enum

The JSON:API type for this API. Should always be cloudflare-accounts. Allowed enum values: cloudflare-accounts

default: cloudflare-accounts

{
  "data": {
    "attributes": {
      "email": "test-email@example.com",
      "name": "test-name",
      "resources": [
        "web",
        "dns",
        "lb",
        "worker"
      ],
      "zones": [
        "zone_id_1",
        "zone_id_2"
      ]
    },
    "id": "c1a8e059bfd1e911cf10b626340c9a54",
    "type": "cloudflare-accounts"
  }
}

Bad Request

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Ejemplo de código

"""
Update Cloudflare account returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloudflare_integration_api import CloudflareIntegrationApi
from datadog_api_client.v2.model.cloudflare_account_type import CloudflareAccountType
from datadog_api_client.v2.model.cloudflare_account_update_request import CloudflareAccountUpdateRequest
from datadog_api_client.v2.model.cloudflare_account_update_request_attributes import (
    CloudflareAccountUpdateRequestAttributes,
)
from datadog_api_client.v2.model.cloudflare_account_update_request_data import CloudflareAccountUpdateRequestData

# there is a valid "cloudflare_account" in the system
CLOUDFLARE_ACCOUNT_DATA_ID = environ["CLOUDFLARE_ACCOUNT_DATA_ID"]

body = CloudflareAccountUpdateRequest(
    data=CloudflareAccountUpdateRequestData(
        attributes=CloudflareAccountUpdateRequestAttributes(
            api_key="fakekey",
            email="dev@datadoghq.com",
            zones=[
                "zone-id-3",
            ],
        ),
        type=CloudflareAccountType.CLOUDFLARE_ACCOUNTS,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudflareIntegrationApi(api_client)
    response = api_instance.update_cloudflare_account(account_id=CLOUDFLARE_ACCOUNT_DATA_ID, body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"

DELETE https://api.ap1.datadoghq.com/api/v2/integrations/cloudflare/accounts/{account_id}https://api.datadoghq.eu/api/v2/integrations/cloudflare/accounts/{account_id}https://api.ddog-gov.com/api/v2/integrations/cloudflare/accounts/{account_id}https://api.datadoghq.com/api/v2/integrations/cloudflare/accounts/{account_id}https://api.us3.datadoghq.com/api/v2/integrations/cloudflare/accounts/{account_id}https://api.us5.datadoghq.com/api/v2/integrations/cloudflare/accounts/{account_id}

Información general

Delete a Cloudflare account. This endpoint requires the manage_integrations permission.

Argumentos

Parámetros de ruta

Nombre

Tipo

Descripción

account_id [required]

string

None

Respuesta

OK

Bad Request

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Too many requests

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Ejemplo de código

"""
Delete Cloudflare account returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.cloudflare_integration_api import CloudflareIntegrationApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = CloudflareIntegrationApi(api_client)
    api_instance.delete_cloudflare_account(
        account_id="account_id",
    )

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"