Skip to main content

subscriptions

Creates, updates, deletes, gets or lists a subscriptions resource.

Overview

Namesubscriptions
TypeResource
Idcloudflare.zones.subscriptions

Fields

The following fields are returned by SELECT queries:

Zone Subscription Details response

NameDatatypeDescription
idstringSubscription identifier tag. (example: 506e3185e9c882d175a2d0cb0093d9f2)
currencystringThe monetary unit in which pricing information is displayed. (example: USD)
current_period_endstring (date-time)The end of the current period and also when the next billing is due. (example: 2014-03-31T12:20:00Z)
current_period_startstring (date-time)When the current billing period started. May match initial_period_start if this is the first period. (example: 2014-05-11T12:20:00Z)
frequencystringHow often the subscription is renewed automatically. (weekly, monthly, quarterly, yearly, not-applicable) (example: monthly)
pricenumberThe price of the subscription that will be billed, in US dollars.
rate_planobjectThe rate plan applied to the subscription.
statestringThe state that the subscription is in. (Trial, Provisioned, Paid, AwaitingPayment, Cancelled, Failed, Expired) (example: Paid)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectzone_idLists zone subscription details.
createinsertzone_idCreate a zone subscription, either plan or add-ons.
updatereplacezone_idUpdates zone subscriptions, either plan or add-ons.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
zone_idstringThe Cloudflare zone ID.

SELECT examples

Lists zone subscription details.

SELECT
id,
currency,
current_period_end,
current_period_start,
frequency,
price,
rate_plan,
state
FROM cloudflare.zones.subscriptions
WHERE zone_id = '{{ zone_id }}' -- required
;

INSERT examples

Create a zone subscription, either plan or add-ons.

INSERT INTO cloudflare.zones.subscriptions (
frequency,
rate_plan,
zone_id
)
SELECT
'{{ frequency }}',
'{{ rate_plan }}',
'{{ zone_id }}'
RETURNING
errors,
messages,
result,
success
;

REPLACE examples

Updates zone subscriptions, either plan or add-ons.

REPLACE cloudflare.zones.subscriptions
SET
frequency = '{{ frequency }}',
rate_plan = '{{ rate_plan }}'
WHERE
zone_id = '{{ zone_id }}' --required
RETURNING
errors,
messages,
result,
success;