Devices
Register, update, look up and delete devices. The SDK registers devices for you; your server reads and deletes them.
A device is one install of your app on one iPhone, iPad or Mac, with its APNs token, environment, user and tags. The SDK creates and updates it; you rarely call the first three endpoints yourself.
PUT /v1/devices/{deviceId}
Publishable key. Registers a device, or fully updates it. The SDK makes the device ID (dev_ and 26 characters). The first call answers 201 with a deviceSecret, which the SDK sends as X-Device-Secret on every later call for this device; later calls answer 200.
{
"token": "a3f1c2e4b5d6978812ab34cd56ef7890a3f1c2e4b5d6978812ab34cd56ef7890",
"environment": "production",
"platform": "ios",
"bundleId": "com.example.weather",
"authorizationStatus": "authorized",
"userId": "u_123",
"tags": ["pro"],
"locale": "en-US",
"timezone": "America/Los_Angeles",
"appVersion": "2.4.1",
"osVersion": "26.1",
"sdkVersion": "0.5.0",
"model": "iPhone17,2",
"serviceExtension": true
}
token,environment(sandboxorproduction),platform(ios,ipados,macosormaccatalyst) andbundleIdare required.serviceExtension(optional boolean) says the app ships Pushwren’s extension helper; the SDK sends it. Only a device that reportstrueis asked for delivery receipts, and older SDKs never send it.- A
bundleIdthat isn’t the app’s answersbundle_mismatch. - Leaving out
userIdortagskeeps the stored ones. - With identity verification on, a
userIdneeds itsuserIdSignature, or it answersinvalid_user_signature.
PATCH /v1/devices/{deviceId}
Publishable key with the device secret, or a secret key. Changes part of a device and answers with the device as GET shows it.
{
"userId": "u_123",
"addTags": ["pro"],
"removeTags": ["trial"]
}
userId: null clears the user. authorizationStatus updates the notification permission. Tags your server adds stay when the app adds its own.
DELETE /v1/devices/{deviceId}
Publishable key with the device secret, or a secret key. Removes the device, its user and its tags. Answers 204. The SDK’s Pushwren.deleteDevice() calls it.
GET /v1/devices
Secret key. Looks up devices by exactly one of ?userId=, ?token= or ?tag=, with pagination:
curl "https://api.pushwren.com/v1/devices?userId=u_123" -H "Authorization: Bearer $PUSHWREN_SECRET_KEY"
{
"devices": [
{
"deviceId": "dev_01JD3Q8Z4T7M2K9XW5B6C0HFRA",
"token": "a3f1c2e4b5d6978812ab34cd56ef7890a3f1c2e4b5d6978812ab34cd56ef7890",
"environment": "production",
"platform": "ios",
"userId": "u_123",
"tags": ["pro"],
"authorizationStatus": "authorized",
"valid": true,
"serviceExtension": true,
"firstSeenAt": "2026-11-20T09:12:03Z",
"lastSeenAt": "2026-11-23T08:01:44Z"
}
]
}
A device Apple has said is gone has valid: false with its invalidReason; Pushwren stops sending to it and deletes it after 30 days.
GET /v1/devices/{deviceId}
Secret key. One device, in the same shape.