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

# Create a media container

> Create a container for an image, reel, story, or carousel.

Step 1 of the publish flow. Creates a media container from a public HTTPS media URL.<br />
Poll the returned container ID until `status_code` is `FINISHED`, then [publish it](/instagram/api/publishing/publish-media).

## Authentication

Use the `hmat_` channel token from `GET /meta/channels/{id}/token` or `hookmyapp channels env <channel>`. Do not use an `hmok_` API key for this call.

```bash theme={null}
Authorization: Bearer hmat_...
```

## Path parameters

<ParamField path="instagramAccountId" type="string" required>
  The connected Instagram account ID.
</ParamField>

## Request body

<ParamField body="image_url" type="string">
  Public HTTPS URL of a JPEG image. Required for images; either this or `video_url` for stories.
</ParamField>

<ParamField body="video_url" type="string">
  Public HTTPS URL of a video. Required for reels; either this or `image_url` for stories.
</ParamField>

<ParamField body="media_type" type="string">
  `REELS`, `STORIES`, or `CAROUSEL`. Omit for a feed image.
</ParamField>

<ParamField body="caption" type="string">
  Post caption.
</ParamField>

<ParamField body="is_carousel_item" type="boolean">
  Set `true` when creating a child container for a carousel. Child containers take `image_url` (or `video_url` with `media_type=VIDEO`) and no caption.
</ParamField>

<ParamField body="children" type="string">
  For the carousel parent (`media_type=CAROUSEL`): the child container IDs created with `is_carousel_item=true`, as a comma-separated string (for example `"17890000000000001,17890000000000002"`). 2–10 items.
</ParamField>

<ParamField body="cover_url" type="string">
  Cover image URL for reels.
</ParamField>

See [media requirements](/instagram/publish-content#media-requirements) for size, format, and quota limits.

## Example

```bash theme={null}
curl -X POST "https://gateway.hookmyapp.com/meta/v25.0/{INSTAGRAM_ACCOUNT_ID}/media" \
  -H "Authorization: Bearer hmat_..." \
  -H "Content-Type: application/json" \
  -d '{ "image_url": "https://example.com/photo.jpg", "caption": "New drop" }'
```

## Successful response

```json theme={null}
{ "id": "17900000000000001" }
```

Containers expire after 24 hours.
