Catalog
View as Markdown

Create a plan

Needs the catalog:write scope, or a full-access key. About scopes

POST
/api/v1/plans

Authorization

Authorization
Required
Bearer <token>

An API key: gpy_test_… or gpy_live_… (or an agent key, agk_…).

In: header

Request Body

application/jsonOptional

product_id
Required
string

Format: "uuid"

name
Required
string

Minimum length: 1Maximum length: 200

code
Required
string

Minimum length: 1Maximum length: 100

pricing_model
Required
string

Value in: "flat" | "per_seat" | "metered" | "tiered" | "volume" | "package"

interval
Required
string

Value in: "monthly" | "quarterly" | "annual" | "one_time"

amount_cents
Required
string

Plan price, in minor units, serialized as a decimal string (also accepted as a plain integer on input).

Pattern: "^\\d+$"

currency
Required
string

Value in: "USD" | "AUD" | "CAD" | "GBP" | "EUR" | "INR" | "NPR"

included_unitsstring

Included usage units before metered overage applies, serialized as a decimal string.

Pattern: "^\\d+$"

package_sizeinteger

unit_namestring

Maximum length: 50

billing_timingstring

advance (default for new plans) invoices each period at its START; arrears at its end. Metered usage is always billed in arrears.

Value in: "advance" | "arrears"

Header Parameters

Idempotency-Keystring

A unique value for this operation, chosen by you. A retry with the same key and the same body returns the first response instead of running again. The same key with a different body answers 409 idempotency_key_reused; a key whose first request is still running answers 409 idempotency_in_progress.

curl -X POST "https://globalymint.com/api/v1/plans" \
  -H "Idempotency-Key: order-8842-charge" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "string",
    "code": "string",
    "pricing_model": "flat",
    "interval": "monthly",
    "amount_cents": "1999",
    "currency": "USD",
    "included_units": "1999",
    "package_size": 1,
    "unit_name": "string",
    "billing_timing": "advance"
  }'

Plan created.

{
  "data": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "_agent": {
    "summary": "string",
    "status": "ok",
    "next_actions": [
      "string"
    ],
    "warnings": [
      "string"
    ]
  },
  "api_version": "2026-07-01"
}