# Roles ## List Roles `client.accounts.roles.list(RoleListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/roles` Get all available roles for an account. ### Parameters - `params: RoleListParams` - `account_id: string` Path param: Account identifier tag. - `page?: number` Query param: Page number of paginated results. - `per_page?: number` Query param: Number of roles per page. ### Returns - `Role` - `id: string` Role identifier tag. - `description: string` Description of role's permissions. - `name: string` Role name. - `permissions: Permissions` - `analytics?: PermissionGrant` - `read?: boolean` - `write?: boolean` - `billing?: PermissionGrant` - `cache_purge?: PermissionGrant` - `dns?: PermissionGrant` - `dns_records?: PermissionGrant` - `lb?: PermissionGrant` - `logs?: PermissionGrant` - `organization?: PermissionGrant` - `ssl?: PermissionGrant` - `waf?: PermissionGrant` - `zone_settings?: PermissionGrant` - `zones?: PermissionGrant` ### Example ```node 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 }); // Automatically fetches more pages as needed. for await (const role of client.accounts.roles.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(role.id); } ``` #### Response ```json { "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 } } } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Role Details `client.accounts.roles.get(stringroleId, RoleGetParamsparams, RequestOptionsoptions?): Role` **get** `/accounts/{account_id}/roles/{role_id}` Get information about a specific role for an account. ### Parameters - `roleId: string` Role identifier tag. - `params: RoleGetParams` - `account_id: string` Account identifier tag. ### Returns - `Role` - `id: string` Role identifier tag. - `description: string` Description of role's permissions. - `name: string` Role name. - `permissions: Permissions` - `analytics?: PermissionGrant` - `read?: boolean` - `write?: boolean` - `billing?: PermissionGrant` - `cache_purge?: PermissionGrant` - `dns?: PermissionGrant` - `dns_records?: PermissionGrant` - `lb?: PermissionGrant` - `logs?: PermissionGrant` - `organization?: PermissionGrant` - `ssl?: PermissionGrant` - `waf?: PermissionGrant` - `zone_settings?: PermissionGrant` - `zones?: PermissionGrant` ### Example ```node 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); ``` #### Response ```json { "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 } } } } ```