Zum Hauptinhalt springen
POST
/
api
/
plans
/
{id}
/
activate
Activate a plan
curl --request POST \
  --url https://coreapi.io/api/plans/{id}/activate \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://coreapi.io/api/plans/{id}/activate"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.text)
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

fetch('https://coreapi.io/api/plans/{id}/activate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://coreapi.io/api/plans/{id}/activate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
{
  "id": "1280792f-4e23-793d-8e9c-3a1bf36630bd",
  "code": "pro-plan",
  "name": "Pro Plan",
  "currency": "EUR",
  "tiers": [
    {
      "id": "<string>",
      "position": 1,
      "name": "Pro",
      "upgradeable": true,
      "downgradeable": true,
      "commitmentPeriod": "P1Y",
      "items": [
        {
          "id": "<string>",
          "productId": "<string>",
          "productName": "Add-On",
          "pricePlanId": "<string>",
          "pricePlanName": "Add-On Monthly",
          "currency": "EUR",
          "defaultQuantity": 1,
          "minQuantity": 123,
          "maxQuantity": 123
        }
      ]
    }
  ],
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z"
}
{
"status": 404,
"type": "PLAN__NOT_FOUND",
"title": "An error occurred",
"detail": "Plan not found."
}
{
"status": 404,
"type": "PLAN__NOT_FOUND",
"title": "An error occurred",
"detail": "Plan not found."
}
{
"status": 404,
"type": "PLAN__NOT_FOUND",
"title": "An error occurred",
"detail": "Plan not found."
}
{
"status": 422,
"type": "https://tools.ietf.org/html/rfc2616#section-10",
"title": "Validation Failed",
"violations": [
{
"propertyPath": "tiers[0].name",
"message": "This value should not be blank.",
"code": "<string>"
}
]
}

Autorisierungen

Authorization
string
header
erforderlich

Organisation API token. Send it as Authorization: Bearer api_... The token is scoped to a single Organisation.

Pfadparameter

id
string<uuid>
erforderlich

The plan UUID.

Beispiel:

"1280792f-4e23-793d-8e9c-3a1bf36630bd"

Antwort

The activated plan.

id
string<uuid>
Beispiel:

"1280792f-4e23-793d-8e9c-3a1bf36630bd"

code
string
Beispiel:

"pro-plan"

name
string
Beispiel:

"Pro Plan"

status
enum<string>

Lifecycle status. A plan is created as draft, becomes active once you activate it, and can later be archived. Only active plans can be sold or switched into.

Verfügbare Optionen:
draft,
active,
archived
currency
string | null

Currency derived from the price plans, null when the plan has no items yet.

Beispiel:

"EUR"

tiers
object[]
createdAt
string<date-time>
updatedAt
string<date-time>