The Baremetrics API Developer Hub

Baremetrics 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!

If 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.

The Baremetrics API is currently in alpha testing. If you would like to help us test it, please reach out.

    

Search results for "{{ search.query }}"

No results found for "{{search.query}}". 
View All Results
Suggest Edits

Introduction

 

Baremetrics 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!

If 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.

You'll need a Baremetrics account to use the API. Your API keys are available in the Settings area.

Suggest Edits

Authentication

Authentication to the Baremetrics API is performed using a bearer token. To use this, send the following with your request:

 
-H "Authorization: Bearer APIKEY"

You can view your API key here

All requests must be sent over HTTPS

Authentication Error

{
  "error": "Unauthorized. Token not found"
}

Test Authentication

You can call the following endpoint to confirm you are authenticated

RestClient.get 'https://api.baremetrics.com/v1/account'
 

To help you build your integration, we have setup a full sandbox environment for you.

The sandbox is underpowered relative to our production servers. Please only use the sandbox for testing that your code works... don't submit a significant amount of data else it could take a very very long time to process!

You can view your sandbox API key here

Sandbox API

You can use the Sandbox API by using: https://api-sandbox.baremetrics.com

Sandbox Dashboard

You can access the Sandbox Dashboard in your API Settings

You must access the sandbox from this link. Trying to access it directly will ask for a username/password, and your existing ones won't work for the sandbox.

Suggest Edits

Pagination

 

All 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.

The following objects will be returned in all paginated responses:

{
  ...
  "meta": {
    "pagination": {
      "has_more": false,
      "page": 0,
      "per_page": 30
    }
  }
}
Suggest Edits

Rate Limit

 

Our rate limit set to 1000 requests per hour. If you need to temporarily increase this, please contact us.

We will return the following headers to help you manage this:

X-RateLimit-Limit
X-RateLimit-Remaining
Suggest Edits

Quick Start Guide

Learn how to create your first plan, customer and subscription in Baremetrics. Still need help? Join us in the #api channel in our Slack!

 

Getting your first customer into Baremetrics requires only 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.

You only need to create a plan once! It can be used over and over again for multiple customers and subscriptions.

Before you begin, snag the Source ID for the provider Baremetrics. You will need this anytime you create, modify or interact with plans, customers, subscriptions or charges through the API.

Create a Plan

Let's create a $10/mo. plan called *Basic Plan. Here's what that looks like.

The amount is in cents. So for our $10/mo. plan we will use an amount of 1000.

RestClient.post "https://api.baremetrics.com/v1/:source_id/plans", {
  oid: 'basic_plan',
  name: 'Basic',
  currency: 'usd',
  amount: 1000, 
  interval: 'month',
  interval_count: 1
}

If you did everything right, you'll get a 200 response with your new plan details!

{
  "plan": {
    "oid": "basic_plan",
    "source_id": "123",
    "source": "baremetrics",
    "name": "Basic",
    "interval": "month",
    "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": 1000
      }
    ]
  }
}

Create a Customer

Once you have at least one plan you can start creating customers.

You 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!

RestClient.post "https://api.baremetrics.com/v1/:source_id/customers", {
  oid: '123123123', # Provide a unique ID for the customer
  name: 'Josh Pigford',
  notes: 'Salesperson: Kaegan Donnelly', # This will populate the notes field in the customer profile
  email: 'josh@baremetrics.com', # We use the email address to retrieve social data about your customer such as a picture and location
  created: 1471343207 # The unix date "created" date for a customer. We add this to the customer profile as well.
}

If everything goes as planned, we'll return a 200 response with more details about the customer that you've created!

{
  "customer": {
    "oid": "123123123",
    "source_id": "source_1",
    "source": "stripe",
    "created": 1471343207,
    "email": "josh@baremetrics.com",
    "name": "Josh Pigford",
    "display_image": "https://logo.clearbit.com/baremetrics.com",
    "display_name": "Customer 1",
    "notes": 'Salesperson: Kaegan Donnelly',
    "ltv": 0,
    "is_active": false,
    "is_canceled": false,
    "current_mrr": 0,
    "current_plans": []
  }
}

