{"openapi":"3.1.0","info":{"title":"Credit API","version":"1.0.0","description":"Application-scoped credits, features, plans, subscriptions, checkout, wallets, deposits, and usage. Nanocredit amounts are decimal strings; 1 credit = 1,000,000,000 nanocredits. Stripe amounts use the currency's smallest unit."},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"Credit secret API key"}},"schemas":{},"parameters":{}},"paths":{"/v1/credits":{"post":{"operationId":"createCredit","tags":["Credits"],"summary":"Create credit","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"unit":{"type":"string","minLength":1,"maxLength":40}},"required":["key","name","unit"],"additionalProperties":false}}}},"responses":{"201":{"description":"Credit created","content":{"application/json":{"schema":{"type":"object","properties":{"revision":{"type":"integer","exclusiveMinimum":0},"id":{"type":"string"},"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"unit":{"type":"string","minLength":1,"maxLength":40},"createdAt":{"type":"number"}},"required":["revision","id","key","name","unit","createdAt"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}},"get":{"operationId":"listCredits","tags":["Credits"],"summary":"List credits","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":4096},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Credit page","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"revision":{"type":"integer","exclusiveMinimum":0},"id":{"type":"string"},"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"unit":{"type":"string","minLength":1,"maxLength":40},"createdAt":{"type":"number"}},"required":["revision","id","key","name","unit","createdAt"],"additionalProperties":false}},"cursor":{"type":["string","null"]}},"required":["data","cursor"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/credits/{key}":{"get":{"operationId":"getCredit","tags":["Credits"],"summary":"Get credit","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"required":true,"name":"key","in":"path"}],"responses":{"200":{"description":"Credit","content":{"application/json":{"schema":{"type":"object","properties":{"revision":{"type":"integer","exclusiveMinimum":0},"id":{"type":"string"},"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"unit":{"type":"string","minLength":1,"maxLength":40},"createdAt":{"type":"number"}},"required":["revision","id","key","name","unit","createdAt"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}},"patch":{"operationId":"updateCredit","tags":["Credits"],"summary":"Update credit","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"required":true,"name":"key","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expectedRevision":{"type":"integer","exclusiveMinimum":0},"name":{"type":"string","minLength":1,"maxLength":120},"unit":{"type":"string","minLength":1,"maxLength":40}},"additionalProperties":false,"minProperties":1}}}},"responses":{"200":{"description":"Credit updated","content":{"application/json":{"schema":{"type":"object","properties":{"revision":{"type":"integer","exclusiveMinimum":0},"id":{"type":"string"},"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"unit":{"type":"string","minLength":1,"maxLength":40},"createdAt":{"type":"number"}},"required":["revision","id","key","name","unit","createdAt"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/features":{"post":{"operationId":"createFeature","tags":["Features"],"summary":"Create feature","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"unit":{"type":"string","minLength":1,"maxLength":40},"creditKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"costNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"quantityPerUnit":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991,"default":1},"pricingMode":{"type":"string","enum":["fixed","callback"],"default":"fixed"},"deduplicationPeriod":{"type":"string","enum":["none","day","week","month","billing"],"default":"none"}},"required":["key","name","unit","creditKey","costNanocredits"],"additionalProperties":false}}}},"responses":{"201":{"description":"Feature created","content":{"application/json":{"schema":{"type":"object","properties":{"revision":{"type":"integer","exclusiveMinimum":0},"planPricingLocked":{"type":"boolean"},"id":{"type":"string"},"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"unit":{"type":"string","minLength":1,"maxLength":40},"creditKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"costNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"quantityPerUnit":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"pricingMode":{"type":"string","enum":["fixed","callback"]},"deduplicationPeriod":{"type":"string","enum":["none","day","week","month","billing"]},"deduplicationLocked":{"type":"boolean"},"createdAt":{"type":"number"}},"required":["revision","planPricingLocked","id","key","name","unit","creditKey","costNanocredits","quantityPerUnit","pricingMode","deduplicationPeriod","deduplicationLocked","createdAt"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}},"get":{"operationId":"listFeatures","tags":["Features"],"summary":"List features","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":4096},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Feature page","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"revision":{"type":"integer","exclusiveMinimum":0},"planPricingLocked":{"type":"boolean"},"id":{"type":"string"},"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"unit":{"type":"string","minLength":1,"maxLength":40},"creditKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"costNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"quantityPerUnit":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"pricingMode":{"type":"string","enum":["fixed","callback"]},"deduplicationPeriod":{"type":"string","enum":["none","day","week","month","billing"]},"deduplicationLocked":{"type":"boolean"},"createdAt":{"type":"number"}},"required":["revision","planPricingLocked","id","key","name","unit","creditKey","costNanocredits","quantityPerUnit","pricingMode","deduplicationPeriod","deduplicationLocked","createdAt"],"additionalProperties":false}},"cursor":{"type":["string","null"]}},"required":["data","cursor"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/features/{key}":{"get":{"operationId":"getFeature","tags":["Features"],"summary":"Get feature","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"required":true,"name":"key","in":"path"}],"responses":{"200":{"description":"Feature","content":{"application/json":{"schema":{"type":"object","properties":{"revision":{"type":"integer","exclusiveMinimum":0},"planPricingLocked":{"type":"boolean"},"id":{"type":"string"},"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"unit":{"type":"string","minLength":1,"maxLength":40},"creditKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"costNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"quantityPerUnit":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"pricingMode":{"type":"string","enum":["fixed","callback"]},"deduplicationPeriod":{"type":"string","enum":["none","day","week","month","billing"]},"deduplicationLocked":{"type":"boolean"},"createdAt":{"type":"number"}},"required":["revision","planPricingLocked","id","key","name","unit","creditKey","costNanocredits","quantityPerUnit","pricingMode","deduplicationPeriod","deduplicationLocked","createdAt"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}},"patch":{"operationId":"updateFeature","tags":["Features"],"summary":"Update feature","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"required":true,"name":"key","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expectedRevision":{"type":"integer","exclusiveMinimum":0},"name":{"type":"string","minLength":1,"maxLength":120},"unit":{"type":"string","minLength":1,"maxLength":40},"creditKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"costNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"quantityPerUnit":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"pricingMode":{"type":"string","enum":["fixed","callback"]},"deduplicationPeriod":{"type":"string","enum":["none","day","week","month","billing"]}},"additionalProperties":false,"minProperties":1}}}},"responses":{"200":{"description":"Feature updated","content":{"application/json":{"schema":{"type":"object","properties":{"revision":{"type":"integer","exclusiveMinimum":0},"planPricingLocked":{"type":"boolean"},"id":{"type":"string"},"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"unit":{"type":"string","minLength":1,"maxLength":40},"creditKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"costNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"quantityPerUnit":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"pricingMode":{"type":"string","enum":["fixed","callback"]},"deduplicationPeriod":{"type":"string","enum":["none","day","week","month","billing"]},"deduplicationLocked":{"type":"boolean"},"createdAt":{"type":"number"}},"required":["revision","planPricingLocked","id","key","name","unit","creditKey","costNanocredits","quantityPerUnit","pricingMode","deduplicationPeriod","deduplicationLocked","createdAt"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/plans":{"post":{"operationId":"createPlan","tags":["Plans"],"summary":"Create plan","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"amountCents":{"type":"integer","minimum":0,"maximum":99999999},"currency":{"type":"string","pattern":"^[a-z]{3}$"},"interval":{"type":"string","enum":["month","year"]},"featureLimits":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"limit":{"type":"integer","minimum":0,"maximum":9007199254740991},"period":{"type":"string","enum":["month","billing"],"default":"month"},"overage":{"type":"string","enum":["block","credits"],"default":"block"}},"required":["featureKey","limit"],"additionalProperties":false},"maxItems":100},"creditGrants":{"type":"array","items":{"type":"object","properties":{"creditKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"}},"required":["creditKey","amountNanocredits"],"additionalProperties":false},"maxItems":100,"default":[]},"featureMultipliers":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"basisPoints":{"type":"integer","minimum":0,"maximum":1000000}},"required":["featureKey","basisPoints"],"additionalProperties":false},"maxItems":100,"default":[]},"topupsEnabled":{"type":"boolean","default":true},"active":{"type":"boolean","default":true}},"required":["key","name","amountCents","currency","interval","featureLimits"],"additionalProperties":false}}}},"responses":{"201":{"description":"Plan created; Stripe synchronization is queued","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"amountCents":{"type":"integer","minimum":0,"maximum":99999999},"currency":{"type":"string","pattern":"^[a-z]{3}$"},"interval":{"type":"string","enum":["month","year"]},"featureLimits":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"limit":{"type":"integer","minimum":0,"maximum":9007199254740991},"period":{"type":"string","enum":["month","billing"],"default":"month"},"overage":{"type":"string","enum":["block","credits"],"default":"block"}},"required":["featureKey","limit"],"additionalProperties":false},"maxItems":100},"creditGrants":{"type":"array","items":{"type":"object","properties":{"creditKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"}},"required":["creditKey","amountNanocredits"],"additionalProperties":false},"maxItems":100,"default":[]},"featureMultipliers":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"basisPoints":{"type":"integer","minimum":0,"maximum":1000000}},"required":["featureKey","basisPoints"],"additionalProperties":false},"maxItems":100,"default":[]},"topupsEnabled":{"type":"boolean","default":true},"active":{"type":"boolean","default":true},"id":{"type":"string"},"revision":{"type":"number"},"createdAt":{"type":"number"},"stripeProductId":{"type":"string"},"stripePriceId":{"type":"string"},"syncStatus":{"type":"string","enum":["pending","synced","error"]},"syncError":{"type":"string"}},"required":["key","name","amountCents","currency","interval","featureLimits","id","revision","createdAt","syncStatus"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}},"get":{"operationId":"listPlans","tags":["Plans"],"summary":"List plans","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":4096},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Plan page","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"amountCents":{"type":"integer","minimum":0,"maximum":99999999},"currency":{"type":"string","pattern":"^[a-z]{3}$"},"interval":{"type":"string","enum":["month","year"]},"featureLimits":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"limit":{"type":"integer","minimum":0,"maximum":9007199254740991},"period":{"type":"string","enum":["month","billing"],"default":"month"},"overage":{"type":"string","enum":["block","credits"],"default":"block"}},"required":["featureKey","limit"],"additionalProperties":false},"maxItems":100},"creditGrants":{"type":"array","items":{"type":"object","properties":{"creditKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"}},"required":["creditKey","amountNanocredits"],"additionalProperties":false},"maxItems":100,"default":[]},"featureMultipliers":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"basisPoints":{"type":"integer","minimum":0,"maximum":1000000}},"required":["featureKey","basisPoints"],"additionalProperties":false},"maxItems":100,"default":[]},"topupsEnabled":{"type":"boolean","default":true},"active":{"type":"boolean","default":true},"id":{"type":"string"},"revision":{"type":"number"},"createdAt":{"type":"number"},"stripeProductId":{"type":"string"},"stripePriceId":{"type":"string"},"syncStatus":{"type":"string","enum":["pending","synced","error"]},"syncError":{"type":"string"}},"required":["key","name","amountCents","currency","interval","featureLimits","id","revision","createdAt","syncStatus"],"additionalProperties":false}},"cursor":{"type":["string","null"]}},"required":["data","cursor"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/plans/{key}":{"get":{"operationId":"getPlan","tags":["Plans"],"summary":"Get plan","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"required":true,"name":"key","in":"path"}],"responses":{"200":{"description":"Plan","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"amountCents":{"type":"integer","minimum":0,"maximum":99999999},"currency":{"type":"string","pattern":"^[a-z]{3}$"},"interval":{"type":"string","enum":["month","year"]},"featureLimits":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"limit":{"type":"integer","minimum":0,"maximum":9007199254740991},"period":{"type":"string","enum":["month","billing"],"default":"month"},"overage":{"type":"string","enum":["block","credits"],"default":"block"}},"required":["featureKey","limit"],"additionalProperties":false},"maxItems":100},"creditGrants":{"type":"array","items":{"type":"object","properties":{"creditKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"}},"required":["creditKey","amountNanocredits"],"additionalProperties":false},"maxItems":100,"default":[]},"featureMultipliers":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"basisPoints":{"type":"integer","minimum":0,"maximum":1000000}},"required":["featureKey","basisPoints"],"additionalProperties":false},"maxItems":100,"default":[]},"topupsEnabled":{"type":"boolean","default":true},"active":{"type":"boolean","default":true},"id":{"type":"string"},"revision":{"type":"number"},"createdAt":{"type":"number"},"stripeProductId":{"type":"string"},"stripePriceId":{"type":"string"},"syncStatus":{"type":"string","enum":["pending","synced","error"]},"syncError":{"type":"string"}},"required":["key","name","amountCents","currency","interval","featureLimits","id","revision","createdAt","syncStatus"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}},"patch":{"operationId":"updatePlan","tags":["Plans"],"summary":"Update plan","description":"Updates the plan for new subscriptions. Existing subscriptions keep their current terms.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"required":true,"name":"key","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"amountCents":{"type":"integer","minimum":0,"maximum":99999999},"currency":{"type":"string","pattern":"^[a-z]{3}$"},"interval":{"type":"string","enum":["month","year"]},"featureLimits":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"limit":{"type":"integer","minimum":0,"maximum":9007199254740991},"period":{"type":"string","enum":["month","billing"],"default":"month"},"overage":{"type":"string","enum":["block","credits"],"default":"block"}},"required":["featureKey","limit"],"additionalProperties":false},"maxItems":100},"creditGrants":{"type":"array","items":{"type":"object","properties":{"creditKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"}},"required":["creditKey","amountNanocredits"],"additionalProperties":false},"maxItems":100},"featureMultipliers":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"basisPoints":{"type":"integer","minimum":0,"maximum":1000000}},"required":["featureKey","basisPoints"],"additionalProperties":false},"maxItems":100},"topupsEnabled":{"type":"boolean"},"active":{"type":"boolean"},"expectedRevision":{"type":"integer","exclusiveMinimum":0}},"additionalProperties":false}}}},"responses":{"200":{"description":"Plan updated; existing subscriptions keep their terms","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"amountCents":{"type":"integer","minimum":0,"maximum":99999999},"currency":{"type":"string","pattern":"^[a-z]{3}$"},"interval":{"type":"string","enum":["month","year"]},"featureLimits":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"limit":{"type":"integer","minimum":0,"maximum":9007199254740991},"period":{"type":"string","enum":["month","billing"],"default":"month"},"overage":{"type":"string","enum":["block","credits"],"default":"block"}},"required":["featureKey","limit"],"additionalProperties":false},"maxItems":100},"creditGrants":{"type":"array","items":{"type":"object","properties":{"creditKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"}},"required":["creditKey","amountNanocredits"],"additionalProperties":false},"maxItems":100,"default":[]},"featureMultipliers":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"basisPoints":{"type":"integer","minimum":0,"maximum":1000000}},"required":["featureKey","basisPoints"],"additionalProperties":false},"maxItems":100,"default":[]},"topupsEnabled":{"type":"boolean","default":true},"active":{"type":"boolean","default":true},"id":{"type":"string"},"revision":{"type":"number"},"createdAt":{"type":"number"},"stripeProductId":{"type":"string"},"stripePriceId":{"type":"string"},"syncStatus":{"type":"string","enum":["pending","synced","error"]},"syncError":{"type":"string"}},"required":["key","name","amountCents","currency","interval","featureLimits","id","revision","createdAt","syncStatus"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/checkout":{"post":{"operationId":"createSubscriptionCheckout","summary":"Subscription checkout","tags":["Subscriptions"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"identity":{"type":"string","minLength":1,"maxLength":200},"planKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"successUrl":{"type":"string","maxLength":2048,"format":"uri"},"cancelUrl":{"type":"string","maxLength":2048,"format":"uri"},"idempotencyKey":{"type":"string","minLength":1,"maxLength":200}},"required":["identity","planKey","successUrl","cancelUrl","idempotencyKey"],"additionalProperties":false}}}},"responses":{"200":{"description":"Hosted checkout","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"}},"required":["id","url"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/topup-checkout":{"post":{"operationId":"createTopupCheckout","summary":"Top-up checkout","tags":["Subscriptions"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"identity":{"type":"string","minLength":1,"maxLength":200},"creditKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"amountCents":{"type":"integer","minimum":1,"maximum":99999999},"currency":{"type":"string","pattern":"^[a-z]{3}$"},"successUrl":{"type":"string","maxLength":2048,"format":"uri"},"cancelUrl":{"type":"string","maxLength":2048,"format":"uri"},"idempotencyKey":{"type":"string","minLength":1,"maxLength":200}},"required":["identity","creditKey","amountNanocredits","amountCents","currency","successUrl","cancelUrl","idempotencyKey"],"additionalProperties":false}}}},"responses":{"200":{"description":"Hosted checkout; balance changes only after confirmed payment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"}},"required":["id","url"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/billing-portal":{"post":{"operationId":"createBillingPortal","summary":"Billing settings or upgrade confirmation","tags":["Subscriptions"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"identity":{"type":"string","minLength":1,"maxLength":200},"returnUrl":{"type":"string","maxLength":2048,"format":"uri"},"planKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"successUrl":{"type":"string","maxLength":2048,"format":"uri"}},"required":["identity","returnUrl"],"additionalProperties":false}}}},"responses":{"200":{"description":"Hosted billing settings or immediate upgrade confirmation","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/subscriptions/{identity}":{"get":{"operationId":"getSubscription","summary":"Get subscription","tags":["Subscriptions"],"security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"identity","in":"path"}],"responses":{"200":{"description":"Subscription, or null when none exists","content":{"application/json":{"schema":{"type":["object","null"],"properties":{"id":{"type":"string"},"identity":{"type":"string","minLength":1,"maxLength":200},"planKey":{"type":"string"},"status":{"type":"string"},"periodStart":{"type":"number"},"periodEnd":{"type":"number"},"cancelAtPeriodEnd":{"type":"boolean"},"scheduledChange":{"type":"object","properties":{"planKey":{"type":"string"},"effectiveAt":{"type":"number"}},"required":["planKey","effectiveAt"],"additionalProperties":false},"paymentHold":{"type":"boolean"},"creditGrants":{"type":"array","items":{"type":"object","properties":{"creditKey":{"type":"string"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"}},"required":["creditKey","amountNanocredits"],"additionalProperties":false},"default":[]},"topupsEnabled":{"type":"boolean","default":true},"featureMultipliers":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string"},"basisPoints":{"type":"number"}},"required":["featureKey","basisPoints"],"additionalProperties":false},"default":[]},"pendingChange":{"type":"object","properties":{"planKey":{"type":"string"},"expiresAt":{"type":"number"},"paymentUrl":{"type":"string"}},"required":["planKey","expiresAt"],"additionalProperties":false},"featureLimits":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string"},"limit":{"type":"number"},"period":{"type":"string","enum":["month","billing"]},"overage":{"type":"string","enum":["block","credits"]}},"required":["featureKey","limit","period","overage"],"additionalProperties":false}}},"required":["id","identity","planKey","status","periodStart","periodEnd","cancelAtPeriodEnd","featureLimits"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/subscriptions/{identity}/change":{"post":{"operationId":"changeSubscription","summary":"Change plan","tags":["Subscriptions"],"description":"Upgrades start and charge for a full new billing period immediately, granting credits after confirmed payment. If payment requires action, the old plan remains until payment completes. Downgrades retain the current plan until renewal and return scheduledChange with the target plan and effectiveAt timestamp.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"identity","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"planKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"idempotencyKey":{"type":"string","minLength":1,"maxLength":200}},"required":["planKey","idempotencyKey"],"additionalProperties":false}}}},"responses":{"200":{"description":"Current subscription","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"identity":{"type":"string","minLength":1,"maxLength":200},"planKey":{"type":"string"},"status":{"type":"string"},"periodStart":{"type":"number"},"periodEnd":{"type":"number"},"cancelAtPeriodEnd":{"type":"boolean"},"scheduledChange":{"type":"object","properties":{"planKey":{"type":"string"},"effectiveAt":{"type":"number"}},"required":["planKey","effectiveAt"],"additionalProperties":false},"paymentHold":{"type":"boolean"},"creditGrants":{"type":"array","items":{"type":"object","properties":{"creditKey":{"type":"string"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"}},"required":["creditKey","amountNanocredits"],"additionalProperties":false},"default":[]},"topupsEnabled":{"type":"boolean","default":true},"featureMultipliers":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string"},"basisPoints":{"type":"number"}},"required":["featureKey","basisPoints"],"additionalProperties":false},"default":[]},"pendingChange":{"type":"object","properties":{"planKey":{"type":"string"},"expiresAt":{"type":"number"},"paymentUrl":{"type":"string"}},"required":["planKey","expiresAt"],"additionalProperties":false},"featureLimits":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string"},"limit":{"type":"number"},"period":{"type":"string","enum":["month","billing"]},"overage":{"type":"string","enum":["block","credits"]}},"required":["featureKey","limit","period","overage"],"additionalProperties":false}}},"required":["id","identity","planKey","status","periodStart","periodEnd","cancelAtPeriodEnd","featureLimits"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/subscriptions/{identity}/cancel":{"post":{"operationId":"cancelSubscription","summary":"Cancel subscription","description":"Schedules cancellation at the end of the billing period, or undoes a scheduled cancellation. Either releases a queued downgrade first; cancelAtPeriodEnd false keeps the current plan renewing.","tags":["Subscriptions"],"security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"identity","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"cancelAtPeriodEnd":{"type":"boolean"},"idempotencyKey":{"type":"string","minLength":1,"maxLength":200}},"required":["cancelAtPeriodEnd","idempotencyKey"],"additionalProperties":false}}}},"responses":{"200":{"description":"Current subscription","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"identity":{"type":"string","minLength":1,"maxLength":200},"planKey":{"type":"string"},"status":{"type":"string"},"periodStart":{"type":"number"},"periodEnd":{"type":"number"},"cancelAtPeriodEnd":{"type":"boolean"},"scheduledChange":{"type":"object","properties":{"planKey":{"type":"string"},"effectiveAt":{"type":"number"}},"required":["planKey","effectiveAt"],"additionalProperties":false},"paymentHold":{"type":"boolean"},"creditGrants":{"type":"array","items":{"type":"object","properties":{"creditKey":{"type":"string"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"}},"required":["creditKey","amountNanocredits"],"additionalProperties":false},"default":[]},"topupsEnabled":{"type":"boolean","default":true},"featureMultipliers":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string"},"basisPoints":{"type":"number"}},"required":["featureKey","basisPoints"],"additionalProperties":false},"default":[]},"pendingChange":{"type":"object","properties":{"planKey":{"type":"string"},"expiresAt":{"type":"number"},"paymentUrl":{"type":"string"}},"required":["planKey","expiresAt"],"additionalProperties":false},"featureLimits":{"type":"array","items":{"type":"object","properties":{"featureKey":{"type":"string"},"limit":{"type":"number"},"period":{"type":"string","enum":["month","billing"]},"overage":{"type":"string","enum":["block","credits"]}},"required":["featureKey","limit","period","overage"],"additionalProperties":false}}},"required":["id","identity","planKey","status","periodStart","periodEnd","cancelAtPeriodEnd","featureLimits"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/wallets":{"post":{"operationId":"createWallet","tags":["Wallets"],"security":[{"bearerAuth":[]}],"summary":"Create wallet","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"identity":{"type":"string","minLength":1,"maxLength":200,"pattern":"^(?!\\.{1,2}$)"},"billingPeriod":{"type":"object","properties":{"interval":{"type":"string","enum":["day","week","month"]},"anchor":{"type":"integer","minimum":0,"maximum":253402300799999}},"required":["interval","anchor"],"additionalProperties":false}},"required":["identity"],"additionalProperties":false}}}},"responses":{"201":{"description":"Wallet created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"identity":{"type":"string"},"billingPeriod":{"type":["object","null"],"properties":{"interval":{"type":"string","enum":["day","week","month"]},"anchor":{"type":"integer","minimum":0,"maximum":253402300799999}},"required":["interval","anchor"],"additionalProperties":false},"billingPeriodLocked":{"type":"boolean"},"createdAt":{"type":"number"},"balances":{"type":"array","items":{"type":"object","properties":{"creditKey":{"type":"string"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"debtNanocredits":{"type":"string","pattern":"^(0|[1-9]\\d*)$"}},"required":["creditKey","amountNanocredits"],"additionalProperties":false},"maxItems":100,"description":"Stored balances. A credit absent from this list has a zero balance."}},"required":["id","identity","billingPeriod","billingPeriodLocked","createdAt","balances"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}},"get":{"operationId":"listWallets","tags":["Wallets"],"security":[{"bearerAuth":[]}],"summary":"List wallets","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":4096},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":25,"default":10},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Wallet page","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"identity":{"type":"string"},"billingPeriod":{"type":["object","null"],"properties":{"interval":{"type":"string","enum":["day","week","month"]},"anchor":{"type":"integer","minimum":0,"maximum":253402300799999}},"required":["interval","anchor"],"additionalProperties":false},"billingPeriodLocked":{"type":"boolean"},"createdAt":{"type":"number"},"balances":{"type":"array","items":{"type":"object","properties":{"creditKey":{"type":"string"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"debtNanocredits":{"type":"string","pattern":"^(0|[1-9]\\d*)$"}},"required":["creditKey","amountNanocredits"],"additionalProperties":false},"maxItems":100,"description":"Stored balances. A credit absent from this list has a zero balance."}},"required":["id","identity","billingPeriod","billingPeriodLocked","createdAt","balances"],"additionalProperties":false}},"cursor":{"type":["string","null"]}},"required":["data","cursor"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/wallets/{identity}":{"get":{"operationId":"getWallet","tags":["Wallets"],"security":[{"bearerAuth":[]}],"summary":"Get wallet","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"identity","in":"path"}],"responses":{"200":{"description":"Wallet","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"identity":{"type":"string"},"billingPeriod":{"type":["object","null"],"properties":{"interval":{"type":"string","enum":["day","week","month"]},"anchor":{"type":"integer","minimum":0,"maximum":253402300799999}},"required":["interval","anchor"],"additionalProperties":false},"billingPeriodLocked":{"type":"boolean"},"createdAt":{"type":"number"},"balances":{"type":"array","items":{"type":"object","properties":{"creditKey":{"type":"string"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"debtNanocredits":{"type":"string","pattern":"^(0|[1-9]\\d*)$"}},"required":["creditKey","amountNanocredits"],"additionalProperties":false},"maxItems":100,"description":"Stored balances. A credit absent from this list has a zero balance."}},"required":["id","identity","billingPeriod","billingPeriodLocked","createdAt","balances"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/wallets/{identity}/billing-period":{"patch":{"operationId":"setWalletBillingPeriod","tags":["Wallets"],"security":[{"bearerAuth":[]}],"summary":"Set billing period","description":"Sets the wallet's billing period before its first charge.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"identity","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"billingPeriod":{"type":"object","properties":{"interval":{"type":"string","enum":["day","week","month"]},"anchor":{"type":"integer","minimum":0,"maximum":253402300799999}},"required":["interval","anchor"],"additionalProperties":false}},"required":["billingPeriod"],"additionalProperties":false}}}},"responses":{"200":{"description":"Updated wallet","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"identity":{"type":"string"},"billingPeriod":{"type":["object","null"],"properties":{"interval":{"type":"string","enum":["day","week","month"]},"anchor":{"type":"integer","minimum":0,"maximum":253402300799999}},"required":["interval","anchor"],"additionalProperties":false},"billingPeriodLocked":{"type":"boolean"},"createdAt":{"type":"number"},"balances":{"type":"array","items":{"type":"object","properties":{"creditKey":{"type":"string"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"debtNanocredits":{"type":"string","pattern":"^(0|[1-9]\\d*)$"}},"required":["creditKey","amountNanocredits"],"additionalProperties":false},"maxItems":100,"description":"Stored balances. A credit absent from this list has a zero balance."}},"required":["id","identity","billingPeriod","billingPeriodLocked","createdAt","balances"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/deposits":{"post":{"operationId":"createDeposit","tags":["Deposits"],"security":[{"bearerAuth":[]}],"summary":"Create deposit","description":"The idempotency key is unique within the application. Retrying the same deposit returns the existing record without funding the wallet again.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"identity":{"type":"string","minLength":1,"maxLength":200},"creditKey":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"idempotencyKey":{"type":"string","minLength":1,"maxLength":200}},"required":["identity","creditKey","amountNanocredits","idempotencyKey"],"additionalProperties":false}}}},"responses":{"200":{"description":"Previously accepted deposit","content":{"application/json":{"schema":{"type":"object","properties":{"deposit":{"type":"object","properties":{"id":{"type":"string"},"identity":{"type":"string"},"creditKey":{"type":"string"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"idempotencyKey":{"type":["string","null"]},"createdAt":{"type":"number"}},"required":["id","identity","creditKey","amountNanocredits","idempotencyKey","createdAt"],"additionalProperties":false},"duplicate":{"type":"boolean"}},"required":["deposit","duplicate"],"additionalProperties":false}}}},"201":{"description":"Deposit created","content":{"application/json":{"schema":{"type":"object","properties":{"deposit":{"type":"object","properties":{"id":{"type":"string"},"identity":{"type":"string"},"creditKey":{"type":"string"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"idempotencyKey":{"type":["string","null"]},"createdAt":{"type":"number"}},"required":["id","identity","creditKey","amountNanocredits","idempotencyKey","createdAt"],"additionalProperties":false},"duplicate":{"type":"boolean"}},"required":["deposit","duplicate"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}},"get":{"operationId":"listDeposits","tags":["Deposits"],"security":[{"bearerAuth":[]}],"summary":"List deposits","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":4096},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"identity","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"required":false,"name":"creditKey","in":"query"}],"responses":{"200":{"description":"Deposit page","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"identity":{"type":"string"},"creditKey":{"type":"string"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"idempotencyKey":{"type":["string","null"]},"createdAt":{"type":"number"}},"required":["id","identity","creditKey","amountNanocredits","idempotencyKey","createdAt"],"additionalProperties":false}},"cursor":{"type":["string","null"]}},"required":["data","cursor"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/application":{"get":{"operationId":"getApplicationContext","summary":"Get application","tags":["Application"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Application, organization, and permissions associated with this key","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string"},"orgSlug":{"type":["string","null"]},"appId":{"type":"string"},"name":{"type":"string"},"isLive":{"type":"boolean"},"deploymentUrl":{"type":"string","format":"uri"},"permissions":{"type":"array","items":{"type":"string"}}},"required":["orgId","orgSlug","appId","name","isLive","permissions"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/check":{"post":{"operationId":"checkUsage","summary":"Check usage","description":"Checks subscription allowances and the current credit balance without reserving usage or credits. Tracking enforces both again atomically.","tags":["Events"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"identity":{"type":"string","minLength":1,"maxLength":200},"feature":{"type":"string","minLength":1,"maxLength":100},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"occurredAt":{"type":"integer","minimum":0,"maximum":9007199254740991},"entityId":{"type":"string","minLength":1,"maxLength":200},"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991,"default":1}},"required":["identity","feature"],"additionalProperties":false}}}},"responses":{"200":{"description":"Current affordability, charge, and credit balance","content":{"application/json":{"schema":{"type":"object","properties":{"allowed":{"type":"boolean"},"creditKey":{"type":"string"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"balanceNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"periodStart":{"type":"number"},"periodEnd":{"type":"number"},"limit":{"type":"object","properties":{"limit":{"type":"number"},"used":{"type":"number"},"remaining":{"type":"number"},"periodStart":{"type":"number"},"periodEnd":{"type":"number"},"overage":{"type":"string","enum":["block","credits"]}},"required":["limit","used","remaining","periodStart","periodEnd","overage"],"additionalProperties":false},"reason":{"type":"string","enum":["feature_limit_exceeded","subscription_inactive","insufficient_balance"]}},"required":["allowed","creditKey","amountNanocredits","balanceNanocredits"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}},"/v1/events":{"post":{"operationId":"ingestEvent","summary":"Track usage","tags":["Events"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200},"identity":{"type":"string","minLength":1,"maxLength":200},"feature":{"type":"string","minLength":1,"maxLength":100},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"occurredAt":{"type":"integer","minimum":0,"maximum":9007199254740991},"entityId":{"type":"string","minLength":1,"maxLength":200},"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991,"default":1}},"required":["id","identity","feature"],"additionalProperties":false}}}},"responses":{"200":{"description":"Retry or another use in an already billed period","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["accepted","duplicate","deduplicated"]},"transactionId":{"type":"string"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"periodStart":{"type":"number"},"periodEnd":{"type":"number"},"deduplicatedFrom":{"type":"string"}},"required":["status","transactionId","amountNanocredits"],"additionalProperties":false}}}},"201":{"description":"Usage accepted and charged","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["accepted","duplicate","deduplicated"]},"transactionId":{"type":"string"},"amountNanocredits":{"type":"string","maxLength":19,"pattern":"^(0|[1-9][0-9]*)$"},"periodStart":{"type":"number"},"periodEnd":{"type":"number"},"deduplicatedFrom":{"type":"string"}},"required":["status","transactionId","amountNanocredits"],"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"401":{"description":"Missing, expired, or revoked API key","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"403":{"description":"Insufficient permission or unsupported key kind","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"409":{"description":"Conflict or insufficient balance","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"413":{"description":"Body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"422":{"description":"Unsupported pricing or billing configuration","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded; see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":false}}}}}}}},"webhooks":{},"servers":[{"url":"https://api.orbytelabs.com","description":"Credit API"}]}