Skip to content
Start here

Update User Subscription

client.user.subscriptions.update(stringidentifier, SubscriptionUpdateParams { frequency, rate_plan } body, RequestOptionsoptions?): SubscriptionUpdateResponse
PUT/user/subscriptions/{identifier}

Updates a user's subscriptions.

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)
Billing Write
ParametersExpand Collapse
identifier: string

Subscription identifier tag.

maxLength32
body: SubscriptionUpdateParams { frequency, rate_plan }
frequency?: "weekly" | "monthly" | "quarterly" | "yearly"

How often the subscription is renewed automatically.

One of the following:
"weekly"
"monthly"
"quarterly"
"yearly"
rate_plan?: RatePlan { id, currency, externally_managed, 4 more }

The rate plan applied to the subscription.

id?: "free" | "lite" | "pro" | 7 more

The ID of the rate plan.

One of the following:
"free"
"lite"
"pro"
"pro_plus"
"business"
"enterprise"
"partners_free"
"partners_pro"
"partners_business"
"partners_enterprise"
currency?: string

The currency applied to the rate plan subscription.

externally_managed?: boolean

Whether this rate plan is managed externally from Cloudflare.

is_contract?: boolean

Whether a rate plan is enterprise-based (or newly adopted term contract).

public_name?: string

The full name of the rate plan.

scope?: string

The scope that this rate plan applies to.

sets?: Array<string>

The list of sets this rate plan applies to. Returns array of strings.

ReturnsExpand Collapse
SubscriptionUpdateResponse = unknown | string | null
One of the following:
unknown
string | null

Update User Subscription

import Cloudflare from 'cloudflare';

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

const subscription = await client.user.subscriptions.update('506e3185e9c882d175a2d0cb0093d9f2');

console.log(subscription);
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {},
  "success": 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"
      }
    }
  ],
  "result": {},
  "success": true
}