# Instagram

Source: https://docs.autessa.com/docs/tools/instagram

> Tool types for drafting, publishing, syncing, and measuring Instagram posts through an Instagram connector.

# Instagram

Draft Instagram posts — single images or carousels — into a reviewable AutessaDB table, publish approved drafts to the connected account, sync existing posts, and read per-post engagement.

Every tool on this page requires an Instagram connector (see
[Connectors](/docs/guide/connectors.md)); pass its ID as `connectorId`. Posts
live as rows in an AutessaDB table the connector provisions: drafts start at
`status = DRAFT`, and publishing runs Instagram's container flow (create the
media container, wait for processing, then publish) before flipping the row
to `PUBLISHED` with the Instagram post ID stored. Image URLs must be
publicly accessible — Instagram fetches the media from the URL, not from
Autessa.

## Create a draft **TOOL** `INSTAGRAM_CREATE_DRAFT`

Inserts a new draft row with `status = DRAFT` — nothing is posted to
Instagram yet. `caption` is capped at 2,200 characters, and `mediaUrls` is a
comma-separated list of image URLs: one URL publishes as a single image, two
to five publish as a carousel. Returns the new `recordId` for the update,
publish, and stats tools.

### Example

```json title="Tool config"
{
  "toolType": "INSTAGRAM_CREATE_DRAFT",
  "connectorId": "V1StGXR8Z5",
  "caption": "@@{CAPTION}",
  "mediaUrls": "https://example.com/photo-1.jpg,https://example.com/photo-2.jpg"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `caption` (string) — Max 2200 characters
- `mediaUrls` (string) — Comma-separated URLs of images (max 5)

## Update a draft **TOOL** `INSTAGRAM_UPDATE_DRAFT`

Edits an existing draft row in place; `caption` and `mediaUrls` are both
optional and only the provided fields change. This edits the AutessaDB row
only — Instagram does not allow editing a post's media after publishing, so
get the draft right before you publish it.

### Example

```json title="Tool config"
{
  "toolType": "INSTAGRAM_UPDATE_DRAFT",
  "connectorId": "V1StGXR8Z5",
  "recordId": 42,
  "caption": "@@{REVISED_CAPTION}"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `recordId` (integer) — Required integer value.
- `caption` (string · optional) — Optional - only updates if provided
- `mediaUrls` (string · optional) — Optional - only updates if provided

## Publish a post **TOOL** `INSTAGRAM_PUBLISH_POST`

Reads the draft row and runs Instagram's two-step publish: it creates a
media container (single image or carousel), polls until Instagram finishes
processing the media, then publishes the container. The row must still be in
`DRAFT` status — republishing fails with `ALREADY_PUBLISHED`. On success the
row is updated to `status = PUBLISHED` with the Instagram post ID stored.
Expect this call to take longer than most tools while Instagram processes
the media.

### Example

```json title="Tool config"
{
  "toolType": "INSTAGRAM_PUBLISH_POST",
  "connectorId": "V1StGXR8Z5",
  "recordId": 42
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `recordId` (integer) — Required integer value.

## Get post stats **TOOL** `INSTAGRAM_GET_POST_STATS`

Looks up the Instagram post ID on a published row and fetches live
engagement metrics for that post from the Instagram API. Only works for
rows that have been published (or synced) and therefore carry an Instagram
post ID.

### Example

```json title="Tool config"
{
  "toolType": "INSTAGRAM_GET_POST_STATS",
  "connectorId": "V1StGXR8Z5",
  "recordId": 42
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `recordId` (integer) — Required integer value.

## Get all posts **TOOL** `INSTAGRAM_GET_ALL_POSTS`

Lists rows from the connector's posts table — drafts and published posts
together by default, or filtered with `status` (`DRAFT`, `PUBLISHED`).
`pageSize` defaults to 50 and caps at 100. Reads the AutessaDB table, so
results include synced posts as well as agent-created drafts.

### Example

```json title="Tool config"
{
  "toolType": "INSTAGRAM_GET_ALL_POSTS",
  "connectorId": "V1StGXR8Z5",
  "status": "DRAFT",
  "pageSize": 50
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `status` (string · optional) — Optional filter: DRAFT, PUBLISHED
- `pageSize` (integer · optional) — Optional, default 50, max 100

## Get post by ID **TOOL** `INSTAGRAM_GET_POST_BY_ID`

Fetches a single row from the posts table by its AutessaDB `rowId`,
returning the caption, media URLs, status, and stored Instagram post ID.
Use it to inspect one specific draft or published post without paging
through the full list.

### Example

```json title="Tool config"
{
  "toolType": "INSTAGRAM_GET_POST_BY_ID",
  "connectorId": "V1StGXR8Z5",
  "rowId": 42
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `rowId` (integer) — Required integer value.

## Sync posts **TOOL** `INSTAGRAM_SYNC_POSTS`

Imports the connected account's existing posts from the Instagram API into
the AutessaDB table as `PUBLISHED` rows, skipping posts that are already
present. Results are cached for 24 hours — a second sync inside that window
returns the cached summary unless `forceRefresh` is `true`.

### Example

```json title="Tool config"
{
  "toolType": "INSTAGRAM_SYNC_POSTS",
  "connectorId": "V1StGXR8Z5",
  "forceRefresh": false
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `forceRefresh` (boolean · optional) — Optional: bypass daily cache if true

## Related

- [Tool Types overview](/docs/tools.md)
- [Tools guide](/docs/guide/agentic/tools.md)
- [Connectors guide](/docs/guide/connectors.md)
- [Facebook tool types](/docs/tools/facebook.md)
- [Threads tool types](/docs/tools/threads.md)
- [TikTok tool types](/docs/tools/tiktok.md)

