Omertà Signals docs

API reference

Send signals to Omertà Signals over HTTP when your platform has no client yet, or when you want to know exactly what the service accepts and refuses. You need your app's id and key, which the dashboard shows when you make the app. Keep the key out of anything you do not control: it can send signals for your app and do nothing else.

Every body is JSON, and every error is { "error": "<what is wrong>" }. Times are whole seconds since 1970, in UTC.

Send signals

POST https://api.omertasignals.com/v1/signals

HeaderValue
AuthorizationBearer <your app's key>
Content-Typeapplication/json

The body is an array of 1 to 1000 signals, at most 1,048,576 bytes (1 MB) of UTF-8. The answer is 200 with { "accepted": <how many> }.

[{ "app": "<your app's id>", "type": "app.launched", "at": 1767225600, "user": "<optional>", "payload": { "plan": "pro" } }]

Each signal is an object with these fields, and no others:

FieldRequiredWhat it holds
appyesYour app's id, 1 to 64 characters. It must be the app the key belongs to.
typeyes1 to 64 characters, starting with an ASCII letter, then only letters, digits, ., _ and -.
atyesWhen it happened: a whole number of seconds since 1970, from 0 to 4102444800. Not milliseconds.
usernoWho it happened to: a string of 1 to 256 characters. Hash it on the device first, so that the raw identifier never leaves it. The service keeps only a keyed hash of it.
payloadnoAn object of at most 32 keys. Each key is 1 to 64 characters, and each value is a string of at most 1000 characters (counted in UTF-16 code units, so most emoji count as 2).

One bad signal refuses the whole batch, and nothing from it is kept. The error begins signal <position, from 0>: .

A signal without user gets a visitor identifier made from the request's IP address and user agent, with a salt that changes every UTC day. It recognises a visitor within one day only, and the IP address and user agent are never stored.

Limits

CORS

A browser on any site may send signals. OPTIONS /v1/signals answers 204 with no body, Access-Control-Allow-Origin: *, Access-Control-Allow-Methods: POST, Access-Control-Allow-Headers: authorization, content-type and Access-Control-Max-Age: 86400. Every answer from /v1/signals, errors included, carries Access-Control-Allow-Origin: *, and a 429 also carries Access-Control-Expose-Headers: Retry-After, so a page can read the header.

Example

Put your app's id and key in the first two lines, then paste it into a terminal.

APP_ID=your-app-id
APP_KEY=your-app-key
curl -i -X POST https://api.omertasignals.com/v1/signals \
  -H "Authorization: Bearer $APP_KEY" \
  -H "Content-Type: application/json" \
  -d "[{\"app\":\"$APP_ID\",\"type\":\"app.launched\",\"at\":$(date +%s),\"user\":\"hashed-user-1\"}]"

The answer is 200 with {"accepted":1}.

Refusals

A refusal is checked in this order: key (401), body size (413), body and signals (400), per-minute limit (429), plan limit (402). A refused batch is not kept, but a batch refused with 402 still counts toward the per-minute limit. In a message, <n>, <i> and the like stand for the value the service fills in. The service never repeats back a value you sent. Where a message has <key>, it repeats only the name of a field or payload key (at most 64 characters of it), not what it holds.

401, the key

MessageWhat to do
app key required: send Authorization: Bearer <app key>Send the Authorization header with Bearer and your app's key.
app key not recognisedCheck the key against the dashboard. It is the app's key, not its id.

413, the body is too large

MessageWhat to do
body must be at most 1048576 bytesSend fewer signals in each request.

400, the batch or a signal

MessageWhat to do
body must be valid JSON: a JSON array of 1 to 1000 signalsSend valid JSON.
body must be an array of 1 to 1000 signals; it is emptySend at least one signal.
body must be an array of 1 to 1000 signals; it has <n>Split the batch into requests of at most 1000.
body must be an array of 1 to 1000 signals, not an object; wrap one signal as [ {...} ]Put a single signal inside an array.
body must be an array of 1 to 1000 signals, not <kind>Send an array. <kind> is null, a string, a number or a boolean.
signal <i>: signal must be an object, not <kind>Each item must be an object. <kind> is a string, a number, a boolean, null or an array.
signal <i>: unknown key: <key>; a signal has only app, type, at, user, payload and visitorRemove the key. A signal has the fields in the table above.
signal <i>: app is required: a string of 1 to 64 charactersAdd app, your app's id.
signal <i>: app must be a string of 1 to 64 characters, not <kind>Send the id as a string. The message may end ; it is empty or ; it has <n> instead.
signal <i>: app is not the app of this keySend the id of the app the key belongs to.
signal <i>: type is required: 1 to 64 characters, starting with a letterAdd type.
signal <i>: type must be 1 to 64 characters, start with a letter, and hold only letters, digits, '.', '_' and '-' followed by , not <kind>, ; it is empty, ; it has <n>, ; character 1 is not a letter or ; character <n> is not allowedChange the type to follow the rule. <n> is the position of the first bad character, from 1.
signal <i>: at is required: whole seconds since 1970Add at.
signal <i>: at must be whole seconds since 1970, not milliseconds: send <seconds> or at most 4102444800Divide a millisecond time such as Date.now() by 1000 and round down.
signal <i>: at must be a whole number from 0 to 4102444800Send whole seconds since 1970.
signal <i>: user must be a string of 1 to 256 characters, not <kind>Send the user as a string. The message may end ; it is empty or ; it has <n> instead.
signal <i>: payload must be an object with string valuesSend payload as an object, not a list or a single value.
signal <i>: payload must have at most 32 keys; it has <n>Send fewer keys.
signal <i>: payload keys must be 1 to 64 characters; one is emptyGive the key a name.
signal <i>: payload key <key> must be 1 to 64 charactersShorten the key. It is cut to its first 64 characters in the message.
signal <i>: payload.<key> must be a string, not <kind>Send every payload value as a string.
signal <i>: payload.<key> must be at most 1000 characters; it has <n>Shorten the value.

429, too many signals

MessageWhat to do
too many signals: this key may send at most <N> per minute; retry after <S> secondsWait the <S> seconds, also sent in the Retry-After header, and send the same batch again. Nothing of it was kept.

402, the plan's signals are used up

MessageWhat to do
this app's organisation has used its <N> signals for <YYYY-MM>: upgrade at https://dashboard.omertasignals.com/accountUpgrade your plan at the address in the message, or wait for the next UTC month. <N> is the limit that was reached.

405, the wrong method

MessageWhat to do
method must be POSTUse POST. The answer carries Allow: POST, OPTIONS.

The service stores only a keyed hash of user, so what it keeps is pseudonymous.