# Facebook API

> Returns public Facebook Pages with their follower counts, a Page's timeline posts, a post by its permalink and the comments of a post.

Category: Social & Video. Region: global. 4 endpoints at `https://api.hoshime.com/v1/facebook/<endpoint>`, `GET` with query parameters, answering `{data, meta}` (see https://hoshime.com/docs/responses.md). Reference: https://hoshime.com/docs/platforms/facebook
## GET /v1/facebook/page

One Facebook Page: name, id, URL, avatar, category, bio, follower count and whether it is verified.

Scope: `social:read` · Units: 1 · Cached: 60 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Page username or URL (https://www.facebook.com/<username>). (e.g. NASA) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `avatarUrl` (string), `bio` (string), `category` (string), `createdAt` (string), `followerCount` (integer (int64)), `followingCount` (integer (int64)), `id` (string), `name` (string), `postCount` (integer (int64)), `url` (string), `username` (string), `verified` (boolean)

```bash
curl "https://api.hoshime.com/v1/facebook/page?id=NASA" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/facebook/pagePosts

Posts on the timeline of one Facebook Page, newest first: text, author, time, reaction, comment and share counts, and photos or videos. The first page holds the posts in the page's HTML; each next page holds the next three.

Scope: `social:read` · Units: 1 · Cached: 10 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Page username or URL (https://www.facebook.com/<username>). (e.g. NASA) |
| `cursor` | string | no | meta.pagination.nextCursor of the previous page. Omit it for the first page. |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `author` (Author), `author.avatarUrl` (string), `author.id` (string), `author.name` (string), `author.url` (string), `author.username` (string), `commentCount` (integer (int64)), `createdAt` (string), `id` (string), `likeCount` (integer (int64)), `media` (Media[]), `media[].durationSeconds` (integer (int64)), `media[].height` (any), `media[].thumbnailUrl` (string), `media[].type` (string), `media[].url` (string), `media[].width` (any), `shareCount` (integer (int64)), `text` (string), `url` (string), `viewCount` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/facebook/pagePosts?id=NASA" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/facebook/post

One public Facebook post by its permalink: text, author, time, reaction, comment and share counts, and photos or videos.

Scope: `social:read` · Units: 1 · Cached: 10 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Post permalink (https://www.facebook.com/<page>/posts/pfbid...). (e.g. https://www.facebook.com/NASA/posts/pfbid05obVhEi3rgpfK4zN3tm6Fao6rRsCWcFAj9xEdHBZ2ghzmagEJbgnRQHk8A3ttV81l) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `author` (Author), `author.avatarUrl` (string), `author.id` (string), `author.name` (string), `author.url` (string), `author.username` (string), `commentCount` (integer (int64)), `createdAt` (string), `id` (string), `likeCount` (integer (int64)), `media` (Media[]), `media[].durationSeconds` (integer (int64)), `media[].height` (any), `media[].thumbnailUrl` (string), `media[].type` (string), `media[].url` (string), `media[].width` (any), `shareCount` (integer (int64)), `text` (string), `url` (string), `viewCount` (integer (int64))

```bash
curl "https://api.hoshime.com/v1/facebook/post?id=https%3A%2F%2Fwww.facebook.com%2FNASA%2Fposts%2Fpfbid05obVhEi3rgpfK4zN3tm6Fao6rRsCWcFAj9xEdHBZ2ghzmagEJbgnRQHk8A3ttV81l" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/facebook/postComments

Comments on one public Facebook post, ten per call, in the order Facebook shows them, with the author, text, like count and reply count of each.

Scope: `social:read` · Units: 1 · Cached: 10 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Post permalink (https://www.facebook.com/<page>/posts/pfbid...). (e.g. https://www.facebook.com/NASA/posts/pfbid05obVhEi3rgpfK4zN3tm6Fao6rRsCWcFAj9xEdHBZ2ghzmagEJbgnRQHk8A3ttV81l) |
| `cursor` | string | no | meta.pagination.nextCursor of the previous page. Omit it for the first page. |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `author` (Author), `author.avatarUrl` (string), `author.id` (string), `author.name` (string), `author.url` (string), `author.username` (string), `createdAt` (string), `id` (string), `likeCount` (integer (int64)), `replyCount` (integer (int64)), `text` (string)

```bash
curl "https://api.hoshime.com/v1/facebook/postComments?id=https%3A%2F%2Fwww.facebook.com%2FNASA%2Fposts%2Fpfbid05obVhEi3rgpfK4zN3tm6Fao6rRsCWcFAj9xEdHBZ2ghzmagEJbgnRQHk8A3ttV81l" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
