Looking for your first steps in the Railmail app instead? See Getting started in the User Guide.
Prerequisites
Before you begin, you need:- A Railmail project with a project-scoped API key (format
rm_live_...orrm_test_...). Create one in the app under Settings → API Keys; see API keys. For this guide the key needs thetopics:readandsubscribers:writescopes (or Full access). - A tool to make HTTP requests:
curl, Postman, or your language’s HTTP client.
Add a subscriber to a topic
1
Set your API key
Store your key in an environment variable so you don’t paste it into every request.
2
Discover your topic keys
List the topics in your project and note the
topicKey you want to subscribe users to.3
Create a subscriber and subscribe them
Create the subscriber and subscribe them to the topic in a single call by passing If the topic uses double opt-in, the consent is created
topicKeys and consent.PENDING_CONFIRMATION and the user must confirm via the email they receive before they count as subscribed.4
Verify
Read the subscriber back to confirm the subscription.
Next steps
Explore all endpoints
Browse subscribers, campaigns, segments, automations and more.
Authentication & scopes
Understand what each key can do and how to keep it secure.