Audience
- Engineers building services that publish custom metrics to Snippet
- Product teams planning how widgets map to their protocol data
High-level flow
- Create an API key in the Snippet mobile app. This API key authenticates your backend-to-backend calls. (The app flow is not part of this public API; just ensure you have a valid key.)
- Register a protocol using the API. One protocol maps to one widget. The protocol ID must be unique and becomes the widget identifier.
- From your service, push metrics for that protocol at your desired cadence. If you provide a timestamp, it will be used as-is; otherwise the server snaps it to the top of the hour for consistency.
- Users add your widget in the iOS app. The widget reads the latest metrics for your protocol ID.
Key concepts
- Protocol: A unique integration identified by an ID (slug). One protocol equals one widget.
- Metric: A numeric data point identified by an
id
with pattern{protocolId}___{Label}
. Example:awesome-dex___TVL
orawesome-dex___REVENUE
. - Timestamp alignment: If you provide a timestamp, it must be a valid ISO 8601 string and not more than 5 minutes in the future; when omitted, the server snaps it to the top of the hour (minutes/seconds/millis set to 0).
- Ownership and visibility:
- Protocols registered via API keys are owned by that key. Widgets tied to private protocols will only expose data when the same API key is used in read requests.
- Public protocols can be read without authentication.
- Units: Free-form. You can send any unit label (e.g.,
USD
,BTC
,%
,TPS
, or evenfootball_fields
). For best UX, keep units consistent across updates. - Labels: For best widget display, keep the part after
___
to 16 characters or fewer.
Constraints you must follow
- Max 100 metrics per POST batch.
id
must follow{protocolId}___{Label}
.- Timestamps must be ISO 8601 strings in UTC (e.g.,
2025-01-15T12:00:00Z
) and cannot be more than 5 minutes in the future.
Authentication
Use the API key from the mobile app in theAuthorization
header: