{"openapi":"3.0.1","basePath":"/v1","info":{"version":"1.0.0","title":"Upgrade.Chat API Documentation","description":"Fully Interactive Upgrade.Chat API Documentation. Click Authorize to Begin.","termsOfService":"https://docs.upgrade.chat/terms-of-service","contact":{"name":"Upgrade.Chat","url":"https://upgrade.chat"}},"servers":[{"url":"https://api.upgrade.chat","description":"Upgrade.Chat Public API"}],"components":{"schemas":{"OrderItem":{"type":"object","properties":{"price":{"type":"number","format":"double"},"quantity":{"type":"number","format":"integer"},"interval":{"type":"string","enum":["day","week","month","year"]},"interval_count":{"type":"number","format":"integer"},"free_trial_length":{"type":"number","format":"integer"},"is_time_limited":{"type":"boolean"},"type":{"type":"string","enum":["UPGRADE","SHOP"]},"discord_roles":{"type":"array","items":{"type":"object","properties":{"discord_id":{"type":"string"},"name":{"type":"string"}}}},"product_types":{"description":"The types of the product. A product purchased through the shop will be a shop product. All other types are upgrades.","type":"array","items":{"type":"string","enum":["DISCORD_ROLE","SHOP_PRODUCT"]}},"product":{"description":"An Upgrade.Chat product","type":"object","properties":{"uuid":{"type":"string","format":"uuid"},"name":{"type":"string"}}}}},"Coupon":{"type":"object","properties":{"code":{"type":"string"},"type":{"type":"string","enum":["value","percentage"]},"duration":{"type":"string","enum":["once","forever","repeating"]},"duration_in_months":{"type":"number","nullable":true},"amount_off":{"type":"number","nullable":true},"percent_off":{"type":"number","nullable":true},"created":{"description":"The date when the coupon was created","type":"string","format":"date"}}},"LastCharge":{"description":"Simplified charge object for the most recent charge that occurred","type":"object","properties":{"payment_processor_created":{"description":"Date charge was created","type":"string","format":"date"}}},"Order":{"type":"object","properties":{"uuid":{"type":"string"},"purchased_at":{"type":"string","format":"date"},"payment_processor":{"type":"string","enum":["PAYPAL","STRIPE"]},"payment_processor_record_id":{"type":"string"},"user":{"$ref":"#/components/schemas/User"},"subtotal":{"type":"number","format":"double"},"discount":{"type":"number","format":"double"},"total":{"type":"number","format":"double"},"coupon_code":{"description":"The applied coupon code if any","type":"string","nullable":true},"coupon":{"description":"The applied coupon if any","$ref":"#/components/schemas/Coupon","nullable":true},"last_succeeded_charge":{"description":"The last succeeded charge if any","$ref":"#/components/schemas/LastCharge","nullable":true},"type":{"type":"string","enum":["UPGRADE","SHOP"]},"is_subscription":{"type":"boolean"},"cancelled_at":{"type":"string","format":"date","description":"The date when the subscription was cancelled"},"deleted":{"type":"string","format":"date","description":"The date when the subscription expired"},"order_items":{"type":"array","items":{"$ref":"#/components/schemas/OrderItem"}}}},"OneOrder":{"type":"object","properties":{"uuid":{"type":"string"},"purchased_at":{"type":"string","format":"date"},"payment_processor":{"type":"string","enum":["PAYPAL","STRIPE"]},"payment_processor_record_id":{"type":"string"},"user":{"$ref":"#/components/schemas/Customer"},"subtotal":{"type":"number","format":"double"},"discount":{"type":"number","format":"double"},"total":{"type":"number","format":"double"},"coupon_code":{"description":"The applied coupon code if any","type":"string","nullable":true},"coupon":{"description":"The applied coupon if any","$ref":"#/components/schemas/Coupon","nullable":true},"type":{"type":"string","enum":["UPGRADE","SHOP"]},"is_subscription":{"type":"boolean"},"cancelled_at":{"type":"string","format":"date","description":"The date when the subscription was cancelled"},"deleted":{"type":"string","format":"date","description":"The date when the subscription expired"},"order_items":{"type":"array","items":{"$ref":"#/components/schemas/OrderItem"}}}},"Product":{"type":"object","properties":{"uuid":{"type":"string","format":"uuid"},"checkout_uri":{"type":"string","format":"uri","description":"Direct Link to Product"},"name":{"type":"string"},"account_id":{"type":"number"},"prices":{"description":"An array of prices. Lists up to 10 prices.","type":"array","items":{"$ref":"#/components/schemas/Price"}},"free_trial_length":{"type":"number"},"description":{"type":"string"},"image_link":{"type":"string"},"variable_price":{"type":"boolean"},"is_time_limited":{"type":"boolean"},"limited_inventory":{"type":"boolean"},"available_stock":{"type":"number"},"shippable":{"type":"boolean"},"paymentless_trial":{"type":"boolean"},"product_types":{"type":"array","items":{"type":"string","enum":["DISCORD_ROLE","SHOP_PRODUCT"]}},"created":{"type":"string","format":"date-time"},"updated":{"type":"string","format":"date-time"},"deleted":{"type":"string","nullable":true,"format":"date-time"}}},"Price":{"type":"object","properties":{"price":{"type":"number","format":"double"},"interval":{"type":"string","nullable":true,"enum":["day","week","month","year"]},"interval_count":{"type":"integer","nullable":true},"is_subscription":{"type":"boolean"}}},"User":{"type":"object","properties":{"discord_id":{"type":"string","nullable":true},"username":{"type":"string","nullable":true}}},"Customer":{"type":"object","properties":{"id":{"type":"number","format":"integer"},"discord_id":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"username":{"type":"string","nullable":true}}},"WebhookEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"webhook_id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["order.created","order.updated","order.deleted"]},"body":{"$ref":"#/components/schemas/Order"},"attempts":{"type":"number","format":"integer"}}},"Webhook":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"uri":{"type":"string","format":"uri"}}}},"securitySchemes":{"oauth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.upgrade.chat/oauth/token"}}}}},"paths":{"/v1/orders":{"get":{"description":"Lists Orders","security":[{"oauth2":null}],"tags":["orders"],"produces":["application/json"],"parameters":[{"name":"limit","in":"query","description":"1-100. Default 100","required":false,"type":"string"},{"name":"offset","in":"query","description":"Default 0","required":false,"type":"string"},{"name":"userDiscordId","in":"query","description":"Discord ID of User","required":false,"type":"string"},{"name":"type","in":"query","description":"Order Type","required":false,"type":"string"},{"name":"coupon","in":"query","description":"Whether any coupon was applied","required":false,"type":"boolean"}],"responses":{"200":{"description":"A list of orders","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"description":"An array of Orders","type":"array","items":{"$ref":"#/components/schemas/Order"}},"total":{"type":"number","format":"integer","description":"Total number of orders"},"has_more":{"type":"boolean","description":"Boolean indicating if there are more records."}}}}}}}}},"/v1/orders/{uuid}":{"get":{"description":"Retrieve Order","security":[{"oauth2":null}],"tags":["orders"],"produces":["application/json"],"parameters":[{"name":"uuid","in":"path","description":"Order UUID","required":true,"type":"string"}],"responses":{"200":{"description":"An order record","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"description":"An Order","$ref":"#/components/schemas/OneOrder"}}}}}}}}},"/v1/products":{"get":{"description":"Lists products","security":[{"oauth2":null}],"tags":["products"],"produces":["application/json"],"parameters":[{"name":"limit","in":"query","description":"1-100. Default 100","required":false,"type":"string"},{"name":"offset","in":"query","description":"Default 0","required":false,"type":"string"},{"name":"type","in":"query","description":"Product type filter. Default will return all products.","required":false,"schema":{"enum":["UPGRADE","SHOP_PRODUCT"],"type":"string"}}],"responses":{"200":{"description":"A list of products","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"description":"An array of product records","type":"array","items":{"$ref":"#/components/schemas/Product"}},"total":{"type":"number","format":"integer","description":"Total number of records"},"has_more":{"type":"boolean","description":"Boolean indicating if there are more records."}}}}}}}}},"/v1/products/{uuid}":{"get":{"description":"Get Product by UUID","security":[{"oauth2":null}],"tags":["products"],"produces":["application/json"],"parameters":[{"name":"uuid","in":"path","description":"Product UUID","required":true,"type":"string"}],"responses":{"200":{"description":"A product record","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"description":"A product","$ref":"#/components/schemas/Product"}}}}}}}}},"/v1/users":{"get":{"description":"Lists Users","security":[{"oauth2":null}],"tags":["users"],"produces":["application/json"],"parameters":[{"name":"limit","in":"query","description":"1-100. Default 100","required":false,"type":"string"},{"name":"offset","in":"query","description":"Default 0","required":false,"type":"string"}],"responses":{"200":{"description":"A list of users","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"description":"An array of Users","type":"array","items":{"$ref":"#/components/schemas/User"}},"total":{"type":"number","format":"integer","description":"Total number of records"},"has_more":{"type":"boolean","description":"Boolean indicating if there are more records."}}}}}}}}},"/v1/webhook-events":{"get":{"description":"Lists Webhook Events","security":[{"oauth2":null}],"tags":["webhook-events"],"produces":["application/json"],"parameters":[{"name":"limit","in":"query","description":"1-100. Default 100","required":false,"type":"string"},{"name":"offset","in":"query","description":"Default 0","required":false,"type":"string"}],"responses":{"200":{"description":"A list of webhook events","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"description":"An array of Webhook Events","type":"array","items":{"$ref":"#/components/schemas/WebhookEvent"}},"total":{"type":"number","format":"integer","description":"Total number of records"},"has_more":{"type":"boolean","description":"Boolean indicating if there are more records."}}}}}}}}},"/v1/webhook-events/{id}":{"get":{"description":"Get Webhook Event by Id","security":[{"oauth2":null}],"tags":["webhook-events"],"produces":["application/json"],"parameters":[{"name":"id","in":"path","description":"Webhook Event ID","required":true,"type":"string"}],"responses":{"200":{"description":"A Webhook record","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"description":"A Webhook","$ref":"#/components/schemas/WebhookEvent"}}}}}}}}},"/v1/webhook-events/{id}/validate":{"get":{"description":"Validate a webhook event","security":[{"oauth2":null}],"tags":["webhook-events"],"produces":["application/json"],"parameters":[{"name":"id","in":"path","description":"Webhook ID","required":true,"type":"string"}],"responses":{"200":{"description":"Validate a webhook event","content":{"application/json":{"schema":{"type":"object","properties":{"valid":{"type":"boolean"}}}}}}}}},"/v1/webhooks":{"get":{"description":"List Webhooks","security":[{"oauth2":null}],"tags":["webhooks"],"produces":["application/json"],"parameters":[{"name":"limit","in":"query","description":"1-100. Default 100","required":false,"type":"string"},{"name":"offset","in":"query","description":"Default 0","required":false,"type":"string"}],"responses":{"200":{"description":"A list of webhooks","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"description":"An array of Webhooks","type":"array","items":{"$ref":"#/components/schemas/Webhook"}},"total":{"type":"number","format":"integer","description":"Total number of records"},"has_more":{"type":"boolean","description":"Boolean indicating if there are more records."}}}}}}}}},"/v1/webhooks/{id}":{"get":{"description":"Get Webhook by Id","security":[{"oauth2":null}],"tags":["webhooks"],"produces":["application/json"],"parameters":[{"name":"id","in":"path","description":"Webhook ID","required":true,"type":"string"}],"responses":{"200":{"description":"A Webhook record","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"description":"A Webhook","$ref":"#/components/schemas/Webhook"}}}}}}}}}},"tags":[]}