{"openapi":"3.1.0","info":{"title":"Baremetrics API","version":"1.0","description":"# Introduction\n\nBaremetrics offers simple integration with popular payment providers such as Stripe, Recurly and Braintree. If you are using one of those providers, go ahead and [sign up and connect them right now](https://app.baremetrics.com/users/sign_up)!\n\nIf you're using a non-supported payment provider, or you're managing your own subscriptions, the Baremetrics API might be a great fit for you. With just a little dev work on your part, you can create customers and manage their subscriptions to unlock the full Baremetrics feature set.\n\nYou'll need a [Baremetrics account](https://app.baremetrics.com/users/sign_up) to use the API. Your API keys are available in [the Settings area](https://app.baremetrics.com/settings/api).\n\n# Authentication\n\nAuthentication to the Baremetrics API is performed using a bearer token. To use this, send the following with your request:\n\nOur API uses Bearer Authentication for access to all endpoints. You can either supply an API key found in your [API settings](https://app.baremetrics.com/settings/api), or you can use an Access Token obtained via [oAuth](/reference/oauth).\n\n```curl\n-H \"Authorization: Bearer APIKEY\"\n```\n\n> [!CAUTION]\n> **All requests must be sent over HTTPS**\n\n## Authentication Error\n\n```json\n{\n  \"error\": \"Unauthorized. Token not found\"\n}\n```\n\n# oAuth\n\nWe offer access to our API via oAuth, allowing you to connect with Baremetrics users easily.\n\nTo begin, you will need to request access to our oAuth system. You can do so by reaching out to support, briefly explaining what you will be using our API for.\n\nOnce you have your Client ID and Client Secret, you can follow the standard oAuth 2.0 specification flow.\n\n## Send to Baremetrics\n\nThe first step is to send the user from your application to Baremetrics, using the following URL format.\n\nYou will need to specify `response_type=code` as a query param.\n\nThe scopes we offer are `read` and `write`. To allow both, use a space separated string.\n\n```text\nhttps://app.baremetrics.com/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&scope=SCOPES&response_type=code\n```\n\n## Request Access Token\n\nOnce the user has authenticated, they will be redirected back to your application with a `code` query parameter. You should use this code to request an access token for that user, for example:\n\n```ruby\nRestClient.post(\"https://app.baremetrics.com/oauth/token\", {\n  'code' => code,\n  'client_id' => CLIENT_ID,\n  'client_secret' => CLIENT_SECRET,\n  'grant_type' => 'authorization_code',\n  'redirect_uri' => REDIRECT_URL\n})\n```\n\nThis will return you an Access Token that should then be passed into the Bearer Authentication header.\n\n# Sandbox\n\nTo help you build your integration, we have setup a full sandbox environment for you.\n\n> [!CAUTION]\n> Please only use the sandbox for testing your code implementation, it's not designed for importing all your data. You will be limited to a low number of Subscriptions.\n\nYou can view your sandbox API key [here](https://app.baremetrics.com/settings/api)\n\n## Sandbox API\n\nYou can use the Sandbox API by using: <https://api-sandbox.baremetrics.com>\n\n## Sandbox Dashboard\n\nYou can access the Sandbox Dashboard [here](https://sandbox.baremetrics.com).\n\n# Pagination\n\nAll endpoints return 30 objects by default. You can override this by passing the query param of `per_page`. **The maximum objects per page is 200 at this time.** You can specify the page by supplying the query param of `page`.\n\nThe following objects will be returned in all paginated responses:\n\n```json\n{\n  ...\n  \"meta\": {\n    \"pagination\": {\n      \"has_more\": false,\n      \"page\": 0,\n      \"per_page\": 30\n    }\n  }\n}\n```\n\n# Rate Limit\n\nYou are limited to 3,600 requests per hour. If you are consistently hitting this limit then [please contact us](mailto:hello@baremetrics.com) with as much detail as possible regarding your use case and we can look into increasing this for you.\n\nYou can check your rate limit by looking at the `X-RateLimit-Limit` header in every response.\n\nIf you need to temporarily increase this, [please contact us](mailto:hello@baremetrics.com).\n\nWe will return the following headers to help you manage this:\n\n```text\nX-RateLimit-Limit: 3600\nX-RateLimit-Remaining: 3599\n```\n\n# Quick Start Guide\n\nLearn how to create your first plan, customer and subscription in Baremetrics.\n\nGetting your first customer into Baremetrics requires three steps! The steps must be completed in order, however. For example, you can't create a subscription without first creating a customer and a plan.\n\n* [**Step 1. Create a Plan**](/reference/create-plan)\n* [**Step 2. Create a Customer**](/reference/create-customer)\n* [**Step 3. Create a Subscription**](/reference/create-subscription)\n\nYou only need to create a plan once! It can be used over and over again for multiple customers and subscriptions.\n\n> [!WARNING]\n> Before you begin, [snag the **Source ID** for the provider **Baremetrics**.](/reference/sources) You will need this anytime you create, modify or interact with plans, customers, subscriptions or charges through the API.\n\n## Create a Plan\n\nLet's create a $10/mo. plan called *Basic Plan*. Here's what that looks like.\n\n> [!CAUTION]\n> The amount is in **cents**. So for our $10/mo. plan we will use an amount of `1000`.\n\n```ruby\nRestClient.post \"https://api.baremetrics.com/v1/:source_id/plans\", {\n  oid: 'basic_plan',\n  name: 'Basic',\n  currency: 'usd',\n  amount: 1000,\n  interval: 'month',\n  interval_count: 1\n}\n```\n\nIf you did everything right, you'll get a 200 response with your new plan details!\n\n```ruby\n{\n  \"plan\": {\n    \"oid\": \"basic_plan\",\n    \"source_id\": \"123\",\n    \"source\": \"baremetrics\",\n    \"name\": \"Basic\",\n    \"interval\": \"month\",\n    \"interval_count\": 1,\n    \"trial_duration\": null,\n    \"trial_duration_unit\": null,\n    \"created\": null,\n    \"active\": true,\n    \"setup_fees\": 0,\n    \"amounts\": [\n      {\n        \"currency\": \"USD\",\n        \"symbol\": \"$\",\n        \"symbol_right\": false,\n        \"amount\": 1000\n      }\n    ]\n  }\n}\n```\n\n## Create a Customer\n\nOnce you have at least one plan you can start creating customers.\n\nYou only need to provide us a unique ID to create a customer. However to get the best experience, we recommend sending Baremetrics as much data as possible!\n\n```ruby\nRestClient.post \"https://api.baremetrics.com/v1/:source_id/customers\", {\n  oid: '123123123', # Provide a unique ID for the customer\n  name: 'Josh Pigford',\n  notes: 'Salesperson: Kaegan Donnelly', # This will populate the notes field in the customer profile\n  email: 'josh@baremetrics.com', # We use the email address to retrieve social data about your customer such as a picture and location\n  created: 1471343207 # The unix date \"created\" date for a customer. We add this to the customer profile as well.\n}\n```\n\nIf everything goes as planned, we'll return a 200 response with more details about the customer that you've created!\n\n```ruby\n{\n  \"customer\": {\n    \"oid\": \"123123123\",\n    \"source_id\": \"source_1\",\n    \"source\": \"stripe\",\n    \"created\": 1471343207,\n    \"email\": \"josh@baremetrics.com\",\n    \"name\": \"Josh Pigford\",\n    \"display_image\": \"https://logo.clearbit.com/baremetrics.com\",\n    \"display_name\": \"Customer 1\",\n    \"notes\": 'Salesperson: Kaegan Donnelly',\n    \"ltv\": 0,\n    \"is_active\": false,\n    \"is_canceled\": false,\n    \"current_mrr\": 0,\n    \"current_plans\": []\n  }\n}\n```\n\n## Create a Subscription\n\nAlright, you're most of the way there! If you look at your Baremetrics dashboard though you won't see a whole lot. Since Baremetrics is all about tracking your subscriptions, this final step is crucial to getting your key metrics and insights!\n\nYou can get really fancy with subscriptions with things like addons and quantities, but we're going to keep this first one really simple.\n\n```ruby\nRestClient.post \"https://api.baremetrics.com/v1/:source_id/subscriptions\", {\n  oid: 'abcdabcd', # A unique ID for the subscription\n  started_at: 1471887288, # The date the subscription begins\n  canceled_at: nil, # The date the subscription ends, if applicable\n  plan_oid: 'basic_plan', # The ID of the plan you created earlier\n  customer_oid: '123123123', # The ID of the customer you created earlier\n}\n```\n\n> [!CAUTION]\n> Metrics generally update about once every 30 minutes, but it can take a couple of hours at times. Check the \"Last Updated\" date at the top right of your dashboard to see when we last calculated your metrics.\n\nHere's what your finished subscription customer will look like in Baremetrics!\n\n![A subscription customer in Baremetrics](/developer-docs/images/quick-start-customer.png)\n\n# Reporting Issues\n\nIf you come across any issues, please reach out to <success@baremetrics.com>, including the following:\n\n* A brief description of what you are trying to do, what you were expecting, and what actually happened\n* Include the `request-id` ( **not`x-request-id`**) header returned by our API for any requests you have made."},"servers":[{"url":"https://api.baremetrics.com","description":"Production"},{"url":"https://api-sandbox.baremetrics.com","description":"Sandbox"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Account"},{"name":"Sources"},{"name":"Plans"},{"name":"Customers"},{"name":"Subscriptions"},{"name":"Annotations"},{"name":"Goals"},{"name":"Users"},{"name":"Charges"},{"name":"Refunds"},{"name":"Events"},{"name":"Metrics","description":"# Available Metrics\n\nThe following metrics are available through our Read API.\n\n```text\n- active_customers\n- active_subscriptions\n- active_trials\n- arpu\n- arr\n- cancellations\n- churned_customers\n- converted_trials\n- coupons\n- downgrades\n- failed_charges\n- fees\n- ltv\n- mrr\n- mrr_growth_rate\n- net_revenue\n- net_revenue_churn\n- new_customers\n- new_subscriptions\n- new_trials\n- other_revenue\n- plan_quantities\n- quick_ratio\n- reactivations\n- refunds\n- revenue_churn\n- trial_conversion\n- trial_time_to_cancelation\n- trial_time_to_conversion\n- upgrades\n- user_churn\n```\n\n# Available Metrics for the Show Customers Endpoint\n\n```text\n- active_trials\n- add_on_mrr\n- cancellations\n- canceled_trials\n- churned_customers\n- converted_trials\n- downgrades\n- new_customers\n- new_subscriptions\n- new_trials\n- plan_quantities\n- reactivations\n- upgrades\n- other_revenue\n```"},{"name":"Segments"},{"name":"Attributes"},{"name":"Cancellation Insights"}],"paths":{"/v1/account":{"get":{"tags":["Account"],"summary":"Get Account","operationId":"get-account","responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"account":{"id":"account_id","default_currency":{"id":"usd","alternate_symbols":["US$"],"decimal_mark":".","disambiguate_symbol":"US$","html_entity":"$","iso_code":"USD","iso_numeric":"840","name":"United States Dollar","priority":1,"smallest_denomination":1,"subunit":"Cent","subunit_to_unit":100,"symbol":"$","symbol_first":true,"thousands_separator":","},"company":"Example Company","created_at":123456789}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/sources":{"get":{"tags":["Sources"],"summary":"List Sources","description":"Each Plan, Customer, Subscription and Charge belongs to a source. A source can be your Payment Provider or the Baremetrics API.\n\nWhen you want to interact with any of these objects, you must supply the Source in the URL. For example: `GET /v1/:source_id/subscriptions`\n\nYou can get your `source_id` from the [Sources](/reference/sources) endpoint\n\n> [!WARNING]\n> Please note that while you can *read* data from your Payment Provider sources, you can only *modify* data that has been added via the API.","operationId":"sources","responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"sources":[{"id":"source_id","provider":"stripe","provider_id":"<stripe_account_id>"},{"id":"source_id","provider":"baremetrics","provider_id":null}]}}},"schema":{"type":"object","properties":{"sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"source_id"},"provider":{"type":"string","example":"stripe"},"provider_id":{"type":"string","example":"<stripe_account_id>"}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/{source_id}/plans":{"get":{"tags":["Plans"],"summary":"List Plans","operationId":"list-plans","parameters":[{"name":"search","in":"query","description":"Allows you to search based on the name or oid fields","schema":{"type":"string"}},{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"plans":[{"oid":"plan_1","source_id":"123","source":"baremetrics","name":"Plan 1","interval":"year","interval_count":1,"trial_duration":null,"trial_duration_unit":null,"created":null,"active":true,"setup_fees":0,"amounts":[{"currency":"USD","symbol":"$","symbol_right":false,"amount":450000}]},{"oid":"plan_2","source_id":"123","source":"baremetrics","name":"Plan 2","interval":"year","interval_count":1,"trial_duration":null,"trial_duration_unit":null,"created":null,"active":true,"setup_fees":0,"amounts":[{"currency":"USD","symbol":"$","symbol_right":false,"amount":450000}]}]}}},"schema":{"type":"object","properties":{"plans":{"type":"array","items":{"type":"object","properties":{"oid":{"type":"string","example":"plan_1"},"source_id":{"type":"string","example":"123"},"source":{"type":"string","example":"baremetrics"},"name":{"type":"string","example":"Plan 1"},"interval":{"type":"string","example":"year"},"interval_count":{"type":"integer","example":1,"default":0},"trial_duration":{},"trial_duration_unit":{},"created":{},"active":{"type":"boolean","example":true,"default":true},"setup_fees":{"type":"integer","example":0,"default":0},"amounts":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string","example":"USD"},"symbol":{"type":"string","example":"$"},"symbol_right":{"type":"boolean","example":false,"default":true},"amount":{"type":"integer","example":450000,"default":0}}}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"post":{"tags":["Plans"],"summary":"Create Plan","description":"Create a plan for use when [creating](/reference/create-subscription) or [updating](/reference/update-subscription) subscriptions.\n\n> [!WARNING]\n> **Trials**\n>\n> When creating a subscription with a plan that has a trial, only the first plan will trigger a trial.\n>\n> For example, if you create a subscription on Plan A, which has a 7 day trial, and then on day 2 you switch them to Plan B, the trial will continue until day 7, at which point they will become a paying customer on Plan B.","operationId":"create-plan","parameters":[{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["oid","name","currency","amount","interval","interval_count"],"properties":{"oid":{"type":"string","description":"Your unique ID for the plan"},"name":{"type":"string","description":"Your internal name for this plan. This will be displayed in the Plan Breakout section"},"currency":{"type":"string","description":"The ISO code of the currency of this plan. E.G: usd"},"amount":{"type":"integer","description":"How much is this plan? (In cents)","format":"int32"},"interval":{"type":"string","description":"day, month or year"},"interval_count":{"type":"integer","format":"int32"},"trial_duration":{"type":"integer","description":"The duration of this trial. This is to be used in conjunction with trial_duration_unit","default":0,"format":"int32"},"trial_duration_unit":{"type":"string","description":"This is to be used in conjunction with trial_duration","default":"day"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"plan":{"oid":"plan_2","source_id":"123","source":"baremetrics","name":"Plan 2","interval":"year","interval_count":1,"trial_duration":null,"trial_duration_unit":null,"created":null,"active":true,"setup_fees":0,"amounts":[{"currency":"USD","symbol":"$","symbol_right":false,"amount":450000}]}}}},"schema":{"type":"object","properties":{"plan":{"type":"object","properties":{"oid":{"type":"string","example":"plan_2"},"source_id":{"type":"string","example":"123"},"source":{"type":"string","example":"baremetrics"},"name":{"type":"string","example":"Plan 2"},"interval":{"type":"string","example":"year"},"interval_count":{"type":"integer","example":1,"default":0},"trial_duration":{},"trial_duration_unit":{},"created":{},"active":{"type":"boolean","example":true,"default":true},"setup_fees":{"type":"integer","example":0,"default":0},"amounts":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string","example":"USD"},"symbol":{"type":"string","example":"$"},"symbol_right":{"type":"boolean","example":false,"default":true},"amount":{"type":"integer","example":450000,"default":0}}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{"error":"Error message here"}}},"schema":{"type":"object","properties":{"error":{"type":"string","example":"Error message here"}}}}}}},"deprecated":false}},"/v1/{source_id}/plans/{oid}":{"get":{"tags":["Plans"],"summary":"Show Plan","operationId":"show-plan","parameters":[{"name":"oid","in":"path","required":true,"schema":{"type":"string"}},{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"plan":{"oid":"plan_2","source_id":"123","source":"baremetrics","name":"Plan 2","interval":"year","interval_count":1,"trial_duration":null,"trial_duration_unit":null,"created":null,"active":true,"setup_fees":0,"amounts":[{"currency":"USD","symbol":"$","symbol_right":false,"amount":450000}]}}}},"schema":{"type":"object","properties":{"plan":{"type":"object","properties":{"oid":{"type":"string","example":"plan_2"},"source_id":{"type":"string","example":"123"},"source":{"type":"string","example":"baremetrics"},"name":{"type":"string","example":"Plan 2"},"interval":{"type":"string","example":"year"},"interval_count":{"type":"integer","example":1,"default":0},"trial_duration":{},"trial_duration_unit":{},"created":{},"active":{"type":"boolean","example":true,"default":true},"setup_fees":{"type":"integer","example":0,"default":0},"amounts":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string","example":"USD"},"symbol":{"type":"string","example":"$"},"symbol_right":{"type":"boolean","example":false,"default":true},"amount":{"type":"integer","example":450000,"default":0}}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"put":{"tags":["Plans"],"summary":"Update Plan","operationId":"update-plan","parameters":[{"name":"oid","in":"path","description":"Your interval plan id","required":true,"schema":{"type":"string"}},{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"The new name of this plan"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"plan":{"oid":"plan_2","source_id":"123","source":"baremetrics","name":"Plan 2","interval":"year","interval_count":1,"trial_duration":null,"trial_duration_unit":null,"created":null,"active":true,"setup_fees":0,"amounts":[{"currency":"USD","symbol":"$","symbol_right":false,"amount":450000}]}}}},"schema":{"type":"object","properties":{"plan":{"type":"object","properties":{"oid":{"type":"string","example":"plan_2"},"source_id":{"type":"string","example":"123"},"source":{"type":"string","example":"baremetrics"},"name":{"type":"string","example":"Plan 2"},"interval":{"type":"string","example":"year"},"interval_count":{"type":"integer","example":1,"default":0},"trial_duration":{},"trial_duration_unit":{},"created":{},"active":{"type":"boolean","example":true,"default":true},"setup_fees":{"type":"integer","example":0,"default":0},"amounts":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string","example":"USD"},"symbol":{"type":"string","example":"$"},"symbol_right":{"type":"boolean","example":false,"default":true},"amount":{"type":"integer","example":450000,"default":0}}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"delete":{"tags":["Plans"],"summary":"Delete Plan","description":"> [!WARNING]\n> You must delete all subscriptions on this plan before you can remove it.","operationId":"delete-plan","parameters":[{"name":"oid","in":"path","required":true,"schema":{"type":"string"}},{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"202","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/{source_id}/customers":{"get":{"tags":["Customers"],"summary":"List Customers","description":"Fetch a list of all customers on your account","operationId":"list-customers","parameters":[{"name":"search","in":"query","description":"Allows you to search for a customer based on: oid, email, notes and name","schema":{"type":"string"}},{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}},{"name":"sort","in":"query","description":"Allows you to sort the results. You can use ltv or created","schema":{"type":"string","default":"created"}},{"name":"order","in":"query","schema":{"type":"string","default":"asc"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"customers":[{"oid":"customer_1","source_id":"source_1","source":"stripe","created":1492605754,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":"Here are some notes","ltv":50000,"is_active":true,"is_canceled":false,"current_mrr":1000,"current_plans":[{"oid":"plan_1","source_id":"source_1","source":"stripe","name":"Plan 1","interval":"month","interval_count":1,"trial_duration":null,"trial_duration_unit":null,"created":1492605754,"active":true,"setup_fees":0,"amounts":[{"currency":"USD","symbol":"$","symbol_right":false,"amount":1000}]}]}]}}},"schema":{"type":"object","properties":{"customers":{"type":"array","items":{"type":"object","properties":{"oid":{"type":"string","example":"customer_1"},"source_id":{"type":"string","example":"source_1"},"source":{"type":"string","example":"stripe"},"created":{"type":"integer","example":1492605754,"default":0},"email":{"type":"string","example":"customer_1@baremetrics.com"},"name":{"type":"string","example":"Customer 1"},"display_image":{"type":"string","example":"https://logo.clearbit.com/baremetrics.com"},"display_name":{"type":"string","example":"Customer 1"},"notes":{"type":"string","example":"Here are some notes"},"ltv":{"type":"integer","example":50000,"default":0},"is_active":{"type":"boolean","example":true,"default":true},"is_canceled":{"type":"boolean","example":false,"default":true},"current_mrr":{"type":"integer","example":1000,"default":0},"current_plans":{"type":"array","items":{"type":"object","properties":{"oid":{"type":"string","example":"plan_1"},"source_id":{"type":"string","example":"source_1"},"source":{"type":"string","example":"stripe"},"name":{"type":"string","example":"Plan 1"},"interval":{"type":"string","example":"month"},"interval_count":{"type":"integer","example":1,"default":0},"trial_duration":{},"trial_duration_unit":{},"created":{"type":"integer","example":1492605754,"default":0},"active":{"type":"boolean","example":true,"default":true},"setup_fees":{"type":"integer","example":0,"default":0},"amounts":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string","example":"USD"},"symbol":{"type":"string","example":"$"},"symbol_right":{"type":"boolean","example":false,"default":true},"amount":{"type":"integer","example":1000,"default":0}}}}}}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"post":{"tags":["Customers"],"summary":"Create Customer","description":"This endpoint allows you to create a customer record. After you create the record, you will be able to create a [Subscription](/reference/create-subscription)\n\n> [!WARNING]\n> It may take a little while for us to fetch all of the profile information for the customer.","operationId":"create-customer","parameters":[{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["oid"],"properties":{"name":{"type":"string"},"notes":{"type":"string","description":"Your own notes for this customer. These will be displayed in the profile"},"email":{"type":"string","description":"An email address for this customer. This is used to lookup extra profile information"},"oid":{"type":"string","description":"Your unique ID for the customer"},"created":{"type":"string","description":"A unix timestamp of when this customer was created. Defaults to now.","default":"NOW","format":"date-time"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"customer":{"oid":"customer_1","source_id":"source_1","source":"stripe","created":1492605754,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":"Here are some notes","ltv":0,"is_active":false,"is_canceled":false,"current_mrr":0,"current_plans":[]}}}},"schema":{"type":"object","properties":{"customer":{"type":"object","properties":{"oid":{"type":"string","example":"customer_1"},"source_id":{"type":"string","example":"source_1"},"source":{"type":"string","example":"stripe"},"created":{"type":"integer","example":1492605754,"default":0},"email":{"type":"string","example":"customer_1@baremetrics.com"},"name":{"type":"string","example":"Customer 1"},"display_image":{"type":"string","example":"https://logo.clearbit.com/baremetrics.com"},"display_name":{"type":"string","example":"Customer 1"},"notes":{"type":"string","example":"Here are some notes"},"ltv":{"type":"integer","example":0,"default":0},"is_active":{"type":"boolean","example":false,"default":true},"is_canceled":{"type":"boolean","example":false,"default":true},"current_mrr":{"type":"integer","example":0,"default":0},"current_plans":{"type":"array"}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{"error":"Error message here"}}},"schema":{"type":"object","properties":{"error":{"type":"string","example":"Error message here"}}}}}}},"deprecated":false}},"/v1/{source_id}/customers/{oid}":{"get":{"tags":["Customers"],"summary":"Show Customer","operationId":"show-customer","parameters":[{"name":"oid","in":"path","required":true,"schema":{"type":"string"}},{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"customer":{"oid":"customer_1","source_id":"source_1","source":"stripe","created":1492605754,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":"Here are some notes","ltv":50000,"is_active":true,"is_canceled":false,"current_mrr":1000,"current_plans":[{"oid":"plan_1","source_id":"source_1","source":"stripe","name":"Plan 1","interval":"month","interval_count":1,"trial_duration":null,"trial_duration_unit":null,"created":1492605754,"active":true,"setup_fees":0,"amounts":[{"currency":"USD","symbol":"$","symbol_right":false,"amount":1000}]}]}}}},"schema":{"type":"object","properties":{"customer":{"type":"object","properties":{"oid":{"type":"string","example":"customer_1"},"source_id":{"type":"string","example":"source_1"},"source":{"type":"string","example":"stripe"},"created":{"type":"integer","example":1492605754,"default":0},"email":{"type":"string","example":"customer_1@baremetrics.com"},"name":{"type":"string","example":"Customer 1"},"display_image":{"type":"string","example":"https://logo.clearbit.com/baremetrics.com"},"display_name":{"type":"string","example":"Customer 1"},"notes":{"type":"string","example":"Here are some notes"},"ltv":{"type":"integer","example":50000,"default":0},"is_active":{"type":"boolean","example":true,"default":true},"is_canceled":{"type":"boolean","example":false,"default":true},"current_mrr":{"type":"integer","example":1000,"default":0},"current_plans":{"type":"array","items":{"type":"object","properties":{"oid":{"type":"string","example":"plan_1"},"source_id":{"type":"string","example":"source_1"},"source":{"type":"string","example":"stripe"},"name":{"type":"string","example":"Plan 1"},"interval":{"type":"string","example":"month"},"interval_count":{"type":"integer","example":1,"default":0},"trial_duration":{},"trial_duration_unit":{},"created":{"type":"integer","example":1492605754,"default":0},"active":{"type":"boolean","example":true,"default":true},"setup_fees":{"type":"integer","example":0,"default":0},"amounts":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string","example":"USD"},"symbol":{"type":"string","example":"$"},"symbol_right":{"type":"boolean","example":false,"default":true},"amount":{"type":"integer","example":1000,"default":0}}}}}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"put":{"tags":["Customers"],"summary":"Update Customer","description":"This endpoint allows you to update the basic information stored on a Customer, such as first name, last name and notes","operationId":"update-customer","parameters":[{"name":"oid","in":"path","description":"Your unique ID for the customer","schema":{"type":"string"},"required":true},{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"notes":{"type":"string"},"created":{"type":"string","description":"Unix timestamp of when this customer was created","format":"date-time"},"email":{"type":"string","description":"Email for this customer"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"customer":{"oid":"customer_1","source_id":"source_1","source":"stripe","created":1492605754,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":"Here are some notes","ltv":50000,"is_active":true,"is_canceled":false,"current_mrr":1000,"current_plans":[{"oid":"plan_1","source_id":"source_1","source":"stripe","name":"Plan 1","interval":"month","interval_count":1,"trial_duration":null,"trial_duration_unit":null,"created":1492605754,"active":true,"setup_fees":0,"amounts":[{"currency":"USD","symbol":"$","symbol_right":false,"amount":1000}]}]}}}},"schema":{"type":"object","properties":{"customer":{"type":"object","properties":{"oid":{"type":"string","example":"customer_1"},"source_id":{"type":"string","example":"source_1"},"source":{"type":"string","example":"stripe"},"created":{"type":"integer","example":1492605754,"default":0},"email":{"type":"string","example":"customer_1@baremetrics.com"},"name":{"type":"string","example":"Customer 1"},"display_image":{"type":"string","example":"https://logo.clearbit.com/baremetrics.com"},"display_name":{"type":"string","example":"Customer 1"},"notes":{"type":"string","example":"Here are some notes"},"ltv":{"type":"integer","example":50000,"default":0},"is_active":{"type":"boolean","example":true,"default":true},"is_canceled":{"type":"boolean","example":false,"default":true},"current_mrr":{"type":"integer","example":1000,"default":0},"current_plans":{"type":"array","items":{"type":"object","properties":{"oid":{"type":"string","example":"plan_1"},"source_id":{"type":"string","example":"source_1"},"source":{"type":"string","example":"stripe"},"name":{"type":"string","example":"Plan 1"},"interval":{"type":"string","example":"month"},"interval_count":{"type":"integer","example":1,"default":0},"trial_duration":{},"trial_duration_unit":{},"created":{"type":"integer","example":1492605754,"default":0},"active":{"type":"boolean","example":true,"default":true},"setup_fees":{"type":"integer","example":0,"default":0},"amounts":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string","example":"USD"},"symbol":{"type":"string","example":"$"},"symbol_right":{"type":"boolean","example":false,"default":true},"amount":{"type":"integer","example":1000,"default":0}}}}}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{"error":"Error message here"}}},"schema":{"type":"object","properties":{"error":{"type":"string","example":"Error message here"}}}}}}},"deprecated":false},"delete":{"tags":["Customers"],"summary":"Delete Customer","description":"> [!WARNING]\n> You must delete all subscriptions for this customer before you can remove them.","operationId":"delete-customer","parameters":[{"name":"oid","in":"path","required":true,"schema":{"type":"string"}},{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"202","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/{source_id}/customers/{oid}/events":{"get":{"tags":["Customers"],"summary":"List Customer Events","operationId":"list-customer-events","parameters":[{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","schema":{"type":"string"},"required":true},{"name":"oid","in":"path","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"events":[{"id":"id_1","event_type":"new_customer","source":"baremetrics","source_id":"baremetrics_1","timestamp":1475452800},{"id":"id_2","event_type":"charge","source":"baremetrics","source_id":"baremetrics_1","timestamp":1475452800}]}}},"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"id_1"},"event_type":{"type":"string","example":"new_customer"},"source":{"type":"string","example":"baremetrics"},"source_id":{"type":"string","example":"baremetrics_1"},"timestamp":{"type":"integer","example":1475452800,"default":0}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/{source_id}/subscriptions":{"get":{"tags":["Subscriptions"],"summary":"List Subscriptions","description":"Get all subscriptions linked to this API Key.","operationId":"list-subscriptions","parameters":[{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}},{"name":"customer_oid","in":"query","description":"This allows you to return subscriptions for a given customer","schema":{"type":"string"}},{"name":"order","in":"query","description":"Allows you to order subscriptions from newest to oldest `desc` or oldest to newest `asc`","schema":{"type":"string","default":"desc"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"subscriptions":[{"oid":"subscription_1","source_id":"source_1","source":"stripe","customer":{"oid":"customer_1","source_id":"source_1","source":"stripe","created":1492605754,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":"Here are some notes","ltv":50000},"canceled_at":null,"started_at":1492605754,"processed":true,"active":true,"quantity":1,"discount":0,"plan":{"oid":"plan_1","source_id":"source_1","source":"stripe","name":"Plan 1","interval":"month","interval_count":1,"trial_duration":null,"trial_duration_unit":null,"created":1492605754,"active":true,"setup_fees":0,"amounts":[{"currency":"USD","symbol":"$","symbol_right":false,"amount":1000}]}}]}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"post":{"tags":["Subscriptions"],"summary":"Create Subscription","description":"This endpoint allows you to create a Subscription.\n\n> [!CAUTION]\n> You will need to create a [Customer](/reference/create-customer) and [Plan](/reference/create-plan) before you can use this endpoint.\n\n> [!CAUTION]\n> It may take a while for your subscriptions to appear in your metrics. There may also be a delay in the data being fully displayed in the [GET /subscriptions](/reference/list-subscriptions) endpoint.\n\n> [!WARNING]\n> **How and why do I use addons?**\n>\n> Addons are used to add additional charges to a base plan. They allow you to create a variety of different combinations of features without creating a separate plan for each possible combination.\n>\n> *Let's look at a hypothetical way of charging for Baremetrics.*\n>\n> We could have a base subscription of $25/mo. Additional features like dunning, customer profiles, etc. could be treated as an addon.\n>\n> $25/mo. base charge + $25 addon for Dunning = $50/mo.\n\n> [!NOTE]\n> We will automatically create charges for your subscriptions. If you don't want this to happen, then please contact us.","operationId":"create-subscription","parameters":[{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["oid","started_at","plan_oid","customer_oid"],"properties":{"oid":{"type":"string","description":"Your unique ID for the subscription"},"started_at":{"type":"string","description":"A unix timestamp of when this subscription started","format":"date-time"},"canceled_at":{"type":"string","description":"A unix timestamp of when this subscription was, or should be canceled. This cannot be changed, so only set this if you are certain you know when the subscription will end.","format":"date-time"},"plan_oid":{"type":"string","description":"Your unique ID for the plan"},"customer_oid":{"type":"string","description":"Your unique ID for the customer"},"addons":{"type":"array","items":{"properties":{"oid":{"type":"string"},"amount":{"type":"integer","format":"int32"},"quantity":{"type":"integer","format":"int32"}},"required":["oid","amount","quantity"],"type":"object"}},"quantity":{"type":"integer","default":1,"format":"int32"},"discount":{"type":"integer","description":"Integer value (in the same currency as the plan)","format":"int32"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"event":{"id":"48X1ZZHtRaBtfN","type":"subscription.created","info":{"oid":"subscription_51","started_at":1474381618,"plan_oid":"1476719008009","customer_oid":"1476719006346","canceled_at":null,"quantity":1,"addons":[{"oid":"addon_1","amount":100,"quantity":1},{"oid":"addon_2","amount":50,"quantity":1}]},"occurred_at":1474381618,"received_at":1480421211}}}},"schema":{"type":"object","properties":{"event":{"type":"object","properties":{"id":{"type":"string","example":"48X1ZZHtRaBtfN"},"type":{"type":"string","example":"subscription.created"},"info":{"type":"object","properties":{"oid":{"type":"string","example":"subscription_51"},"started_at":{"type":"integer","example":1474381618,"default":0},"plan_oid":{"type":"string","example":"1476719008009"},"customer_oid":{"type":"string","example":"1476719006346"},"canceled_at":{},"quantity":{"type":"integer","example":1,"default":0},"addons":{"type":"array","items":{"type":"object","properties":{"oid":{"type":"string","example":"addon_1"},"amount":{"type":"integer","example":100,"default":0},"quantity":{"type":"integer","example":1,"default":0}}}}}},"occurred_at":{"type":"integer","example":1474381618,"default":0},"received_at":{"type":"integer","example":1480421211,"default":0}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{"error":"Error message here"}}},"schema":{"type":"object","properties":{"error":{"type":"string","example":"Error message here"}}}}}}},"deprecated":false}},"/v1/{source_id}/subscriptions/{oid}":{"get":{"tags":["Subscriptions"],"summary":"Show Subscription","operationId":"show-subscription","parameters":[{"name":"oid","in":"path","required":true,"schema":{"type":"string"}},{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"subscription":{"oid":"subscription_1","source_id":"source_1","source":"stripe","customer":{"oid":"customer_1","source_id":"source_1","source":"stripe","created":1492605754,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":"Here are some notes","ltv":50000},"canceled_at":null,"started_at":1492605754,"processed":true,"active":true,"quantity":1,"discount":0,"plan":{"oid":"plan_1","source_id":"source_1","source":"stripe","name":"Plan 1","interval":"month","interval_count":1,"trial_duration":null,"trial_duration_unit":null,"created":1492605754,"active":true,"setup_fees":0,"amounts":[{"currency":"USD","symbol":"$","symbol_right":false,"amount":1000}]}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"put":{"tags":["Subscriptions"],"summary":"Update Subscription","description":"This allows you to update a Subscription, such as changing plans and addons.\n\n> [!CAUTION]\n> Passing an empty \"addons\" array will remove all addons from this subscription.\n\n> [!CAUTION]\n> It may take a while for your updates to appear in your metrics. There may also be a delay in the data being fully displayed in the [GET /subscriptions](/reference/list-subscriptions) endpoint.","operationId":"update-subscription","parameters":[{"name":"oid","in":"path","description":"Your unique ID for the subscription","required":true,"schema":{"type":"string"}},{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["plan_oid"],"properties":{"plan_oid":{"type":"string","description":"Your unique ID for the plan"},"occurred_at":{"type":"string","description":"A unix timestamp of when this change occurred. Defaults to now","default":"NOW","format":"date-time"},"addons":{"type":"array","description":"In cents. The OID can be anything you want.","items":{"properties":{"oid":{"type":"string"},"amount":{"type":"integer","format":"int32"},"quantity":{"type":"integer","format":"int32"}},"required":["oid","amount","quantity"],"type":"object"}},"quantity":{"type":"integer","default":1,"format":"int32"},"discount":{"type":"integer","description":"Integer value (in the same currency as the plan)","format":"int32"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"event":{"id":"48X4cZ3T25MKkL","type":"subscription.updated","info":{"plan_oid":"1476719008009","occurred_at":1480421495,"quantity":1,"addons":[{"oid":"addon_1","amount":100,"quantity":1},{"oid":"addon_2","amount":50,"quantity":1},{"oid":"addon_3","amount":25,"quantity":1}]},"occurred_at":1480421495,"received_at":1480421495}}}},"schema":{"type":"object","properties":{"event":{"type":"object","properties":{"id":{"type":"string","example":"48X4cZ3T25MKkL"},"type":{"type":"string","example":"subscription.updated"},"info":{"type":"object","properties":{"plan_oid":{"type":"string","example":"1476719008009"},"occurred_at":{"type":"integer","example":1480421495,"default":0},"quantity":{"type":"integer","example":1,"default":0},"addons":{"type":"array","items":{"type":"object","properties":{"oid":{"type":"string","example":"addon_1"},"amount":{"type":"integer","example":100,"default":0},"quantity":{"type":"integer","example":1,"default":0}}}}}},"occurred_at":{"type":"integer","example":1480421495,"default":0},"received_at":{"type":"integer","example":1480421495,"default":0}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{"error":"Error message here"}}},"schema":{"type":"object","properties":{"error":{"type":"string","example":"Error message here"}}}}}}},"deprecated":false},"delete":{"tags":["Subscriptions"],"summary":"Delete Subscription","description":"> [!WARNING]\n> It may take a while for your subscriptions to disappear from your metrics.","operationId":"delete-subscription","parameters":[{"name":"oid","in":"path","required":true,"schema":{"type":"string"}},{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"202","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/{source_id}/subscriptions/{oid}/cancel":{"put":{"tags":["Subscriptions"],"summary":"Cancel Subscription","description":"This endpoint allows you to cancel a subscription.\n\n> [!CAUTION]\n> It may take a while for your cancellations to appear in your metrics.\n\n> [!NOTE]\n> To update the canceled\\_at time on a subscription, you may send subsequent canceled events. However, you cannot set the date further forward than it currently is set.","operationId":"cancel-subscription","parameters":[{"name":"oid","in":"path","description":"Your unique ID for the subscription","required":true,"schema":{"type":"string"}},{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["canceled_at"],"properties":{"canceled_at":{"type":"string","description":"A unix timestamp of when this subscription was, or should be canceled.","format":"date-time"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"event":{"id":"48X3C1W4w5vCbx","type":"subscription.canceled","info":{"canceled_at":1480421362,"addons":[]},"occurred_at":1480421362,"received_at":1480421362}}}},"schema":{"type":"object","properties":{"event":{"type":"object","properties":{"id":{"type":"string","example":"48X3C1W4w5vCbx"},"type":{"type":"string","example":"subscription.canceled"},"info":{"type":"object","properties":{"canceled_at":{"type":"integer","example":1480421362,"default":0},"addons":{"type":"array"}}},"occurred_at":{"type":"integer","example":1480421362,"default":0},"received_at":{"type":"integer","example":1480421362,"default":0}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{"error":"Error message here"}}},"schema":{"type":"object","properties":{"error":{"type":"string","example":"Error message here"}}}}}}},"deprecated":false}},"/v1/annotations":{"get":{"tags":["Annotations"],"summary":"List Annotations","operationId":"list-annotations","responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"annotations":[{"id":"our_unique_id","metric":"mrr","annotation":"New Feature 1","date":"2015-03-31","global":true,"user":{"id":"user_id","email":"user@baremetrics.com","admin":true,"name":"User Name"}}]}}},"schema":{"type":"object","properties":{"annotations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"our_unique_id"},"metric":{"type":"string","example":"mrr"},"annotation":{"type":"string","example":"New Feature 1"},"date":{"type":"string","example":"2015-03-31"},"global":{"type":"boolean","example":true,"default":true},"user":{"type":"object","properties":{"id":{"type":"string","example":"user_id"},"email":{"type":"string","example":"user@baremetrics.com"},"admin":{"type":"boolean","example":true,"default":true},"name":{"type":"string","example":"User Name"}}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"post":{"tags":["Annotations"],"summary":"Create Annotation","operationId":"create-annotation","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["metric","annotation","date","global","user_id"],"properties":{"metric":{"type":"string","description":"Which metric is this for?"},"annotation":{"type":"string","description":"The annotation text"},"date":{"type":"string","description":"YYYY-MM-DD","format":"date"},"global":{"type":"boolean","description":"Should this show on all graphs?"},"user_id":{"type":"string","description":"Who added this annotation?"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"annotation":{"id":"our_unique_id","metric":"mrr","annotation":"New Feature 1","date":"2015-03-31","global":true,"user":{"id":"user_id","email":"user@baremetrics.com","admin":true,"name":"User Name"}}}}},"schema":{"type":"object","properties":{"annotation":{"type":"object","properties":{"id":{"type":"string","example":"our_unique_id"},"metric":{"type":"string","example":"mrr"},"annotation":{"type":"string","example":"New Feature 1"},"date":{"type":"string","example":"2015-03-31"},"global":{"type":"boolean","example":true,"default":true},"user":{"type":"object","properties":{"id":{"type":"string","example":"user_id"},"email":{"type":"string","example":"user@baremetrics.com"},"admin":{"type":"boolean","example":true,"default":true},"name":{"type":"string","example":"User Name"}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/annotations/{id}":{"get":{"tags":["Annotations"],"summary":"Show Annotation","operationId":"show-annotation","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"annotation":{"id":"our_unique_id","metric":"mrr","annotation":"New Feature 1","date":"2015-03-31","global":true,"user":{"id":"user_id","email":"user@baremetrics.com","admin":true,"name":"User Name"}}}}},"schema":{"type":"object","properties":{"annotation":{"type":"object","properties":{"id":{"type":"string","example":"our_unique_id"},"metric":{"type":"string","example":"mrr"},"annotation":{"type":"string","example":"New Feature 1"},"date":{"type":"string","example":"2015-03-31"},"global":{"type":"boolean","example":true,"default":true},"user":{"type":"object","properties":{"id":{"type":"string","example":"user_id"},"email":{"type":"string","example":"user@baremetrics.com"},"admin":{"type":"boolean","example":true,"default":true},"name":{"type":"string","example":"User Name"}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"delete":{"tags":["Annotations"],"summary":"Delete Annotation","operationId":"delete-annotation","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"202","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/goals":{"get":{"tags":["Goals"],"summary":"List Goals","operationId":"list-goals","responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"goals":[{"id":"our_unique_id","metric":"mrr","end_amount":2000,"start_amount":1000,"end_date":"2016-06-30","start_date":"2016-01-02","name":"MRR Growth"}]}}},"schema":{"type":"object","properties":{"goals":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"our_unique_id"},"metric":{"type":"string","example":"mrr"},"end_amount":{"type":"integer","example":2000,"default":0},"start_amount":{"type":"integer","example":1000,"default":0},"end_date":{"type":"string","example":"2016-06-30"},"start_date":{"type":"string","example":"2016-01-02"},"name":{"type":"string","example":"MRR Growth"}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"post":{"tags":["Goals"],"summary":"Create Goal","operationId":"create-goal","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["metric","start_amount","end_amount","start_date","end_date","name"],"properties":{"metric":{"type":"string"},"start_amount":{"type":"integer","description":"In cents","format":"int32"},"end_amount":{"type":"integer","description":"In cents","format":"int32"},"start_date":{"type":"string","format":"date"},"end_date":{"type":"string","format":"date"},"name":{"type":"string","description":"The goal name"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"goal":{"id":"our_unique_id","metric":"mrr","end_amount":2000,"start_amount":1000,"end_date":"2016-06-30","start_date":"2016-01-02","name":"Goal 1"}}}},"schema":{"type":"object","properties":{"goal":{"type":"object","properties":{"id":{"type":"string","example":"our_unique_id"},"metric":{"type":"string","example":"mrr"},"end_amount":{"type":"integer","example":2000,"default":0},"start_amount":{"type":"integer","example":1000,"default":0},"end_date":{"type":"string","example":"2016-06-30"},"start_date":{"type":"string","example":"2016-01-02"},"name":{"type":"string","example":"Goal 1"}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/goals/{id}":{"get":{"tags":["Goals"],"summary":"Show Goal","operationId":"show-goal","parameters":[{"name":"id","in":"path","description":"Unique ID","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"goal":{"id":"our_unique_id","metric":"mrr","end_amount":2000,"start_amount":1000,"end_date":"2016-06-30","start_date":"2016-01-02","name":"MRR Growth"}}}},"schema":{"type":"object","properties":{"goal":{"type":"object","properties":{"id":{"type":"string","example":"our_unique_id"},"metric":{"type":"string","example":"mrr"},"end_amount":{"type":"integer","example":2000,"default":0},"start_amount":{"type":"integer","example":1000,"default":0},"end_date":{"type":"string","example":"2016-06-30"},"start_date":{"type":"string","example":"2016-01-02"},"name":{"type":"string","example":"MRR Growth"}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"delete":{"tags":["Goals"],"summary":"Delete Goal","operationId":"delete-goal","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"202","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/users":{"get":{"tags":["Users"],"summary":"List Users","operationId":"list-users","responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"users":[{"id":"our_unique_id","email":"user@baremetrics.com","admin":true,"name":"User Name"}]}}},"schema":{"type":"object","properties":{"users":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"our_unique_id"},"email":{"type":"string","example":"user@baremetrics.com"},"admin":{"type":"boolean","example":true,"default":true},"name":{"type":"string","example":"User Name"}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/users/{id}":{"get":{"tags":["Users"],"summary":"Show User","operationId":"show-user","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"user":{"id":"our_unique_id","email":"user@baremetrics.com","admin":true,"name":"User Name"}}}},"schema":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string","example":"our_unique_id"},"email":{"type":"string","example":"user@baremetrics.com"},"admin":{"type":"boolean","example":true,"default":true},"name":{"type":"string","example":"User Name"}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/{source_id}/charges":{"get":{"tags":["Charges"],"summary":"List Charges","operationId":"list-charges","parameters":[{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}},{"name":"start","in":"query","description":"A unix timestamp","schema":{"type":"string","format":"date-time"}},{"name":"end","in":"query","description":"A unix timestamp","schema":{"type":"string","format":"date-time"}},{"name":"subscription_oid","in":"query","schema":{"type":"string"}},{"name":"customer_oid","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"charges":[{"oid":"your_unique_id","source_id":"source_id","source":"baremetrics","status":"paid","created":1475452800,"customer":{"oid":"customer_1","source_id":"source_1","source":"stripe","created":1492605754,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":"Here are some notes","ltv":50000},"subscription":null,"amount":450000,"currency":"USD","original_amount":450000,"fee":500,"original_fee":500}]}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"post":{"tags":["Charges"],"summary":"Create Charge","description":"Create \"One-Off\" charges that are not linked to a subscription.\n\n> [!CAUTION]\n> These charges **do not** affect MRR. They only impact Net Revenue and Other Revenue.\n\n> [!CAUTION]\n> **If you are managing subscription charges manually, please note that this will not impact the subscription state or MRR. For example, if you stop sending charges, the subscription will stay active until you cancel it. This feature is purely designed to allow people to control the timing of charges, and for people who have custom proration methods.**\n>\n> If you want to manually manage subscription charges, then please contact support.\n>\n> Otherwise, we will automatically create charges.\n\n> [!CAUTION]\n> **Zero-decimal currencies**\n>\n> Our API expects currencies to be submitted in their smallest unit. The value 100 USD, for example, should be submitted to our API as 10,000 (i.e. 10,000 cents).\n>\n> We consider the following currencies to be zero-decimal:\\\n> BIF, DJF, JPY, KRW, PYG, VND, XAF, XPF, CLP, GNF, KMF, MGA, RWF, VUV, XOF, ISK, HUF\n>\n> **Special Exceptions**\n>\n> Although the Hungarian Forint (HUF) is sometimes considered to have an exponent of 2, our API treats HUF as a zero-decimal currency. All HUF values should therefore be rounded to the nearest whole number (e.g. a charge of HUF 100.95 should be submitted to our API as 101).","operationId":"create-charge","parameters":[{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["oid","amount","currency","customer_oid"],"properties":{"oid":{"type":"string","description":"Your unique reference for this charge"},"amount":{"type":"integer","description":"The charge amount (in cents)","format":"int32"},"currency":{"type":"string","description":"The ISO code of the currency of this plan. E.G: usd"},"customer_oid":{"type":"string","description":"Your unique ID for the customer"},"created":{"type":"string","description":"Unix timestamp of when this was created","default":"NOW","format":"date-time"},"status":{"type":"string","description":"The status of this charge. Can be paid or failed. Defaults to paid.","default":"paid"},"fee":{"type":"integer","default":0,"format":"int32"},"subscription_oid":{"type":"string","description":"This can only be supplied when Subscription Auto Charging is disabled. Please contact support if you want to handle your subscription charges manually."}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"charge":{"oid":"your_unique_id","source_id":"source_id","source":"baremetrics","status":"paid","created":1475452800,"customer":{"oid":"customer_1","source_id":"source_1","source":"stripe","created":1492605754,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":"Here are some notes","ltv":50000},"subscription":null,"amount":450000,"currency":"USD","original_amount":450000,"fee":500,"original_fee":500}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/{source_id}/charges/{oid}":{"get":{"tags":["Charges"],"summary":"Show Charge","operationId":"show-charge","parameters":[{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}},{"name":"oid","in":"path","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"charge":{"oid":"your_unique_id","source_id":"source_id","source":"baremetrics","status":"paid","created":1475452800,"customer":{"oid":"customer_1","source_id":"source_1","source":"stripe","created":1492605754,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":"Here are some notes","ltv":50000},"subscription":null,"amount":450000,"currency":"USD","original_amount":450000,"fee":500,"original_fee":500}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"delete":{"tags":["Charges"],"summary":"Delete Charge","description":"Delete \"One-Off\" charges that are not linked to a subscription.\n\n> [!WARNING]\n> You can only remove charges that were created via the API directly. Charges created automatically from Subscriptions cannot be removed via this endpoint.","operationId":"delete-charge","parameters":[{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","schema":{"type":"string"},"required":true},{"name":"oid","in":"path","schema":{"type":"string"},"required":true}],"responses":{"202":{"description":"202","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/{source_id}/refunds":{"get":{"tags":["Refunds"],"summary":"List Refunds","operationId":"list-refunds","parameters":[{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","schema":{"type":"string"},"required":true},{"name":"start","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"end","in":"query","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"refunds":[{"oid":"your_unique_id","source_id":"source_id","source":"stripe","charge_oid":"charge_oid","created":1510789071,"customer":{"oid":"customer_1","source_id":"source_id","source":"stripe","created":1445122336,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":null,"ltv":116148},"amount":8700}]}}},"schema":{"type":"object","properties":{"refunds":{"type":"array","items":{"type":"object","properties":{"oid":{"type":"string","example":"your_unique_id"},"source_id":{"type":"string","example":"source_id"},"source":{"type":"string","example":"stripe"},"charge_oid":{"type":"string","example":"charge_oid"},"created":{"type":"integer","example":1510789071,"default":0},"customer":{"type":"object","properties":{"oid":{"type":"string","example":"customer_1"},"source_id":{"type":"string","example":"source_id"},"source":{"type":"string","example":"stripe"},"created":{"type":"integer","example":1445122336,"default":0},"email":{"type":"string","example":"customer_1@baremetrics.com"},"name":{"type":"string","example":"Customer 1"},"display_image":{"type":"string","example":"https://logo.clearbit.com/baremetrics.com"},"display_name":{"type":"string","example":"Customer 1"},"notes":{},"ltv":{"type":"integer","example":116148,"default":0}}},"amount":{"type":"integer","example":8700,"default":0}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"post":{"tags":["Refunds"],"summary":"Create Refund","description":"Create \"One-Off\" refunds that are not linked to a subscription.\n\n> [!CAUTION]\n> These refunds **do not** affect MRR. They only impact Net Revenue and Other Revenue.\n\n> [!CAUTION]\n> **Zero-decimal currencies**\n>\n> Our API expects currencies to be submitted in their smallest unit. The value 100 USD, for example, should be submitted to our API as 10,000 (i.e. 10,000 cents).\n>\n> We consider the following currencies to be zero-decimal:\\\n> BIF, DJF, JPY, KRW, PYG, VND, XAF, XPF, CLP, GNF, KMF, MGA, RWF, VUV, XOF, ISK, HUF\n>\n> **Special Exceptions**\n>\n> Although the Hungarian Forint (HUF) is sometimes considered to have an exponent of 2, our API treats HUF as a zero-decimal currency. All HUF values should therefore be rounded to the nearest whole number (e.g. a charge of HUF 100.95 should be submitted to our API as 101).","operationId":"create-refund","parameters":[{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["oid","amount","currency","customer_oid","charge_oid"],"properties":{"oid":{"type":"string","description":"Your unique reference for this charge"},"amount":{"type":"integer","description":"The charge amount (in cents)","format":"int32"},"currency":{"type":"string","description":"The ISO code of the currency of this plan. E.G: usd"},"customer_oid":{"type":"string","description":"Your unique ID for the customer"},"charge_oid":{"type":"string","description":"Which charge do you want to refund? This must be an API charge."},"created":{"type":"string","description":"Unix timestamp of when this was created","default":"NOW","format":"date-time"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"refund":{"oid":"your_unique_id","source_id":"source_id","source":"baremetrics","created":1475452800,"customer":{"oid":"customer_1","source_id":"source_1","source":"stripe","created":1492605754,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":"Here are some notes","ltv":50000},"charge":{"oid":"123","source_id":"source_id","source":"baremetrics","status":"paid","created":1475452800,"currency":"usd","amount":450000,"original_amount":450000},"amount":450000}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/{source_id}/refunds/{oid}":{"get":{"tags":["Refunds"],"summary":"Show Refund","operationId":"show-refund","parameters":[{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","schema":{"type":"string"},"required":true},{"name":"oid","in":"path","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"oid":"your_unique_id","source_id":"source_id","source":"stripe","charge_oid":"charge_oid","created":1510789071,"customer":{"oid":"customer_1","source_id":"source_id","source":"stripe","created":1445122336,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":null,"ltv":116148},"amount":8700}}},"schema":{"type":"object","properties":{"oid":{"type":"string","example":"your_unique_id"},"source_id":{"type":"string","example":"source_id"},"source":{"type":"string","example":"stripe"},"charge_oid":{"type":"string","example":"charge_oid"},"created":{"type":"integer","example":1510789071,"default":0},"customer":{"type":"object","properties":{"oid":{"type":"string","example":"customer_1"},"source_id":{"type":"string","example":"source_id"},"source":{"type":"string","example":"stripe"},"created":{"type":"integer","example":1445122336,"default":0},"email":{"type":"string","example":"customer_1@baremetrics.com"},"name":{"type":"string","example":"Customer 1"},"display_image":{"type":"string","example":"https://logo.clearbit.com/baremetrics.com"},"display_name":{"type":"string","example":"Customer 1"},"notes":{},"ltv":{"type":"integer","example":116148,"default":0}}},"amount":{"type":"integer","example":8700,"default":0}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"delete":{"tags":["Refunds"],"summary":"Delete Refund","description":"Delete \"One-Off\" refunds that are not linked to a subscription.\n\n> [!WARNING]\n> You can only remove refunds that were created via the API directly. Refunds created automatically from Subscriptions cannot be removed via this endpoint.","operationId":"delete-refund","parameters":[{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","schema":{"type":"string"},"required":true},{"name":"oid","in":"path","schema":{"type":"string"},"required":true}],"responses":{"202":{"description":"202","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/{source_id}/events":{"get":{"tags":["Events"],"summary":"List Events","operationId":"list-events","parameters":[{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","schema":{"type":"string"},"required":true},{"name":"live_stream","in":"query","description":"Set this to true to only return events that show up in the live stream","schema":{"type":"string","default":"false"}},{"name":"start","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"end","in":"query","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"events":[{"id":"id_1","event_type":"charge","source":"baremetrics","source_id":"baremetrics_1","timestamp":1475452800,"customer":{"oid":"customer_1","source_id":"source_1","source":"stripe","created":1492605754,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":"Here are some notes","ltv":50000}}],"meta":{"pagination":{"has_more":false,"page":0,"per_page":30}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/{source_id}/events/{id}":{"get":{"tags":["Events"],"summary":"Show Event","operationId":"show-event","parameters":[{"name":"source_id","in":"path","description":"Please see [Sources](/reference/sources)","schema":{"type":"string"},"required":true},{"name":"id","in":"path","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"event":{"id":"id_1","event_type":"charge","source":"baremetrics","source_id":"baremetrics_1","timestamp":1475452800,"customer":{"oid":"customer_1","source_id":"source_1","source":"stripe","created":1492605754,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":"Here are some notes","ltv":50000}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/metrics":{"get":{"tags":["Metrics"],"summary":"Show Summary","operationId":"show-summary","parameters":[{"name":"start_date","in":"query","required":true,"schema":{"type":"string","default":"2016-11-01"}},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","default":"2016-11-26"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"metrics":[{"human_date":"2016-11-26","date":1480118400,"active_customers":642,"active_subscriptions":642,"add_on_mrr":0,"arpu":9383,"arr":72289044,"cancellations":0,"coupons":43300,"downgrades":0,"failed_charges":1,"fees":7373,"ltv":159039,"mrr":6024087,"net_revenue":233498,"new_customers":0,"other_revenue":0,"reactivated_customers":0,"refunds":0,"revenue_churn":543,"trial_conversions":0,"upgrades":1,"user_churn":590},{"human_date":"2016-11-27","date":1480204800,"active_customers":640,"active_subscriptions":640,"add_on_mrr":0,"arpu":9362,"arr":71900916,"cancellations":2,"coupons":6677,"downgrades":1,"failed_charges":1,"fees":4452,"ltv":158949,"mrr":5991743,"net_revenue":129723,"new_customers":0,"other_revenue":0,"reactivated_customers":0,"refunds":0,"revenue_churn":497,"trial_conversions":0,"upgrades":1,"user_churn":589}]}}},"schema":{"type":"object","properties":{"metrics":{"type":"array","items":{"type":"object","properties":{"human_date":{"type":"string","example":"2016-11-26"},"date":{"type":"integer","example":1480118400,"default":0},"active_customers":{"type":"integer","example":642,"default":0},"active_subscriptions":{"type":"integer","example":642,"default":0},"add_on_mrr":{"type":"integer","example":0,"default":0},"arpu":{"type":"integer","example":9383,"default":0},"arr":{"type":"integer","example":72289044,"default":0},"cancellations":{"type":"integer","example":0,"default":0},"coupons":{"type":"integer","example":43300,"default":0},"downgrades":{"type":"integer","example":0,"default":0},"failed_charges":{"type":"integer","example":1,"default":0},"fees":{"type":"integer","example":7373,"default":0},"ltv":{"type":"integer","example":159039,"default":0},"mrr":{"type":"integer","example":6024087,"default":0},"net_revenue":{"type":"integer","example":233498,"default":0},"new_customers":{"type":"integer","example":0,"default":0},"other_revenue":{"type":"integer","example":0,"default":0},"reactivated_customers":{"type":"integer","example":0,"default":0},"refunds":{"type":"integer","example":0,"default":0},"revenue_churn":{"type":"integer","example":543,"default":0},"trial_conversions":{"type":"integer","example":0,"default":0},"upgrades":{"type":"integer","example":1,"default":0},"user_churn":{"type":"integer","example":590,"default":0}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/metrics/{metric}":{"get":{"tags":["Metrics"],"summary":"Show Metric","operationId":"show-metric","parameters":[{"name":"metric","in":"path","required":true,"description":"You can see a list of available metrics [here](/reference/available-metrics)","schema":{"type":"string","default":""}},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","format":"date","default":"2016-11-01"}},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","format":"date","default":"2016-11-26"}},{"name":"compare_to","in":"query","description":"The number of days ago to compare results to","schema":{"type":"integer","format":"int32","default":30}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"metrics":[{"date":1480118400,"human_date":"2016-11-26","value":6024087,"notes":null,"previous":{"date":1477526400,"human_date":"2016-10-27","value":5941979,"percent":1.4,"notes":null}},{"date":1480204800,"human_date":"2016-11-27","value":5991743,"notes":null,"previous":{"date":1477612800,"human_date":"2016-10-28","value":5932562,"percent":1,"notes":null}},{"date":1480291200,"human_date":"2016-11-28","value":6050735,"notes":null,"previous":{"date":1477699200,"human_date":"2016-10-29","value":5940529,"percent":1.9,"notes":null}},{"date":1480377600,"human_date":"2016-11-29","value":6076135,"notes":null,"previous":{"date":1477785600,"human_date":"2016-10-30","value":5935279,"percent":2.4,"notes":null}}]}}},"schema":{"type":"object","properties":{"metrics":{"type":"array","items":{"type":"object","properties":{"date":{"type":"integer","example":1480118400,"default":0},"human_date":{"type":"string","example":"2016-11-26"},"value":{"type":"integer","example":6024087,"default":0},"notes":{},"previous":{"type":"object","properties":{"date":{"type":"integer","example":1477526400,"default":0},"human_date":{"type":"string","example":"2016-10-27"},"value":{"type":"integer","example":5941979,"default":0},"percent":{"type":"number","example":1.4,"default":0},"notes":{}}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/metrics/{metric}/customers":{"get":{"tags":["Metrics"],"summary":"Show Customers","description":"Returns a list of customers that make up this metric. For example, the upgrades metric will return all customers who have upgraded within the selected range. You can also see their MRR contribution.","operationId":"show-customers","parameters":[{"name":"start_date","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"metric","in":"path","required":true,"description":"You can see a list of available metrics [here](/reference/customer)","schema":{"type":"string","default":""}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"metrics":[{"date":1475107200,"human_date":"2016-09-29","value":2,"customers":[{"mrr":5000,"customer":{"oid":"customer_1","source_id":"source_1","source":"stripe","created":1492605754,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":"Here are some notes","ltv":50000},"current_plan":{"oid":"mrr_50_mo","source_id":"stripe_1","source":"stripe","name":"Startup $50 - MRR - Monthly","interval":"month","interval_count":1,"trial_duration":null,"trial_duration_unit":null,"created":1450216295,"active":true,"setup_fees":0,"amounts":[{"currency":"USD","symbol":"$","symbol_right":false,"amount":5000}]},"previous_plan":{"oid":"free","source_id":"stripe_1","source":"stripe","name":"Free","interval":"month","interval_count":1,"trial_duration":14,"trial_duration_unit":"day","created":1438620623,"active":true,"setup_fees":0,"amounts":[{"currency":"USD","symbol":"$","symbol_right":false,"amount":0}]}}]}]}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/metrics/{metric}/plans":{"get":{"tags":["Metrics"],"summary":"Show Plan Breakout","description":"This allows you to break down a metric by plan, across a date range","operationId":"show-plan-breakout","parameters":[{"name":"start_date","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"metric","in":"path","required":true,"description":"You can see a list of available metrics [here](/reference/available-metrics)","schema":{"type":"string","default":""}}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"metrics":[{"date":1477872000,"human_date":"2016-10-31","value":52664,"plan":{"oid":"startup_yearly_790","source_id":"3ULWIj59pU016O","source":"stripe","name":"Startup (Yearly)","interval":"year","interval_count":1,"trial_duration":null,"trial_duration_unit":null,"created":1394818080,"active":true,"setup_fees":0,"amounts":[{"currency":"USD","symbol":"$","symbol_right":false,"amount":79000}]}}]}}},"schema":{"type":"object","properties":{"metrics":{"type":"array","items":{"type":"object","properties":{"date":{"type":"integer","example":1477872000,"default":0},"human_date":{"type":"string","example":"2016-10-31"},"value":{"type":"integer","example":52664,"default":0},"plan":{"type":"object","properties":{"oid":{"type":"string","example":"startup_yearly_790"},"source_id":{"type":"string","example":"3ULWIj59pU016O"},"source":{"type":"string","example":"stripe"},"name":{"type":"string","example":"Startup (Yearly)"},"interval":{"type":"string","example":"year"},"interval_count":{"type":"integer","example":1,"default":0},"trial_duration":{},"trial_duration_unit":{},"created":{"type":"integer","example":1394818080,"default":0},"active":{"type":"boolean","example":true,"default":true},"setup_fees":{"type":"integer","example":0,"default":0},"amounts":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string","example":"USD"},"symbol":{"type":"string","example":"$"},"symbol_right":{"type":"boolean","example":false,"default":true},"amount":{"type":"integer","example":79000,"default":0}}}}}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/metrics/cohorts":{"get":{"tags":["Metrics"],"summary":"Show Cohorts","operationId":"show-cohorts","responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":[{"end":"2017-08-31","mrr":569521,"begin":"2017-08-01","cells":[{"end":"2017-08-31","user":{"total":1563,"absolute":1533,"percentage":0.98},"begin":"2017-08-01","revenue":{"total":569521,"absolute":554122,"percentage":0.97,"absolute_formatted":"$5,541","total_formatted":"$569,521"}},{"end":"2017-09-30","user":{"total":1563,"absolute":1509,"percentage":0.97},"begin":"2017-09-01","revenue":{"total":569521,"absolute":541089,"percentage":0.95,"absolute_formatted":"$5,410","total_formatted":"$569,521"}},{"end":"2017-10-31","user":{"total":1563,"absolute":1476,"percentage":0.94},"begin":"2017-10-01","revenue":{"total":569521,"absolute":522393,"percentage":0.92,"absolute_formatted":"$5,223","total_formatted":"$569,521"}},{"end":"2017-11-30","user":{"total":1563,"absolute":1454,"percentage":0.93},"begin":"2017-11-01","revenue":{"total":569521,"absolute":509309,"percentage":0.89,"absolute_formatted":"$5,093","total_formatted":"$569,521"}},{"end":"2017-12-31","user":{"total":1563,"absolute":1437,"percentage":0.92},"begin":"2017-12-01","revenue":{"total":569521,"absolute":499460,"percentage":0.88,"absolute_formatted":"$4,994","total_formatted":"$569,521"}},{"end":"2018-01-31","user":{"total":1563,"absolute":1421,"percentage":0.91},"begin":"2018-01-01","revenue":{"total":569521,"absolute":490544,"percentage":0.86,"absolute_formatted":"$4,905","total_formatted":"$569,521"}},{"end":"2018-02-28","user":{"total":1563,"absolute":1403,"percentage":0.9},"begin":"2018-02-01","revenue":{"total":569521,"absolute":480095,"percentage":0.84,"absolute_formatted":"$4,800","total_formatted":"$569,521"}},{"end":"2018-03-31","user":{"total":1563,"absolute":1383,"percentage":0.88},"begin":"2018-03-01","revenue":{"total":569521,"absolute":469370,"percentage":0.82,"absolute_formatted":"$4,693","total_formatted":"$569,521"}},{"end":"2018-04-30","user":{"total":1563,"absolute":1372,"percentage":0.88},"begin":"2018-04-01","revenue":{"total":569521,"absolute":463904,"percentage":0.81,"absolute_formatted":"$4,639","total_formatted":"$569,521"}},{"end":"2018-05-31","user":{"total":1563,"absolute":1363,"percentage":0.87},"begin":"2018-05-01","revenue":{"total":569521,"absolute":458738,"percentage":0.81,"absolute_formatted":"$4,587","total_formatted":"$569,521"}},{"end":"2018-06-30","user":{"total":1563,"absolute":1334,"percentage":0.85},"begin":"2018-06-01","revenue":{"total":569521,"absolute":448529,"percentage":0.79,"absolute_formatted":"$4,485","total_formatted":"$569,521"}},{"end":"2018-07-31","user":{"total":1563,"absolute":1313,"percentage":0.84},"begin":"2018-07-01","revenue":{"total":569521,"absolute":439404,"percentage":0.77,"absolute_formatted":"$4,394","total_formatted":"$569,521"}},{"end":"2018-08-31","user":{"total":1563,"absolute":1185,"percentage":0.76},"begin":"2018-08-01","revenue":{"total":569521,"absolute":544633,"percentage":0.96,"absolute_formatted":"$5,446","total_formatted":"$569,521"}},{"end":"2018-09-30","user":{"total":1563,"absolute":1097,"percentage":0.7},"begin":"2018-09-01","revenue":{"total":569521,"absolute":555553,"percentage":0.98,"absolute_formatted":"$5,555","total_formatted":"$569,521"}},{"end":"2018-10-31","user":{"total":1563,"absolute":1089,"percentage":0.7},"begin":"2018-10-01","revenue":{"total":569521,"absolute":550585,"percentage":0.97,"absolute_formatted":"$5,505","total_formatted":"$569,521"}},{"end":"2018-11-30","user":{"total":1563,"absolute":1085,"percentage":0.69},"begin":"2018-11-01","revenue":{"total":569521,"absolute":547985,"percentage":0.96,"absolute_formatted":"$5,479","total_formatted":"$569,521"}},{"end":"2018-12-31","user":{"total":1563,"absolute":1081,"percentage":0.69},"begin":"2018-12-01","revenue":{"total":569521,"absolute":544584,"percentage":0.96,"absolute_formatted":"$5,445","total_formatted":"$569,521"}},{"end":"2019-01-31","user":{"total":1563,"absolute":1068,"percentage":0.68},"begin":"2019-01-01","revenue":{"total":569521,"absolute":537324,"percentage":0.94,"absolute_formatted":"$5,373","total_formatted":"$569,521"}},{"end":"2019-02-28","user":{"total":1563,"absolute":1065,"percentage":0.68},"begin":"2019-02-01","revenue":{"total":569521,"absolute":535216,"percentage":0.94,"absolute_formatted":"$5,352","total_formatted":"$569,521"}},{"end":"2019-03-31","user":{"total":1563,"absolute":1058,"percentage":0.68},"begin":"2019-03-01","revenue":{"total":569521,"absolute":530816,"percentage":0.93,"absolute_formatted":"$5,308","total_formatted":"$569,521"}},{"end":"2019-04-30","user":{"total":1563,"absolute":1055,"percentage":0.67},"begin":"2019-04-01","revenue":{"total":569521,"absolute":528000,"percentage":0.93,"absolute_formatted":"$5,280","total_formatted":"$569,521"}},{"end":"2019-05-31","user":{"total":1563,"absolute":1049,"percentage":0.67},"begin":"2019-05-01","revenue":{"total":569521,"absolute":524092,"percentage":0.92,"absolute_formatted":"$5,240","total_formatted":"$569,521"}},{"end":"2019-06-30","user":{"total":1563,"absolute":1046,"percentage":0.67},"begin":"2019-06-01","revenue":{"total":569521,"absolute":522416,"percentage":0.92,"absolute_formatted":"$5,224","total_formatted":"$569,521"}},{"end":"2019-07-31","user":{"total":1563,"absolute":1040,"percentage":0.67},"begin":"2019-07-01","revenue":{"total":569521,"absolute":518940,"percentage":0.91,"absolute_formatted":"$5,189","total_formatted":"$569,521"}}],"customers":1563,"mrr_formatted":"$5,695"}]}},"schema":{"type":"array","items":{"type":"object","properties":{"end":{"type":"string","example":"2017-08-31"},"mrr":{"type":"integer","example":569521,"default":0},"begin":{"type":"string","example":"2017-08-01"},"cells":{"type":"array","items":{"type":"object","properties":{"end":{"type":"string","example":"2017-08-31"},"user":{"type":"object","properties":{"total":{"type":"integer","example":1563,"default":0},"absolute":{"type":"integer","example":1533,"default":0},"percentage":{"type":"number","example":0.98,"default":0}}},"begin":{"type":"string","example":"2017-08-01"},"revenue":{"type":"object","properties":{"total":{"type":"integer","example":569521,"default":0},"absolute":{"type":"integer","example":554122,"default":0},"percentage":{"type":"number","example":0.97,"default":0},"absolute_formatted":{"type":"string","example":"$5,541"},"total_formatted":{"type":"string","example":"$569,521"}}}}}},"customers":{"type":"integer","example":1563,"default":0},"mrr_formatted":{"type":"string","example":"$5,695"}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/segments/fields":{"get":{"tags":["Segments"],"summary":"List Fields","description":"Returns the fields that can be used to create/search a segment. The key is the category, and a category contains multiple fields.","operationId":"list-fields","responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"baremetrics":[{"field":"oid","title":"OID","type":"string","methods":["equals","not_equals","contains","not_contains"]},{"field":"email","title":"Email Address","type":"string","methods":["equals","not_equals","contains","not_contains"]}],"clearbit":[{"field":"company.geo.country","title":"Clearbit Company Country","type":"string","methods":["equals","not_equals","contains","not_contains"]}]}}},"schema":{"type":"object","properties":{"baremetrics":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","example":"oid"},"title":{"type":"string","example":"OID"},"type":{"type":"string","example":"string"},"methods":{"type":"array","items":{"type":"string","example":"equals"}}}}},"clearbit":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","example":"company.geo.country"},"title":{"type":"string","example":"Clearbit Company Country"},"type":{"type":"string","example":"string"},"methods":{"type":"array","items":{"type":"string","example":"equals"}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/segments":{"get":{"tags":["Segments"],"summary":"List Segments","operationId":"list-segments","responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"segments":[{"id":"1","name":"Active Customers","query":[{"category":"baremetrics","field":"subscriptions.is_active","method":"true","value":"true"}],"created_at":1492523687,"updated_at":1492614366}]}}},"schema":{"type":"object","properties":{"segments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"1"},"name":{"type":"string","example":"Active Customers"},"query":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","example":"baremetrics"},"field":{"type":"string","example":"subscriptions.is_active"},"method":{"type":"string","example":"true"},"value":{"type":"string","example":"true"}}}},"created_at":{"type":"integer","example":1492523687,"default":0},"updated_at":{"type":"integer","example":1492614366,"default":0}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"post":{"tags":["Segments"],"summary":"Create Segment","description":"The category is one of three keys: baremetrics, clearbit, or customer\\_properties that you can see from [listing fields](/reference/list-fields).\n\n![Segment filters in Baremetrics](/developer-docs/images/create-segment.png)","operationId":"create-segment","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["query"],"properties":{"query":{"type":"array","items":{"properties":{"category":{"type":"string"},"field":{"type":"string"},"value":{"type":"string","description":"Can be an string, integer, or boolean"},"method":{"type":"string"}},"required":["category","field","value","method"],"type":"object"}},"name":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"segment":{"id":"1","name":"Active Customers","query":[{"category":"baremetrics","field":"subscriptions.is_active","method":"boolean","value":"true"}],"created_at":1492523687,"updated_at":1492614366}}}},"schema":{"type":"object","properties":{"segment":{"type":"object","properties":{"id":{"type":"string","example":"1"},"name":{"type":"string","example":"Active Customers"},"query":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","example":"baremetrics"},"field":{"type":"string","example":"subscriptions.is_active"},"method":{"type":"string","example":"boolean"},"value":{"type":"string","example":"true"}}}},"created_at":{"type":"integer","example":1492523687,"default":0},"updated_at":{"type":"integer","example":1492614366,"default":0}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/segments/{id}":{"get":{"tags":["Segments"],"summary":"Show Segment","operationId":"show-segment","parameters":[{"name":"id","in":"path","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"segment":{"id":"1","name":"Active Customers","query":[{"category":"baremetrics","field":"subscriptions.is_active","method":"true","value":"true"}],"created_at":1492523687,"updated_at":1492614366}}}},"schema":{"type":"object","properties":{"segment":{"type":"object","properties":{"id":{"type":"string","example":"1"},"name":{"type":"string","example":"Active Customers"},"query":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","example":"baremetrics"},"field":{"type":"string","example":"subscriptions.is_active"},"method":{"type":"string","example":"true"},"value":{"type":"string","example":"true"}}}},"created_at":{"type":"integer","example":1492523687,"default":0},"updated_at":{"type":"integer","example":1492614366,"default":0}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"put":{"tags":["Segments"],"summary":"Update Segment","operationId":"update-segment","parameters":[{"name":"id","in":"path","schema":{"type":"string"},"required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"query":{"type":"array","items":{"properties":{"category":{"type":"string"},"field":{"type":"string"},"value":{"type":"string","description":"Can be an string, integer, or boolean"},"method":{"type":"string"}},"required":["category","field","value","method"],"type":"object"}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"segment":{"id":"1","name":"Active Customers","query":[{"category":"baremetrics","field":"subscriptions.is_active","method":"true","value":"true"}],"created_at":1492523687,"updated_at":1492614366}}}},"schema":{"type":"object","properties":{"segment":{"type":"object","properties":{"id":{"type":"string","example":"1"},"name":{"type":"string","example":"Active Customers"},"query":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","example":"baremetrics"},"field":{"type":"string","example":"subscriptions.is_active"},"method":{"type":"string","example":"true"},"value":{"type":"string","example":"true"}}}},"created_at":{"type":"integer","example":1492523687,"default":0},"updated_at":{"type":"integer","example":1492614366,"default":0}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"delete":{"tags":["Segments"],"summary":"Delete Segment","operationId":"delete-segment","parameters":[{"name":"id","in":"path","schema":{"type":"string"},"required":true}],"responses":{"202":{"description":"202","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/segments/search":{"post":{"tags":["Segments"],"summary":"Search Segment","description":"Search for a segment without saving it","operationId":"search-segment","parameters":[{"name":"per_page","in":"query","schema":{"type":"integer","format":"int32","default":30}},{"name":"page","in":"query","schema":{"type":"integer","format":"int32","default":0}},{"name":"sort","in":"query","schema":{"type":"string","default":"created"}},{"name":"order","in":"query","schema":{"type":"string","default":"asc"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["query"],"properties":{"query":{"type":"array","items":{"properties":{"category":{"type":"string"},"field":{"type":"string"},"value":{"type":"string","description":"Can be an string, integer, or boolean"},"method":{"type":"string"}},"required":["category","field","value","method"],"type":"object"}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"customers":[{"oid":"customer_1","source_id":"source_1","source":"stripe","created":1492605754,"email":"customer_1@baremetrics.com","name":"Customer 1","display_image":"https://logo.clearbit.com/baremetrics.com","display_name":"Customer 1","notes":"Here are some notes","ltv":50000,"is_active":true,"is_canceled":false,"current_mrr":1000,"current_plans":[{"oid":"plan_1","source_id":"source_1","source":"stripe","name":"Plan 1","interval":"month","interval_count":1,"trial_duration":null,"trial_duration_unit":null,"created":1492605754,"active":true,"setup_fees":0,"amounts":[{"currency":"USD","symbol":"$","symbol_right":false,"amount":1000}]}]}]}}},"schema":{"type":"object","properties":{"customers":{"type":"array","items":{"type":"object","properties":{"oid":{"type":"string","example":"customer_1"},"source_id":{"type":"string","example":"source_1"},"source":{"type":"string","example":"stripe"},"created":{"type":"integer","example":1492605754,"default":0},"email":{"type":"string","example":"customer_1@baremetrics.com"},"name":{"type":"string","example":"Customer 1"},"display_image":{"type":"string","example":"https://logo.clearbit.com/baremetrics.com"},"display_name":{"type":"string","example":"Customer 1"},"notes":{"type":"string","example":"Here are some notes"},"ltv":{"type":"integer","example":50000,"default":0},"is_active":{"type":"boolean","example":true,"default":true},"is_canceled":{"type":"boolean","example":false,"default":true},"current_mrr":{"type":"integer","example":1000,"default":0},"current_plans":{"type":"array","items":{"type":"object","properties":{"oid":{"type":"string","example":"plan_1"},"source_id":{"type":"string","example":"source_1"},"source":{"type":"string","example":"stripe"},"name":{"type":"string","example":"Plan 1"},"interval":{"type":"string","example":"month"},"interval_count":{"type":"integer","example":1,"default":0},"trial_duration":{},"trial_duration_unit":{},"created":{"type":"integer","example":1492605754,"default":0},"active":{"type":"boolean","example":true,"default":true},"setup_fees":{"type":"integer","example":0,"default":0},"amounts":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string","example":"USD"},"symbol":{"type":"string","example":"$"},"symbol_right":{"type":"boolean","example":false,"default":true},"amount":{"type":"integer","example":1000,"default":0}}}}}}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/attributes":{"post":{"tags":["Attributes"],"summary":"Set Attributes","description":"Create or update properties on customers. This will work across all sources.\n\n> [!CAUTION]\n> **If you have multiple customers with the same OID (across multiple Sources) then this will update them all.**\n>\n> You must specify an oid, or email.\n\n> [!WARNING]\n> Array fields should have a comma separated list value","operationId":"set-attributes","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"attributes":{"type":"array","items":{"properties":{"customer_oid":{"type":"string","description":"Supply this, or customer_email"},"customer_email":{"type":"string","description":"Supply this, or customer_oid"},"field_id":{"type":"string"},"value":{"type":"string","description":"For an array field, use a comma seperated string"}},"required":["customer_oid","customer_email","field_id","value"],"type":"object"}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{"error":"Title has already been taken"}}},"schema":{"type":"object","properties":{"error":{"type":"string","example":"Title has already been taken"}}}}}},"409":{"description":"Conflict","content":{"text/plain":{"examples":{"Result":{"value":{"error":"Title has already been taken","duplicated_id":6}}},"schema":{"type":"object","properties":{"error":{"type":"string","example":"Title has already been taken"},"duplicated_id":{"type":"integer","example":6,"default":0}}}}}}},"deprecated":false}},"/v1/attributes/fields":{"get":{"tags":["Attributes"],"summary":"List Attribute Fields","operationId":"list-attribute-fields","responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"attribute_fields":[{"id":4,"field_type":"date","title":"Intercom Last Opened","title_with_type":"[date] Intercom Last Opened"}]}}},"schema":{"type":"object","properties":{"attribute_fields":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":4,"default":0},"field_type":{"type":"string","example":"date"},"title":{"type":"string","example":"Intercom Last Opened"},"title_with_type":{"type":"string","example":"[date] Intercom Last Opened"}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"post":{"tags":["Attributes"],"summary":"Create Attribute Field","operationId":"create-attribute-field","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["field_type","title"],"properties":{"field_type":{"type":"string","description":"string, integer, date, boolean, array"},"title":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"attribute_field":{"id":4,"field_type":"date","title":"Intercom Last Opened","title_with_type":"[date] Intercom Last Opened"}}}},"schema":{"type":"object","properties":{"attribute_field":{"type":"object","properties":{"id":{"type":"integer","example":4,"default":0},"field_type":{"type":"string","example":"date"},"title":{"type":"string","example":"Intercom Last Opened"},"title_with_type":{"type":"string","example":"[date] Intercom Last Opened"}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/attributes/fields/{id}":{"put":{"tags":["Attributes"],"summary":"Update Attribute Field","operationId":"update-attribute-field","parameters":[{"name":"id","in":"path","schema":{"type":"string"},"required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["title"],"properties":{"title":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"attribute_fields":{"id":4,"field_type":"date","title":"Intercom Last Opened","title_with_type":"[date] Intercom Last Opened"}}}},"schema":{"type":"object","properties":{"attribute_fields":{"type":"object","properties":{"id":{"type":"integer","example":4,"default":0},"field_type":{"type":"string","example":"date"},"title":{"type":"string","example":"Intercom Last Opened"},"title_with_type":{"type":"string","example":"[date] Intercom Last Opened"}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/cancellation_insights/events":{"get":{"tags":["Cancellation Insights"],"summary":"List Events","operationId":"list-cancellation-insight-events","responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"events":[{"id":"1","comment":null,"created_at":1540920251,"subscriptions":[{"oid":"1","source_id":"1","source":"stripe","canceled_at":1540920254,"started_at":1538422033,"processed":true,"active":false,"quantity":0,"discount":0,"mrr":0,"add_on_mrr":0,"plan":null}],"reason":{"id":"1","text":"Too expensive"},"customer":{"oid":"customer_1","source_id":"1","source":"stripe","created":1538422031,"email":"email@example.com","name":"Customer 1","display_image":"https://logo.clearbit.com/example.com","display_name":"Customer 1","notes":null,"ltv":0}}],"meta":{"pagination":{"has_more":true,"page":0,"per_page":1}}}}},"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"1"},"comment":{},"created_at":{"type":"integer","example":1540920251,"default":0},"subscriptions":{"type":"array","items":{"type":"object","properties":{"oid":{"type":"string","example":"1"},"source_id":{"type":"string","example":"1"},"source":{"type":"string","example":"stripe"},"canceled_at":{"type":"integer","example":1540920254,"default":0},"started_at":{"type":"integer","example":1538422033,"default":0},"processed":{"type":"boolean","example":true,"default":true},"active":{"type":"boolean","example":false,"default":true},"quantity":{"type":"integer","example":0,"default":0},"discount":{"type":"integer","example":0,"default":0},"mrr":{"type":"integer","example":0,"default":0},"add_on_mrr":{"type":"integer","example":0,"default":0},"plan":{}}}},"reason":{"type":"object","properties":{"id":{"type":"string","example":"1"},"text":{"type":"string","example":"Too expensive"}}},"customer":{"type":"object","properties":{"oid":{"type":"string","example":"customer_1"},"source_id":{"type":"string","example":"1"},"source":{"type":"string","example":"stripe"},"created":{"type":"integer","example":1538422031,"default":0},"email":{"type":"string","example":"email@example.com"},"name":{"type":"string","example":"Customer 1"},"display_image":{"type":"string","example":"https://logo.clearbit.com/example.com"},"display_name":{"type":"string","example":"Customer 1"},"notes":{},"ltv":{"type":"integer","example":0,"default":0}}}}}},"meta":{"type":"object","properties":{"pagination":{"type":"object","properties":{"has_more":{"type":"boolean","example":true,"default":true},"page":{"type":"integer","example":0,"default":0},"per_page":{"type":"integer","example":1,"default":0}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"post":{"tags":["Cancellation Insights"],"summary":"Create Event","operationId":"create-event","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["reason_id"],"properties":{"reason_id":{"type":"string"},"comment":{"type":"string"},"customer_oid":{"type":"string"},"subscription_oids":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"event":{"id":"1","comment":null,"created_at":1540920251,"subscriptions":[{"oid":"1","source_id":"1","source":"stripe","canceled_at":1540920254,"started_at":1538422033,"processed":true,"active":false,"quantity":0,"discount":0,"mrr":0,"add_on_mrr":0,"plan":null}],"reason":{"id":"1","text":"Too expensive"},"customer":{"oid":"customer_1","source_id":"1","source":"stripe","created":1538422031,"email":"email@example.com","name":"Customer 1","display_image":"https://logo.clearbit.com/example.com","display_name":"Customer 1","notes":null,"ltv":0}}}}},"schema":{"type":"object","properties":{"event":{"type":"object","properties":{"id":{"type":"string","example":"1"},"comment":{},"created_at":{"type":"integer","example":1540920251,"default":0},"subscriptions":{"type":"array","items":{"type":"object","properties":{"oid":{"type":"string","example":"1"},"source_id":{"type":"string","example":"1"},"source":{"type":"string","example":"stripe"},"canceled_at":{"type":"integer","example":1540920254,"default":0},"started_at":{"type":"integer","example":1538422033,"default":0},"processed":{"type":"boolean","example":true,"default":true},"active":{"type":"boolean","example":false,"default":true},"quantity":{"type":"integer","example":0,"default":0},"discount":{"type":"integer","example":0,"default":0},"mrr":{"type":"integer","example":0,"default":0},"add_on_mrr":{"type":"integer","example":0,"default":0},"plan":{}}}},"reason":{"type":"object","properties":{"id":{"type":"string","example":"1"},"text":{"type":"string","example":"Too expensive"}}},"customer":{"type":"object","properties":{"oid":{"type":"string","example":"customer_1"},"source_id":{"type":"string","example":"1"},"source":{"type":"string","example":"stripe"},"created":{"type":"integer","example":1538422031,"default":0},"email":{"type":"string","example":"email@example.com"},"name":{"type":"string","example":"Customer 1"},"display_image":{"type":"string","example":"https://logo.clearbit.com/example.com"},"display_name":{"type":"string","example":"Customer 1"},"notes":{},"ltv":{"type":"integer","example":0,"default":0}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/cancellation_insights/events/{id}":{"get":{"tags":["Cancellation Insights"],"summary":"Show Event","operationId":"show-event-1","parameters":[{"name":"id","in":"path","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"event":{"id":"1","comment":null,"created_at":1540920251,"subscriptions":[{"oid":"1","source_id":"1","source":"stripe","canceled_at":1540920254,"started_at":1538422033,"processed":true,"active":false,"quantity":0,"discount":0,"mrr":0,"add_on_mrr":0,"plan":null}],"reason":{"id":"1","text":"Too expensive"},"customer":{"oid":"customer_1","source_id":"1","source":"stripe","created":1538422031,"email":"email@example.com","name":"Customer 1","display_image":"https://logo.clearbit.com/example.com","display_name":"Customer 1","notes":null,"ltv":0}}}}},"schema":{"type":"object","properties":{"event":{"type":"object","properties":{"id":{"type":"string","example":"1"},"comment":{},"created_at":{"type":"integer","example":1540920251,"default":0},"subscriptions":{"type":"array","items":{"type":"object","properties":{"oid":{"type":"string","example":"1"},"source_id":{"type":"string","example":"1"},"source":{"type":"string","example":"stripe"},"canceled_at":{"type":"integer","example":1540920254,"default":0},"started_at":{"type":"integer","example":1538422033,"default":0},"processed":{"type":"boolean","example":true,"default":true},"active":{"type":"boolean","example":false,"default":true},"quantity":{"type":"integer","example":0,"default":0},"discount":{"type":"integer","example":0,"default":0},"mrr":{"type":"integer","example":0,"default":0},"add_on_mrr":{"type":"integer","example":0,"default":0},"plan":{}}}},"reason":{"type":"object","properties":{"id":{"type":"string","example":"1"},"text":{"type":"string","example":"Too expensive"}}},"customer":{"type":"object","properties":{"oid":{"type":"string","example":"customer_1"},"source_id":{"type":"string","example":"1"},"source":{"type":"string","example":"stripe"},"created":{"type":"integer","example":1538422031,"default":0},"email":{"type":"string","example":"email@example.com"},"name":{"type":"string","example":"Customer 1"},"display_image":{"type":"string","example":"https://logo.clearbit.com/example.com"},"display_name":{"type":"string","example":"Customer 1"},"notes":{},"ltv":{"type":"integer","example":0,"default":0}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"put":{"tags":["Cancellation Insights"],"summary":"Update Event","operationId":"update-event","parameters":[{"name":"id","in":"path","schema":{"type":"string"},"required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason_id":{"type":"string"},"comment":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"event":{"id":"1","comment":null,"created_at":1540920251,"subscriptions":[{"oid":"1","source_id":"1","source":"stripe","canceled_at":1540920254,"started_at":1538422033,"processed":true,"active":false,"quantity":0,"discount":0,"mrr":0,"add_on_mrr":0,"plan":null}],"reason":{"id":"1","text":"Too expensive"},"customer":{"oid":"customer_1","source_id":"1","source":"stripe","created":1538422031,"email":"email@example.com","name":"Customer 1","display_image":"https://logo.clearbit.com/example.com","display_name":"Customer 1","notes":null,"ltv":0}}}}},"schema":{"type":"object","properties":{"event":{"type":"object","properties":{"id":{"type":"string","example":"1"},"comment":{},"created_at":{"type":"integer","example":1540920251,"default":0},"subscriptions":{"type":"array","items":{"type":"object","properties":{"oid":{"type":"string","example":"1"},"source_id":{"type":"string","example":"1"},"source":{"type":"string","example":"stripe"},"canceled_at":{"type":"integer","example":1540920254,"default":0},"started_at":{"type":"integer","example":1538422033,"default":0},"processed":{"type":"boolean","example":true,"default":true},"active":{"type":"boolean","example":false,"default":true},"quantity":{"type":"integer","example":0,"default":0},"discount":{"type":"integer","example":0,"default":0},"mrr":{"type":"integer","example":0,"default":0},"add_on_mrr":{"type":"integer","example":0,"default":0},"plan":{}}}},"reason":{"type":"object","properties":{"id":{"type":"string","example":"1"},"text":{"type":"string","example":"Too expensive"}}},"customer":{"type":"object","properties":{"oid":{"type":"string","example":"customer_1"},"source_id":{"type":"string","example":"1"},"source":{"type":"string","example":"stripe"},"created":{"type":"integer","example":1538422031,"default":0},"email":{"type":"string","example":"email@example.com"},"name":{"type":"string","example":"Customer 1"},"display_image":{"type":"string","example":"https://logo.clearbit.com/example.com"},"display_name":{"type":"string","example":"Customer 1"},"notes":{},"ltv":{"type":"integer","example":0,"default":0}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/cancellation_insights/reasons/{id}":{"get":{"tags":["Cancellation Insights"],"summary":"Show Reason","operationId":"show-reason","parameters":[{"name":"id","in":"path","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"reason":{"id":"172877c7-8b79-4948-a255-e020b80b3821","text":"Technical issues","sort_key":0}}}},"schema":{"type":"object","properties":{"reason":{"type":"object","properties":{"id":{"type":"string","example":"172877c7-8b79-4948-a255-e020b80b3821"},"text":{"type":"string","example":"Technical issues"},"sort_key":{"type":"integer","example":0,"default":0}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"delete":{"tags":["Cancellation Insights"],"summary":"Delete Reason","operationId":"delete-reason","parameters":[{"name":"id","in":"path","schema":{"type":"string"},"required":true}],"responses":{"202":{"description":"202","content":{"application/json":{"examples":{}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"put":{"tags":["Cancellation Insights"],"summary":"Update Reason","operationId":"update-reason","parameters":[{"name":"id","in":"path","schema":{"type":"string"},"required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["text"],"properties":{"text":{"type":"string"},"sort_key":{"type":"integer","format":"int32"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"reason":{"id":"172877c7-8b79-4948-a255-e020b80b3821","text":"Technical issues","sort_key":0}}}},"schema":{"type":"object","properties":{"reason":{"type":"object","properties":{"id":{"type":"string","example":"172877c7-8b79-4948-a255-e020b80b3821"},"text":{"type":"string","example":"Technical issues"},"sort_key":{"type":"integer","example":0,"default":0}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}},"/v1/cancellation_insights/reasons":{"get":{"tags":["Cancellation Insights"],"summary":"List Reasons","operationId":"list-reasons","responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"reasons":[{"id":"172877c7-8b79-4948-a255-e020b80b3821","text":"Technical issues","sort_key":0},{"id":"3609459a-6929-491f-b5b1-e02142772703","text":"Shutting down the company","sort_key":2},{"id":"190ab9a6-9449-479e-b414-4905bbe3450e","text":"Missing features I need","sort_key":3},{"id":"60991a6f-58b8-4ea7-8898-8facde7dab49","text":"Switching to another product","sort_key":4},{"id":"5b6392c5-480a-427d-bdad-4dee9ebd1699","text":"Not sure how to use the data & tools","sort_key":5},{"id":"9fc2561c-6553-4a57-94a9-d6001820ae59","text":"Other (please explain below)","sort_key":6},{"id":"ff9e2598-b6f5-49ee-bbad-9c536b67c55b","text":"Not using it enough","sort_key":6}],"meta":{"pagination":{"has_more":false,"page":0,"per_page":30}}}}},"schema":{"type":"object","properties":{"reasons":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"172877c7-8b79-4948-a255-e020b80b3821"},"text":{"type":"string","example":"Technical issues"},"sort_key":{"type":"integer","example":0,"default":0}}}},"meta":{"type":"object","properties":{"pagination":{"type":"object","properties":{"has_more":{"type":"boolean","example":false,"default":true},"page":{"type":"integer","example":0,"default":0},"per_page":{"type":"integer","example":30,"default":0}}}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false},"post":{"tags":["Cancellation Insights"],"summary":"Create Reason","operationId":"create-reason","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["text"],"properties":{"text":{"type":"string"},"sort_key":{"type":"integer","format":"int32"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"examples":{"Result":{"value":{"reason":{"id":"172877c7-8b79-4948-a255-e020b80b3821","text":"Technical issues","sort_key":0}}}},"schema":{"type":"object","properties":{"reason":{"type":"object","properties":{"id":{"type":"string","example":"172877c7-8b79-4948-a255-e020b80b3821"},"text":{"type":"string","example":"Technical issues"},"sort_key":{"type":"integer","example":0,"default":0}}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"examples":{"Result":{"value":{}}},"schema":{"type":"object","properties":{}}}}}},"deprecated":false}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Your API key from [Settings → API](https://app.baremetrics.com/settings/api), or an OAuth access token."}}}}