Skip to content
Start here

Create organization

client.organizations.create(OrganizationCreateParams { name, parent, profile } body, RequestOptionsoptions?): Organization { id, create_time, meta, 3 more }
POST/organizations

Create a new organization for a user. Sub-organization creation availability depends on the organization’s capabilities. The optional profile object accepts partial profile details; its individual fields are not required. Organization names are limited to 65 UTF-8 bytes. Each profile field is limited to 1,000 UTF-8 bytes, and a non-empty business email must be valid. At least one of business name, address, phone, or email must be non-empty to persist a profile.

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)
User Details Write
ParametersExpand Collapse
body: OrganizationCreateParams { name, parent, profile }
name: string

The Organization name, limited to 65 UTF-8 bytes.

minLength1
parent?: Parent
id: string
profile?: Profile

Optional profile fields, each limited to 1,000 UTF-8 bytes. An empty profile is ignored.

business_address?: string
business_email?: string
business_name?: string
business_phone?: string
external_metadata?: string
ReturnsExpand Collapse
Organization { id, create_time, meta, 3 more }

References an Organization in the Cloudflare data model.

id: string
create_time: string
formatdate-time
meta: Meta { are_child_accounts_accessible_by_org_members, hierarchy_tags, managed_by, 2 more }
are_child_accounts_accessible_by_org_members?: boolean
hierarchy_tags?: Array<string>

Ordered chain of organization tags from the root organization down to (and including) this organization itself. Root organizations return a single-element array containing their own tag; sub-organizations return [rootTag, ...intermediateTags, parentTag, selfTag]. Useful for constructing authorization scopes that need to cover every ancestor in the hierarchy.

managed_by?: string
tenant_flags?: TenantFlags { account_creation, account_creation_applies_tenant_defaults, account_deletion, 5 more }

Enable features for Organizations.

account_creation: string
account_creation_applies_tenant_defaults: string
account_deletion: string
account_migration: string
account_mobility: string
enterprise_capability: string
member_management: string
sub_org_creation: string
tenant_type?: string
name: string
parent?: Parent { id, name }
id: string
name: string
profile?: Profile { business_address, business_email, business_name, 2 more }
business_address: string
business_email: string
business_name: string
business_phone: string
external_metadata: string

Create organization

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

const organization = await client.organizations.create({ name: 'x' });

console.log(organization.id);
{
  "errors": [],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "id": "a7b9c3d2e8f4a1b5c6d0e9f2a3b7c4d8",
    "create_time": "2019-12-27T18:11:19.117Z",
    "meta": {
      "are_child_accounts_accessible_by_org_members": true,
      "hierarchy_tags": [
        "string"
      ],
      "managed_by": "managed_by",
      "tenant_flags": {
        "account_creation": "account_creation",
        "account_creation_applies_tenant_defaults": "account_creation_applies_tenant_defaults",
        "account_deletion": "account_deletion",
        "account_migration": "account_migration",
        "account_mobility": "account_mobility",
        "enterprise_capability": "enterprise_capability",
        "member_management": "member_management",
        "sub_org_creation": "sub_org_creation"
      },
      "tenant_type": "tenant_type"
    },
    "name": "name",
    "parent": {
      "id": "a7b9c3d2e8f4a1b5c6d0e9f2a3b7c4d8",
      "name": "name"
    },
    "profile": {
      "business_address": "business_address",
      "business_email": "business_email",
      "business_name": "business_name",
      "business_phone": "business_phone",
      "external_metadata": "external_metadata"
    }
  },
  "success": true
}
Returns Examples
{
  "errors": [],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "id": "a7b9c3d2e8f4a1b5c6d0e9f2a3b7c4d8",
    "create_time": "2019-12-27T18:11:19.117Z",
    "meta": {
      "are_child_accounts_accessible_by_org_members": true,
      "hierarchy_tags": [
        "string"
      ],
      "managed_by": "managed_by",
      "tenant_flags": {
        "account_creation": "account_creation",
        "account_creation_applies_tenant_defaults": "account_creation_applies_tenant_defaults",
        "account_deletion": "account_deletion",
        "account_migration": "account_migration",
        "account_mobility": "account_mobility",
        "enterprise_capability": "enterprise_capability",
        "member_management": "member_management",
        "sub_org_creation": "sub_org_creation"
      },
      "tenant_type": "tenant_type"
    },
    "name": "name",
    "parent": {
      "id": "a7b9c3d2e8f4a1b5c6d0e9f2a3b7c4d8",
      "name": "name"
    },
    "profile": {
      "business_address": "business_address",
      "business_email": "business_email",
      "business_name": "business_name",
      "business_phone": "business_phone",
      "external_metadata": "external_metadata"
    }
  },
  "success": true
}