NAV
shell ruby java python javascript

Introduction

Welcome to the Reveniq API!.

We have examples in Shell, Ruby, Java, Javascript, Python. You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Authentication

To authorize all requests from this point bellow, use your user's API Token created on Dashboard as an Authorization header in the request.

curl -X GET \
  https://api.reveniq.com/v1/RESOURCE \
  -H 'Authorization: YOUR_API_TOKEN_HERE' \
  -H 'Content-Type: application/json' \
require 'uri'
require 'net/http'

url = URI("http://api.reveniq.com/api/v1/RESOURCE")

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

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["Authorization"] = 'YOUR_API_TOKEN_HERE'

response = http.request(request)
puts response.read_body
HttpResponse<String> response = Unirest.get("http://api.reveniq.com/api/v1/RESOURCE")
  .header("Content-Type", "application/json")
  .header("Authorization", "YOUR_API_TOKEN_HERE")
  .asString();
import requests

url = "http://api.reveniq.com/api/v1/RESOURCE"

payload = ""
headers = {
    'Content-Type': "application/json",
    'Authorization': "YOUR_API_TOKEN_HERE",
    }

response = requests.request("GET", url, data=payload, headers=headers)

print(response.text)
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();


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

xhr.open("GET", "http://api.reveniq.com/api/v1/RESOURCE");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");

xhr.send(data);

Make sure to replace YOUR_API_TOKEN_HERE with your API key.

To make API calls you will need your personal API token which can be found under My Account.

Reveniq API expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: YOUR_API_TOKEN_HERE

Revenue

Revenue Report

curl -X GET \
  https://api.reveniq.com/v1/revenue/reports.csv \
  -H 'Authorization: YOUR_API_TOKEN_HERE'
require 'uri'
require 'net/http'

url = URI("https://api.reveniq.com/v1/revenue/reports.csv")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'YOUR_API_TOKEN_HERE'

response = http.request(request)
puts response.read_body
HttpResponse<String> response = Unirest.get("https://api.reveniq.com/v1/revenue/reports.csv")
  .header("Authorization", "YOUR_API_TOKEN_HERE")
  .asString();
import requests

url = "https://api.reveniq.com/v1/revenue/reports.csv"

headers = {
    'Authorization': "YOUR_API_TOKEN_HERE",
    }

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

print(response.text)
var data = null;

var xhr = new XMLHttpRequest();


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

xhr.open("GET", "https://api.reveniq.com/v1/revenue/reports.csv");
xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");

xhr.send(data);

The above commands returns CSV structured like this:

Invoice ID,Customer ID,Account Name,Stripe Invoice ID,Salesforce ID,Unit Price,Quantity,Stripe Description,Product ID,Created Date,Status,Currency,Monthly Revenue Variance,No Of Months,MRR,ARR,MRR Variance,ARR Variance,Start Date,End Date
2367,26,abc,in_wewewdadasdsads,01t7V000006aR48QAE,0.5,449,"Formula meter point €0,50 Maestro plan",113,2023-03-01T18:41:44.981Z,approved,EUR - Euro,1.5,1,224.5,2694.0,1.5,18.0,2023-03-01 18:41:44 UTC,2023-03-31 18:41:44 UTC

This endpoint returns a csv with the revenue report of the selected period. If we are not passing period parameter it will return current month revenue report.

HTTP Request

GET https://api.reveniq.com/v1/revenue/reports.csv

URL Parameters

Parameter Description Optional
period Month and Year of the report which need to be generated eg: "03-2023" YES

Reports

License

curl -X GET \
  https://api.reveniq.com/v1/reports/license.csv \
  -H 'Authorization: YOUR_API_TOKEN_HERE'
require 'uri'
require 'net/http'

url = URI("https://api.reveniq.com/v1/reports/license.csv")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'YOUR_API_TOKEN_HERE'

response = http.request(request)
puts response.read_body
HttpResponse<String> response = Unirest.get("https://api.reveniq.com/v1/reports/license.csv")
  .header("Authorization", "YOUR_API_TOKEN_HERE")
  .asString();
import requests

url = "https://api.reveniq.com/v1/reports/license.csv"

headers = {
    'Authorization': "YOUR_API_TOKEN_HERE",
    }

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

print(response.text)
var data = null;

var xhr = new XMLHttpRequest();


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

xhr.open("GET", "https://api.reveniq.com/v1/reports/license.csv");
xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");

xhr.send(data);

The above commands returns CSV structured like this:

Account Name,Product Name,Currency,Salesforce Account ID,Salesforce Account Name,Salesforce Product ID,Dec-2022,Jan-2023,Feb-2023,Mar-2023,Apr-2023
EXc and St John District Council,Annual COMPOSER base plan to Cloud-based Energy Management and Analytics Subscription,gbp,0017V04581m9CNGHGA2,,136.37,136.37,136.37 ,136.37 ,136.37 
Derry City and Strabane District Council,Annual single value datapoint subscription,gbp,0017V00001m9CNYQA2,,76.37,87.28,87.28 ,87.28 ,87.28 

This endpoint returns a csv with the license report of the selected periods.

HTTP Request

GET https://api.reveniq.com/v1/reports/license.csv

URL Parameters

Parameter Description Required
from_date starting date of the report which need to be generated eg: "DD-MM-YYYY" YES
to_date ending date of the report which need to be generated eg: "DD-MM-YYYY". if the query parameter from_date: "01-01-2023" and to_date: "31-01-2023" will return license reports between these two dates. NO

Invoices

Bills

