Catalog
View as Markdown

Create or update a plan by its code (versioned on a price change)

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

PUT
/api/v1/plans/by-code/{code}

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

pricing_model
Required
string

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

interval
Required
string

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

billing_timingstring

Value in: "advance" | "arrears"

currency
Required
string

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

amount_cents
Required
string

Base-currency price, in minor units. On a graduated per_seat plan it is set to band 1 of tier_config.

Pattern: "^\\d+$"

tier_configarray<object>

Base-currency ladder, ascending, last band up_to: null.

included_unitsstring

Included usage units.

Pattern: "^\\d+$"

package_sizeinteger

unit_namestring

Maximum length: 50

aggregationstring

Value in: "sum" | "max" | "last_during_period"

pricesarray<object>

Other currencies (never the base one, none twice). A graduated per_seat plan needs tiers on every one.

metadataobject

At most 20 keys; values up to 500 characters.

activeboolean

Omitted: a new plan is active, an existing one keeps its flag.

Path Parameters

code
Required
string

Pattern: "^[a-z0-9_]+$"
curl -X PUT "https://globalymint.com/api/v1/plans/by-code/string" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "string",
    "pricing_model": "flat",
    "interval": "monthly",
    "billing_timing": "advance",
    "currency": "USD",
    "amount_cents": "1999",
    "tier_config": [
      {
        "up_to": 1,
        "unit_amount_cents": "1999"
      }
    ],
    "included_units": "1999",
    "package_size": 1,
    "unit_name": "string",
    "aggregation": "sum",
    "prices": [
      {
        "currency": "USD",
        "amount_cents": "1999",
        "tiers": [
          {
            "up_to": 1,
            "unit_amount_cents": "1999"
          }
        ]
      }
    ],
    "metadata": {
      "property1": "string",
      "property2": "string"
    },
    "active": true
  }'

updated (name, product, unit name, metadata or active changed in place) or unchanged.

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