Create a Subscription

Alright, 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!

You can get really fancy with subscriptions with things like addons and quantities, but we're going to keep this first one really simple.

RestClient.post "https://api.baremetrics.com/v1/:source_id/subscriptions", {
  oid: 'abcdabcd', # A unique ID for the subscription
  started_at: 1471887288, # The date the subscription begins
  canceled_at: nil, # The date the subscription ends, if applicable
  plan_oid: 'basic_plan', # The ID of the plan you created earlier
  customer_oid: '123123123', # The ID of the customer you created earlier
}

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.

Here's what your finished subscription customer will look like in Baremetrics!

Suggest Edits

Get Account

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/account
curl --request GET \
  --url https://api.baremetrics.com/v1/account
var request = require("request");

var options = { method: 'GET', url: 'https://api.baremetrics.com/v1/account' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/account")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/account");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/account"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
  }
}
 
Suggest Edits

List Sources

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/sources
curl --request GET \
  --url https://api.baremetrics.com/v1/sources
var request = require("request");

var options = { method: 'GET', url: 'https://api.baremetrics.com/v1/sources' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/sources")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/sources");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/sources"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "sources": [
    {
      "id": "source_id",
      "provider": "stripe",
      "provider_id": "<stripe_account_id>"
    },
    {
      "id": "source_id",
      "provider": "baremetrics",
      "provider_id": null
    }
  ]
}
 

Each Plan, Customer, Subscription and Charge belongs to a source. A source can be Stripe, Braintree, Recurly or the Baremetrics API.

When you want to interact with any of these objects, you must supply the Source in the URL. For example: GET /v1/:source_id/subscriptions

You can get your source_id from the Sources endpoint

Please note that while you can read data from your Stripe, Braintree and Recurly sources, you can only modify data that has been added via the API.

Suggest Edits

List Plans

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/source_id/plans
curl --request GET \
  --url https://api.baremetrics.com/v1/source_id/plans
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/source_id/plans' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/plans")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/source_id/plans");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/plans"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
        }
      ]
    }
  ]
}

Path Params

source_id
string
required

Please see Sources

Query Params

search
string

Allows you to search based on the name or oid fields

 
Suggest Edits

Show Plan

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/source_id/plans/oid
curl --request GET \
  --url https://api.baremetrics.com/v1/source_id/plans/oid
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/source_id/plans/oid' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/plans/oid")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/source_id/plans/oid");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/plans/oid"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
      }
    ]
  }
}

Path Params

oid
string
required
source_id
string
required

Please see Sources

 
Suggest Edits

Update Plan

 

Query Auth

 Authentication is required for this endpoint.
puthttps://api.baremetrics.com/v1/source_id/plans/plan_oid
curl --request PUT \
  --url https://api.baremetrics.com/v1/source_id/plans/plan_oid
var request = require("request");

var options = { method: 'PUT',
  url: 'https://api.baremetrics.com/v1/source_id/plans/plan_oid' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/plans/plan_oid")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.baremetrics.com/v1/source_id/plans/plan_oid");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/plans/plan_oid"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
      }
    ]
  }
}

Path Params

plan_oid
string
required

Your interval plan id

source_id
string
required

Please see Sources

Body Params

name
string
required

The new name of this plan

 
Suggest Edits

Create Plan

Create a plan for use when creating or updating subscriptions.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.baremetrics.com/v1/source_id/plans
curl --request POST \
  --url https://api.baremetrics.com/v1/source_id/plans
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.baremetrics.com/v1/source_id/plans' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/plans")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.baremetrics.com/v1/source_id/plans");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/plans"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
      }
    ]
  }
}
{
	"error": "Error message here"
}

Path Params

source_id
string
required

