Subscriptions
View as Markdown

Create a subscription

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

POST
/api/v1/subscriptions

Authorization

Authorization
Required
Bearer <token>

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

In: header

Request Body

application/jsonOptional

customer_idstring

Exactly one of customer_id / customer_external_id.

Format: "uuid"

customer_external_idstring

Your own customer id.

Minimum length: 1Maximum length: 200

plan_idstring

The base plan: at most one of plan_id / plan_code. Optional when items is given: the first item becomes the base.

Format: "uuid"

plan_codestring

A plan code; its latest active version is used.

Minimum length: 1Maximum length: 200

itemsarray<object>

Extra charges beside the base plan, each plan_id or plan_code. Same interval as the base.

quantityAny properties in integer, string

Seats on the base plan. Default 1.

start_atstring

Format: "date-time"

trial_endstring | null

Omitted = the product's trial_days; null = no trial.

Format: "date-time"

metadataobject

Flat scalars: at most 50 keys of at most 40 characters; strings at most 500 characters.

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/subscriptions" \
  -H "Idempotency-Key: order-8842-charge" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "customer_external_id": "string",
    "plan_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "plan_code": "gos_growth_annual",
    "items": [
      {
        "plan_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "plan_code": "gos_growth_annual",
        "quantity": 1
      }
    ],
    "quantity": 1,
    "start_at": "2019-08-24T14:15:22Z",
    "trial_end": "2019-08-24T14:15:22Z",
    "metadata": {
      "single_module_key": "crm"
    }
  }'

Subscription created; an advance first invoice is finalized and charged against the default card.

{
  "data": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "status": "string",
    "quantity": 0,
    "current_period_start": "2019-08-24T14:15:22Z",
    "current_period_end": "2019-08-24T14:15:22Z",
    "latest_invoice": {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "status": "string",
      "total_cents": "1999",
      "amount_due_cents": "1999",
      "payment": {
        "status": "attempted",
        "payment_intent_id": "string",
        "reason": "string"
      }
    }
  },
  "_agent": {
    "summary": "string",
    "status": "ok",
    "next_actions": [
      "string"
    ],
    "warnings": [
      "string"
    ]
  },
  "api_version": "2026-07-01"
}