Skip to content
Start here

Role Details

client.Accounts.Roles.Get(ctx, roleID, query) (*Role, error)
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
query RoleGetParams
AccountID param.Field[string]

Account identifier tag.

maxLength32
minLength32
ReturnsExpand Collapse
type Role struct{…}
ID string

Role identifier tag.

maxLength32
Description string

Description of role's permissions.

Name string

Role name.

maxLength120
Permissions RolePermissions
Analytics PermissionGrantoptional
Read booloptional
Write booloptional
Billing PermissionGrantoptional
Read booloptional
Write booloptional
CachePurge PermissionGrantoptional
Read booloptional
Write booloptional
DNS PermissionGrantoptional
Read booloptional
Write booloptional
DNSRecords PermissionGrantoptional
Read booloptional
Write booloptional
LB PermissionGrantoptional
Read booloptional
Write booloptional
Logs PermissionGrantoptional
Read booloptional
Write booloptional
Organization PermissionGrantoptional
Read booloptional
Write booloptional
SSL PermissionGrantoptional
Read booloptional
Write booloptional
WAF PermissionGrantoptional
Read booloptional
Write booloptional
ZoneSettings PermissionGrantoptional
Read booloptional
Write booloptional
Zones PermissionGrantoptional
Read booloptional
Write booloptional

Role Details

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/accounts"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
    option.WithAPIEmail("user@example.com"),
  )
  role, err := client.Accounts.Roles.Get(
    context.TODO(),
    "3536bcfad5faccb999b47003c79917fb",
    accounts.RoleGetParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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
      }
    }
  }
}