Push notification REST API quickstart
This quickstart shows the push notification REST API behind every PushFire SDK, with curl commands you can paste. Use it from any language that speaks HTTPS and JSON. PushFire is the easiest lifecycle messaging platform for AI agents and vibe coders: push and email lifecycle campaigns, segments and workflows behind one small API.
The API Reference documents each field, and the OpenAPI spec lets you generate a client or AI tool definitions. This page adds the rules that trip people up.
Prerequisites
- A PushFire account and project at console.pushfire.app, with your Firebase service account uploaded for push.
- API keys from Developers → API keys: a Public key (pf_pk_) for apps and a Secret key (pf_sk_) for servers. See Public and Secret keys.
- For email: an active Resend or SMTP connector. See Connectors.
Base URL, authentication and body shape
- Base URL: https://api.pushfire.app/functions/v1. Each endpoint is one flat path, such as /register-device.
- Header: Authorization: Bearer <key> and Content-Type: application/json.
- Body: every request wraps its fields in a data object.
Which key each endpoint accepts
- Public or Secret key: register-device, update-device, login-subscriber, update-subscriber, logout-subscriber, add-subscriber-tag, update-subscriber-tag, remove-subscriber-tag.
- Secret key only: create-workflow-execution, send-batch-push-notifications, send-batch-email-notifications. A Public key gets 403 "Client key cannot perform this action".
- Restricted keys (pf_rk_) carry the scopes you pick. A missing scope returns 403 "API key is missing required scope".
Warning: never ship a Secret key (pf_sk_) in a mobile app, browser bundle or no-code frontend. PushFire does not block a Secret key on a client, so the call works, but anyone can extract the key from your app and message all your users. Start workflows and send messages from your server, a Supabase Edge Function or your app builder's server function.
Install
Nothing to install. You need curl, or the HTTP client of your language. Language guides: Node.js and Python.
Register a device
Send the FCM token from Firebase Messaging. PushFire creates the device and an anonymous subscriber, and returns both UUIDs. The keys osVersion, appVersion, manufacturer, model and language are required, but each may be null. A second registration of the same FCM token returns 400.
When the token rotates or the permission changes, update the same device. PATCH changes only the fields you send; PUT replaces the device and needs every field.
Identify a subscriber
Login replaces the anonymous subscriber on the device with your user, keyed by externalId. It accepts name, email, phone (8 characters or more) and timezone (an IANA zone such as America/New_York). Login does not store metadata.
Update the profile with PATCH update-subscriber. Send the subscriber id, or only the externalId: PushFire finds the subscriber by either one. This is also where metadata goes.
On sign-out, log out. PushFire detaches the user and gives the device a new anonymous subscriber, whose UUID it returns.
Tags
Create tags in Audience → Tags. The API takes the tag UUID and the subscriber UUID. A value is a string, a number of 1 or more, or null. Use add for a new tag and update to change a value.
Trigger a workflow
Start a workflow now (Immediate) or later (Scheduled, with an ISO 8601 scheduledFor). The target is a list of subscriber UUIDs or segment UUIDs. You can also skip the call: a workflow whose start is "A subscriber enters a segment" runs when tags move a subscriber into that segment.
Send push and email from the server
Batch push sends one notification to each externalId. Values in notification.data must be strings, because PushFire passes them to FCM, which rejects other types.
If every recipient fails, the status is 400 with the same shape. Error items use the key error.
Batch email needs connectorId and connectorSenderId. Copy both from Connectors → Resend (or SMTP). emailLayoutId is optional. The HTML body may not contain scripts, iframes or on... handlers. mergeData sits next to notification and fills custom {{token}} placeholders.
Errors
Validation errors return 400 with a path for each problem:
Auth errors return 401 or 403 with a code: invalid_or_revoked, public_ceiling or scope_denied.
A wrong path returns 404 "Requested function was not found". A wrong method returns 405.
Verify delivery
- Send a batch push to your own externalId and check the success list.
- Open Developers → API Messages → Push Notifications. Each API send shows Pending, In progress, Completed, Retrying or Failed, with the Firebase error when it fails.
- Open Audience → Subscribers to check devices, tags, profile fields and timezone.
- For email, open Developers → API Messages → Email Notifications.
Troubleshooting
- 400 with a data.<field> path: a required key is missing or has the wrong type. Device fields must all be present, even as null.
- 400 "Invalid tag ID" or "Invalid target UUID": you sent a name instead of the UUID from the console.
- 403 "Client key cannot perform this action": you called a send or workflow endpoint with a Public key.
- 404 on a path such as /devices/register-device: use the flat path /register-device.
- Email fails validation on emailSenderId: send connectorId and connectorSenderId. Some older docs show emailSenderId.
- Push shows Failed with a data error: a notification.data value is not a string.
FAQ
Can I call the PushFire API from any programming language?
Yes. The API is plain HTTPS with JSON bodies and a Bearer header, so any language with an HTTP client works: Go, Ruby, PHP, Java, C#, Rust, Elixir and others. Native SDKs for these languages are coming soon. Until then, translate the curl commands on this page.
Do I need a device to send a push notification?
Yes. Push goes to devices with an FCM token and push enabled. Your app registers the device and logs the user in, which ties the device to your externalId. After that, your server can send to that externalId without knowing any device details.
What is the difference between batch push and a workflow?
Batch push sends one message now to a list of externalId values. A workflow is a journey you design in the console, with waits, conditions, push and email steps. Start it from the API for subscribers or segments, or let it start when a subscriber enters a segment.
Is there an OpenAPI spec for PushFire?
Yes, at https://www.pushfire.app/openapi.json. Use it to generate typed clients or AI tool definitions. Where this quickstart and the spec differ, this page follows the live backend: for example, batch email takes connectorId and connectorSenderId.
Next steps
- Every field: API Reference.
- Keys and scopes: API keys.
- App side: Flutter, iOS, Android and React Native.
- Let an agent wire it: PushFire AI agent skill.