Integrations › For developers

API guide

Let another system, such as an accounting, stock or reporting tool, read your itsPOS products, stock and sales with an API key. The API is read-only: a key can never change anything in itsPOS.

Who can create keys

Create a key

  1. Open Integrations › API keys and press Create API key.
  2. Name: what the key is for, for example "Stock tool" (1 to 40 characters).
  3. What this key can read: any of
    • Products and prices (products and categories),
    • Stock levels,
    • Sales.
  4. Shops this key can read: every shop, or only the shops you choose. A key limited to Leeds can't read York's stock or sales. You can change the shops later; the key keeps working.
  5. Expires: after 30 days, 90 days, 1 year (the default) or never.
  6. Allowed IP addresses (optional): one per line, as an address (203.0.113.7) or a range (203.0.113.0/24). Calls from anywhere else are refused.
  7. Press Create. The key is shown once, starting itk_. Copy it into the other system straight away. itsPOS keeps only a fingerprint of it and can never show it again.

To change a key's access, create a new key, move your other system to it, then Revoke the old key. A revoked key stops working at once.

Call the API

Send each request to https://app.itspos.io/api/method/<method> with two headers:

GET https://app.itspos.io/api/method/itspos.api.inventory.list_stock?page=1&page_length=50
Authorization: Bearer itk_…
X-itsPOS-Site: <your account>

Methods a key can call

Only reading methods of products, stock and sales pass: itspos.api.catalog.*, itspos.api.inventory.* and itspos.api.sales.* whose name starts list_ or get_. Each also needs the matching access on the key. The ones most systems need:

Method Needs Returns
itspos.api.catalog.list_product Products and prices Products with prices, barcodes and VAT
itspos.api.catalog.get_product (name) Products and prices One product
itspos.api.catalog.list_category Products and prices Categories
itspos.api.inventory.list_stock Stock levels Stock on hand per product and shop
itspos.api.sales.list_transaction Sales Sales and refunds, newest first
itspos.api.sales.get_transaction (name) Sales One sale with its lines, payments and VAT

A method outside this pattern answers 404 "This method is not available with an API key.", and one the key's access doesn't cover answers 403.

Lists

Every list_ method takes:

Argument Meaning
search Text to search for
filters A JSON object of filters (unknown keys are refused)
from_date, to_date Dates, inclusive, where the records have a date (sales)
outlet One shop's code, for example OUT-0001. A key limited to some shops gets only those shops; asking for another one is refused
page, page_length Pages start at 1; 20 a page unless you ask, at most 200
order_by "<field> asc" or "<field> desc"

Errors

Errors are { "error": { "code": "...", "message": "..." } } with an HTTP status:

Status Code Means
400 validation Something in the request is wrong; the message says what. A missing X-itsPOS-Site header is this too
401 unauthorized No key, an unknown key, or a revoked or expired one
403 forbidden The key can't read this, or a shop it isn't allowed, or the call came from an address that isn't allowed ("This API key cannot be used from this IP address.")
403 feature_disabled API keys aren't on your plan
404 not_found The record or method doesn't exist for API keys
429 rate_limited More than 600 calls a minute with this key. Wait a minute and slow down
503 unavailable itsPOS can't be reached right now. Try again shortly

Keep your data safe

Help