Zum Hauptinhalt springen
PUT
/
api
/
plans
/
{id}
Update a plan
curl --request PUT \
  --url https://coreapi.io/api/plans/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "code": "pro-plan",
  "name": "Pro Plan",
  "tiers": [
    {
      "position": 0,
      "name": "Starter",
      "upgradeable": true,
      "downgradeable": false,
      "changeTiming": "immediately",
      "creditType": "pro_rata",
      "items": [
        {
          "productId": "1280792f-4e23-793d-8e9c-3a1bf36630bd",
          "pricePlanId": "e0c546c5-eee0-7219-8847-c0ed16ae4a88",
          "defaultQuantity": 1
        }
      ]
    },
    {
      "position": 1,
      "name": "Pro",
      "upgradeable": true,
      "downgradeable": true,
      "changeTiming": "immediately",
      "creditType": "pro_rata",
      "items": [
        {
          "productId": "f5ece259-08ea-77a4-8bd9-9f3a9ed9e246",
          "pricePlanId": "295ad101-5d9f-7f1f-80f5-a9420c21eb1e",
          "defaultQuantity": 1
        },
        {
          "productId": "27e3a683-8829-73a8-8acb-5d9fbffb30b6",
          "pricePlanId": "a1384760-a089-76a8-82e0-abd2993a39ac",
          "defaultQuantity": 1,
          "minQuantity": 0,
          "maxQuantity": 50
        }
      ]
    },
    {
      "position": 2,
      "name": "Business",
      "upgradeable": false,
      "downgradeable": true,
      "changeTiming": "end_of_period",
      "creditType": "none",
      "items": [
        {
          "productId": "645077e0-f408-7f73-8f6e-585435440667",
          "pricePlanId": "321d6d27-a4aa-7dd7-8395-a57ead3b5ffb",
          "defaultQuantity": 1
        }
      ]
    }
  ]
}
'
{
  "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"
}

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"

Body

application/json

Full representation of a plan. PUT replaces the plan as a whole: send every tier and item you want to keep, provide ids to keep existing rows stable, and omit rows you want removed.

code
string
erforderlich

Stable, Organisation unique identifier in lower kebab case, for example pro-plan.

Required string length: 1 - 64
Pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$
Beispiel:

"pro-plan"

name
string
erforderlich

Display name of the plan.

Required string length: 1 - 255
Beispiel:

"Pro Plan"

tiers
object[]
erforderlich

The tiers of the plan, ordered by position. At least one tier is required.

Minimum array length: 1

Antwort

The updated 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>