Please see Sources

Body Params

oid
string
required

Your unique ID for the plan

name
string
required

Your internal name for this plan. This will be displayed in the Plan Breakout section

currency
string
required

The ISO code of the currency of this plan. E.G: usd

amount
int32
required

How much is this plan? (In cents)

interval
string
required

day, month or year

interval_count
int32
required
 
Suggest Edits

Delete Plan

 

Query Auth

 Authentication is required for this endpoint.
deletehttps://api.baremetrics.com/v1/source_id/plans/oid
curl --request DELETE \
  --url https://api.baremetrics.com/v1/source_id/plans/oid
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.baremetrics.com/v1/source_id/plans/oid' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/plans/oid")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.baremetrics.com/v1/source_id/plans/oid");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/plans/oid"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

Try the API to see results

Path Params

oid
string
required
source_id
string
required

Please see Sources

 

You must delete all subscriptions on this plan before you can remove it.

Suggest Edits

List Customers

Fetch a list of all customers on your account

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/source_id/customers
curl --request GET \
  --url https://api.baremetrics.com/v1/source_id/customers
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/source_id/customers' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/customers")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/source_id/customers");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/customers"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
            }
          ]
        }
      ]
    }
  ]
}

Path Params

source_id
string
required

Please see Sources

Query Params

search
string

Allows you to search for a customer based on: oid, email, notes and name

sort
string

Allows you to sort the results. You can use ltv or created

order
string
 
Suggest Edits

Show Customer

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/source_id/customers/oid
curl --request GET \
  --url https://api.baremetrics.com/v1/source_id/customers/oid
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/source_id/customers/oid' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/customers/oid")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/source_id/customers/oid");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/customers/oid"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
          }
        ]
      }
    ]
  }
}

Path Params

oid
string
required
source_id
string
required

Please see Sources

 
Suggest Edits

List Customer Events

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/source_id/customers/oid/events
curl --request GET \
  --url https://api.baremetrics.com/v1/source_id/customers/oid/events
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/source_id/customers/oid/events' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/customers/oid/events")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/source_id/customers/oid/events");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/customers/oid/events"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
    }
  ]
}

Path Params

source_id
string
required

Please see Sources

oid
string
required
 
Suggest Edits

Update Customer

This endpoint allows you to update the basic information stored on a Customer, such as first name, last name and notes

 

Query Auth

 Authentication is required for this endpoint.
puthttps://api.baremetrics.com/v1/source_id/customers/customer_oid
curl --request PUT \
  --url https://api.baremetrics.com/v1/source_id/customers/customer_oid
var request = require("request");

var options = { method: 'PUT',
  url: 'https://api.baremetrics.com/v1/source_id/customers/customer_oid' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/customers/customer_oid")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.baremetrics.com/v1/source_id/customers/customer_oid");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/customers/customer_oid"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
          }
        ]
      }
    ]
  }
}
{
	"error": "Error message here"
}

Path Params

customer_oid
string
required

Your unique ID for the customer

source_id
string
required

Please see Sources

Body Params

name
string
notes
string
created
date-time

Unix timestamp of when this customer was created

email
string

Email for this customer

 
Suggest Edits

Create Customer

This endpoint allows you to create a customer record. After you create the record, you will be able to create a Subscription

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.baremetrics.com/v1/source_id/customers
curl --request POST \
  --url https://api.baremetrics.com/v1/source_id/customers
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.baremetrics.com/v1/source_id/customers' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/customers")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.baremetrics.com/v1/source_id/customers");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/customers"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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": []
  }
}
{
	"error": "Error message here"
}

Path Params

source_id
string
required

Please see Sources

Body Params

name
string
notes
string

Your own notes for this customer. These will be displayed in the profile

email
string

An email address for this customer. This is used to lookup extra profile information

oid
string
required

Your unique ID for the customer

created
date-time

A unix timestamp of when this customer was created. Defaults to now.

 

