Preview: the PushFleet API isn't live yet. Join the waitlist
Devices
Apps usually register through a client SDK. These endpoints are for registering from your server, or from anything without an SDK.
Register a device
Section titled “Register a device”POST /v1/devices
| Field | Type | Notes |
|---|---|---|
token |
string | The push token from Apple or Firebase. Required. |
user |
string | Your user ID. Required. |
platform |
"ios" | "android" |
Optional; detected from the token’s shape. |
apns_environment |
"sandbox" | "production" |
Apple devices only: which Apple push server the token belongs to. Debug builds get sandbox tokens; TestFlight and App Store builds get production ones. The client SDKs set it from the build. Default "production". |
userToken |
string | Required in live mode with a publishable key. See identity verification. |
With a secret key, or devices: write, no userToken is needed: your server is trusted. A live publishable-key registration without one gets 403 user_token_required.
await fleet.devices.create({
token: "a4f9c2…7be21c",
user: "user_8f3k",
});fleet.devices.create(
token="a4f9c2…7be21c",
user="user_8f3k",
)fleet.Devices.Create(ctx, pushfleet.DevicesCreateParams{
Token: "a4f9c2…7be21c",
User: "user_8f3k",
})fleet
.devices()
.create()
.token("a4f9c2…7be21c")
.user("user_8f3k")
.await?;fleet.devices.create(
token: "a4f9c2…7be21c",
user: "user_8f3k"
)curl https://api.pushfleet.com/v1/devices \
-H "Authorization: Bearer $PUSHFLEET_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"token":"a4f9c2…7be21c","user":"user_8f3k"}'Answers 201 with {"id":"dev_…"}. Registering a token again updates it instead of duplicating it.
Remove a device
Section titled “Remove a device”DELETE /v1/devices/{id}
await fleet.devices.delete("dev_9fK2");fleet.devices.delete("dev_9fK2")fleet.Devices.Delete(ctx, "dev_9fK2")fleet.devices().delete("dev_9fK2").await?;fleet.devices.delete("dev_9fK2")curl -X DELETE https://api.pushfleet.com/v1/devices/dev_9fK2 \
-H "Authorization: Bearer $PUSHFLEET_SECRET_KEY"Answers 204. Devices with dead tokens are removed automatically, with a device.removed webhook.