Quickstart
Get started with the RelayAPI unified social media API in minutes.
Overview
RelayAPI is a unified API that lets you post to 21 social media platforms with a single API call. Connect your social accounts, create posts, and publish everywhere — all through one consistent interface.
Authentication
Sign up at relayapi.dev and create an API key from your dashboard.
Getting Your API Key
- Log in to your RelayAPI account at relayapi.dev
- Go to Settings > API Keys
- Click Create API Key
- Copy the key immediately — you won't be able to see it again
Key Format
API keys are prefixed with rlay_live_ for production or rlay_test_ for testing. Keys are stored as SHA-256 hashes and are only shown once at creation.
Install the SDK
npm install @relayapi/sdkpip install relaygo get github.com/relayapi-dev/relay-go# Gradle
implementation("dev.relayapi:relay-java:0.0.1")# No installation needed — use curl directlySet Up the Client
import Relay from '@relayapi/sdk';
const client = new Relay(); // reads RELAY_API_KEY from environmentfrom relay import Relay
client = Relay() # reads RELAY_API_KEY from environmentimport relaygo "github.com/relayapi-dev/relay-go"
client := relaygo.NewClient() // reads RELAY_API_KEY from environmentimport dev.relayapi.api.client.RelayClient;
import dev.relayapi.api.client.okhttp.RelayOkHttpClient;
RelayClient client = RelayOkHttpClient.fromEnv(); // reads RELAY_API_KEY from environment# Set your API key as an environment variable
export RELAY_API_KEY="rlay_live_your_api_key"Connect a Social Account
Before posting, connect at least one social media account through the dashboard or via the API.
const flow = await client.connect.startOAuthFlow('twitter');
// Redirect user to flow.auth_url to authorizeflow = client.connect.start_oauth_flow('twitter')
# Redirect user to flow.auth_url to authorizeflow, err := client.Connect.StartOAuthFlow(context.TODO(), "twitter", relaygo.ConnectStartOAuthFlowParams{})
// Redirect user to flow.AuthURL to authorizeConnectStartOAuthFlowResponse flow = client.connect().startOAuthFlow("twitter");
// Redirect user to flow.authUrl() to authorizecurl https://api.relayapi.dev/v1/connect/twitter \
-H "Authorization: Bearer $RELAY_API_KEY"Available Platforms
See Platforms Overview for the full list of supported platforms and their capabilities.
Create and Publish a Post
const post = await client.posts.create({
content: 'Hello from RelayAPI!',
targets: ['twitter', 'linkedin'],
scheduled_at: 'now',
});
console.log(post.id); // "post_abc123"
console.log(post.status); // "published"post = client.posts.create(
content='Hello from RelayAPI!',
targets=['twitter', 'linkedin'],
scheduled_at='now',
)
print(post.id) # "post_abc123"
print(post.status) # "published"post, err := client.Posts.New(context.TODO(), relaygo.PostNewParams{
Content: relaygo.F("Hello from RelayAPI!"),
Targets: relaygo.F([]string{"twitter", "linkedin"}),
ScheduledAt: relaygo.F("now"),
})
fmt.Println(post.ID) // "post_abc123"
fmt.Println(post.Status) // "published"PostCreateResponse post = client.posts().create(PostCreateParams.builder()
.content("Hello from RelayAPI!")
.addTarget("twitter")
.addTarget("linkedin")
.scheduledAt("now")
.build());
System.out.println(post.id()); // "post_abc123"
System.out.println(post.status()); // "published"curl -X POST https://api.relayapi.dev/v1/posts \
-H "Authorization: Bearer $RELAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Hello from RelayAPI!",
"targets": ["twitter", "linkedin"],
"scheduled_at": "now"
}'Posting to Multiple Platforms
Target multiple accounts in a single API call. RelayAPI handles platform-specific formatting automatically.
Scheduling Posts
Schedule posts for future publishing by adding scheduled_at and timezone:
const post = await client.posts.create({
content: 'Scheduled post!',
targets: ['twitter'],
scheduled_at: '2024-01-16T12:00:00',
timezone: 'America/New_York',
});post = client.posts.create(
content='Scheduled post!',
targets=['twitter'],
scheduled_at='2024-01-16T12:00:00',
timezone='America/New_York',
)post, err := client.Posts.New(context.TODO(), relaygo.PostNewParams{
Content: relaygo.F("Scheduled post!"),
Targets: relaygo.F([]string{"twitter"}),
ScheduledAt: relaygo.F("2024-01-16T12:00:00"),
Timezone: relaygo.F("America/New_York"),
})PostCreateResponse post = client.posts().create(PostCreateParams.builder()
.content("Scheduled post!")
.addTarget("twitter")
.scheduledAt("2024-01-16T12:00:00")
.timezone("America/New_York")
.build());curl -X POST https://api.relayapi.dev/v1/posts \
-H "Authorization: Bearer $RELAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Scheduled post!",
"targets": ["twitter"],
"scheduled_at": "2024-01-16T12:00:00",
"timezone": "America/New_York"
}'Supported Platforms
| Platform | Post | Schedule | Media | Analytics |
|---|---|---|---|---|
| Twitter/X | ✅ | ✅ | ✅ | ✅ |
| ✅ | ✅ | ✅ | ✅ | |
| ✅ | ✅ | ✅ | ✅ | |
| ✅ | ✅ | ✅ | ✅ | |
| TikTok | ✅ | ✅ | ✅ | ✅ |
| YouTube | ✅ | ✅ | ✅ | ✅ |
| ✅ | ✅ | ✅ | ✅ | |
| ✅ | ✅ | ✅ | ✅ | |
| Bluesky | ✅ | ✅ | ✅ | ✅ |
| Threads | ✅ | ✅ | ✅ | ✅ |
| Telegram | ✅ | ✅ | ✅ | ✅ |
| Snapchat | ✅ | ✅ | ✅ | ✅ |
| Discord | ✅ | ✅ | ✅ | — |
| Mastodon | ✅ | ✅ | ✅ | — |
| ✅ | ✅ | ✅ | — | |
| Google Business | ✅ | ✅ | ✅ | ✅ |
| SMS | ✅ | ✅ | ✅ | — |
What's Next?
- Platforms Overview — Learn about platform-specific features
- API Reference — Full endpoint documentation
- Guides — Step-by-step guides
Found something wrong? Help us improve this page.