Skip to content
Docs

Create a post

Early access. Tell us what you're building and we'll set you up. Contact us

POSTapi.lempile.com/api/v1/posts

Publishes a feed post through Instagram's own Create: 1 to 10 pictures or videos and a caption. 201 once Instagram shows the post; 202 with status: "PROCESSING" when Instagram is still processing it (a video, often): read the account's posts a little later. A long video can take longer than the 140 seconds a request waits: send Prefer: respond-async to get 202 as soon as Lempile starts the post (post_id: null, the key in the Idempotency-Key header), then read GET /writes/{key} until it is done or failed. A story (post_type: "story") or a video_thumbnail answers 501: Instagram's web can't make them.

Paced per account: 3 posts a day.

Scope: accounts.write.

Authentication

X-API-KEY header·A Lempile API key, made in the dashboard under Access tokens.

Headers

  • Idempotency-Keystringrequired

    1–200 characters of A-Z a-z 0-9 . _ : -, scoped to your workspace. The same key with the same request replays the first answer; see Write receipts. A dry run needs none.

    ≤ 200 chars
  • Preferstring

    respond-async: answer 202 as soon as Lempile starts the post, without waiting for Instagram; the answer carries Preference-Applied: respond-async and a Location header pointing at its receipt. Follow GET /writes/{key}. Without it, the request waits up to 140 seconds as usual.

