Omono API
Menu Getting started

Getting started

View as Markdown

The Omono API lets your software read and change the records your organisation keeps in Omono. You can work with companies and their contacts and addresses, quotes, sales orders and the dispatches that ship them, credit notes, purchase orders and the deliveries you receive against them, stock items, tasks and documents. You can also read the reference lists, such as tax rates, currencies and workflow statuses, that those records point to.

This guide takes you from no access to your first successful request. It explains how your organisation gets access, how to create an API key, which host to call, and where to test safely.

Note: The Omono API is in beta. Until it's generally available, any part of it can change. A change takes effect when the changelog lists it, with no notice in advance, and that stays true after general availability. The compatibility policy explains what can change and when a change takes effect. Changes you make through the API are real and take effect at once, so test on a sandbox organisation first, and don't make a critical process depend on the API alone yet.

Ask Omono to switch on the API#

Omono switches the API on separately for each organisation, when the organisation asks. To ask, an admin of your organisation sends a message through Omono's in-app chat.

Until access is on, the API page of Settings in Omono says so, nobody can create a key, and every request fails with a 403 error and the code api-access-disabled.

Once access is on, an admin can also pause every key at once with the API Access switch on the same page, for example while they look into a problem. While the switch is off, every request fails with the same 403 error. The keys aren't revoked, so they work again as soon as the switch is back on.

Create an API key#

An admin of your organisation creates API keys on the API page of Settings in Omono. Give each key the name of the integration that will use it, because Omono shows that name next to every change the key makes, as How your changes appear in Omono explains.

When you create a key, you choose its scopes: the kinds of data it can read and change. The form starts with only reference:read ticked, so tick what your integration needs, and nothing more.

Scope What it covers
companies:read, companies:write Companies, with their contacts and addresses, and the list of all your contacts.
sales:read, sales:write Quotes, sales orders and their dispatches, invoices, credit notes, the list of sales order lines, and the dashboard figures (sales and output against target).
purchasing:read, purchasing:write Purchase orders and their deliveries. With a stock scope as well, your stock items' suppliers: purchasing:read reads them and purchasing:write changes them.
stock:read, stock:write Stock items, and the costs and margins on quote and sales order line items and on invoices.
tasks:read, tasks:write Tasks.
documents:read, documents:write Documents, which are the files attached to records.
reference:read Your organisation's details and its reference lists, such as users (with their email addresses), tax rates and currencies.
pricing:read Your customers' price lists, and the price and discount Omono fills in on a line.

Each scope also covers the notes of its records.

A read scope lets the key read those records, and a write scope lets it create and change them. A write scope includes reading, so a key with sales:write can also read quotes, sales orders and credit notes. When you tick a write scope on the form, Omono ticks its read scope too, and the list of keys shows both. A scope covers only its own kind of record: for example, sales:write doesn't let a key read companies, and no scope but pricing:read lets a key read your customers' prices. The form leaves pricing:read unticked.

Each operation in the API reference names the scopes that let a key call it, and so does its security in the OpenAPI document: any one of the scopes it lists is enough. So you can check, before you deploy, that your key's scopes cover every operation your integration calls.

An admin can change a key's scopes after you create it. On Settings → API, click the pencil icon (Edit access) on the key's row, change the ticks, then save. The key has its new scopes from its next request, so the integration keeps using the same key. Omono emails your admins about every change. A key's name, expiry date and secret can't change: to replace a key, create a new one, move your integration to it, then revoke the old one. If your integration reads deletes from GET /events, read what to do after a change in Keeping in sync.

Omono shows the full key only once, straight after you create it. Copy it into your secret manager before you close the window. After that, Omono shows only the start of the key and its last four characters.

