Skip to main content
This guide walks you through the end-to-end flow to ship a custom widget:

Prerequisites

  • Snippet mobile app installed and you can access the API key screen
  • A backend service capable of sending HTTPS requests

1) Create an API key (in the mobile app)

  • Open the Snippet app and generate an API key
  • Store the key securely; you will use it in the Authorization: Bearer <KEY> header

2) Register your protocol (one widget = one protocol)

Request:
  • id must be unique (lowercase slug recommended). The server sanitizes the ID.
  • Response includes the created protocol.

3) Push your metrics

  • Send metrics at your cadence. If you provide timestamp, it will be used; if you omit it, the server snaps to the top of the hour.
  • Units are free-form; keep them consistent for display.
  • Max 100 metrics per call.
  • id must be {protocolId}___{Label}.
  • timestamp must be ISO 8601 and not more than 5 minutes in the future. If omitted, the server snaps to the hour.
Successful response:

4) Verify what was stored (optional)

5) Add the widget on iOS

  • In the Snippet app, add your widget and select your protocolId.
  • The widget will display the latest values you posted.

6) Reading metrics (what the widget does)

  • Public protocol: GET /metrics/byProtocol/:protocolId
  • Private protocol (owned by your API key): include the same Authorization header.
Example:
Or for private:
The response contains current values with change fields and a timestamp per metric.