{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pricklymails-com/json-schema/pricklymails-com-subscription-response-schema.json",
  "title": "SubscriptionResponse",
  "description": "JSON response body for `GET /api/subscription`.",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pricklymails-com-openapi.json#/components/schemas/SubscriptionResponse",
  "type": "object",
  "required": [
    "plan",
    "status",
    "billing_cycle",
    "period_start",
    "period_end",
    "monthly_credits",
    "has_access"
  ],
  "properties": {
    "billing_cycle": {
      "type": "string",
      "description": "Billing cycle (`\"monthly\"` or `\"yearly\"`)."
    },
    "external_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Identifier of the subscription at the payment provider, `null` when there is none."
    },
    "has_access": {
      "type": "boolean",
      "description": "Whether the subscription provides access to the service."
    },
    "monthly_credits": {
      "type": "integer",
      "format": "int32",
      "description": "Tokens granted each month by the plan.",
      "minimum": 0
    },
    "period_end": {
      "type": "string",
      "format": "date-time",
      "description": "End of the current billing period."
    },
    "period_start": {
      "type": "string",
      "format": "date-time",
      "description": "Start of the current billing period."
    },
    "plan": {
      "type": "string",
      "description": "Plan code: `\"free\"`, `\"starter\"`, `\"pro\"`, `\"business\"` or `\"enterprise\"`."
    },
    "status": {
      "type": "string",
      "description": "Subscription status: `\"trial\"`, `\"active\"`, `\"past_due\"`, `\"canceled\"`, `\"expired\"` or `\"paused\"`."
    },
    "trial_days_remaining": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64",
      "description": "Days remaining in a trial period. `null` when not in trial."
    }
  }
}