La tua prima pubblicazione
Ottieni una chiave API1. Verificare le reti collegate
Una pubblicazione parte dagli account collegati all'attività. Elencali; se ne manca uno, crea un link di collegamento.
curl https://api.sofia-post.com/api/v1/establishments/$ESTABLISHMENT_ID/accounts \
-H "Authorization: Bearer $SOFIA_API_KEY"2. Aggiungere un media
Instagram e TikTok richiedono una foto o un video. Importane uno da un URL https pubblico; Sofia lo scarica nella mediateca e restituisce il suo id.
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. Verificare con una simulazione
Aggiungi ?dry_run=true: Sofia giudica ogni rete in base alle sue regole reali e all'account collegato, e non scrive nulla.
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'" }] }
]
}'{
"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. Pubblicare
Invia lo stesso body senza dry_run, con una Idempotency-Key perché un nuovo tentativo non pubblichi mai due volte. Senza scheduledAt la pubblicazione parte subito; con uno scheduledAt futuro viene programmata.
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.json5. Seguirla
La pubblicazione risponde publishing, poi ogni rete passa a published con il suo permalink, o a failed con il suo motivo. Leggila con GET /v1/posts/{id}, oppure registra un webhook per essere avvisato.
{
"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_/"
}
]
}