{
  "openapi": "3.1.0",
  "info": {
    "title": "Tenth API",
    "version": "1.0.0",
    "description": "The public Tenth API: customers, entitlements, credits, grants, offerings, purchases and the event feed. Authenticate with a secret key from your server, or a publishable key plus a customer token from an app."
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "tenth_{test|live}_{pk|sk}_…"
      }
    },
    "schemas": {
      "Problem": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "number"
          },
          "code": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          },
          "errors": {}
        },
        "required": [
          "type",
          "title",
          "status",
          "code"
        ],
        "additionalProperties": false
      },
      "EntitlementState": {
        "type": "object",
        "properties": {
          "active": {
            "type": "boolean"
          },
          "source": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "purchase",
                  "subscription",
                  "grant"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "store": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "stripe",
                  "apple",
                  "google"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Where to manage it: App Store, Google Play or web (Stripe)."
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "will_renew": {
            "type": "boolean"
          },
          "in_grace": {
            "type": "boolean"
          },
          "billing_issue": {
            "type": "boolean"
          },
          "quantity": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "active",
          "source",
          "store",
          "expires_at",
          "will_renew",
          "in_grace",
          "billing_issue",
          "quantity"
        ],
        "additionalProperties": false
      },
      "CreditBalance": {
        "type": "object",
        "properties": {
          "balance": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "available": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Balance minus credits reserved by open holds."
          }
        },
        "required": [
          "balance",
          "available"
        ],
        "additionalProperties": false
      },
      "SubscriptionSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "product": {
            "type": [
              "string",
              "null"
            ]
          },
          "store": {
            "type": "string",
            "enum": [
              "stripe",
              "apple",
              "google"
            ]
          },
          "status": {
            "type": "string"
          },
          "current_period_start": {
            "type": [
              "string",
              "null"
            ]
          },
          "current_period_end": {
            "type": [
              "string",
              "null"
            ]
          },
          "trial_end": {
            "type": [
              "string",
              "null"
            ]
          },
          "grace_period_end": {
            "type": [
              "string",
              "null"
            ]
          },
          "cancel_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "will_renew": {
            "type": "boolean"
          },
          "provisional": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "product",
          "store",
          "status",
          "current_period_start",
          "current_period_end",
          "trial_end",
          "grace_period_end",
          "cancel_at",
          "will_renew",
          "provisional"
        ],
        "additionalProperties": false
      },
      "CustomerState": {
        "type": "object",
        "properties": {
          "customer": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "app_user_id": {
                "type": "string"
              },
              "app_account_token": {
                "type": "string",
                "description": "Set this as appAccountToken on every StoreKit purchase, so Tenth can tell whose it is."
              },
              "obfuscated_account_id": {
                "type": "string",
                "description": "Set this as obfuscatedAccountId on every Play Billing purchase, so Tenth can tell whose it is."
              },
              "created_at": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "app_user_id",
              "app_account_token",
              "obfuscated_account_id",
              "created_at"
            ],
            "additionalProperties": false
          },
          "entitlements": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/EntitlementState"
            }
          },
          "credits": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/CreditBalance"
            }
          },
          "subscriptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SubscriptionSummary"
            }
          }
        },
        "required": [
          "customer",
          "entitlements",
          "credits",
          "subscriptions"
        ],
        "additionalProperties": false
      },
      "CreditTransaction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "credit_type": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "grant",
              "debit",
              "expire",
              "clawback",
              "adjustment",
              "refill"
            ]
          },
          "amount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lot_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "metadata": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "credit_type",
          "type",
          "amount",
          "lot_id",
          "metadata",
          "occurred_at"
        ],
        "additionalProperties": false
      },
      "CreditHold": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "credit_type": {
            "type": "string"
          },
          "amount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "status": {
            "type": "string",
            "enum": [
              "held",
              "committed",
              "released",
              "expired"
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "credit_type",
          "amount",
          "status",
          "expires_at",
          "created_at"
        ],
        "additionalProperties": false
      },
      "Grant": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "customer_id": {
            "type": "string"
          },
          "entitlement": {
            "type": [
              "string",
              "null"
            ]
          },
          "credit_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "amount": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "starts_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "reason": {
            "type": "string"
          },
          "created_by": {
            "type": "string"
          },
          "revoked_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "customer_id",
          "entitlement",
          "credit_type",
          "amount",
          "starts_at",
          "expires_at",
          "reason",
          "created_by",
          "revoked_at",
          "created_at"
        ],
        "additionalProperties": false
      },
      "Event": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "id",
          "type",
          "created_at",
          "payload"
        ],
        "additionalProperties": false
      },
      "RevenueTransaction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "customer_id": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "stripe",
              "apple",
              "google"
            ]
          },
          "platform": {
            "type": "string",
            "enum": [
              "ios",
              "android",
              "web"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "purchase",
              "renewal",
              "refund",
              "refund_reversal",
              "chargeback",
              "chargeback_reversal"
            ]
          },
          "provider_transaction_id": {
            "type": "string"
          },
          "original_transaction_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "refunded_transaction_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "subscription_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchase_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "product_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "period_start": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "period_end": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "country": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "gross_amount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "description": "Minor units of `currency`."
          },
          "tax_amount": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "fee_amount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "net_amount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "fee_is_estimated": {
            "type": "boolean"
          },
          "amount_is_estimated": {
            "type": "boolean"
          },
          "gross_amount_usd": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ],
            "description": "USD cents. Null until the day’s FX rate is known."
          },
          "fee_amount_usd": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "net_amount_usd": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "fx_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "fx_rate_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "fx_source": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "identity",
                  "stripe_balance_transaction",
                  "daily_rate"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "is_trial_conversion": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "customer_id",
          "provider",
          "platform",
          "type",
          "provider_transaction_id",
          "original_transaction_id",
          "refunded_transaction_id",
          "subscription_id",
          "purchase_id",
          "product_id",
          "occurred_at",
          "period_start",
          "period_end",
          "country",
          "currency",
          "gross_amount",
          "tax_amount",
          "fee_amount",
          "net_amount",
          "fee_is_estimated",
          "amount_is_estimated",
          "gross_amount_usd",
          "fee_amount_usd",
          "net_amount_usd",
          "fx_rate",
          "fx_rate_date",
          "fx_source",
          "is_trial_conversion"
        ],
        "additionalProperties": false
      },
      "DisplayPrice": {
        "type": "object",
        "properties": {
          "amount_minor": {
            "type": "string",
            "pattern": "^\\d+$",
            "description": "Minor units of `currency`, as an integer string."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217, uppercase."
          },
          "recurring": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "interval": {
                    "type": "string",
                    "enum": [
                      "day",
                      "week",
                      "month",
                      "year"
                    ]
                  },
                  "interval_count": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "interval",
                  "interval_count"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "Null for one-time prices."
          },
          "trial_period_days": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "amount_minor",
          "currency",
          "recurring",
          "trial_period_days"
        ],
        "additionalProperties": false
      },
      "ServedPaywall": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "config": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "A published paywall config (@tenthbilling/paywall/schema) whose schema_version is at most `paywall_schema`. Parse it with parseServedPaywall."
          },
          "assets": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            },
            "description": "Image id → URL, on the API's own origin."
          }
        },
        "required": [
          "id",
          "version",
          "config",
          "assets"
        ],
        "additionalProperties": false
      },
      "CurrentOffering": {
        "type": "object",
        "properties": {
          "offering": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string"
                  },
                  "purchase_path": {
                    "type": "string",
                    "enum": [
                      "store",
                      "web_link_out",
                      "in_app_stripe",
                      "none"
                    ]
                  },
                  "products": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "subscription",
                            "non_consumable",
                            "consumable"
                          ]
                        },
                        "display_name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "label": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "badge": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "is_highlighted": {
                          "type": "boolean"
                        },
                        "store_product_id": {
                          "type": "string",
                          "description": "App Store product id, Google Play product id, or Stripe price id, for this platform and purchase path."
                        },
                        "google_base_plan_id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "google_offer_id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "price": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/DisplayPrice"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Web (Stripe) products only: Stripe's current price. Null for store products (the device reads store prices) and when Stripe can't be reached; hide a web product without a price."
                        },
                        "entitlements": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "credits": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "credit_type": {
                                "type": "string"
                              },
                              "amount": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "per": {
                                "type": "string",
                                "enum": [
                                  "purchase",
                                  "period"
                                ]
                              }
                            },
                            "required": [
                              "credit_type",
                              "amount",
                              "per"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "key",
                        "type",
                        "display_name",
                        "label",
                        "badge",
                        "is_highlighted",
                        "store_product_id",
                        "google_base_plan_id",
                        "google_offer_id",
                        "price",
                        "entitlements",
                        "credits"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "key",
                  "purchase_path",
                  "products"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "paywall": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ServedPaywall"
              },
              {
                "type": "null"
              }
            ],
            "description": "The newest published paywall for this offering (else the app's default paywall) at or below `paywall_schema`. Null when there's none; the SDK then uses its bundled default."
          }
        },
        "required": [
          "offering",
          "paywall"
        ],
        "additionalProperties": false
      }
    }
  },
  "paths": {
    "/v1/customers/me": {
      "get": {
        "summary": "The calling customer's entitlements, credit balances and subscriptions",
        "tags": [
          "public"
        ],
        "description": "Authenticate with a publishable key plus X-Customer-Token (or X-Anonymous-Id). The customer is created on first call.",
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerState"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/{id}": {
      "get": {
        "summary": "A customer by app_user_id (secret key)",
        "tags": [
          "public"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "app_user_id, or `me` with a publishable key"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerState"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Update a customer's email or attributes",
        "tags": [
          "public"
        ],
        "description": "Attributes merge into the existing ones; set a key to null to remove it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 320,
                        "format": "email",
                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "attributes": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 1000
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "app_user_id, or `me` with a publishable key"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerState"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Privacy delete: remove personal data, keep financial records",
        "tags": [
          "public"
        ],
        "description": "Email, attributes and every app_user_id for this customer are removed. Purchases, revenue and credit history stay, without personal data, because tenants need them for accounting.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "app_user_id, or `me` with a publishable key"
          }
        ],
        "responses": {
          "204": {
            "description": "Default Response"
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/{id}/entitlements": {
      "get": {
        "summary": "A customer's entitlements (the hot path)",
        "tags": [
          "public"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "app_user_id, or `me` with a publishable key"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entitlements": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "$ref": "#/components/schemas/EntitlementState"
                      }
                    }
                  },
                  "required": [
                    "entitlements"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/{id}/alias": {
      "post": {
        "summary": "Make another app_user_id resolve to this customer (identify, or merge)",
        "tags": [
          "public"
        ],
        "description": "With a publishable key, `alias` must be the SDK's anonymous id ($tenth_anon_…): it's merged into the signed-in customer. The app's merge policy decides what happens when the id already belongs to another customer.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "alias": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "merge_policy": {
                    "type": "string",
                    "enum": [
                      "transfer_purchases",
                      "keep_existing",
                      "reject"
                    ]
                  }
                },
                "required": [
                  "alias"
                ]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "app_user_id, or `me` with a publishable key"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "added",
                        "already_aliased",
                        "merged",
                        "kept_existing"
                      ]
                    },
                    "customer": {
                      "$ref": "#/components/schemas/CustomerState"
                    }
                  },
                  "required": [
                    "outcome",
                    "customer"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/{id}/export": {
      "get": {
        "summary": "Everything Tenth holds about one customer, as JSON, for an access request",
        "tags": [
          "public"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "app_user_id, or `me` with a publishable key"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/{id}/credits": {
      "get": {
        "summary": "Credit balances and recent transactions",
        "tags": [
          "public"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9_]{1,64}$"
            },
            "in": "query",
            "name": "credit_type",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "query",
            "name": "before",
            "required": false
          },
          {
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "balances": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "$ref": "#/components/schemas/CreditBalance"
                      }
                    },
                    "transactions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CreditTransaction"
                      }
                    }
                  },
                  "required": [
                    "balances",
                    "transactions"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/{id}/credits/{type}/debit": {
      "post": {
        "summary": "Spend credits",
        "tags": [
          "public"
        ],
        "description": "Secret key by default. A publishable key works only when the credit type allows app-side debits, and only for the signed-in customer. Anyone who modifies an app can skip an app-side debit, so use server-side debits when payment matters.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "idempotency_key": {
                    "type": "string",
                    "pattern": "^[\\x21-\\x7e]{1,200}$",
                    "description": "Same key → same result, never a second debit."
                  },
                  "metadata": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 500
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "amount",
                  "idempotency_key"
                ]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9_]{1,64}$"
            },
            "in": "path",
            "name": "type",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "credit_type": {
                      "type": "string"
                    },
                    "amount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "available": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "replayed": {
                      "type": "boolean",
                      "description": "True when this idempotency_key was used before; nothing new was debited."
                    },
                    "transactions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CreditTransaction"
                      }
                    }
                  },
                  "required": [
                    "credit_type",
                    "amount",
                    "balance",
                    "available",
                    "replayed",
                    "transactions"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/{id}/credits/{type}/reserve": {
      "post": {
        "summary": "Hold credits for long-running work; commit or release the hold later",
        "tags": [
          "public"
        ],
        "description": "Held credits can't be spent by other debits. A hold that isn't committed or released expires after ttl_seconds (default 900).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "idempotency_key": {
                    "type": "string",
                    "pattern": "^[\\x21-\\x7e]{1,200}$",
                    "description": "Same key → same result, never a second debit."
                  },
                  "ttl_seconds": {
                    "default": 900,
                    "type": "integer",
                    "minimum": 10,
                    "maximum": 86400
                  }
                },
                "required": [
                  "amount",
                  "idempotency_key"
                ]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9_]{1,64}$"
            },
            "in": "path",
            "name": "type",
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditHold"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/{id}/credits/{type}/holds/{holdId}/commit": {
      "post": {
        "summary": "Spend held credits. Commit less than the hold to release the rest.",
        "tags": [
          "public"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "default": {},
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9_]{1,64}$"
            },
            "in": "path",
            "name": "type",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "holdId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "credit_type": {
                      "type": "string"
                    },
                    "amount": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "balance": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "available": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "replayed": {
                      "type": "boolean",
                      "description": "True when this idempotency_key was used before; nothing new was debited."
                    },
                    "transactions": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CreditTransaction"
                      }
                    }
                  },
                  "required": [
                    "credit_type",
                    "amount",
                    "balance",
                    "available",
                    "replayed",
                    "transactions"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/{id}/credits/{type}/holds/{holdId}/release": {
      "post": {
        "summary": "Release a hold without spending",
        "tags": [
          "public"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "in": "path",
            "name": "id",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9_]{1,64}$"
            },
            "in": "path",
            "name": "type",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "holdId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditHold"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/{id}/grants": {
      "post": {
        "summary": "Give an entitlement or credits without payment",
        "tags": [
          "public"
        ],
        "description": "Creates the customer if this app_user_id is new. Grants never create revenue.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entitlement": {
                    "type": "string",
                    "pattern": "^[a-z0-9_]{1,64}$"
                  },
                  "credit_type": {
                    "type": "string",
                    "pattern": "^[a-z0-9_]{1,64}$"
                  },
                  "amount": {
                    "description": "Credits to grant (credit grants only).",
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "starts_at": {
                    "description": "Entitlement grants can start later. Credits are granted now.",
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  "expires_at": {
                    "description": "Leave out for no expiry.",
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "reason"
                ]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Grant"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/grants/{grantId}": {
      "delete": {
        "summary": "Revoke a grant. Unspent granted credits are removed.",
        "tags": [
          "public"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "grantId",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Grant"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/offerings/current": {
      "get": {
        "summary": "The offering this user should see, for their platform",
        "tags": [
          "public"
        ],
        "description": "Targeted offerings whose rules all match win by priority; otherwise the default offering. `offering` is null when the app has none.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "ios",
                "android",
                "web"
              ]
            },
            "in": "query",
            "name": "platform",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{2}$"
            },
            "in": "query",
            "name": "country",
            "required": false,
            "description": "Store storefront country, ISO 3166-1 alpha-2."
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^\\d+(\\.\\d+){0,3}$"
            },
            "in": "query",
            "name": "app_version",
            "required": false
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            },
            "in": "query",
            "name": "paywall_schema",
            "required": false,
            "description": "The highest paywall config schema version the SDK renders. Without it, `paywall` is null."
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CurrentOffering"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/offerings/{key}": {
      "get": {
        "summary": "An offering by key, for a platform",
        "tags": [
          "public"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "ios",
                "android",
                "web"
              ]
            },
            "in": "query",
            "name": "platform",
            "required": true
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            },
            "in": "query",
            "name": "paywall_schema",
            "required": false,
            "description": "The highest paywall config schema version the SDK renders. Without it, `paywall` is null."
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "in": "path",
            "name": "key",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CurrentOffering"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events": {
      "get": {
        "summary": "Events for this app and environment, oldest first",
        "tags": [
          "public"
        ],
        "description": "The same events webhooks deliver, for apps that prefer to poll. Pass the last id you processed as `after`.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "query",
            "name": "after",
            "required": false
          },
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 64
            },
            "in": "query",
            "name": "type",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "in": "query",
            "name": "customer",
            "required": false,
            "description": "Only events for this app_user_id."
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Event"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/revenue/transactions": {
      "get": {
        "summary": "Revenue rows for this app and environment (the data behind the transactions export)",
        "tags": [
          "public"
        ],
        "description": "One row per money movement. Store fees are estimates from your commission settings; Stripe fees are actual.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "query",
            "name": "after",
            "required": false
          },
          {
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            },
            "in": "query",
            "name": "from",
            "required": false,
            "description": "occurred_at at or after"
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            },
            "in": "query",
            "name": "to",
            "required": false,
            "description": "occurred_at before"
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RevenueTransaction"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/checkout-sessions": {
      "post": {
        "summary": "Start a hosted Stripe Checkout for a product",
        "tags": [
          "purchases"
        ],
        "description": "Send `success_url` and `cancel_url` (web), or `return: \"app\"` (native link-out): Checkout then returns through Tenth to the app's `return_url_scheme` as `<scheme>://tenth/checkout-return?status=success|cancel`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "app_user_id": {
                    "default": "me",
                    "description": "`me` with a publishable key and customer token; any app_user_id with a secret key.",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "product": {
                    "type": "string",
                    "pattern": "^[a-z0-9_]{1,64}$"
                  },
                  "success_url": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "cancel_url": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "return": {
                    "description": "Return to the app through its return_url_scheme, instead of URLs.",
                    "type": "string",
                    "enum": [
                      "app"
                    ]
                  }
                },
                "required": [
                  "product"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "url"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/payment-intents": {
      "post": {
        "summary": "Start an embedded Stripe payment for a product",
        "tags": [
          "purchases"
        ],
        "description": "`elements` (default, web): the Payment Element over a Checkout Session; tax, trials and billing anchors all apply. `payment_sheet` (native, where store rules allow): a PaymentIntent, or an unpaid subscription; Stripe Tax is not available on it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "app_user_id": {
                    "default": "me",
                    "description": "`me` with a publishable key and customer token; any app_user_id with a secret key.",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "product": {
                    "type": "string",
                    "pattern": "^[a-z0-9_]{1,64}$"
                  },
                  "form": {
                    "default": "elements",
                    "type": "string",
                    "enum": [
                      "elements",
                      "payment_sheet"
                    ]
                  },
                  "return_url": {
                    "description": "Where redirect-based payment methods return (elements).",
                    "type": "string",
                    "maxLength": 2048
                  }
                },
                "required": [
                  "product"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "form": {
                      "type": "string",
                      "enum": [
                        "elements",
                        "payment_sheet"
                      ]
                    },
                    "client_secret": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "publishable_key": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "stripe_account": {
                      "description": "Pass to Stripe.js for Connect accounts.",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "form",
                    "client_secret",
                    "publishable_key",
                    "stripe_account"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customers/me/management-url": {
      "get": {
        "summary": "Where the signed-in customer manages a subscription",
        "tags": [
          "customers"
        ],
        "description": "The App Store settings page, the Google Play subscription page, or a Stripe customer portal session.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "query",
            "name": "subscription_id",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 2048
            },
            "in": "query",
            "name": "return_url",
            "required": false,
            "description": "Stripe portal only: where its back link goes."
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/subscriptions/{id}/change": {
      "post": {
        "summary": "Move a Stripe subscription to another product (upgrade, downgrade)",
        "tags": [
          "subscriptions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "product": {
                    "type": "string",
                    "pattern": "^[a-z0-9_]{1,64}$"
                  },
                  "timing": {
                    "description": "Defaults to the new product's setting.",
                    "type": "string",
                    "enum": [
                      "immediately",
                      "period_end"
                    ]
                  },
                  "proration": {
                    "type": "string",
                    "enum": [
                      "create_prorations",
                      "none",
                      "always_invoice"
                    ]
                  }
                },
                "required": [
                  "product"
                ]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerState"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/subscriptions/{id}/cancel": {
      "post": {
        "summary": "Cancel a Stripe subscription, at period end (default) or now",
        "tags": [
          "subscriptions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "default": {
                  "at_period_end": true
                },
                "type": "object",
                "properties": {
                  "at_period_end": {
                    "default": true,
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerState"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/subscriptions/{id}/resume": {
      "post": {
        "summary": "Undo a scheduled cancellation, or resume a paused Stripe subscription",
        "tags": [
          "subscriptions"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerState"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/subscriptions/{id}/anchor": {
      "post": {
        "summary": "Move a Stripe subscription to a fixed billing day",
        "tags": [
          "subscriptions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "day": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 31
                  },
                  "month": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "timezone": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "first_period": {
                    "type": "string",
                    "enum": [
                      "prorate",
                      "free_until_anchor",
                      "full_then_anchor"
                    ]
                  },
                  "minimum_first_period_days": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 31
                  }
                },
                "required": [
                  "day",
                  "first_period"
                ]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerState"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/purchases/{id}/refund": {
      "post": {
        "summary": "Refund a Stripe one-time purchase, fully or in part",
        "tags": [
          "subscriptions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "default": {},
                "type": "object",
                "properties": {
                  "amount": {
                    "description": "Minor units; leave out for the full amount.",
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerState"
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/paywall-assets/{id}": {
      "get": {
        "summary": "A paywall image (no authentication)",
        "tags": [
          "public"
        ],
        "description": "The image bytes with their stored content type. Offerings return these URLs in `paywall.assets`.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response"
          }
        }
      }
    },
    "/v1/apple/offer-signatures": {
      "post": {
        "summary": "Sign an App Store promotional offer for the signed-in customer",
        "tags": [
          "public"
        ],
        "description": "Only offers configured on the app's product in Tenth can be signed (apple_promotional_offer_ids). Pass the result to StoreKit's promotional offer purchase option, with the customer's app_account_token.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "product_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255,
                    "description": "The App Store product id"
                  },
                  "offer_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "product_id",
                  "offer_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "key_identifier": {
                      "type": "string"
                    },
                    "nonce": {
                      "type": "string"
                    },
                    "timestamp": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "signature": {
                      "type": "string"
                    },
                    "app_account_token": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "key_identifier",
                    "nonce",
                    "timestamp",
                    "signature",
                    "app_account_token"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/receipts": {
      "post": {
        "summary": "Submit an App Store or Google Play purchase for verification",
        "tags": [
          "public"
        ],
        "description": "iOS: send StoreKit 2's signed transaction after a purchase, and finish the transaction only once this succeeds. Android: send Play Billing's purchase token, product id and type; Tenth acknowledges or consumes the purchase itself once it's recorded, so the app must not. With a secret key, name the customer in app_user_id. A purchase whose appAccountToken or obfuscatedAccountId belongs to another customer is refused; use restore for that.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "platform": {
                        "type": "string",
                        "enum": [
                          "ios"
                        ]
                      },
                      "signed_transaction": {
                        "type": "string",
                        "maxLength": 32768,
                        "pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$"
                      },
                      "app_user_id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      }
                    },
                    "required": [
                      "platform",
                      "signed_transaction"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "purchase_token": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9._-]{8,2048}$"
                      },
                      "product_id": {
                        "type": "string",
                        "pattern": "^[a-z0-9][a-z0-9._]{0,149}$",
                        "description": "The Play product id (for subscriptions, the subscription id)."
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "subscription",
                          "one_time"
                        ]
                      },
                      "platform": {
                        "type": "string",
                        "enum": [
                          "android"
                        ]
                      },
                      "app_user_id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      }
                    },
                    "required": [
                      "purchase_token",
                      "product_id",
                      "type",
                      "platform"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "provisional": {
                      "type": "boolean",
                      "description": "Granted from the verified transaction while Apple was unreachable."
                    },
                    "customer": {
                      "$ref": "#/components/schemas/CustomerState"
                    }
                  },
                  "required": [
                    "provisional",
                    "customer"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/receipts/restore": {
      "post": {
        "summary": "Restore App Store or Google Play purchases",
        "tags": [
          "public"
        ],
        "description": "iOS: send StoreKit 2's Transaction.currentEntitlements. Android: send what queryPurchasesAsync returned. A purchase that belongs to another customer of this app follows the app's restore transfer policy. Restores never create revenue.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "platform": {
                        "type": "string",
                        "enum": [
                          "ios"
                        ]
                      },
                      "signed_transactions": {
                        "maxItems": 100,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 32768,
                          "pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$"
                        }
                      }
                    },
                    "required": [
                      "platform",
                      "signed_transactions"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "platform": {
                        "type": "string",
                        "enum": [
                          "android"
                        ]
                      },
                      "purchases": {
                        "maxItems": 100,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "purchase_token": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9._-]{8,2048}$"
                            },
                            "product_id": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9._]{0,149}$",
                              "description": "The Play product id (for subscriptions, the subscription id)."
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "subscription",
                                "one_time"
                              ]
                            }
                          },
                          "required": [
                            "purchase_token",
                            "product_id",
                            "type"
                          ]
                        }
                      }
                    },
                    "required": [
                      "platform",
                      "purchases"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "transaction_id": {
                            "description": "The App Store transaction id, or the Play purchase token.",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "outcome": {
                            "type": "string",
                            "enum": [
                              "owned",
                              "transferred",
                              "shared",
                              "kept_with_original",
                              "invalid"
                            ]
                          }
                        },
                        "required": [
                          "transaction_id",
                          "outcome"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "customer": {
                      "$ref": "#/components/schemas/CustomerState"
                    }
                  },
                  "required": [
                    "results",
                    "customer"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://api.tenthbilling.com"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ]
}
