Skip to content
Start here

Update OAuth Client

client.IAM.OAuthClients.Update(ctx, oauthClientID, params) (*OAuthClientUpdateResponse, error)
PATCH/accounts/{account_id}/oauth_clients/{oauth_client_id}

Update an existing OAuth client. Only include fields you want to update.

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)
OAuth Client Write
ParametersExpand Collapse
oauthClientID string

The unique identifier for an OAuth client.

params OAuthClientUpdateParams
AccountID param.Field[string]

Path param: Account identifier tag.

maxLength32
minLength32
AllowedCORSOrigins param.Field[[]string]Optional

Body param: Array of allowed CORS origins.

ClientName param.Field[string]Optional

Body param: Human-readable name of the OAuth client.

ClientURI param.Field[string]Optional

Body param: URL of the home page of the client.

GrantTypes param.Field[[]OAuthClientUpdateParamsGrantType]Optional

Body param: Array of OAuth grant types the client is allowed to use. authorization_code is required; refresh_token may be included optionally.

const OAuthClientUpdateParamsGrantTypeAuthorizationCode OAuthClientUpdateParamsGrantType = "authorization_code"
const OAuthClientUpdateParamsGrantTypeRefreshToken OAuthClientUpdateParamsGrantType = "refresh_token"
LogoURI param.Field[string]Optional

Body param: URL of the client’s logo.

PolicyURI param.Field[string]Optional

Body param: URL that points to a privacy policy document.

PostLogoutRedirectURIs param.Field[[]string]Optional

Body param: Array of allowed post-logout redirect URIs.

RedirectURIs param.Field[[]string]Optional

Body param: Array of allowed redirect URIs for the client.

ResponseTypes param.Field[[]OAuthClientUpdateParamsResponseType]Optional

Body param: Array of OAuth response types the client is allowed to use.

const OAuthClientUpdateParamsResponseTypeToken OAuthClientUpdateParamsResponseType = "token"
const OAuthClientUpdateParamsResponseTypeIDToken OAuthClientUpdateParamsResponseType = "id_token"
const OAuthClientUpdateParamsResponseTypeCode OAuthClientUpdateParamsResponseType = "code"
Scopes param.Field[[]string]Optional

Body param: Array of OAuth scopes the client is allowed to request. Colon-delimited scopes are not accepted. Dot-delimited scopes are validated against available OAuth API scopes; simple identity scopes are allowed. Protocol scopes offline_access and openid are added or removed automatically based on grant_types and response_types.

TokenEndpointAuthMethod param.Field[OAuthClientUpdateParamsTokenEndpointAuthMethod]Optional

Body param: The authentication method the client uses at the token endpoint.

const OAuthClientUpdateParamsTokenEndpointAuthMethodNone OAuthClientUpdateParamsTokenEndpointAuthMethod = "none"
const OAuthClientUpdateParamsTokenEndpointAuthMethodClientSecretBasic OAuthClientUpdateParamsTokenEndpointAuthMethod = "client_secret_basic"
const OAuthClientUpdateParamsTokenEndpointAuthMethodClientSecretPost OAuthClientUpdateParamsTokenEndpointAuthMethod = "client_secret_post"
TosURI param.Field[string]Optional

Body param: URL that points to a terms of service document.

Visibility param.Field[OAuthClientUpdateParamsVisibility]Optional

Body param: Promote the OAuth client from private to public visibility. Only public is accepted; demotion to private is not supported. Promotion requires a non-empty client name, logo URI, verified client URI host, and at least one non-identity scope.

const OAuthClientUpdateParamsVisibilityPublic OAuthClientUpdateParamsVisibility = "public"
ReturnsExpand Collapse
type OAuthClientUpdateResponse struct{…}

Fields shared by OAuth client responses and create/update requests.

ClientID string

The unique identifier for an OAuth client.

Visibility OAuthClientUpdateResponseVisibility

Visibility of the OAuth client.

One of the following:
const OAuthClientUpdateResponseVisibilityPublic OAuthClientUpdateResponseVisibility = "public"
const OAuthClientUpdateResponseVisibilityPrivate OAuthClientUpdateResponseVisibility = "private"
AllowedCORSOrigins []stringOptional

Array of allowed CORS origins.

ClientName stringOptional

Human-readable name of the OAuth client.

ClientURI stringOptional

URL of the home page of the client.

ClientURIVerification OAuthClientUpdateResponseClientURIVerificationOptional

Client URI domain control verification state.

Status OAuthClientUpdateResponseClientURIVerificationStatusOptional

Current verification status for the client URI host.

One of the following:
const OAuthClientUpdateResponseClientURIVerificationStatusPending OAuthClientUpdateResponseClientURIVerificationStatus = "pending"
const OAuthClientUpdateResponseClientURIVerificationStatusInProgress OAuthClientUpdateResponseClientURIVerificationStatus = "in_progress"
const OAuthClientUpdateResponseClientURIVerificationStatusVerified OAuthClientUpdateResponseClientURIVerificationStatus = "verified"
const OAuthClientUpdateResponseClientURIVerificationStatusFailed OAuthClientUpdateResponseClientURIVerificationStatus = "failed"
Text stringOptional