It may take a little while for us to fetch all of the profile information for the customer.

Suggest Edits

Delete Customer

 

Query Auth

 Authentication is required for this endpoint.
deletehttps://api.baremetrics.com/v1/source_id/customers/oid
curl --request DELETE \
  --url https://api.baremetrics.com/v1/source_id/customers/oid
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.baremetrics.com/v1/source_id/customers/oid' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/customers/oid")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.baremetrics.com/v1/source_id/customers/oid");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/customers/oid"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

Try the API to see results

Path Params

oid
string
required
source_id
string
required

Please see Sources

 

You must delete all subscriptions for this customer before you can remove them.

Suggest Edits

List Subscriptions

Get all subscriptions linked to this API Key.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/source_id/subscriptions
curl --request GET \
  --url https://api.baremetrics.com/v1/source_id/subscriptions
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/source_id/subscriptions' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/subscriptions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/source_id/subscriptions");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/subscriptions"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
          }
        ]
      }
    }
  ]
}

Path Params

source_id
string
required

Please see Sources

Query Params

customer_oid
string

This allows you to return subscriptions for a given customer

 
Suggest Edits

Show Subscription

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/source_id/subscriptions/oid
curl --request GET \
  --url https://api.baremetrics.com/v1/source_id/subscriptions/oid
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/source_id/subscriptions/oid' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/subscriptions/oid")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/source_id/subscriptions/oid");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/subscriptions/oid"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
        }
      ]
    }
  }
}

Path Params

oid
string
required
source_id
string
required

Please see Sources

 
Suggest Edits

Update Subscription

This allows you to update a Subscription, such as changing plans and addons.

 

Query Auth

 Authentication is required for this endpoint.
puthttps://api.baremetrics.com/v1/source_id/subscriptions/subscription_oid
curl --request PUT \
  --url https://api.baremetrics.com/v1/source_id/subscriptions/subscription_oid
var request = require("request");

var options = { method: 'PUT',
  url: 'https://api.baremetrics.com/v1/source_id/subscriptions/subscription_oid' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/subscriptions/subscription_oid")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.baremetrics.com/v1/source_id/subscriptions/subscription_oid");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/subscriptions/subscription_oid"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
  }
}
{
	"error": "Error message here"
}

Path Params

subscription_oid
string
required

Your unique ID for the subscription

source_id
string
required

Please see Sources

Body Params

plan_oid
string
required

Your unique ID for the plan

occurred_at
date-time

A unix timestamp of when this change occurred. Defaults to now

addons
array of objects
oid
amount
quantity
quantity
int32
discount
int32

Integer value (in the same currency as the plan)

 

Passing an empty "addons" array will remove all addons from this subscription.

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 endpoint.

Suggest Edits

Cancel Subscription

This endpoint allows you to cancel a subscription.

 

Query Auth

 Authentication is required for this endpoint.
puthttps://api.baremetrics.com/v1/source_id/subscriptions/subscription_oid/cancel
curl --request PUT \
  --url https://api.baremetrics.com/v1/source_id/subscriptions/subscription_oid/cancel
var request = require("request");

var options = { method: 'PUT',
  url: 'https://api.baremetrics.com/v1/source_id/subscriptions/subscription_oid/cancel' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/subscriptions/subscription_oid/cancel")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.baremetrics.com/v1/source_id/subscriptions/subscription_oid/cancel");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/subscriptions/subscription_oid/cancel"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "event": {
    "id": "48X3C1W4w5vCbx",
    "type": "subscription.canceled",
    "info": {
      "canceled_at": 1480421362,
      "addons": []
    },
    "occurred_at": 1480421362,
    "received_at": 1480421362
  }
}
{
	"error": "Error message here"
}

Path Params

subscription_oid
string
required

Your unique ID for the subscription

source_id
string
required

Please see Sources

Body Params

canceled_at
date-time
required

A unix timestamp of when this subscription was, or should be canceled.

 

