Studio API

Use a Studio key from a server or script to work with the accounts in your own workspace.

Studio keys

An owner or admin can create and revoke Studio keys on the API keys page. Copy the full key when it appears and keep it on your server. A key stops working immediately when revoked or when the person who made it leaves the workspace.

Studio keys start with sq_st_ and call /studio/v1.

Key access

Read only lists and reads resources and validates post drafts. Full access also checks connections, uploads and imports media, and creates and cancels posts.

Set STUDIO_API to the base URL from the API keys page, including /studio/v1. Set STUDIO_API_KEY to your server’s key. The Studio API reference has request and response schemas.

Accounts

List accounts with a current Studio seat. Connect or reconnect an account in the web app.

curl -fsS "$STUDIO_API/accounts" \
  -H "Authorization: Bearer $STUDIO_API_KEY"

Media

Read a workspace file by its ID. A full key can start a multipart upload or import a public HTTPS URL. Wait until the file is ready before using it in a post.

curl -fsS "$STUDIO_API/media/$MEDIA_ID" \
  -H "Authorization: Bearer $STUDIO_API_KEY"

Posts and idempotency

A full key creates a post for one or more Studio accounts. Use a unique Idempotency-Key for each new post. If the request times out, retry with the same header and body to get the original post. Reusing the key with a different body returns 409 conflict. Studio post keys share a namespace across the workspace’s Studio API keys.

curl -fsS "$STUDIO_API/posts" \
  -H "Authorization: Bearer $STUDIO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $POST_KEY" \
  --data "{\"caption\":\"First photo\",\"mediaIds\":[\"$MEDIA_ID\"],\"targets\":[{\"connectionId\":\"$CONNECTION_ID\"}]}"

Read the returned post to track each target’s status. Studio keys can also read posts made in the web app for the workspace.

Analytics

Read profile metrics for an account with a current Studio seat. Use /accounts/$CONNECTION_ID/analytics/posts for per-post metrics.

curl -fsS "$STUDIO_API/accounts/$CONNECTION_ID/analytics" \
  -H "Authorization: Bearer $STUDIO_API_KEY"

Auto replies

Read keys can list rules and see 30 days of Activity for Instagram accounts currently in Studio. A full key can also create, edit, pause, resume, and delete rules. An owner or admin must enable replies for the account in the web app first.

curl -fsS "$STUDIO_API/replies/rules?account=$CONNECTION_ID" \
  -H "Authorization: Bearer $STUDIO_API_KEY"
curl -fsS "$STUDIO_API/replies/activity?account=$CONNECTION_ID&outcome=sent" \
  -H "Authorization: Bearer $STUDIO_API_KEY"

The Auto replies reference has request and response examples for each operation.

Poll for events

Start with a cursor of 0. Process events in order, deduplicate by event ID, and save nextCursor after processing the page. Send it as cursor on your next poll. An empty page keeps the cursor unchanged. Events are kept for 30 days.

curl -fsS "$STUDIO_API/events?cursor=${CURSOR:-0}" \
  -H "Authorization: Bearer $STUDIO_API_KEY"

Rate limits

Studio keys share 600 authenticated requests per minute per workspace, enforced per Cloudflare location. On 429 rate_limited, wait for Retry-After when it is supplied. Uncached platform reads share a separate limit of 10 per minute per workspace and connection.

A workspace can hold up to 10 active keys and attempt to create up to 20 keys per hour. Studio imports also share the workspace’s limits for concurrent imports, hourly starts, and daily bytes.