Skip to content
Start here

Role Details

client.accounts.roles.get(stringroleId, RoleGetParams { account_id } params, RequestOptionsoptions?): Role { id, description, name, permissions }
GET/accounts/{account_id}/roles/{role_id}

Get information about a specific role for an account.

Security

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)
SCIM ProvisioningAccount Settings WriteAccount Settings Read
ParametersExpand Collapse
roleId: string

Role identifier tag.

maxLength32
params: RoleGetParams { account_id }
account_id: string

Account identifier tag.

maxLength32
minLength32
ReturnsExpand Collapse
Role { id, description, name, permissions }
id: string

Role identifier tag.

maxLength32
description: string

Description of role’s permissions.

name: string

Role name.

maxLength120
permissions: Permissions { analytics, billing, cache_purge, 9 more }
analytics?: PermissionGrant { read, write }
read?: boolean
write?: boolean
billing?: PermissionGrant { read, write }
read?: boolean
write?: boolean
cache_purge?: PermissionGrant { read, write }
read?: boolean
write?: boolean
dns?: PermissionGrant { read, write }
read?: boolean
write?: boolean
dns_records?: PermissionGrant { read, write }
read?: boolean
write?: boolean
lb?: PermissionGrant { read, write }
read?: boolean
write?: boolean
logs?: PermissionGrant { read, write }
read?: boolean
write?: boolean
organization?: PermissionGrant { read, write }
read?: boolean
write?: boolean
ssl?: PermissionGrant { read, write }
read?: boolean
write?: boolean
waf?: PermissionGrant { read, write }
read?: boolean
write?: boolean
zone_settings?: PermissionGrant { read, write }
read?: boolean
write?: boolean
zones?: PermissionGrant { read, write }
read?: boolean
write?: boolean

Role Details

import Cloudflare from 'cloudflare';

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

const role = await client.accounts.roles.get('3536bcfad5faccb999b47003c79917fb', {
  account_id: '023e105f4ecef8ad9ca31a8372d0c353',
});

console.log(role.id);
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "3536bcfad5faccb999b47003c79917fb",
    "description": "Administrative access to the entire Account",
    "name": "Account Administrator",
    "permissions": {
      "analytics": {
        "read": true,
        "write": false
      },
      "billing": {
        "read": true,
        "write": false
      },
      "cache_purge": {
        "read": true,
        "write": false
      },
      "dns": {
        "read": true,
        "write": false
      },
      "dns_records": {
        "read": true,
        "write": false
      },
      "lb": {
        "read": true,
        "write": false
      },
      "logs": {
        "read": true,
        "write": false
      },
      "organization": {
        "read": true,
        "write": false
      },
      "ssl": {
        "read": true,
        "write": false
      },
      "waf": {
        "read": true,
        "write": false
      },
      "zone_settings": {
        "read": true,
        "write": false
      },
      "zones": {
        "read": true,
        "write": true
      }
    }
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "3536bcfad5faccb999b47003c79917fb",
    "description": "Administrative access to the entire Account",
    "name": "Account Administrator",
    "permissions": {
      "analytics": {
        "read": true,
        "write": false
      },
      "billing": {
        "read": true,
        "write": false
      },
      "cache_purge": {
        "read": true,
        "write": false
      },
      "dns": {
        "read": true,
        "write": false
      },
      "dns_records": {
        "read": true,
        "write": false
      },
      "lb": {
        "read": true,
        "write": false
      },
      "logs": {
        "read": true,
        "write": false
      },
      "organization": {
        "read": true,
        "write": false
      },
      "ssl": {
        "read": true,
        "write": false
      },
      "waf": {
        "read": true,
        "write": false
      },
      "zone_settings": {
        "read": true,
        "write": false
      },
      "zones": {
        "read": true,
        "write": true
      }
    }
  }
}