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

# Facebook Posting API for Pages | Dohoo

> Use the Dohoo Facebook posting API to publish photos, videos, and messages to connected Facebook Pages.

The Facebook Publish endpoint lets you post photos and videos to any Facebook page connected to your Dohoo account. Supply the connection ID for the target page, the file you want to share, and an optional message, and Dohoo handles the rest of the publishing process with Facebook's API.

## Endpoint

```
POST https://dohoo.ai/api/v2/facebook/publish
```

## Request headers

| Header         | Required | Description                |
| -------------- | -------- | -------------------------- |
| `X-API-Key`    | ✅        | Your Dohoo API key         |
| `Content-Type` | ✅        | Must be `application/json` |

## Request body

| Field          | Type   | Required | Description                                            |
| -------------- | ------ | -------- | ------------------------------------------------------ |
| `connectionId` | string | ✅        | The ID of the Facebook page connection to publish from |
| `fileId`       | string | ✅        | The ID of the uploaded file (photo or video)           |
| `message`      | string | ❌        | The text message to accompany the post                 |

## Example request

```bash theme={null}
curl -X POST https://dohoo.ai/api/v2/facebook/publish \
  -H "X-API-Key: dh_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "connectionId": "conn_facebook_001",
    "fileId": "abc123",
    "message": "Your post message here"
  }'
```

## Example response

```json theme={null}
{
  "success": true,
  "platform": "facebook",
  "postId": "123456789012345_987654321098765",
  "connectionId": "conn_facebook_001",
  "status": "published",
  "publishedAt": "2025-01-15T11:05:00Z",
  "url": "https://www.facebook.com/permalink/123456789"
}
```

<Note>
  This endpoint publishes to **Facebook Pages** only. Publishing to personal Facebook profiles is not supported by the Facebook Graph API.
</Note>

<Tip>
  Videos uploaded to Facebook perform best when encoded in H.264 with a 16:9 or 9:16 aspect ratio. Upload your file via the Dohoo media library first, then pass the returned `fileId` here.
</Tip>

<Warning>
  Make sure the Facebook Page connected to Dohoo has the **"Pages" permission** granted during the OAuth flow. Missing permissions will result in a `403 Forbidden` error on publish.
</Warning>
