{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/atako-ai/json-schema/atako-ai-company-subscription-schema.json",
  "title": "CompanySubscription",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/atako-ai-api-openapi.json#/components/schemas/CompanySubscription",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "companyId": {
      "type": "string",
      "format": "uuid"
    },
    "planId": {
      "type": "string",
      "format": "uuid"
    },
    "planPriceId": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "stripeSubscriptionId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Company admins only — omitted for members."
    },
    "stripeCustomerId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Company admins only — omitted for members."
    },
    "stripeScheduleId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Company admins only — omitted for members."
    },
    "hasStripeSubscription": {
      "type": "boolean",
      "description": "Whether a live Stripe subscription backs this row (false for a self-serve trial without card)."
    },
    "hasStripeCustomer": {
      "type": "boolean",
      "description": "Whether the company has a Stripe customer."
    },
    "status": {
      "type": "string",
      "enum": [
        "trialing",
        "active",
        "past_due",
        "canceled"
      ]
    },
    "currentPeriodStart": {
      "type": "string",
      "format": "date-time"
    },
    "currentPeriodEnd": {
      "type": "string",
      "format": "date-time"
    },
    "activeAgentsPurchased": {
      "type": "integer"
    },
    "pendingActiveAgentsPurchased": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Target seat count of a scheduled reduction (AF-57), null when none is pending."
    },
    "pendingReductionEffectiveAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the pending reduction lands (= currentPeriodEnd at the time it was scheduled)."
    },
    "cancelAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "End-of-period cancellation scheduled on Stripe (billing portal): when the service stops. Null when none is scheduled. On a `canceled` subscription: when the service actually stopped."
    },
    "pendingPaymentActiveAgentsPurchased": {
      "type": [
        "integer",
        "null"
      ],
      "description": "A licence increase whose prorated invoice awaits payment (3DS, declined card): the seat count once paid. Null when nothing is pending."
    },
    "pendingPaymentInvoiceUrl": {
      "type": [
        "string",
        "null"
      ],
      "description": "The hosted Stripe invoice to pay for `pendingPaymentActiveAgentsPurchased`. Company admins only — omitted for members."
    },
    "trialSource": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "self_serve",
        "admin_manual"
      ]
    },
    "trialEndAgentCount": {
      "type": [
        "integer",
        "null"
      ]
    },
    "planName": {
      "type": "string"
    },
    "planDescription": {
      "type": "string"
    },
    "creditsPerAgentPerMonth": {
      "type": "integer"
    },
    "billingInterval": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "monthly",
        "annual"
      ]
    },
    "pricePerAgentCents": {
      "type": [
        "integer",
        "null"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "companyId",
    "planId",
    "status",
    "activeAgentsPurchased"
  ]
}