nsindocs Search the docs⌘K
  1. Docs
  2. API reference
  3. Uptime

Uptime alert delivered to your webhook

postYour webhook URL

What NSIN sends to the webhook URL saved with PUT /uptime/settings (webhook_url, notify_webhook: true): one outage.opened when an incident opens on the domain, one outage.resolved when it resolves, and test for POST /uptime/webhook/test. Each incident sends each event at most once.

Verify every request. X-Nsin-Signature is sha256=<hex HMAC-SHA256> of <X-Nsin-Timestamp>.<raw body>, keyed with the domain's signing secret (GET /uptime/webhook). The timestamp is inside the MAC, so reject requests whose timestamp is too old to stop replays.

Answer with any 2xx within 5 seconds. Anything else — another status, a timeout, a connection error — is retried twice, after 5 and 30 seconds. Redirects are not followed, and a URL that resolves to a private or otherwise disallowed address is refused without retrying. Every delivery is listed in GET /uptime/webhook/deliveries.

Header parameters

  • X-Nsin-Eventstringrequiredheader

    The event name, repeated from the body.

    One of: "outage.opened" "outage.resolved" "test"
  • X-Nsin-Timestampstringrequiredheader

    When the request was signed, in unix seconds.

  • X-Nsin-Signaturestringrequiredheader

    sha256= followed by the hex HMAC-SHA256 of <timestamp>.<raw body>.

  • User-Agentstringheader

    Always Nsin-Uptime-Webhook/1.

    One of: "Nsin-Uptime-Webhook/1"

Request body

Content type: application/json · required

  • eventstring

    What happened. test for POST /uptime/webhook/test.

    One of: "outage.opened" "outage.resolved" "test"
  • incident_idinteger

    The incident this event is about. 0 on test.

  • domainstring
  • hostnamestring
  • monitor_idinteger | null

    null for the default whole-host watch.

  • scopestring

    The monitor's name or path; empty for the whole-host watch.

  • peak_error_pctnumber

    Highest per-minute origin-error percentage seen in the incident.

  • started_atstring (date-time)

    When the incident opened.

  • resolved_atstring | null (date-time)

    When it resolved. null on outage.opened.

  • duration_secinteger | null

    How long it lasted, in seconds. null until resolved.

  • sent_atstring (date-time)

    When this delivery was signed — the same instant as X-Nsin-Timestamp.

Responses

2XXDelivery accepted. Any other answer counts as a failure and is retried.
esc