MastodonAPI
Post to Mastodon from your code
Post to your own instance, whichever one that is. yeetpost registers itself there on demand, reads the instance's character limit when you connect, and checks against that number.
What you can build
Post a status when something ships
The same call works on any instance you connect.
import { yeetpost } from "yeetpost";
await yeetpost({
connection: "mastodon",
text: `${post.title}\n\n${post.url}`,
});Post the same thing to Mastodon and Bluesky
One request, one result per connection, each checked against its own limit.
const response = await fetch("https://api.yeetpost.com/api/v2/posts", {
method: "POST",
headers: {
"x-api-key": process.env.YEETPOST_API_KEY,
"content-type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify({
text: "shipped the new api docs today",
connectionSlugs: ["mastodon", "bluesky"],
}),
});Post a thread and read what landed
A thread Mastodon refuses partway is deleted again, head included, and comes back failed.
const data = await response.json();
const mastodon = data.results.find((r) => r.connectionSlug === "mastodon");
console.log(mastodon.status, mastodon.threadCount);Related features
- Post to Mastodon from your terminal
- Automate LinkedIn posts from your code
- Post to X programmatically
- Post to Bluesky from your code
Explore the full catalog on the features hub.
Related resources
Ready to get started?
Start posting to Mastodon in minutes.