It may take a while for your cancellations to appear in your metrics.

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.

Suggest Edits

Create Subscription

This endpoint allows you to create a Subscription.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.baremetrics.com/v1/source_id/subscriptions
curl --request POST \
  --url https://api.baremetrics.com/v1/source_id/subscriptions
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.baremetrics.com/v1/source_id/subscriptions' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/subscriptions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.baremetrics.com/v1/source_id/subscriptions");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/subscriptions"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "event": {
    "id": "48X1ZZHtRaBtfN",
    "type": "subscription.created",
    "info": {
      "oid": "subscription_51",
      "started_at": 1474381618,
      "plan_oid": "1476719008009",
      "customer_oid": "1476719006346",
      "auto_charge": true,
      "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
  }
}
{
	"error": "Error message here"
}

Path Params

source_id
string
required

Please see Sources

Body Params

oid
string
required

Your unique ID for the subscription

started_at
date-time
required

A unix timestamp of when this subscription started

canceled_at
date-time

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.

plan_oid
string
required

Your unique ID for the plan

customer_oid
string
required

Your unique ID for the customer

addons
array of objects
oid
amount
quantity
quantity
int32
discount
int32

Integer value (in the same currency as the plan)

 

You will need to create a Customer and Plan before you can use this endpoint.

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 endpoint.

How and why do I use addons?

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.

Let's look at a hypothetical way of charging for Baremetrics.

We could have a base subscription of $25/mo. Additional features like dunning, customer profiles, etc. could be treated as an addon.

$25/mo. base charge + $25 addon for Dunning = $50/mo.

Suggest Edits

Delete Subscription

 

Query Auth

 Authentication is required for this endpoint.
deletehttps://api.baremetrics.com/v1/source_id/subscriptions/oid
curl --request DELETE \
  --url https://api.baremetrics.com/v1/source_id/subscriptions/oid
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.baremetrics.com/v1/source_id/subscriptions/oid' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/subscriptions/oid")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.baremetrics.com/v1/source_id/subscriptions/oid");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/subscriptions/oid"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

Try the API to see results

Path Params

oid
string
required
source_id
string
required

Please see Sources

 

It may take a while for your subscriptions to disappear from your metrics.

Suggest Edits

List Annotations

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/annotations
curl --request GET \
  --url https://api.baremetrics.com/v1/annotations
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/annotations' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/annotations")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/annotations");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/annotations"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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"
      }
    }
  ]
}
 
Suggest Edits

Show Annotation

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/annotations/id
curl --request GET \
  --url https://api.baremetrics.com/v1/annotations/id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/annotations/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/annotations/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/annotations/id");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/annotations/id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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"
    }
  }
}

Path Params

id
string
required
 
Suggest Edits

Create Annotation

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.baremetrics.com/v1/annotations
curl --request POST \
  --url https://api.baremetrics.com/v1/annotations
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.baremetrics.com/v1/annotations' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/annotations")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.baremetrics.com/v1/annotations");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/annotations"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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"
    }
  }
}

Body Params

metric
string
required

Which metric is this for?

annotation
string
required

The annotation text

date
date
required

YYYY-MM-DD

global
boolean
required

Should this show on all graphs?

user_id
string
required

Who added this annotation?

 
Suggest Edits

Delete Annotation

 

Query Auth

 Authentication is required for this endpoint.
deletehttps://api.baremetrics.com/v1/annotations/id
curl --request DELETE \
  --url https://api.baremetrics.com/v1/annotations/id
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.baremetrics.com/v1/annotations/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/annotations/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.baremetrics.com/v1/annotations/id");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/annotations/id"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

Try the API to see results

Path Params

id
string
required
 
Suggest Edits

List Goals

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/goals
curl --request GET \
  --url https://api.baremetrics.com/v1/goals
var request = require("request");

var options = { method: 'GET', url: 'https://api.baremetrics.com/v1/goals' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/goals")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/goals");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/goals"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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"
    }
  ]
}
 