curl -X GET \
  https://api.reveniq.com/v1/invoices/bills \
  -H 'Authorization: YOUR_API_TOKEN_HERE'
require 'uri'
require 'net/http'

url = URI("https://api.reveniq.com/v1/invoices/bills")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'YOUR_API_TOKEN_HERE'

response = http.request(request)
puts response.read_body
HttpResponse<String> response = Unirest.get("https://api.reveniq.com/v1/invoices/bills")
  .header("Authorization", "YOUR_API_TOKEN_HERE")
  .asString();
import requests

url = "https://api.reveniq.com/v1/invoices/bills"

headers = {
    'Authorization': "YOUR_API_TOKEN_HERE",
    }

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

print(response.text)
var data = null;

var xhr = new XMLHttpRequest();


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

xhr.open("GET", "https://api.reveniq.com/v1/invoices/bills");
xhr.setRequestHeader("Authorization", "YOUR_API_TOKEN_HERE");

xhr.send(data);

The above commands returns Json like this:

{
    "invoice": [
        {
            "id": 9001,
            "stripe_description": "Payments to: \nWattics Ltd\nVAT: IGTG\nSwift - KIB PTCG\nIban - IE$RAD5GTHJ\n\nThanks for your business!",
            "netsuite_customer_id": null,
            "total": "281.58",
            "due_date": 1675490680,
            "xero_created_at": "2023-02-03T06:05:09.000Z",
            "state": "approved",
            "stripe_status": "draft",
            "currency_code": "gbp",
            "invoice_line_items": [
                {
                    "xero_item_code": "Maestro License £",
                    "netsuite_item_id": null,
                    "quantity": 1,
                    "description": "Maestro Subscription £",
                    "percentage_discount": null,
                    "unit_price": "252.3",
                    "xero_account": "215",
                    "invoice_id": 9001,
                    "tax_rate": "0.0",
                    "created_at": "2023-02-03T06:05:11.208Z",
                    "xero_tax_name": "Non-EU Sales - Services ",
                    "recurring_interval": "month",
                    "recurring_interval_count": "1",
                    "xero_tax_type": "TAX007",
                    "product_id": 64,
                    "stripe_description": "Maestro Subscription £",
                    "invoice_line_discount": [
                        {
                            "discount_amount": "0.0",
                            "netsuite_tax_id": null
                        }
                    ]
                },
                {
                    "xero_item_code": "Single Value Datapoint £",
                    "netsuite_item_id": null,
                    "quantity": 12,
                    "description": "Maestro SV data point £",
                    "percentage_discount": null,
                    "unit_price": "2.44",
                    "xero_account": "215",
                    "invoice_id": 2041,
                    "tax_rate": null,
                    "created_at": "2023-02-03T06:05:11.228Z",
                    "xero_tax_name": "Non-EU Sales - Services ",
                    "recurring_interval": "month",
                    "recurring_interval_count": "1",
                    "xero_tax_type": "TAX007",
                    "product_id": 65,
                    "stripe_description": "Maestro SV data point £",
                    "invoice_line_discount": [
                        {
                            "discount_amount": "0.0",
                            "netsuite_tax_id": null
                        }
                    ]
                },
                {
                    "xero_item_code": "Multi value datapoint £",
                    "netsuite_item_id": null,
                    "quantity": 0,
                    "description": "Maestro MV data point £",
                    "percentage_discount": null,
                    "unit_price": "4.88",
                    "xero_account": "215",
                    "invoice_id": 9001,
                    "tax_rate": null,
                    "created_at": "2023-02-03T06:05:11.240Z",
                    "xero_tax_name": "Non-EU Sales - Services ",
                    "recurring_interval": "month",
                    "recurring_interval_count": "1",
                    "xero_tax_type": "TAX007",
                    "product_id": 66,
                    "stripe_description": "Maestro MV data point £",
                    "invoice_line_discount": [
                        {
                            "discount_amount": "0.0",
                            "netsuite_tax_id": null
                        }
                    ]
                },
                {
                    "xero_item_code": "Prorata",
                    "netsuite_item_id": null,
                    "quantity": 0,
                    "description": "Maestro Formula meter £",
                    "percentage_discount": null,
                    "unit_price": "0.87",
                    "xero_account": "215",
                    "invoice_id": 9001,
                    "tax_rate": null,
                    "created_at": "2023-02-03T06:05:11.256Z",
                    "xero_tax_name": "Non-EU Sales - Services ",
                    "recurring_interval": "month",
                    "recurring_interval_count": "1",
                    "xero_tax_type": "TAX007",
                    "product_id": 67,
                    "stripe_description": "Maestro Formula meter £",
                    "invoice_line_discount": [
                        {
                            "discount_amount": "0.0",
                            "netsuite_tax_id": null
                        }
                    ]
                }
            ]
        }
    ]
}

This endpoint returns a json with the array of invoice for the selected period. If we are not passing period it will return all the invoices from system.

HTTP Request

GET https://api.reveniq.com/v1/invoices/bills

URL Parameters

Parameter Description Optional
period Month and Year of the report which need to be generated eg: "03-2023" YES
customer_email Email ID of the customer YES
page Used for pagination. returns invoice list by pages. and the default is 1 YES
per A limit on the number of invoices to be returned. Limit can range between 1 and 100, and the default is 100. YES

Errors

The Reveniq API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Invalid Token.
403 Forbidden -- The resource requested is not allowed to the user who owns the token.
404 Not Found -- The specified resource could not be found.
422 Unprocessable Entity -- Resource transformation invalid
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.