## Create Zone Subscription `client.zones.subscriptions.create(SubscriptionCreateParamsparams, RequestOptionsoptions?): SubscriptionCreateResponse` **post** `/zones/{zone_id}/subscription` Create a zone subscription, either plan or add-ons. ### Parameters - `params: SubscriptionCreateParams` - `zone_id: string` Path param: Identifier - `frequency?: "weekly" | "monthly" | "quarterly" | "yearly"` Body param: How often the subscription is renewed automatically. - `"weekly"` - `"monthly"` - `"quarterly"` - `"yearly"` - `rate_plan?: RatePlan` Body param: The rate plan applied to the subscription. - `id?: "free" | "lite" | "pro" | 7 more` The ID of the rate plan. - `"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` The list of sets this rate plan applies to. Returns array of strings. ### Returns - `SubscriptionCreateResponse` - `id?: string` Subscription identifier tag. - `currency?: string` The monetary unit in which pricing information is displayed. - `current_period_end?: string` The end of the current period and also when the next billing is due. - `current_period_start?: string` When the current billing period started. May match initial_period_start if this is the first period. - `frequency?: "weekly" | "monthly" | "quarterly" | 2 more` How often the subscription is renewed automatically. - `"weekly"` - `"monthly"` - `"quarterly"` - `"yearly"` - `"not-applicable"` - `price?: number` The price of the subscription that will be billed, in US dollars. - `rate_plan?: RatePlan` The rate plan applied to the subscription. - `id?: "free" | "lite" | "pro" | 7 more` The ID of the rate plan. - `"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` The list of sets this rate plan applies to. Returns array of strings. - `state?: "Trial" | "Provisioned" | "Paid" | 4 more` The state that the subscription is in. - `"Trial"` - `"Provisioned"` - `"Paid"` - `"AwaitingPayment"` - `"Cancelled"` - `"Failed"` - `"Expired"` ### Example ```node 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.zones.subscriptions.create({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(subscription.id); ``` #### Response ```json { "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": { "id": "506e3185e9c882d175a2d0cb0093d9f2", "currency": "USD", "current_period_end": "2014-03-31T12:20:00Z", "current_period_start": "2014-05-11T12:20:00Z", "frequency": "monthly", "price": 20, "rate_plan": { "id": "free", "currency": "USD", "externally_managed": false, "is_contract": false, "public_name": "Business Plan", "scope": "zone", "sets": [ "string" ] }, "state": "Paid" }, "success": true } ```