---
title: "WATCHER: get a signed callback when a crypto asset crosses..."
method: POST
path: "/api/watchers/token-price"
tags: ["watchers"]
---

# WATCHER: get a signed callback when a crypto asset crosses...

`POST /api/watchers/token-price`

## Request

- Base URL: `https://2s.io`
- URL: `https://2s.io/api/watchers/token-price`
- Auth: API key in header `PAYMENT-SIGNATURE`

WATCHER: get a signed callback when a crypto asset crosses a price you set. Arm once, pay once (no account, no API key) — we poll the spot price and POST your custom payload to callbackUrl the moment the condition is met. tokenId is a CoinGecko asset id (lowercase, e.g. bitcoin, ethereum, solana — not the ticker). conditionType: 'above' / 'below' (threshold = a USD price) or 'pct_up' / 'pct_down' (threshold = a percent move over 24h). Fires once per crossing; bounded by a maxFires / expiry budget. Price via CoinGecko. Deliveries are EIP-191-signed (verify offline) and retried with exponential backoff; missed pushes are recoverable via watchers.status. Returns a watcherId.

## Request body

- object
  - `tokenId` string, required: CoinGecko asset id (lowercase, not ticker), e.g. bitcoin, ethereum, solana.
  - `conditionType` 'above' | 'below' | 'pct_up' | 'pct_down', required: above/below = threshold is a USD price; pct_up/pct_down = threshold is a percent move over 24h.
  - `threshold` number, required: Trigger level: a USD price for above/below (e.g. 100000), or a percent for pct_up/pct_down (e.g. 10 = ±10% over 24h).
  - `callbackUrl` string, uri, required: Where we POST the event. Any http(s) URL; the JSON body is signed (verify with X-2s-Signature). e.g. https://your-agent.app/hooks/btc
  - `payload` object: Arbitrary JSON echoed back verbatim in every callback. e.g. {"agentId":"a1"}
  - `expiresInSeconds` integer: How long the watch stays active, in seconds. Default 2592000 (30 days), max 7776000 (90 days).
  - `maxFires` integer: Stop after this many callbacks (default 1 — a one-shot alert). Each fire is a fresh crossing into the condition.
  - `label` string: Optional free-text tag to recognize this watcher later.

## Other responses

- `200` (unresolved $ref)
- `400`: Invalid request — not charged. error.code: BAD_REQUEST or INVALID_PARAM (parameter validation; error.details.issues lists each problem), MALFORMED_JSON, or a request-specific code. Other client errors: 405 METHOD_NOT_ALLOWED (wrong verb; see the Allow header), 413 PAYLOAD_TOO_LARGE.
- `402`: Payment required. Body is the x402 PaymentRequirements envelope with a multi-network accepts array; the per-call price is in accepts[].amount (and on the operation as x-2s-price). Sign for whichever rail you hold USDC on (EIP-3009 for Base, partial SPL transfer for Solana) and retry with the PAYMENT-SIGNATURE header (X-PAYMENT also accepted for v1 clients). Also PAYMENT_SETTLE_FAILED (error envelope) when a verified payment failed to settle: error.details.chargeStatus is "not_charged" (retry with a fresh payment) or "unknown" (the authorization may still settle before its deadline — check it before retrying).
- `404`: Not found — NOT_FOUND (or NO_SOURCES / NO_OPINIONS): the requested entity does not exist. Not charged.
- `429`: Too many requests — RATE_LIMITED: our per-IP / per-payer limiter. Not charged; retry after Retry-After.
- `5XX`: Server-side failure. 500 INTERNAL: unexpected error; quote error.errorId (also the X-2s-Error-Id header). 502 UPSTREAM_UNAVAILABLE (or another UPSTREAM_* code): the data provider failed — composite endpoints refuse unbilled when every source fails. 503 SERVICE_PAUSED: endpoint paused by the operator kill switch, retry after Retry-After; 503 SPEND_CAP: daily upstream budget exhausted. 504 UPSTREAM_TIMEOUT. Not charged.

---

[API](https://skmtc.dev/2s-io/apis/2s-the-most-everything-api.md) · [All operations](https://skmtc.dev/2s-io/apis/2s-the-most-everything-api/llms.txt) · [OpenAPI document](https://skmtc.dev/2s-io/apis/2s-the-most-everything-api/revisions/da4c5caf686e?raw)
