Skip to content
Agentpost robot in sunglasses on a red circleAgentpost

Push addresses

The devices a recipient’s notifications reach by push: each one a provider and the token your app got from it, such as an Expo push token. Your backend registers a token after the principal signs in and removes it when they sign out. A token belongs to one recipient at a time, so a shared phone never shows one principal’s notifications to the next.

Push explains how a token is bound to one recipient, what a push carries, and what happens when a device is gone.

Paths are relative to https://api.agentpost.tools/v1/events, and every request follows the API basics. Who may call explains each kind of caller.

Register a push address

POST /recipients/:id/push-addresses

Binds a device’s push token to a recipient and answers with the address, whose id your backend keeps beside the principal’s session to remove it at sign-out. Registering a token another recipient in this project holds moves it to this one under a new ID, and their pushes stop; registering a token this recipient holds answers with the same address, active again if it was invalid.

  • Who may call: Your server, with your project’s secret key; or a signed-in principal, for their own push addresses only, with a user token or their IdentityHound session token.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Idempotency-Key: optional. Retrying a write has the rule.

Path parameters

Name Type Required Description
id string Yes A recipient ID: your own ID for the principal, such as u_ana, up to 200 printable characters without spaces. The id of a RecipientRecord.

Body

Name Type Required Description
provider "expo" Yes
token string Yes 1–500 characters.

Response

200 OK, with:

Name Type Present Description
pushAddress PushAddressRecord Always

Errors

Any operation can also answer with the codes Conventions lists.

Mark a push address seen

POST /push-addresses/:id/seen

Marks everything through one of the recipient’s notifications seen on this phone, including one a push carried for a topic whose inbox is off. Answers with its stored position and remaining unseen count. An older position changes nothing. Leaves the inbox and every other address alone.

  • Who may call: Your server, with your project’s secret key; or a signed-in principal, for their own push addresses only, with a user token or their IdentityHound session token.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Idempotency-Key: optional. Retrying a write has the rule.

Path parameters

Name Type Required Description
id string Yes A push address ID, pad_…. The id of a PushAddressRecord.

Body

Name Type Required Description
through string Yes 1–100 characters.

Response

200 OK, with SeenResponse.

Errors

Any operation can also answer with the codes Conventions lists.

Remove a push address

DELETE /push-addresses/:id

Removes a push address, as when the principal signs out on that device. Pushes waiting to go to it are canceled. An address that is already gone, or that moved to someone else under a new ID, answers the same.

  • Who may call: Your server, with your project’s secret key; or a signed-in principal, for their own push addresses only, with a user token or their IdentityHound session token.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Idempotency-Key: optional. Retrying a write has the rule.

Path parameters

Name Type Required Description
id string Yes A push address ID, pad_…. The id of a PushAddressRecord.

Response

204 No Content, with no body.

Errors

Only the codes any operation can answer with, which Conventions lists.

Remove a push address by its token

DELETE /push-addresses

Removes the push address with this provider and token, whichever recipient in this project holds it, for a backend that kept the token rather than the address ID. Pushes waiting to go to it are canceled.

  • Who may call: Your server, with your project’s secret key; or a signed-in principal, for their own push addresses only, with a user token or their IdentityHound session token.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Idempotency-Key: optional. Retrying a write has the rule.

Query parameters

Name Type Required Description
provider "expo" Yes
token string Yes 1–500 characters.

Response

204 No Content, with no body.

Errors

Any operation can also answer with the codes Conventions lists.

The PushAddressRecord object

One push address: a provider and a token, bound to a recipient. The token is never returned.

Name Type Present Description
id string Always A push address ID, pad_….
recipientId string Always
provider "expo" Always The push providers EventWolf sends through. Expo first; direct APNs, FCM, and Web Push would be new values.
status "active" or "invalid" Always invalid once the provider reports the app gone from the device; deliveries to it are then skipped. Registering the token again makes it active.
invalidatedAt string When set
invalidReason "device_not_registered" When set Why an address stopped being used: the provider said the app is no longer on the device.
seenThrough string When set This phone’s newest seen notification. Absent on a new address, which starts with nothing seen.
createdAt string Always
lastDeliveredAt string When set When a push to it last reached the device, as the provider reported.

The SeenResponse object

Name Type Present Description
seenThrough string Always The stored position after the call: the one given, or a newer one already stored.
unseen number Always Remaining unseen notifications on the target surface.