Cloudflare.Account (Cloudflare v0.5.0)

Copy Markdown View Source

Accounts

Create an account

POST /accounts

Create an account (only available for tenant admins at this time)

Responses

200 Account Creation Success Response

Data is at body["result"]

{
  "created_on": "*string*",
  "id": "*string*",
  "managed_by": {
    "parent_org_id": "*string*",
    "parent_org_name": "*string*"
  },
  "name": "*string*",
  "settings": {
    "abuse_contact_email": "*string*",
    "enforce_twofactor": "*boolean*"
  },
  "type": null
}
4XX Account Creation Failure Response
{
  "errors": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "result": {},
  "success": "*boolean*"
}

List Accounts

GET /accounts

List all accounts you have ownership or verified access to.

Responses

200 List Accounts response

Data is at body["result"]

[
  {
    "created_on": "*string*",
    "id": "*string*",
    "managed_by": {
      "parent_org_id": "*string*",
      "parent_org_name": "*string*"
    },
    "name": "*string*",
    "settings": {
      "abuse_contact_email": "*string*",
      "enforce_twofactor": "*boolean*"
    },
    "type": null
  }
]
4XX List Accounts response failure
{
  "errors": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Batch move accounts

POST /accounts/move

Batch move a collection of accounts to a specific organization. ⚠️ Not implemented.

Responses

200 The request has succeeded.

Data is at body["result"]

{
  "statuses": {
    "message": "*string*",
    "moved": "*boolean*",
    "tag": "*string*"
  }
}
4XX An unexpected error response.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Update Account

PUT /accounts/{account_id}

Update an existing account.

Responses

200 Update Account response

Data is at body["result"]

{
  "created_on": "*string*",
  "id": "*string*",
  "managed_by": {
    "parent_org_id": "*string*",
    "parent_org_name": "*string*"
  },
  "name": "*string*",
  "settings": {
    "abuse_contact_email": "*string*",
    "enforce_twofactor": "*boolean*"
  },
  "type": null
}
4XX Update Account response failure
{
  "errors": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Account Details

GET /accounts/{account_id}

Get information about a specific account that you are a member of.

Responses

200 Account Details response

Data is at body["result"]

{
  "created_on": "*string*",
  "id": "*string*",
  "managed_by": {
    "parent_org_id": "*string*",
    "parent_org_name": "*string*"
  },
  "name": "*string*",
  "settings": {
    "abuse_contact_email": "*string*",
    "enforce_twofactor": "*boolean*"
  },
  "type": null
}
4XX Account Details response failure
{
  "errors": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Delete a specific account

DELETE /accounts/{account_id}

Delete a specific account (only available for tenant admins at this time). This is a permanent operation that will delete any zones or other resources under the account

Responses

200 Account Deletion Success Response

Data is at body["result"]

{
  "id": "*string*"
}
4XX Account Deletion Failure Response
{
  "errors": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "documentation_url": "*string*",
      "message": "*string*",
      "source": {
        "pointer": "*string*"
      }
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Move account

POST /accounts/{account_id}/move

Move an account within an organization hierarchy or an account outside an organization. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/)

Responses

200 The request has succeeded.

Data is at body["result"]

{
  "account_id": "*string*",
  "destination_organization_id": "*string*",
  "source_organization_id": "*string*"
}
4XX An unexpected error response.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

List account organizations

GET /accounts/{account_id}/organizations

Retrieve a list of the organizations that "contain" this account or are managing it.

The returned list will be in order from "root" to "leaf", where the "leaf" will be the organization that immediately contains the specified account.

Responses

200 The request has succeeded.

Data is at body["result"]

[
  {
    "create_time": "*string*",
    "id": "*string*",
    "meta": {
      "flags": null,
      "managed_by": "*string*"
    },
    "name": "*string*",
    "parent": {
      "id": "*string*",
      "name": "*string*"
    },
    "profile": {
      "business_address": "*string*",
      "business_email": "*string*",
      "business_name": "*string*",
      "business_phone": "*string*",
      "external_metadata": "*string*"
    }
  }
]
4XX An unexpected error response.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Modify account profile

PUT /accounts/{account_id}/profile

Responses

204 There is no content to send for this request, but the headers may be useful.

Data is at body["result"]

4XX An unexpected error response.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Get account profile

GET /accounts/{account_id}/profile

Responses

200 The request has succeeded.

Data is at body["result"]

{
  "business_address": "*string*",
  "business_email": "*string*",
  "business_name": "*string*",
  "business_phone": "*string*",
  "external_metadata": "*string*"
}
4XX An unexpected error response.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Summary

Functions

client(opts \\ [])

index(opts \\ [])

@spec index(opts :: Restlax.Resource.action_options()) ::
  {:ok, map()} | {:error, term()}

index!(opts \\ [])

@spec index!(opts :: Restlax.Resource.action_options()) :: map() | no_return()

path_for(id, opts \\ [])

@spec path_for(term(), [{:action, String.t()}]) :: String.t()

show(id, opts \\ [])

@spec show(id :: term(), opts :: Restlax.Resource.action_options()) ::
  {:ok, map()} | {:error, term()}

show!(id, opts \\ [])

@spec show!(id :: term(), opts :: Restlax.Resource.action_options()) ::
  map() | no_return()

update(id, body, opts \\ [])

@spec update(
  id :: term(),
  body :: Restlax.Resource.action_body(),
  opts :: Restlax.Resource.action_options()
) :: {:ok, map()} | {:error, term()}

update!(id, body, opts \\ [])

@spec update!(
  id :: term(),
  body :: Restlax.Resource.action_body(),
  opts :: Restlax.Resource.action_options()
) :: map() | no_return()