# Facebook

Publish feed posts, multi-image posts, link carousels, Stories and Reels to a Facebook Page with the Zernio API, with drafts, first comments and country targeting.

import { Tab, Tabs } from 'fumadocs-ui/components/tabs';


Publish feed posts, multi-image posts, link carousels, Stories and Reels to a Facebook Page with `POST /v1/posts` and `platform: "facebook"`.

The same account also serves analytics, Messenger DMs, comments, Page reviews and comment-to-DM automations.

## Quick reference

| Property | Value |
|----------|-------|
| Character limit | 63,206 (truncated at about 480 with "See more") |
| Images per post | 10 |
| Videos per post | 1 |
| Image formats | JPEG, PNG, GIF (WebP converted to JPEG) |
| Image max size | 4 MB (Facebook rejects larger files in practice) |
| Video formats | MP4, MOV |
| Video max size | 4 GB |
| Video max duration | 240 minutes (feed), 60 seconds (Reel), 120 seconds (Stories) |
| Post types | Feed (text, image, video, multi-image, link carousel), Story, Reel |
| Scheduling | Yes |
| Inbox (DMs) | Yes |
| Inbox (comments) | Yes |
| Inbox (reviews) | Yes |
| Comment-to-DM automations | Yes |
| Analytics | Yes |

## Before you start

Facebook requires a Page. Personal profiles cannot post through the API, and the user must be an Admin or Editor of the Page.

One connected account can manage several Pages ([Post to several Pages](/platforms/facebook/posts#post-to-several-pages)).

Facebook tokens expire frequently, so subscribe to the `account.disconnected` webhook.

## Connect

Call `GET /v1/connect/facebook` with `profileId` on [Get OAuth connect URL](/connect/get-connect-url).

After OAuth, the user picks which Page to connect, in standard or headless mode. See [platforms requiring secondary selection](/guides/connecting-accounts#platforms-requiring-secondary-selection).

The [connecting accounts guide](/guides/connecting-accounts) covers the OAuth flow and [scopes](/guides/connecting-accounts#scopes) in general. [Account health](/accounts/get-all-accounts-health) reports what a connected account can do with the scopes the user granted.

A [Meta Ads](/platforms/meta-ads) connection is a separate `metaads` account. It does not serve organic posting or Page Insights.

[Connections and billing](/platforms/meta-ads#connections-and-billing) explains how the two relate and how each is billed.

### OAuth scopes

The consent screen also requests `ads_management`, `ads_read`, `pages_manage_ads` and `leads_retrieval` (the `ads` area). The same token can then drive [Meta Ads](/platforms/meta-ads) and lead forms.

Pass [`scopes`](/guides/connecting-accounts#scopes) to ask for fewer areas.

`pages_manage_metadata` comes with every area except `analytics`, because it subscribes the Page to webhooks. A `scopes=analytics` connect is read-only: it cannot change the Page, and the Page gets no webhooks.

Accounts connected before ads were included need a reconnect to pick the ads scopes up.

## Publish a post

This request publishes an image post to a Facebook Page right away.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data: published } = await zernio.posts.createPost({
  body: {
    content: 'New collection in store from Monday',
    mediaItems: [
      { type: 'image', url: 'https://cdn.example.com/collection.jpg' }
    ],
    platforms: [
      { platform: 'facebook', accountId: '66b2e19d8c3f5a7e9d0b1c2d' }
    ],
    publishNow: true
  }
});

console.log(published.post.platforms[0].platformPostUrl);
```
</Tab>
<Tab value="Python">
```python
from zernio import Zernio

client = Zernio()

published = client.posts.create_post(
    content="New collection in store from Monday",
    media_items=[
        {"type": "image", "url": "https://cdn.example.com/collection.jpg"}
    ],
    platforms=[
        {"platform": "facebook", "accountId": "66b2e19d8c3f5a7e9d0b1c2d"}
    ],
    publish_now=True
)

print(published["post"]["platforms"][0]["platformPostUrl"])
```
</Tab>
<Tab value="curl">
```bash
curl -X POST https://zernio.com/api/v1/posts \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "New collection in store from Monday",
    "mediaItems": [
      {"type": "image", "url": "https://cdn.example.com/collection.jpg"}
    ],
    "platforms": [
      {"platform": "facebook", "accountId": "66b2e19d8c3f5a7e9d0b1c2d"}
    ],
    "publishNow": true
  }'
```
</Tab>
</Tabs>

Every option is on [Posts, Stories & Reels](/platforms/facebook/posts).

## In this section

<PlatformPages platform="facebook" />

## Related

- [Connecting accounts](/guides/connecting-accounts): the OAuth flow and the Page selection step.
- [Create post](/posts/create-post): every field of the request.
- [Media uploads](/guides/media-uploads): upload images and videos instead of hosting them.
- [Messages](/messages/list-inbox-conversations), [Comments](/comments/list-inbox-comments) and [Reviews](/reviews/list-inbox-reviews): the inbox API.
- [Meta Ads](/platforms/meta-ads): run ads from the same connection.
- [ManyChat-style automations](/guides/manychat-patterns): ref links, comment to DM, welcome screen and handover.
- [Pricing](/pricing): what analytics, the inbox and outbound messages cost.