{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/recurly/json-schema/recurly-external-subscription-update-schema.json",
  "title": "ExternalSubscriptionUpdate",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/recurly-external-subscription-api-openapi.yml#/components/schemas/ExternalSubscriptionUpdate",
  "allOf": [
    {
      "type": "object",
      "properties": {
        "external_product_reference": {
          "$ref": "#/$defs/ExternalProductReferenceUpdate"
        }
      }
    },
    {
      "$ref": "#/$defs/ExternalSubscriptionBase"
    }
  ],
  "$defs": {
    "ExternalProductReferenceBase": {
      "type": "object",
      "properties": {
        "reference_code": {
          "type": "string",
          "description": "A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store.",
          "maxLength": 255
        },
        "external_connection_type": {
          "$ref": "#/$defs/ExternalProductReferenceConnectionType"
        }
      }
    },
    "ExternalProductReferenceConnectionType": {
      "type": "string",
      "description": "Represents the connection type. One of the connection types of your enabled App Connectors"
    },
    "ExternalProductReferenceUpdate": {
      "allOf": [
        {
          "$ref": "#/$defs/ExternalProductReferenceBase"
        }
      ]
    },
    "ExternalSubscriptionBase": {
      "type": "object",
      "properties": {
        "external_id": {
          "type": "string",
          "title": "External Id",
          "description": "Id of the subscription in the external system, i.e. Apple App Store or Google Play Store."
        },
        "last_purchased": {
          "type": "string",
          "format": "date-time",
          "title": "Last purchased",
          "description": "When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade/downgrade."
        },
        "auto_renew": {
          "type": "boolean",
          "title": "Auto-renew",
          "description": "An indication of whether or not the external subscription will auto-renew at the expiration date.",
          "default": false
        },
        "state": {
          "type": "string",
          "description": "External subscriptions can be active, canceled, expired, past_due, voided, revoked, or paused.",
          "default": "active"
        },
        "app_identifier": {
          "type": "string",
          "title": "App identifier",
          "description": "Identifier of the app that generated the external subscription."
        },
        "quantity": {
          "type": "integer",
          "title": "Quantity",
          "description": "An indication of the quantity of a subscribed item's quantity.",
          "default": 1,
          "minimum": 0
        },
        "activated_at": {
          "type": "string",
          "format": "date-time",
          "title": "Activated at",
          "description": "When the external subscription was activated in the external platform."
        },
        "expires_at": {
          "type": "string",
          "format": "date-time",
          "title": "Expires at",
          "description": "When the external subscription expires in the external platform."
        },
        "trial_started_at": {
          "type": "string",
          "format": "date-time",
          "title": "Trial started at",
          "description": "When the external subscription trial period started in the external platform."
        },
        "trial_ends_at": {
          "type": "string",
          "format": "date-time",
          "title": "Trial ends at",
          "description": "When the external subscription trial period ends in the external platform."
        },
        "imported": {
          "type": "boolean",
          "title": "Import",
          "description": "An indication of whether or not the external subscription was being created by a historical data import.",
          "default": false
        }
      }
    }
  }
}