Suggest Edits

Show Goal

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/goals/id
curl --request GET \
  --url https://api.baremetrics.com/v1/goals/id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/goals/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/goals/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/goals/id");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/goals/id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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"
  }
}

Path Params

id
string
required

Unique ID

 
Suggest Edits

Create Goal

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.baremetrics.com/v1/goals
curl --request POST \
  --url https://api.baremetrics.com/v1/goals
var request = require("request");

var options = { method: 'POST', url: 'https://api.baremetrics.com/v1/goals' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/goals")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.baremetrics.com/v1/goals");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/goals"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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"
  }
}

Body Params

metric
string
required
start_amount
int32
required

In cents

end_amount
int32
required

In cents

start_date
date
required
end_date
date
required
name
string
required

The goal name

 
Suggest Edits

Delete Goal

 

Query Auth

 Authentication is required for this endpoint.
deletehttps://api.baremetrics.com/v1/goals/id
curl --request DELETE \
  --url https://api.baremetrics.com/v1/goals/id
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.baremetrics.com/v1/goals/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/goals/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.baremetrics.com/v1/goals/id");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/goals/id"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

Try the API to see results

Path Params

id
string
required
 
Suggest Edits

List Users

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/users
curl --request GET \
  --url https://api.baremetrics.com/v1/users
var request = require("request");

var options = { method: 'GET', url: 'https://api.baremetrics.com/v1/users' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/users")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/users");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/users"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "users": [
    {
      "id": "our_unique_id",
      "email": "user@baremetrics.com",
      "admin": true,
      "name": "User Name"
    }
  ]
}
 
Suggest Edits

Show User

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/users/id
curl --request GET \
  --url https://api.baremetrics.com/v1/users/id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/users/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/users/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/users/id");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/users/id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "user": {
    "id": "our_unique_id",
    "email": "user@baremetrics.com",
    "admin": true,
    "name": "User Name"
  }
}

Path Params

id
string
required
 
Suggest Edits

List Charges

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/source_id/charges
curl --request GET \
  --url https://api.baremetrics.com/v1/source_id/charges
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/source_id/charges' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/charges")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/source_id/charges");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/charges"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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,
      },
      "amount": 450000
    }
  ]
}

Path Params

source_id
string
required

Please see Sources

 
Suggest Edits

Show Charge

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/source_id/charges/:oid
curl --request GET \
  --url https://api.baremetrics.com/v1/source_id/charges/:oid
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/source_id/charges/:oid' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/charges/:oid")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/source_id/charges/:oid");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/charges/:oid"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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,
    },
    "amount": 450000
  }
}

Path Params

source_id
string
required

Please see Sources

 
Suggest Edits

Create Charge

Create "One-Off" charges that are not linked to a subscription.

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.baremetrics.com/v1/source_id/charges
curl --request POST \
  --url https://api.baremetrics.com/v1/source_id/charges
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.baremetrics.com/v1/source_id/charges' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/charges")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.baremetrics.com/v1/source_id/charges");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/charges"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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,
    },
    "amount": 450000
  }
}

Path Params

source_id
string
required

Please see Sources

Body Params

oid
string
required

Your unique reference for this charge

amount
int32
required

The charge amount (in cents)

currency
string
required

The ISO code of the currency of this plan. E.G: usd

customer_oid
string
required

Your unique ID for the customer

created
date-time

Unix timestamp of when this was created

status
string

The status of this charge. Can be paid or failed. Defaults to paid.

 

These charges do not affect MRR. They only impact Net Revenue and Other Revenue.

Suggest Edits

List Events

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/source_id/events
curl --request GET \
  --url https://api.baremetrics.com/v1/source_id/events
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/source_id/events' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/events")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/source_id/events");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/events"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
    }
  }
}

Path Params

source_id
string
required

Please see Sources

Query Params

live_stream
string

Set this to true to only return events that show up in the live stream

 
Suggest Edits

