> ## Documentation Index
> Fetch the complete documentation index at: https://docs.autoposting.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Facebook Pages beta

> Connect approved Facebook Pages and publish through the API, CLI, SDK or MCP.

<Note>Facebook Pages is restricted to approved beta workspaces. Meta approval for general customer access is pending. Personal profiles and Groups are unsupported.</Note>

## Connect a Page

Open **Brands → Connected Accounts → Facebook Page** in the app. Complete official Facebook consent, then select the intended eligible Pages. Request beta access if the app shows **Request access**. Tokens remain on the server; never paste a Page access token into an API request or MCP client.

The CLI can open the same connection flow:

```bash theme={null}
ap brands connect-facebook my-brand
ap brands auth-status my-brand
```

The SDK returns the browser handoff through `client.brands.facebookConnection('my-brand')`. Page consent and explicit selection happen in the app.

## Create a draft

Use `facebook` as the platform and always pass explicit connected Page IDs, including when a brand has only one Page.

```json theme={null}
{
  "brandSlug": "my-brand",
  "text": "Our latest update",
  "platforms": ["facebook"],
  "facebookOptions": { "format": "text" },
  "targetAccountIds": { "facebook": ["connected-page-id"] }
}
```

POST this body to `https://app.autoposting.ai/api-proxy/posts` with your Autoposting API key. Omitting `scheduledAt` saves a draft; creation does not publish immediately.

<Tabs>
  <Tab title="CLI">
    ```bash theme={null}
    ap posts create --brand my-brand --text "Our latest update" \
      --platforms facebook --facebook-format text --account facebook=connected-page-id
    ap posts get <post-id>
    ap posts schedule <post-id> --at "2030-01-01T09:00:00Z"
    ap posts schedule <post-id> --cancel
    ```

    Replace the example timestamp with your intended future time. `ap posts publish <post-id>` publishes immediately.
  </Tab>

  <Tab title="SDK">
    ```typescript theme={null}
    import { Autoposting } from '@autoposting.ai/sdk'

    const client = new Autoposting({ apiKey: process.env.AUTOPOSTING_API_KEY! })
    const post = await client.posts.create({
      brandSlug: 'my-brand',
      text: 'Our latest update',
      platforms: ['facebook'],
      facebookOptions: { format: 'text' },
      targetAccountIds: { facebook: ['connected-page-id'] },
    })
    const result = await client.posts.getById(post.id)
    console.log(result.platformResults?.facebook?.accounts)
    ```
  </Tab>

  <Tab title="MCP">
    ```json theme={null}
    {
      "name": "create-post",
      "arguments": {
        "brandSlug": "my-brand",
        "text": "Our latest update",
        "platforms": ["facebook"],
        "facebookOptions": { "format": "text" },
        "targetAccountIds": { "facebook": ["connected-page-id"] }
      }
    }
    ```

    Use `get-post` with `{ "id": "post-id" }` to read it. Use the [tool schemas](/mcp/tools) for scheduling and publishing.
  </Tab>
</Tabs>

## Formats and overrides

| Format | Required input |
| - | - |
| `text` | Non-empty effective caption; no media |
| `link` | `facebookOptions.link` with a public HTTPS URL; no uploaded media |
| `photo` | Exactly one image or GIF |
| `multi-photo` | At least two images or GIFs |
| `video` | Exactly one video |
| `reel` | Exactly one public hosted video outside Meta CDN |

Media uses `{ "url": "https://...", "type": "image" }` or `"video"`. Provider media constraints also apply. Upload local files through the CLI or app; use the released `upload-media` MCP tool according to its input schema.

`platformTexts.facebook` overrides the shared caption; `""` is intentional. `platformMedia.facebook` overrides shared attachments; `[]` excludes them. Omit either property to use shared content. Edit through `PUT /posts/:id`, `ap posts update <id> --from <file.json>`, the SDK `posts.update`, or MCP `update-post`.

## Outcomes and recovery

Read each Page outcome in `platformResults.facebook.accounts`. A Page can be `published`, `failed`, `pending` or `unknown`. Remote post IDs and URLs are returned when available; a missing URL is not proof that publishing failed.

Only Pages listed in the server's `facebookRecoveryPageIds` are eligible for explicit recovery. Never republish a successful Page or blindly retry an Unknown result.

* API: `POST /posts/:id/retry?platform=facebook` or `PUT /posts/:id/schedule` with `{ "scheduledAt": "future-ISO-time", "platform": "facebook" }`.
* CLI: `ap posts retry <id> --platforms facebook`, or `ap posts schedule <id> --at <future-ISO-time> --platform facebook`.
* SDK: `client.posts.retry(id, 'facebook')` or `client.posts.schedule(id, futureTime, 'facebook')`.
* MCP: `retry-post` or `schedule-post`, with `id` and `platform: "facebook"`.

Cancel scheduling through the API `{ "cancel": true }`, CLI `--cancel`, or SDK `posts.unschedule(id)`. CLI MCP v0.5.5 supports `cancel-schedule` with `{ "id": "post-id" }`. Normal cancellation returns to draft; recovery cancellation restores the previous outcome without republishing. Do not pass a date or platform.

## Autoposting MCP and Meta MCP

Autoposting MCP manages your Autoposting workspace. Meta's developer MCP manages Meta developer apps; it does not replace Facebook Page consent or enable personal-profile or Group posting. Connecting your own Meta MCP account inside Autoposting is not currently available.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.