Menu

API basics

Base URL, keys, errors, idempotency, pagination and rate limits for the Pushwren REST API.

The Pushwren API is JSON over HTTPS at https://api.pushwren.com/v1. The SDK uses it to register devices; your server uses it to send and to read results.

Keys

Every request carries a key in the Authorization header. Each key belongs to one app, so no endpoint takes an app ID.

Key Where it goes What it can do
Publishable, pk_live_… In your app, given to Pushwren.configure Register and update its own device, report opens and its Live Activity tokens
Secret, sk_live_… On your server only Send, schedule and cancel, read results, read and delete devices, start, update and end Live Activities
curl https://api.pushwren.com/v1/notifications -H "Authorization: Bearer $PUSHWREN_SECRET_KEY"

Make and revoke keys in the portal under Settings › API keys. A key is shown once, when it’s made. A missing, unknown or revoked key answers invalid_api_key; a publishable key on a server endpoint answers forbidden.

Errors

Every error has the same shape. The message says what went wrong in this case, and docUrl links to the code’s page:

{
  "error": {
    "code": "invalid_request",
    "message": "body.target must match exactly one schema in oneOf",
    "docUrl": "https://docs.pushwren.com/errors/invalid_request"
  }
}

Errors lists every code.

Idempotency

POST /v1/notifications and POST /v1/live-activities take an optional Idempotency-Key header. A repeat with the same key within 24 hours returns the original answer and sends nothing new, so retry a connection error or a 5xx with the same key. The same key with a different body answers idempotency_conflict.

Pagination

List endpoints take ?limit= (1 to 100, default 50) and ?cursor=. An answer with more to come has a cursor; pass it back to get the next page.

Rate limits

During the beta each app may make 5 requests a second. Over that, the API answers rate_limited with a Retry-After header in seconds. Send to many devices in one request (by user, tag or all) rather than one request per device. Device registration has its own limits, which never depend on your plan; the SDK retries them for you.

Request IDs

Every answer has a Pushwren-Request-Id header. Include it when you email hello@pushwren.com about a request.

Changes

Changes within /v1 only add things: new fields, new endpoints, new error codes. Ignore fields you don’t know.

GET /v1/health

Whether the API is up, with no key needed.

{ "status": "ok", "version": "r62-2c747e3" }