# Publish to Facebook

> Publish text, a link, photos, or a video to a Facebook Page.

Canonical: <https://www.tryadeli.com/docs/api/posts/publish-facebook>

`POST https://app.tryadeli.com/api/v1/posts`

Authorization: `Bearer <API key>` — see [Authentication](https://www.tryadeli.com/docs/authentication)

Four shapes, chosen by which media field you send rather than by a kind string,
so an impossible combination cannot be expressed. As with Instagram, media is
staged on Adeli's HTTPS media host because Meta fetches it by URL.

| Name        | Type         | Required | Description                                                      |
| ----------- | ------------ | -------- | ---------------------------------------------------------------- |
| `platform`  | `"facebook"` | Yes      |                                                                  |
| `accountId` | `uuid`       | Yes      | A connected Facebook Page in your organization.                  |
| `message`   | `string`     |          | Up to 2200 characters. The caption shown with the post.          |
| `image`     | `object`     |          | One photo — `contentType` and `base64`. Publishes synchronously. |
| `images`    | `object[]`   |          | 2–10 photos, published as one multi-photo post. Synchronous.     |
| `reel`      | `object`     |          | One vertical video, published as a Reel. Asynchronous.           |
| `video`     | `object`     |          | One video, published to the Page feed. Asynchronous.             |
| `title`     | `string`     |          | Only valid alongside `video`. Up to 255 characters.              |

A photo response is the same normalized post Instagram returns, with
`platform: "facebook"`. A Reel or feed video returns `202` with a `publishId`;
pass it to [Facebook video status](https://www.tryadeli.com/docs/api/posts/get-facebook-video-status).

> **Note: A Page must be chosen first**
>
> A Facebook account in `pending_page_selection` has no Page token and cannot
> publish. Every write against it returns `409 page_not_selected` until your
> customer picks a Page. See [Connect](https://www.tryadeli.com/docs/api/connect#provider-requirements).

## Request examples

**cURL**

```bash
curl --fail-with-body -X POST "https://app.tryadeli.com/api/v1/posts" \
  -H "Authorization: Bearer $ADELI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "platform": "facebook",
  "accountId": "00000000-0000-0000-0000-000000000000",
  "message": "Hello",
  "image": {
    "contentType": "image/jpeg",
    "base64": "<base64 JPEG>"
  }
}'
```

**JavaScript**

```javascript
const response = await fetch("https://app.tryadeli.com/api/v1/posts", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ADELI_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    platform: "facebook",
    accountId: "00000000-0000-0000-0000-000000000000",
    message: "Hello",
    image: {
      contentType: "image/jpeg",
      base64: "<base64 JPEG>",
    },
  }),
});
console.log(await response.json());
```

**Python**

```python
import os

import requests

response = requests.post(
    "https://app.tryadeli.com/api/v1/posts",
    headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"},
    json={
        "platform": "facebook",
        "accountId": "00000000-0000-0000-0000-000000000000",
        "message": "Hello",
        "image": {
            "contentType": "image/jpeg",
            "base64": "<base64 JPEG>",
        },
    },
)
print(response.json())
```

## Responses

### 201

```json
{
  "id": "facebook_post_00000000-0000-0000-0000-000000000000_100000000000000_200000000000000",
  "platform": "facebook",
  "accountId": "00000000-0000-0000-0000-000000000000",
  "profileId": "00000000-0000-4000-8000-000000000001",
  "providerId": "100000000000000_200000000000000",
  "caption": "Hello",
  "media": [{ "type": "IMAGE", "url": "https://...", "thumbnailUrl": "https://..." }],
  "permalink": "https://www.facebook.com/...",
  "engagement": { "likes": null, "comments": null },
  "publishedAt": "2026-04-01T12:00:00.000Z"
}
```

### 202

```json
{
  "platform": "facebook",
  "accountId": "00000000-0000-0000-0000-000000000000",
  "profileId": "00000000-0000-0000-0000-000000000000",
  "publishId": "1234567890",
  "status": "ACCEPTED",
  "statusUrl": "/api/v1/posts/facebook/status?accountId=...&profileId=...&publishId=1234567890"
}
```

### 409

```json
{
  "error": {
    "code": "page_not_selected",
    "message": "Choose a Facebook Page first"
  }
}
```
