Skip to content
Start here

Create integration

zero_trust.casb.integrations.create(IntegrationCreateParams**kwargs) -> IntegrationCreateResponse
POST/accounts/{account_id}/one/integrations

Creates a new integration for the specified application.

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
ParametersExpand Collapse
account_id: str
application: Literal["GITHUB", "GOOGLE_WORKSPACE", "MICROSOFT_INTERNAL", 2 more]

Vendor/application slug (e.g., GOOGLE_WORKSPACE).

  • GITHUB - GITHUB
  • GOOGLE_WORKSPACE - GOOGLE_WORKSPACE
  • MICROSOFT_INTERNAL - MICROSOFT_INTERNAL
  • SALESFORCE - SALESFORCE
  • SLACK - SLACK
One of the following:
"GITHUB"
"GOOGLE_WORKSPACE"
"MICROSOFT_INTERNAL"
"SALESFORCE"
"SLACK"
credentials: Dict[str, object]

Credentials for the integration.

name: str

Name of the integration.

maxLength256
minLength1
auth_method: Optional[str]

Authentication method slug (uses default if omitted).

minLength1
dlp_profiles: Optional[Sequence[str]]

List of DLP profile IDs to associate.

permissions: Optional[Sequence[str]]

List of permission scopes (uses policy defaults if empty).

use_cases: Optional[List[Literal["casb", "ces", "auto_remediation"]]]

List of use case or feature slugs to enroll (e.g., [‘casb’, ‘ces’, ‘auto_remediation’]).

One of the following:
"casb"
"ces"
"auto_remediation"
ReturnsExpand Collapse
class IntegrationCreateResponse:

Serializer for v2 integration detail response with use cases.

id: str

Integration ID.

formatuuid
application: Dict[str, Optional[str]]
auth_method: Optional[Dict[str, str]]

The integration’s authentication method.

created: datetime

When the integration was created.

formatdate-time
credentials_expiry: datetime

Credentials expiry time.

formatdate-time
dlp_profiles: List[str]

DLP Profiles enabled for the integration.

health_details: List[Dict[str, object]]

Health details with remediation hints.

is_paused: bool

Whether the user paused the integration.

last_hydrated: datetime

Last time the integration was hydrated.

formatdate-time
name: str

Name of the integration.

organization_id: int

Organization ID.

status: str

Integration status.

updated: datetime

When the integration was last updated.

formatdate-time
use_cases: List[Dict[str, object]]

Use cases enabled for the integration.

Create integration

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
integration = client.zero_trust.casb.integrations.create(
    account_id="023e105f4ecef8ad9ca31a8372d0c353",
    application="GOOGLE_WORKSPACE",
    credentials={
        "admin_email": "admin@corp.com"
    },
    name="My Google Workspace",
    auth_method="service_account",
    dlp_profiles=["e91a2360-da51-4fdf-9711-bcdecd462614"],
    permissions=["https://www.googleapis.com/auth/drive.readonly"],
    use_cases=["casb", "ces"],
)
print(integration.id)
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "application": {
    "foo": "string"
  },
  "auth_method": {
    "foo": "string"
  },
  "authorization_link": {
    "components": {
      "foo": "bar"
    },
    "link": "link"
  },
  "created": "2019-12-27T18:11:19.117Z",
  "credentials_expiry": "2019-12-27T18:11:19.117Z",
  "dlp_profiles": [
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
  ],
  "health_details": [
    {
      "foo": "bar"
    }
  ],
  "is_paused": true,
  "last_hydrated": "2019-12-27T18:11:19.117Z",
  "name": "name",
  "organization_id": 0,
  "status": "status",
  "updated": "2019-12-27T18:11:19.117Z",
  "use_cases": [
    {
      "foo": "bar"
    }
  ]
}
Returns Examples
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "application": {
    "foo": "string"
  },
  "auth_method": {
    "foo": "string"
  },
  "authorization_link": {
    "components": {
      "foo": "bar"
    },
    "link": "link"
  },
  "created": "2019-12-27T18:11:19.117Z",
  "credentials_expiry": "2019-12-27T18:11:19.117Z",
  "dlp_profiles": [
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
  ],
  "health_details": [
    {
      "foo": "bar"
    }
  ],
  "is_paused": true,
  "last_hydrated": "2019-12-27T18:11:19.117Z",
  "name": "name",
  "organization_id": 0,
  "status": "status",
  "updated": "2019-12-27T18:11:19.117Z",
  "use_cases": [
    {
      "foo": "bar"
    }
  ]
}