← All documentation
Networks

Mastodon

Publish statuses (text + images) to any Mastodon instance.

Connect

Credential-based — no OAuth. In your instance, create an access token (Preferences → Development → New application, scopes write:statuses + write:media) and connect:

curl -X POST https://api.herald.leiritech.com/v1/accounts/mastodon \
  -H "Authorization: Bearer hld_…" -H "Content-Type: application/json" \
  -d '{"instance_url":"https://mastodon.social","access_token":"your-access-token"}'
{ "id":"…","network":"mastodon","display_name":"@ada@mastodon.social","status":"active" }

Herald validates via /api/v1/accounts/verify_credentials and stores the instance + token encrypted. 422 if the instance is unreachable or the token is rejected.

Publish

curl -X POST https://api.herald.leiritech.com/v1/posts \
  -H "Authorization: Bearer hld_…" -H "Content-Type: application/json" \
  -d '{"targets":["<mastodon-uuid>"],"text":"tooting from Herald","mode":"now"}'
{ "id":"…","status":"published","targets":[{"network":"mastodon","status":"published",
  "permalink":"https://mastodon.social/@ada/109…","platform_post_id":"109…"}] }

Images (media_ids) are uploaded to /api/v2/media and attached; posts are public.

Rules & gotchas

  • Works with any instance — the instance URL travels with the token.
  • No approval or cost.
  • title is ignored; text or media is required.