RelayGrid logoRelayGrid

REST API Reference

Reference for all public APIs accessible with your API Key.

Resources

Authentication

All requests must include your API Key in the Authorization header:

Authorization: Bearer sk_your_key

Messages

Send and manage notifications

POST/api/v1/messages

Create and send a new notification message to a single recipient. All fields are nested under the message object. Identify the template by name or internal ID. For the recipient, send a nested message[user] object to create-or-update them as part of the send (no separate registration step), or reference an existing recipient by external_user_id / notification_user_id. To send to every recipient matched by a segment instead, use the Broadcasts resource. Responds 201 with the message, its deliveries (one per channel, each with an id you can poll), and — when the template has a live push channel — push_token and push_token_expires_in for subscribing the recipient's device to the realtime channel. A 201 at schedule time is not a guarantee of delivery: if scheduled_at is set, the account's quota is re-checked at dispatch, and a scheduled send can still end in delivery.failed if quota is spent by then.

Request Body

  • message[message_template_name]String (Required unless message[message_template_id] is given)
  • message[message_template_id]Integer (Required unless message[message_template_name] is given)
  • message[user][external_user_id]String

    your own identifier for the recipient; creates them if unknown (Required within message[user])

  • message[user][first_name]String

    updated when it has changed; omit to leave as-is (Optional)

  • message[user][middle_name]String (Optional)
  • message[user][last_name]String

    updated when it has changed; omit to leave as-is (Optional)

  • message[user][email]String

    stored as the recipient's email contact, which email deliveries send to. Omit to leave the existing contact alone; send an empty string to remove it (Optional)

  • message[user][traits]Object

    free-form key/value targeting data for this recipient, matched by traits.<key> segment rules. Shallow-merged into the recipient's existing traits: only the keys you send are touched, and a null value deletes that key rather than setting it to null. This is different from traits on the notification_users endpoints below, which replace the whole document instead of merging — see the note there. Traits are stored in the clear; they are targeting data, not a place for secrets or sensitive PII (Optional)

  • message[external_user_id]String

    strict lookup of an existing recipient; use message[user] instead to create-or-update (Required unless message[user] or message[notification_user_id] is given)

  • message[notification_user_id]Integer (Required unless message[external_user_id] or message[user] is given)
  • message[message_attributes_attributes]Array of {name, value} objects (Optional)
  • message[scheduled_at]String

    ISO 8601 timestamp with an explicit UTC offset (e.g. 2026-09-01T09:00:00-07:00 or 2026-09-01T09:00:00Z), to deliver later instead of immediately. A naive timestamp with no offset, a malformed string, or a timestamp in the past all return 422. Requires the scheduled_deliveries feature; without it this returns 402. Deliveries are created immediately with status scheduled and emit delivery.scheduled — the actual send happens at dispatch time, which also emits delivery.queued (Optional)

GET/api/v1/messages/:id

Retrieve details of a specific message

DELETE/api/v1/messages/:id/schedule

Cancel a message that is still pending dispatch. Responds 200 with the message (schedule_canceled_reason: "requested"). Responds 404 for an unknown message, and 422 when the message is no longer pending — it has already dispatched (sends may already be in flight) or was already canceled.

PATCH/api/v1/messages/:id/mark_as_seen

Mark a specific message as seen

PATCH/api/v1/messages/:id/mark_as_delivered

Mark a specific message as delivered

GET/api/v1/messages/:id/render_message

Get the fully rendered subject and body of a message

GET/api/v1/messages/new_messages_for

Get all unseen messages for a specific recipient, newest first

Query Parameters

  • external_user_idString

    your own identifier for the recipient (Required unless notification_user_id is given)

  • notification_user_idInteger

    the internal recipient id (Required unless external_user_id is given)