Show examples in:
JavascriptHTTP
Endpoint info
Available examples
Dashboard API > Account subscription

Create a new subscription

Warning: Experimental API

Please note that the Dashboard API is an experimental, prerelease API. This API method is considered unstable, and should be avoided in production environments and automations. Changes may occur at any time without warning.

Body parameters

typestringRequired

Must be exactly "per_owner_pricing_subscription".

attributes.recurrenceenumRequired

Type of recurrence (yearly/monthly)

Example:"monthly"
yearlyOptional
monthlyOptional
attributes.payment_intent_idstringOptional
attributes.billing_profilenull, objectOptional
address_linestringRequired
citystringRequired
countrystringRequired
emailstringRequired
first_namestringRequired
last_namestringRequired
statestringRequired
zipstringRequired
companynull, stringOptional
vat_numbernull, stringOptional
cf_cod_fiscalenull, stringOptional
cf_cod_fiscale_partecipante_gruppo_ivanull, stringOptional
po_numbernull, stringOptional
attributes.downgrade_reasonstringOptional

Reason for the downgrade (only considered in case of switch to free plan)

Example:"I'm facing technical issues with the product"
relationships.plan.dataRequired

Subscription plan

Type:<a href="/docs/content-management-api/resources/per_owner_pricing_plan">ResourceLinkage&#x3C;"per_owner_pricing_plan"></a>

Returns

Returns a resource object of type per_owner_pricing_subscription.

Examples

POST https://site-api.datocms.com/per-owner-pricing-subscriptions HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"type": "per_owner_pricing_subscription",
"attributes": {
"recurrence": "monthly"
},
"relationships": {
"plan": {
"data": {
"type": "per_owner_pricing_plan",
"id": "124"
}
}
}
}
}
Terminal window
curl -g 'https://site-api.datocms.com/per-owner-pricing-subscriptions' \
-X POST \
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Accept: application/json" \
-H "X-Api-Version: 3" \
-H "Content-Type: application/vnd.api+json" \
--data-binary '{"data":{"type":"per_owner_pricing_subscription","attributes":{"recurrence":"monthly"},"relationships":{"plan":{"data":{"type":"per_owner_pricing_plan","id":"124"}}}}}'
await fetch("https://site-api.datocms.com/per-owner-pricing-subscriptions", {
method: "POST",
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
"Content-Type": "application/vnd.api+json",
},
body: JSON.stringify({
data: {
type: "per_owner_pricing_subscription",
attributes: { recurrence: "monthly" },
relationships: {
plan: { data: { type: "per_owner_pricing_plan", id: "124" } },
},
},
}),
});
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: cache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
{
"data": {
"type": "per_owner_pricing_subscription",
"id": "124",
"relationships": {
"plan": {
"data": {
"type": "per_owner_pricing_plan",
"id": "124"
}
}
},
"attributes": {
"created_at": "2020-04-21T07:57:11.124Z",
"recurrence": "monthly",
"price": 20,
"extra_packets": [
{
"id": "",
"quantity": 20
}
]
},
"meta": {
"manual_payments_collection": true
}
}
}