# Publish to Facebook with the API
URL: https://skedcast.com/developers/guides/publish-to-facebook-api

Publishing to Facebook is one POST to /v1/posts. Connect a Page once, then send a compose request that names the account. Add a facebook variant to choose feed, Reel or Story, or to post a first comment.

## What do you need before you publish?
You need one connected account for the platform. Connect it in the SkedCast console. If a client owns the account, create a connect link with `POST /v1/clients/{id}/connect-invites` and send it to them. They authorize from that page without a SkedCast login.
`GET /v1/accounts` lists the connected accounts with their ids. Pass that id in `targets.accountIds` below.

## How do you schedule a Facebook post with the API?
```bash
curl -X POST https://api.skedcast.com/v1/posts \
  -H "Authorization: Bearer sked_live_YOUR_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "clientId": "<clientId>",
    "content": "Launch day is here 🚀",
    "mediaIds": ["<mediaAssetId>"],
    "targets": { "mode": "selection", "accountIds": ["<facebookAccountId>"] },
    "schedule": { "type": "at", "scheduledAt": "2030-01-15T15:00:00Z" }
  }'
```

## Which Facebook fields can you set?
Put everything platform-specific in one `variants` entry with `"platform": "facebook"` and an `overrides` object. Send only `facebook` keys on a `facebook` variant. SkedCast reads the keys in the table below and ignores the rest.

## Reference
Field | Type | Values / default | Notes
`contentType` | enum | `feed` \| `reel` \| `story` | Defaults to `feed`.
`firstComment` | string | — | Posted right after publish. Needs the Page engagement permission (`pages_manage_engagement`). If `missingPermissions` on `GET /v1/accounts/{id}` names it, reconnect the Page. Best-effort: a failed comment never fails the post. The outcome is reported as `firstCommentIssue` on `GET /v1/post-targets/{id}`.

## Unknown keys are ignored without an error
A misspelled or unknown key in `overrides` is not an error and not a warning. It is dropped, so check the field names in the table above, especially a required one.
A YouTube-only key (such as `privacyStatus`, `captions` or `chapters`) sent on another platform's variant is ignored and returns an `override_key_wrong_platform` warning.

## How do you add Facebook-specific settings?
```json
{
  "clientId": "<clientId>",
  "content": "New product drop 📦",
  "mediaIds": ["<mediaAssetId>"],
  "targets": { "mode": "selection", "accountIds": ["<facebookAccountId>"] },
  "variants": [
    { "platform": "facebook", "overrides": { "contentType": "reel" } }
  ],
  "schedule": { "type": "at", "scheduledAt": "2030-01-15T15:00:00Z" }
}
```

## Native scheduling
Set the post-level `scheduleMode` to `"native"` to let Facebook publish at the scheduled time instead of SkedCast (the default is `"managed"`). It needs a future `schedule.type` of `"at"`. YouTube supports it too. Every other target on the same post keeps managed scheduling.

## How do you check that the post published?
Publishing creates one post target per account. `GET /v1/post-targets/{id}` (or `GET /v1/posts/{id}`) reports `status`, plus `externalId` (Facebook's own post id) and `permalink` (its public URL) once published. To avoid polling, subscribe to the `target.published` and `target.failed` webhooks (see the webhooks guide).

## FAQ
**Q: Can I schedule a Facebook Reel, not just a feed post?**
A: Yes. Set variants[].overrides.contentType to "reel" on a facebook variant and put a video in mediaIds. Omit contentType (or set "feed") for a feed post, or set "story" for a Story.

**Q: Can I publish immediately instead of scheduling?**
A: Yes. Send schedule: { "type": "now" } in the same POST /v1/posts call.
