---
title: Get Subscription
---

[Skip to content](#%5Ftop) 

[API Reference](https://developers.cloudflare.com/api/go)

[Accounts](https://developers.cloudflare.com/api/go/resources/accounts)

[Subscriptions](https://developers.cloudflare.com/api/go/resources/accounts/subresources/subscriptions)

Copy Markdown

Open in **Claude**

Open in **ChatGPT**

Open in **Cursor**

---

**Copy Markdown**

**View as Markdown**

# Get Subscription

client.Accounts.Subscriptions.GetByIdentifier(ctx, subscriptionIdentifier, query) (\*[Subscription](https://developers.cloudflare.com/api/go/resources/$shared#%28resource%29%20%24shared%20%3E%20%28model%29%20subscription%20%3E%20%28schema%29), error)

GET/accounts/{account\_id}/subscriptions/{subscription\_identifier}

Gets an account subscription by identifier.

##### Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. [Create a token](https://developers.cloudflare.com/fundamentals/api/get-started/create-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` `Billing Read`

##### ParametersExpand Collapse 

subscriptionIdentifier string

Subscription identifier tag.

maxLength32

query SubscriptionGetByIdentifierParams

AccountID param.Field\[string\]

Identifier

maxLength32

##### ReturnsExpand Collapse 

type Subscription struct{…}

ID stringOptional

Subscription identifier tag.

maxLength32

Currency stringOptional

The monetary unit in which pricing information is displayed.

CurrentPeriodEnd TimeOptional

The end of the current period and also when the next billing is due.

formatdate-time

CurrentPeriodStart TimeOptional

When the current billing period started. May match initial\_period\_start if this is the first period.

formatdate-time

Frequency SubscriptionFrequencyOptional

How often the subscription is renewed automatically.

One of the following:

const SubscriptionFrequencyWeekly SubscriptionFrequency \= "weekly"

const SubscriptionFrequencyMonthly SubscriptionFrequency \= "monthly"

const SubscriptionFrequencyQuarterly SubscriptionFrequency \= "quarterly"

const SubscriptionFrequencyYearly SubscriptionFrequency \= "yearly"

Price float64Optional

The price of the subscription that will be billed, in US dollars.

RatePlan [RatePlan](https://developers.cloudflare.com/api/go/resources/$shared#%28resource%29%20%24shared%20%3E%20%28model%29%20rate%5Fplan%20%3E%20%28schema%29)Optional

The rate plan applied to the subscription.

ID RatePlanIDOptional

The ID of the rate plan.

One of the following:

const RatePlanIDFree RatePlanID \= "free"

const RatePlanIDLite RatePlanID \= "lite"

const RatePlanIDPro RatePlanID \= "pro"

const RatePlanIDProPlus RatePlanID \= "pro\_plus"

const RatePlanIDBusiness RatePlanID \= "business"

const RatePlanIDEnterprise RatePlanID \= "enterprise"

const RatePlanIDPartnersFree RatePlanID \= "partners\_free"

const RatePlanIDPartnersPro RatePlanID \= "partners\_pro"

const RatePlanIDPartnersBusiness RatePlanID \= "partners\_business"

const RatePlanIDPartnersEnterprise RatePlanID \= "partners\_enterprise"

Currency stringOptional

The currency applied to the rate plan subscription.

ExternallyManaged boolOptional

Whether this rate plan is managed externally from Cloudflare.

IsContract boolOptional

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

PublicName stringOptional

The full name of the rate plan.

Scope stringOptional

The scope that this rate plan applies to.

Sets \[\]stringOptional

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

State SubscriptionStateOptional

The state that the subscription is in.

One of the following:

const SubscriptionStateTrial SubscriptionState \= "Trial"

const SubscriptionStateProvisioned SubscriptionState \= "Provisioned"

const SubscriptionStatePaid SubscriptionState \= "Paid"

const SubscriptionStateAwaitingPayment SubscriptionState \= "AwaitingPayment"

const SubscriptionStateCancelled SubscriptionState \= "Cancelled"

const SubscriptionStateFailed SubscriptionState \= "Failed"

const SubscriptionStateExpired SubscriptionState \= "Expired"

### Get Subscription

Go

HTTPHTTP

TypeScriptTypeScript

PythonPython

GoGo

TerraformTerraform

```
package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  subscription, err := client.Accounts.Subscriptions.GetByIdentifier(
    context.TODO(),
    "506e3185e9c882d175a2d0cb0093d9f2",
    accounts.SubscriptionGetByIdentifierParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", subscription.ID)
}

```

200 example

```
{
  "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
}
```

##### Returns Examples

200 example

```
{
  "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
}
```