Your first post

Get an API key

1. Check the connected networks

A post leaves through the accounts connected to the establishment. List them; if one is missing, create a connection link.

bash
curl https://api.sofia-post.com/api/v1/establishments/$ESTABLISHMENT_ID/accounts \
  -H "Authorization: Bearer $SOFIA_API_KEY"

2. Add a media

Instagram and TikTok need a photo or a video. Import one from a public https URL; Sofia downloads it into the media library and returns its id.

bash
curl -X POST https://api.sofia-post.com/api/v1/media \
  -H "Authorization: Bearer $SOFIA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"establishmentId":"'$ESTABLISHMENT_ID'","url":"https://images.example.com/tarte-tatin.jpg"}'

3. Check it with a dry run

Add ?dry_run=true: Sofia judges each network on its real rules and on the connected account, and writes nothing.

bash
curl -X POST 'https://api.sofia-post.com/api/v1/posts?dry_run=true' \
  -H "Authorization: Bearer $SOFIA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "establishmentId": "'$ESTABLISHMENT_ID'",
    "targets": [
      { "platform": "instagram", "text": "Tarte tatin du jour", "media": [{ "id": "'$MEDIA_ID'" }] },
      { "platform": "facebook", "text": "Tarte tatin du jour", "media": [{ "id": "'$MEDIA_ID'" }] }
    ]
  }'
json
{
  "status": "ready",
  "dryRun": true,
  "targets": [
    { "platform": "instagram", "accountId": "fecd0904-…", "handle": "sof_ia_officiel", "state": "ready" },
    { "platform": "facebook", "accountId": "a423b3a4-…", "handle": "Sofia post", "state": "ready" }
  ]
}

4. Publish

Send the same body without dry_run, with an Idempotency-Key so a retry never publishes twice. Without scheduledAt the post leaves now; with a future scheduledAt it is scheduled.

bash
curl -X POST https://api.sofia-post.com/api/v1/posts \
  -H "Authorization: Bearer $SOFIA_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Idempotency-Key: $(uuidgen)" \
  -d @post.json

5. Follow it

The post answers publishing, then each network moves to published with its permalink, or to failed with its reason. Read it with GET /v1/posts/{id}, or register a webhook to be told.

json
{
  "id": "efc578cc-ef79-40e9-876d-be1a33d3b8db",
  "status": "published",
  "targets": [
    {
      "platform": "instagram",
      "state": "published",
      "publishedAt": "2026-11-02T20:17:25.453Z",
      "permalink": "https://www.instagram.com/p/DfQJVPGFfb_/"
    }
  ]
}