Show Event

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/source_id/events/id
curl --request GET \
  --url https://api.baremetrics.com/v1/source_id/events/id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/source_id/events/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/source_id/events/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/source_id/events/id");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/source_id/events/id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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,
    }
  }
}

Path Params

source_id
string
required

Please see Sources

id
string
required
 
Suggest Edits

Available Metrics

 

The following metrics are available through our Read API.

- active_customers
- active_subscriptions
- add_on_mrr
- arpu
- arr
- cancellations
- coupons
- downgrades
- failed_charges
- fees
- ltv
- mrr
- net_revenue
- new_customers
- new_subscriptions
- other_revenue
- reactivations
- refunds
- revenue_churn
- trial_conversions
- upgrades
- user_churn
Suggest Edits

Show Summary

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/metrics
curl --request GET \
  --url 'https://api.baremetrics.com/v1/metrics?start_date=2016-11-01&end_date=2016-11-26'
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/metrics',
  qs: 
   { start_date: '2016-11-01',
     end_date: '2016-11-26' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/metrics?start_date=2016-11-01&end_date=2016-11-26")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/metrics?start_date=2016-11-01&end_date=2016-11-26");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/metrics"

querystring = {"start_date":"2016-11-01","end_date":"2016-11-26"}

response = requests.request("GET", url, params=querystring)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
    }
  ]
}

Query Params

start_date
string
required
end_date
string
required
 
Suggest Edits

Show Metric

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/metrics/metric
curl --request GET \
  --url 'https://api.baremetrics.com/v1/metrics/metric?start_date=2016-11-01&end_date=2016-11-26'
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/metrics/metric',
  qs: 
   { start_date: '2016-11-01',
     end_date: '2016-11-26' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/metrics/metric?start_date=2016-11-01&end_date=2016-11-26")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/metrics/metric?start_date=2016-11-01&end_date=2016-11-26");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/metrics/metric"

querystring = {"start_date":"2016-11-01","end_date":"2016-11-26"}

response = requests.request("GET", url, params=querystring)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
      }
    }
  ]
}

Path Params

metric
string
required

You can see a list of available metrics here

Query Params

start_date
date
required
end_date
date
required
compare_to
int32

The number of days ago to compare results to

 
Suggest Edits

Show Customers

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.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/metrics/metric/customers
curl --request GET \
  --url 'https://api.baremetrics.com/v1/metrics/metric/customers?start_date=start_date&end_date=end_date'
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/metrics/metric/customers',
  qs: 
   { start_date: 'start_date',
     end_date: 'end_date' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/metrics/metric/customers?start_date=start_date&end_date=end_date")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/metrics/metric/customers?start_date=start_date&end_date=end_date");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/metrics/metric/customers"

querystring = {"start_date":"start_date","end_date":"end_date"}

response = requests.request("GET", url, params=querystring)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
              }
            ]
          }
        }
      ]
    }
  ]
}

Path Params

metric
string
required

You can see a list of available metrics here

Query Params

start_date
date
required
end_date
date
required
 
Suggest Edits

Show Plan Breakout

This allows you to break down a metric by plan, across a date range

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/metrics/metric/plans
curl --request GET \
  --url 'https://api.baremetrics.com/v1/metrics/metric/plans?start_date=start_date&end_date=end_date'
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/metrics/metric/plans',
  qs: 
   { start_date: 'start_date',
     end_date: 'end_date' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/metrics/metric/plans?start_date=start_date&end_date=end_date")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/metrics/metric/plans?start_date=start_date&end_date=end_date");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/metrics/metric/plans"

querystring = {"start_date":"start_date","end_date":"end_date"}

response = requests.request("GET", url, params=querystring)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
          }
        ]
      }
    }
  ]
}

Path Params

metric
string
required

You can see a list of available metrics here

Query Params

start_date
date
required
end_date
date
required
 
Suggest Edits

List Fields