Exact TXT record value that must be added to DNS to prove ownership of the client URI host.

CreatedAt TimeOptional

Timestamp when the OAuth client was created.

formatdate-time
GrantTypes []OAuthClientUpdateResponseGrantTypeOptional

Array of OAuth grant types the client is allowed to use. authorization_code is required; refresh_token may be included optionally.

One of the following:
const OAuthClientUpdateResponseGrantTypeAuthorizationCode OAuthClientUpdateResponseGrantType = "authorization_code"
const OAuthClientUpdateResponseGrantTypeRefreshToken OAuthClientUpdateResponseGrantType = "refresh_token"
HasRotatedSecret boolOptional

Indicates whether the client has a rotated secret that has not yet been deleted.

LogoURI stringOptional

URL of the client’s logo.

PolicyURI stringOptional

URL that points to a privacy policy document.

PostLogoutRedirectURIs []stringOptional

Array of allowed post-logout redirect URIs.

RedirectURIs []stringOptional

Array of allowed redirect URIs for the client.

ResponseTypes []OAuthClientUpdateResponseResponseTypeOptional

Array of OAuth response types the client is allowed to use.

One of the following:
const OAuthClientUpdateResponseResponseTypeToken OAuthClientUpdateResponseResponseType = "token"
const OAuthClientUpdateResponseResponseTypeIDToken OAuthClientUpdateResponseResponseType = "id_token"
const OAuthClientUpdateResponseResponseTypeCode OAuthClientUpdateResponseResponseType = "code"
Scopes []stringOptional

Array of OAuth scopes the client is allowed to request. Colon-delimited scopes are not accepted. Dot-delimited scopes are validated against available OAuth API scopes; simple identity scopes are allowed. Protocol scopes offline_access and openid are added or removed automatically based on grant_types and response_types.

TokenEndpointAuthMethod OAuthClientUpdateResponseTokenEndpointAuthMethodOptional

The authentication method the client uses at the token endpoint.

One of the following:
const OAuthClientUpdateResponseTokenEndpointAuthMethodNone OAuthClientUpdateResponseTokenEndpointAuthMethod = "none"
const OAuthClientUpdateResponseTokenEndpointAuthMethodClientSecretBasic OAuthClientUpdateResponseTokenEndpointAuthMethod = "client_secret_basic"
const OAuthClientUpdateResponseTokenEndpointAuthMethodClientSecretPost OAuthClientUpdateResponseTokenEndpointAuthMethod = "client_secret_post"
TosURI stringOptional

URL that points to a terms of service document.

UpdatedAt TimeOptional

Timestamp when the OAuth client was last updated.

formatdate-time

Update OAuth Client

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  oauthClient, err := client.IAM.OAuthClients.Update(
    context.TODO(),
    "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
    iam.OAuthClientUpdateParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", oauthClient.ClientID)
}
{
  "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": {
    "client_id": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
    "visibility": "private",
    "allowed_cors_origins": [
      "https://example.com"
    ],
    "client_name": "My OAuth App",
    "client_uri": "https://example.com",
    "client_uri_verification": {
      "status": "in_progress",
      "text": "cloudflare_oauth_client_publisher=example"
    },
    "created_at": "2025-01-01T00:00:00Z",
    "grant_types": [
      "authorization_code",
      "refresh_token"
    ],
    "has_rotated_secret": false,
    "logo_uri": "https://example.com/logo.png",
    "policy_uri": "https://example.com/privacy",
    "post_logout_redirect_uris": [
      "https://example.com/logout"
    ],
    "promoted_at": "2026-05-13T12:00:00Z",
    "redirect_uris": [
      "https://example.com/callback"
    ],
    "response_types": [
      "code"
    ],
    "scopes": [
      "account.read"
    ],
    "token_endpoint_auth_method": "client_secret_post",
    "tos_uri": "https://example.com/tos",
    "updated_at": "2025-01-01T00:00:00Z"
  }
}
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": {
    "client_id": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
    "visibility": "private",
    "allowed_cors_origins": [
      "https://example.com"
    ],
    "client_name": "My OAuth App",
    "client_uri": "https://example.com",
    "client_uri_verification": {
      "status": "in_progress",
      "text": "cloudflare_oauth_client_publisher=example"
    },
    "created_at": "2025-01-01T00:00:00Z",
    "grant_types": [
      "authorization_code",
      "refresh_token"
    ],
    "has_rotated_secret": false,
    "logo_uri": "https://example.com/logo.png",
    "policy_uri": "https://example.com/privacy",
    "post_logout_redirect_uris": [
      "https://example.com/logout"
    ],
    "promoted_at": "2026-05-13T12:00:00Z",
    "redirect_uris": [
      "https://example.com/callback"
    ],
    "response_types": [
      "code"
    ],
    "scopes": [
      "account.read"
    ],
    "token_endpoint_auth_method": "client_secret_post",
    "tos_uri": "https://example.com/tos",
    "updated_at": "2025-01-01T00:00:00Z"
  }
}