Using the Hub API¶
The Hub API is a RESTful interface allowing you to programmatically access the same functions you may also already access using the Hub API.
The API has predictable resource-oriented URLs, accepts only JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication and verbs.
Each API command is available at a specific endpoint. To trigger this endpoint you need to construct an appropriate URL. Hub URLs are made up of three parts:
BASE URL + API PATH + ENDPOINT
The base URL for Hub is always
The API path specifies the major API version you wish to access. Currently only one API path is available:
The endpoint will depend on which function you wish to call.
For example, the
POST /orders endpoint can be used to create a new order. Its full URL is:
Where a list API allows filtering, the rules between different parameters are applied as ANDs, while a parameter with multiple values are applied as ORs.
For example, if a filter query string was
organisation=5&organisation=10&type=invoice this would look for invoices only with an organisation ID of 5 or 6.
Pagination is achieved with two parameters that are applied consistently across the API.
per_pagedetermines the number of results desired in a given page.
pagestarts at 1 and determines the page of results you wish to view
For example, if
per_page is set to
page is set to
2 you will receive results 25-48.
Results will include the
X-Total-Pages headers to tell you the total number of results, and the total number of pages.
If you don't specify
per_page then a suitable default will be used. This is currently
1000 in most cases, but may vary from one endpoint to another and may be changed without notice. You cannot set
per_page any higher than
A small demonstration of the Hub API is available from https://github.com/siphonnetworks/hub-api-sample-python