Skip to content
Navigation

Subscribe devices to a topic

Subscribe devices to one of your app's topics, server-side.

Use this when your backend decides membership (a plan, a cohort, a segment) rather than the device deciding for itself — a client can subscribe itself through the Firebase SDK without involving Truememory at all.

The topic is namespaced to your app before it reaches FCM, and the response echoes the qualified name. Truememory does not store subscriptions: FCM owns that state and offers no way to read it back, so a local copy would drift. Keep your own record if you need to enumerate membership.

POST
https://truememory-api.mvstg.com/notifications/topics/{topic}/subscribe
View as Markdown

Authorization

  • HTTPBearerHTTPrequired

Path parameters

  • topicstringrequired

    Topic name, unprefixed.

    maxLength: 900 · pattern: ^[a-zA-Z0-9\-_.~%]+$

Header parameters

  • X-App-Idoptional

    One of the following:

    • string
    • null
  • X-On-Behalf-Ofoptional

    One of the following:

    • string
    • null
  • X-External-User-Idoptional

    One of the following:

    • string
    • null

Request bodyJSONrequired

  • user_idsoptional

    Truememory user ids; resolved to registered devices for the calling app.

    One of the following:

    • array<string>
    • null
  • tokensoptional

    Raw FCM registration tokens.

    One of the following:

    • array<string>
    • null

Returns

200

Successful Response

JSON
  • topicstringrequired

    The app-namespaced topic FCM was given.

  • success_countintegerrequired
  • failure_countintegerrequired
  • resultsarray ofobjectrequired
    • targetstringrequired

      The registration token, topic, or condition sent to.

    • successbooleanrequired
    • user_idoptional

      Set when the target was resolved from the device registry.

      One of the following:

      • string
      • null
    • message_idoptional

      One of the following:

      • string
      • null
    • error_codeoptional

      FCM's error code, uppercased.

      One of the following:

      • string
      • null
    • erroroptional

      One of the following:

      • string
      • null
    • prunedoptionalboolean

      The token was dropped from the registry because FCM reports it dead.

      default: false
  • unreachable_user_idsoptionalarray ofstring

    Requested users with no device registered for this app.

  • pruned_token_countoptionalinteger
    default: 0

422

Validation Error
JSON
  • detailoptionalarray ofobject
    • locarray ofrequired

      One of the following:

      • string
      • integer
    • msgstringrequired
    • typestringrequired
    • inputoptionalunknown
    • ctxoptionalobject

Type to search…

↑↓ navigate↵ selectEsc close