Skip to content
Docs

List chats

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

GETapi.lempile.com/api/v1/chats

The account's Instagram inbox, newest activity first. A message request the account received has folder: ["PENDING"]. Opens no conversation, so nobody sees "Seen".

Scope: accounts.read.

Authentication

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

Query parameters

  • account_idstringrequired

    The connected Instagram account: its Lempile id (a UUID), its Instagram user id or its username.

  • limitinteger

    1 to 250 (default 20).

    Default20≥ 1 · ≤ 250
  • cursorstring

    The previous page's cursor.

  • unreadstring

    Not yet: 501.

  • beforestring

    Not yet: 501.

  • afterstring

    Not yet: 501.

Responses

200

The chats.

›

application/json

  • objectany
    AlwaysChatList
  • itemsarray of Chat
    ›Show fields
    • objectany
      AlwaysChat
    • idstring
    • account_idstring

      The account's Lempile id, whichever form you sent.

    • account_typeany
      AlwaysINSTAGRAM
    • provider_idstring
    • attendee_provider_idstring

      The other person in a one-to-one chat.

    • namestring | null
    • typeinteger

      0 one person, 1 a group.

      One of01
    • timestampstring · date-time
    • unread_countinteger
    • archivedinteger
      One of01
    • muted_untilstring | null
    • read_onlyinteger
      One of01
    • folderarray of string

      PENDING is a message request the account received.

    • pinnedinteger
      One of01
    • lastMessageone of

      GET /chats/{chat_id} only.

      ›Show fields
      • Option 1object
        ›Show fields
        • objectany
          AlwaysMessage
        • idstring
        • message_idstring
        • provider_idstring

          Instagram's message id alone.

        • account_idstring
        • chat_idstring
        • chat_provider_idstring
        • sender_idstring
        • sender_attendee_idstring
        • textstring | null
        • attachmentsarray of object
          ›Show fields
          • idstring
          • typestring
            One ofimgvideoaudiomedia_shareprofile
          • urlstring

            Instagram's own link, which expires: GET /messages/{message_id}/attachments/{attachment_id} reads the file.

          • voice_noteboolean
          • postobject
          • storyobject
        • timestampstring · date-time
        • is_senderinteger

          1 for the account's own messages.

          One of01
        • reactionsarray of object
          ›Show fields
          • valuestring
          • sender_idstring
          • is_senderboolean
        • seeninteger
          One of01
        • seen_byobject
        • hiddeninteger
          One of01
        • deletedinteger
          One of01
        • editedinteger
          One of01
        • is_eventinteger
          One of01
        • deliveredinteger
          One of01
        • behaviornull
        • originalstring
        • message_typestring | null

          STORY_MENTION: they mentioned the account in their story. STORY_REPLY: they answered one of its stories. null: a plain message.

          One ofSTORY_MENTIONSTORY_REPLYnull
        • marks_seenboolean
      • Option 2null
    • marks_seenboolean
  • cursorstring | null

    Pass it back as cursor for the next page; null when there's no more.

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
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
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 answer within 100 seconds. A read changed nothing: try 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?