Request body

  • account_idstringrequired
  • textstring

    The caption (Instagram's limit). @username mentions someone.

    ≤ 2200 chars
  • attachmentsarray of string · binaryrequired

    JPEG or PNG pictures (8 MB each), MP4 or MOV videos (50 MB). 10 files and 50 MB at most in all.

    ≥ 1 items · ≤ 10 items
  • locationstring

    A place to tag. The best match is used; no match leaves the post untagged.

    ≤ 200 chars
  • dry_runboolean

    true: everything up to the last step, nothing sent: 200 with not_sent: true. Not paced, no receipt. When the write is already so (already liked, already following), checks holds { "check": "already", "already": true }.

Responses

200

A dry run.

›

application/json

  • objectstring

    The write's own dry-run object, for example MessageDryRun.

  • not_sentany
    Alwaystrue
  • checksarray of object
201

Published.

›

application/json

  • objectany
    AlwaysPostCreated
  • post_idstring | null

    null only in the 202 after Prefer: respond-async.

  • statusstring
    One ofPUBLISHEDPROCESSING
202

Instagram is still processing it, or Lempile started it after Prefer: respond-async (post_id: null): read GET /writes/{key}.

›

application/json

  • objectany
    AlwaysPostCreated
  • post_idstring | null

    null only in the 202 after Prefer: respond-async.

  • statusstring
    One ofPUBLISHEDPROCESSING
400

errors/invalid_parameters: a field Lempile won't take; detail names it. Nothing was opened.

›

application/problem+json

  • typestringrequired
  • titlestring
  • statusintegerrequired
  • detailstring

    What happened, in words, and whether anything was done.

  • codestring

    On a 429: too_fast, daily_limit or hourly_limit.

  • retry_afterinteger

    Seconds to wait.

  • retry_atstring · date-time
401

A missing or invalid API key answers { "error": "unauthorized", "message" }. errors/disconnected_account (problem JSON): Instagram signed the account out; connect it again.

›

application/json

  • errorstringrequired
  • messagestring
402

subscription_required (in error): the workspace has no active trial or subscription.

›

application/json

  • errorstringrequired
  • messagestring
403

errors/insufficient_permissions (the key lacks the scope), errors/account_restricted (Instagram blocked the action, restricted the account or asks for a check: someone has to look at it on Instagram) or errors/action_required (the account waits for something done on Instagram itself; account_status and reason say what).

›

application/problem+json

  • typestringrequired
  • titlestring
  • statusintegerrequired
  • detailstring

    What happened, in words, and whether anything was done.

  • codestring

    On a 429: too_fast, daily_limit or hourly_limit.

  • retry_afterinteger

    Seconds to wait.

  • retry_atstring · date-time
404

errors/resource_not_found: no such account in this workspace, or no such chat, message, person or post.

›

application/problem+json

  • typestringrequired
  • titlestring
  • statusintegerrequired
  • detailstring

    What happened, in words, and whether anything was done.

  • codestring

    On a 429: too_fast, daily_limit or hourly_limit.

  • retry_afterinteger

    Seconds to wait.

  • retry_atstring · date-time
409

errors/in_progress: the same key is still running, or its outcome isn't known yet.

›

application/problem+json

  • typestringrequired
  • titlestring
  • statusintegerrequired
  • detailstring

    What happened, in words, and whether anything was done.

  • codestring

    On a 429: too_fast, daily_limit or hourly_limit.

  • retry_afterinteger

    Seconds to wait.

  • retry_atstring · date-time
415

errors/unsupported_media_type: a file Instagram doesn't take. Nothing was sent.

›

application/problem+json

  • typestringrequired
  • titlestring
  • statusintegerrequired
  • detailstring

    What happened, in words, and whether anything was done.

  • codestring

    On a 429: too_fast, daily_limit or hourly_limit.

  • retry_afterinteger

    Seconds to wait.

  • retry_atstring · date-time
422

errors/idempotency_key_reused: the key was used for another request. Nothing was sent.

›

application/problem+json

  • typestringrequired
  • titlestring
  • statusintegerrequired
  • detailstring

    What happened, in words, and whether anything was done.

  • codestring

    On a 429: too_fast, daily_limit or hourly_limit.

  • retry_afterinteger

    Seconds to wait.

  • retry_atstring · date-time
429

errors/too_many_requests: the account's pace (code: too_fast, daily_limit or hourly_limit; wait until retry_at), or Instagram's own "Try again later" (retry_after: 86400: wait a day before writing from the account again). Nothing was done.

›

application/problem+json

  • typestringrequired
  • titlestring
  • statusintegerrequired
  • detailstring

    What happened, in words, and whether anything was done.

  • codestring

    On a 429: too_fast, daily_limit or hourly_limit.

  • retry_afterinteger

    Seconds to wait.

  • retry_atstring · date-time
501

errors/feature_not_implemented: a field or option Lempile doesn't do for Instagram (detail says which), or an account of another network. Nothing was done.

›

application/problem+json

  • typestringrequired
  • titlestring
  • statusintegerrequired
  • detailstring

    What happened, in words, and whether anything was done.

  • codestring

    On a 429: too_fast, daily_limit or hourly_limit.

  • retry_afterinteger

    Seconds to wait.

  • retry_atstring · date-time
502

errors/service_unavailable: the browser's answer was lost after the write started. Not sure: read the receipt before sending again.

›

application/problem+json

  • typestringrequired
  • titlestring
  • statusintegerrequired
  • detailstring

    What happened, in words, and whether anything was done.

  • codestring

    On a 429: too_fast, daily_limit or hourly_limit.

  • retry_afterinteger

    Seconds to wait.

  • retry_atstring · date-time
503

errors/service_unavailable: the account isn't ready yet, or its browser can't be reached right now. Nothing was done.

›

application/problem+json

  • typestringrequired
  • titlestring
  • statusintegerrequired
  • detailstring

    What happened, in words, and whether anything was done.

  • codestring

    On a 429: too_fast, daily_limit or hourly_limit.

  • retry_afterinteger

    Seconds to wait.

  • retry_atstring · date-time
504

errors/request_timeout: Instagram didn't confirm within 140 seconds. Not sure: read the receipt before sending again.

›

application/problem+json

  • typestringrequired
  • titlestring
  • statusintegerrequired
  • detailstring

    What happened, in words, and whether anything was done.

  • codestring

    On a 429: too_fast, daily_limit or hourly_limit.

  • retry_afterinteger

    Seconds to wait.

  • retry_atstring · date-time

Was this page helpful?