A key starts with its platform's prefix, such as omk_live_, followed by 49 letters and digits. The last six characters are a checksum of the rest of the key, so Omono refuses a mistyped key at once, and secret scanners can tell a real key from other text. The checksum is the CRC-32 of everything before it, written in base 62 with the digits 0-9A-Za-z and padded with 0 to six characters. Keys created before the checksum was added have 43 characters after the prefix and no checksum, and they keep working. Store and send the whole key exactly as Omono shows it, and don't check its length in your code.

A few more things to know about keys:

  • Your organisation can have up to 25 active keys. A key is active until it is revoked or it expires.
  • You can give a key an expiry date. It stops working at 00:00 UTC on that day. If you leave the date blank, the key doesn't expire.
  • Keys belong to your organisation, not to the person who created them. A key keeps working when the admin who created it leaves, and any admin can revoke any key.
  • Every admin gets an email when a key is created, revoked or has its access changed, and when API access is switched on or off.

To rotate a key, create a second key, move your integration over to it, and then revoke the old one. That way, your integration never stops working.

Make your first request#

Every path in the API reference is relative to https://<host>/api/v1. The host depends on the Omono platform your organisation uses, and each platform has its own keys:

Platform Host Keys start with
Production api.omono.co omk_live_
Demo, which also hosts sandbox organisations api-demo.omono.co omk_demo_

If Omono runs a private platform for your organisation, Omono gives you its host and key prefix. A key works only on the platform where it was created. If you send it to another platform's host, the request fails with a 401 error. For a production key or a demo key, the error's detail says which host to use.

To check that everything works, ask for your five newest companies. This request needs a key with the companies:read scope. Test on a sandbox organisation first, with your omk_demo_ key on api-demo.omono.co, as here. For your live organisation, call api.omono.co with your omk_live_ key instead.

curl "https://api-demo.omono.co/api/v1/companies?limit=5" \
  -H "Authorization: Bearer omk_demo_yourKeyHere"

The response is a page of companies. The records are in data, and hasMore tells you whether there are more to fetch:

{
  "data": [
    {
      "id": "b2FpLmNvbXBhbnkQQ",
      "companyName": "Acme Engineering Ltd",
      "accountNo": "ACME01",
      …
    }
  ],
  "hasMore": true,
  "nextCursor": "eyJ2IjoxLCJz…"
}

To learn how to get the next page, read Page through a list.

Authenticate your requests#

Send your key in the Authorization header of every request, as a bearer token:

Authorization: Bearer omk_live_yourKeyHere

The key also tells Omono which organisation you belong to, so you never send an organisation ID, and you only ever see and change your own organisation's data.

If the key is missing, wrong, expired or revoked, the request fails with a 401 error and the code unauthenticated. When Omono recognises the key, the error's detail says what's wrong with it, for example that it has been revoked, or that it's a production key sent to the demo host.

Warning: Never put a key in a URL. If a request to the API carries a key in its path or its query string, Omono refuses the request with a 401 error and revokes the key at once, because URLs end up in proxy logs and browser histories. This happens whatever the request is for, including the OpenAPI document, and even while the API is switched off. Every admin of your organisation gets an email about it. If a key ever appears in any other URL, revoke it yourself on the API page of Settings.

Send the key only in the Authorization header. A request that carries a key in its X-Request-Id header fails with a 400 error and the code malformed-request, and Omono doesn't store the header's value or send it back. The key isn't revoked in this case.

Call the API from your own servers. It's built for server-to-server use, so it doesn't send CORS headers or answer OPTIONS requests, and a web page running in a browser can't call it directly.

Test on a sandbox organisation#

Build and test your integration against a sandbox organisation on the demo platform, not against your live data. A sandbox is a separate organisation, so nothing you do there can change your live data. Omono sets one up when an admin of your organisation asks, and you can choose between two kinds:

  • A copy of your own data. Omono copies your organisation from production into a new sandbox, so you can test against your real customers, orders and stock. This is the best choice when you want to check how your integration handles your actual data.
  • A sandbox with demo data. Omono creates a new organisation filled with demo data, and you become its admin. This is the best choice when you're just getting started, or when you don't want your real data on the demo platform.