Returns the fields that can be used to create/search a segment. The key is the category, and a category contains multiple fields.

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/segments/fields
curl --request GET \
  --url https://api.baremetrics.com/v1/segments/fields
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/segments/fields' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/segments/fields")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/segments/fields");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/segments/fields"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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"
      ]
    }
  ]
}
 
Suggest Edits

List Segments

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/segments
curl --request GET \
  --url https://api.baremetrics.com/v1/segments
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/segments' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/segments")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/segments");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/segments"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "segments": [
    {
      "id": "1",
      "name": "Active Customers",
      "query": [
        {
          "category": "baremetrics",
          "field": "subscriptions.is_active",
          "method": "true",
          "value": "true"
        }
      ],
      "created_at": 1492523687,
      "updated_at": 1492614366
    }
  ]
}
 
Suggest Edits

Show Segment

 

Query Auth

 Authentication is required for this endpoint.
gethttps://api.baremetrics.com/v1/segment/:id
curl --request GET \
  --url https://api.baremetrics.com/v1/segment/:id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.baremetrics.com/v1/segment/:id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/segment/:id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.baremetrics.com/v1/segment/:id");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/segment/:id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "segment": {
    "id": "1",
    "name": "Active Customers",
    "query": [
      {
        "category": "baremetrics",
        "field": "subscriptions.is_active",
        "method": "true",
        "value": "true"
      }
    ],
    "created_at": 1492523687,
    "updated_at": 1492614366
  }
}
 
Suggest Edits

Search Segment

Search for a segment without saving it

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.baremetrics.com/v1/segments/search
curl --request POST \
  --url https://api.baremetrics.com/v1/segments/search
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.baremetrics.com/v1/segments/search' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/segments/search")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.baremetrics.com/v1/segments/search");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/segments/search"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "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
            }
          ]
        }
      ]
    }
  ]
}

Query Params

per_page
int32
page
int32
sort
string
order
string

Body Params

query
array of objects
required
category
field
value
method
 
Suggest Edits

Create Segment

 

Query Auth

 Authentication is required for this endpoint.
posthttps://api.baremetrics.com/v1/segments
curl --request POST \
  --url https://api.baremetrics.com/v1/segments
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.baremetrics.com/v1/segments' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/segments")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.baremetrics.com/v1/segments");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/segments"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "segment": {
    "id": "1",
    "name": "Active Customers",
    "query": [
      {
        "category": "baremetrics",
        "field": "subscriptions.is_active",
        "method": "true",
        "value": "true"
      }
    ],
    "created_at": 1492523687,
    "updated_at": 1492614366
  }
}

Body Params

query
array of objects
required
category
field
value
method
name
string
 

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Suggest Edits

Update Segment

 

Query Auth

 Authentication is required for this endpoint.
puthttps://api.baremetrics.com/v1/segments/:id
curl --request PUT \
  --url https://api.baremetrics.com/v1/segments/:id
var request = require("request");

var options = { method: 'PUT',
  url: 'https://api.baremetrics.com/v1/segments/:id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/segments/:id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.baremetrics.com/v1/segments/:id");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/segments/:id"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "segment": {
    "id": "1",
    "name": "Active Customers",
    "query": [
      {
        "category": "baremetrics",
        "field": "subscriptions.is_active",
        "method": "true",
        "value": "true"
      }
    ],
    "created_at": 1492523687,
    "updated_at": 1492614366
  }
}
 
Suggest Edits

Delete Segment

 

Query Auth

 Authentication is required for this endpoint.
deletehttps://api.baremetrics.com/v1/segments/:id
curl --request DELETE \
  --url https://api.baremetrics.com/v1/segments/:id
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.baremetrics.com/v1/segments/:id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.baremetrics.com/v1/segments/:id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.baremetrics.com/v1/segments/:id");

xhr.send(data);
import requests

url = "https://api.baremetrics.com/v1/segments/:id"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

Try the API to see results