Skip to content
Start here

Edit User

client.User.Edit(ctx, body) (*UserEditResponse, error)
PATCH/user

Edit part of your user details.

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 UserEditParams
Country param.Field[string]optional

The country in which the user lives.

maxLength30
FirstName param.Field[string]optional

User's first name

maxLength60
LastName param.Field[string]optional

User's last name

maxLength60
Telephone param.Field[string]optional

User's telephone number

maxLength20
Zipcode param.Field[string]optional

The zipcode or postal code where the user lives.

maxLength20
ReturnsExpand Collapse
type UserEditResponse struct{…}
ID stringoptional

Identifier of the user.

Betas []stringoptional

Lists the betas that the user is participating in.

Country stringoptional

The country in which the user lives.

maxLength30
FirstName stringoptional

User's first name

maxLength60
HasBusinessZones booloptional

Indicates whether user has any business zones

HasEnterpriseZones booloptional

Indicates whether user has any enterprise zones

HasProZones booloptional

Indicates whether user has any pro zones

LastName stringoptional

User's last name

maxLength60
Organizations []Organizationoptional
ID stringoptional

Identifier

maxLength32
minLength32
Name stringoptional

Organization name.

maxLength100
Permissions []Permissionoptional

Access permissions for this User.

Roles []stringoptional

List of roles that a user has within an organization.

Status Statusoptional

Whether the user is a member of the organization or has an invitation pending.

One of the following:
const StatusMember Status = "member"
const StatusInvited Status = "invited"
Suspended booloptional

Indicates whether user has been suspended

Telephone stringoptional

User's telephone number

maxLength20
TwoFactorAuthenticationEnabled booloptional

Indicates whether two-factor authentication is enabled for the user account. Does not apply to API authentication.

TwoFactorAuthenticationLocked booloptional

Indicates whether two-factor authentication is required by one of the accounts that the user is a member of.

Zipcode stringoptional

The zipcode or postal code where the user lives.

maxLength20

Edit User

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  response, err := client.User.Edit(context.TODO(), user.UserEditParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.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": "6d7f2f5f5b1d4a0e9081fdc98d432fd1",
    "betas": [
      "zone_level_access_beta"
    ],
    "country": "US",
    "first_name": "John",
    "has_business_zones": true,
    "has_enterprise_zones": true,
    "has_pro_zones": true,
    "last_name": "Appleseed",
    "organizations": [
      {
        "id": "023e105f4ecef8ad9ca31a8372d0c353",
        "name": "Cloudflare, Inc.",
        "permissions": [
          "#zones:read"
        ],
        "roles": [
          "All Privileges - Super Administrator"
        ],
        "status": "member"
      }
    ],
    "suspended": true,
    "telephone": "+1 123-123-1234",
    "two_factor_authentication_enabled": true,
    "two_factor_authentication_locked": true,
    "zipcode": "12345"
  }
}
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": "6d7f2f5f5b1d4a0e9081fdc98d432fd1",
    "betas": [
      "zone_level_access_beta"
    ],
    "country": "US",
    "first_name": "John",
    "has_business_zones": true,
    "has_enterprise_zones": true,
    "has_pro_zones": true,
    "last_name": "Appleseed",
    "organizations": [
      {
        "id": "023e105f4ecef8ad9ca31a8372d0c353",
        "name": "Cloudflare, Inc.",
        "permissions": [
          "#zones:read"
        ],
        "roles": [
          "All Privileges - Super Administrator"
        ],
        "status": "member"
      }
    ],
    "suspended": true,
    "telephone": "+1 123-123-1234",
    "two_factor_authentication_enabled": true,
    "two_factor_authentication_locked": true,
    "zipcode": "12345"
  }
}