In either kind of sandbox, you create your own keys on the API page of Settings, and Omono switches on API access for it in the same way as for your own organisation. Keys from production don't work in a sandbox. Its rate limits are the same as on production.

What a copy of your data includes#

A copy holds your organisation's records as they were when Omono made it. It doesn't stay in step with production, so changes you make on either side stay there. Some things work differently in a copy:

  • Your users sign in as usual. Each user signs in on the demo platform with the same email address, password and authenticator app as on production. A password changed on one platform doesn't change on the other.
  • IDs are the same as on production. Every record keeps its production ID, which makes it easy to compare the two. It also means that you should keep your sandbox data and your production data in separate stores, so that a sandbox record never overwrites a live one.
  • Some records aren't copied. The copy doesn't include files attached to records, so the document list starts empty, and you upload test files yourself if you need them. It also leaves out API keys, the request log, the events list and, unless you ask for them, notes.
  • Nothing reaches your customers or suppliers. A sandbox never sends email to your customers or suppliers, even if you ask it to. Your own users can still get account emails from the demo platform, such as a password reset, or a notice when someone creates or revokes an API key.
  • Xero isn't available. A sandbox can't connect to Xero, so nothing you do there can reach your accounts.

Omono shows a banner across the top of every page in a copy, so nobody mistakes it for your live system.

Refresh or remove a sandbox#

Omono can refresh or remove a sandbox when you ask. Refreshing a copy of your data gives you a new copy of your organisation as it is on production at that time, with the same IDs. Resetting a sandbox with demo data gives you a brand-new organisation, with new IDs for every record. Either way, the sandbox gets new keys and a new sequence of events, so delete your copy of the sandbox data and start again with an initial load.

How your changes appear in Omono#

Omono shows every change a key makes as the work of API · <key name>, in notes, in the activity feed and in task history. Documents that a key uploads show API as the uploader. Because staff see the key's name, name each key after the integration that uses it, such as "Web shop" or "Warehouse sync".

Get help#

Contact Omono through the in-app chat, or email support@omono.co. So that Omono can find your request quickly, include:

  • your organisation's name
  • the host you called
  • the key's name and its last four characters, but never the whole key
  • the requestId from the response
  • the time of the request, in UTC

Your admins can see the requests from the last 7 days in the Request Log panel on the API page of Settings. The log never shows a whole key: if a key appears in a request's path, the log shows only its start and its last four characters. The log keeps at most 300 characters of a path. When a key's requests are refused over and over in the same way, for example with the same 429 error, the log keeps at least the first 10 of them in each minute rather than every one. When a key gets any other 4xx error from the same operation over and over, the log keeps at least the first 30 of them in each minute. The Usage panel on the same page still counts them all.

For any request that failed, View shows what Omono received and what it sent back: the path and query, the headers that matter for debugging (such as Content-Type and Idempotency-Key), and the request and response bodies, up to 8 KB each. A header you sent with no value shows as (empty). A body that isn't valid JSON is kept up to 1 KB. The Authorization header is never stored, and a key in a body is masked the same way. Admins can filter the log by method, error code or requestId, and export it to CSV or Excel.

Omono doesn't keep the bodies of every failed request. When one key gets the same error from the same operation many times in a minute, the log keeps the bodies of the first 10 only. When an organisation's failed requests reach a very high volume in a day, the log stops keeping bodies until midnight UTC. In both cases the log still lists the requests that it keeps, and View says why the bodies weren't kept.

If your code closes the connection before Omono answers, for example because its own timeout ran out, Omono still finishes the work, and the log shows the result, so you can see whether a write was saved. When the write succeeded, a retry with the same Idempotency-Key returns the stored response and doesn't do the work again.

Omono sets up sandbox organisations and raises limits only when an admin of your organisation asks, or confirms the request in writing.

Next steps#