{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/asap-cool/json-schema/asap-cool-create-subscription-request-schema.json",
  "title": "CreateSubscriptionRequest",
  "description": "JSON body of `POST /v1/billing/subscription`.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/asap-cool-billing-api-openapi.yml#/components/schemas/CreateSubscriptionRequest",
  "type": "object",
  "required": [
    "plan",
    "payment_method_id"
  ],
  "properties": {
    "interval": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/BillingIntervalWire",
          "description": "Billing cadence (`month` / `year`); defaults to monthly."
        }
      ]
    },
    "payment_method_id": {
      "type": "string",
      "description": "`pm_…` identifier of the card to charge."
    },
    "plan": {
      "$ref": "#/$defs/CheckoutPlan",
      "description": "Target plan slug."
    },
    "promotion_code": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional customer-facing promotion code (e.g. `BIENVENUE8`). When\nset and valid, the discount applies to the first invoice; an\nunknown or inactive code is rejected with 422 before any charge."
    }
  },
  "$defs": {
    "BillingIntervalWire": {
      "type": "string",
      "description": "Billing cadence accepted by checkout and plan changes. Absent means\nmonthly, so a client that predates the annual offer is unaffected.",
      "enum": [
        "month",
        "year"
      ]
    },
    "CheckoutPlan": {
      "type": "string",
      "description": "Wire-format plan slug accepted by checkout.",
      "enum": [
        "solo",
        "studio"
      ]
    }
  }
}