Create stories

Publish an Instagram story with an image or video.

Use Create a Story with an Instagram account to publish a story containing exactly one image or video attachment. Story creation is separate from Create a Post.

Send POST /v2/{account_id}/posts/stories with your X-API-KEY header. The required attachment contains the file; JSON uploads use its filename, content_type, and base64 content. Multipart uploads are also supported; follow the attachment fields in the API reference. You can supply optional text for the caption; mentions use @ followed by a user ID or public identifier when supported by the provider. Do not send a collection of attachments as a carousel story.

Replace BASE64_ENCODED_IMAGE in the examples with the base64 content of your image file.

Keep the returned identifiers for your application. The availability of story creation does not imply story listing, story analytics, or a dedicated story webhook; consult Methods & Events availability for supported operations.

const response = await fetch("https://api.unipile.com/v2/acc_123456789/posts/stories", {
  method: "POST",
  headers: {
    "X-API-KEY": "YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    attachment: {
      filename: "story.jpg",
      content_type: "image/jpeg",
      content: "BASE64_ENCODED_IMAGE",
    },
    text: "Hello from Unipile!",
  }),
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
import requests

response = requests.post(
    "https://api.unipile.com/v2/acc_123456789/posts/stories",
    headers={"X-API-KEY": "YOUR_API_KEY"},
    json={
        "attachment": {
            "filename": 'story.jpg',
            "content_type": 'image/jpeg',
            "content": 'BASE64_ENCODED_IMAGE'
        },
        "text": 'Hello from Unipile!'
    },
    timeout=30,
)
response.raise_for_status()
data = response.json()
curl --request POST \
  --url "https://api.unipile.com/v2/acc_123456789/posts/stories" \
  --header 'X-API-KEY: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "attachment": {
    "filename": "story.jpg",
    "content_type": "image/jpeg",
    "content": "BASE64_ENCODED_IMAGE"
  },
  "text": "Hello from Unipile!"
}'

Did this page help you?