Docs menu

List a chat's messages

GET/v1/profiles/{profile_id}/chats/{chat_id}/messages

  • Scope messages:read
  • Pages with before

The chat's messages, newest first, ordered by when they happened.

Parameters

Path

  • profile_idstringrequired

    The line (prf_…).

  • chat_idstringrequired

    The chat (cht_…).

Query

  • limitinteger

    Items per page, 1–200 (default 50).

  • beforestring

    The next_before of the previous page.

Response

200 OKA page of messages.

  • dataarray of Messagerequired

    Fields of data
    • idstringrequired

      msg_…

    • object"message"required

    • profile_idstringrequired

      prf_…

    • chat_idstringrequired

      cht_…

    • chat_handlestring

      The chat's address: a phone number, email or group chat id.

    • direction"inbound" | "outbound"required

    • senderstring or nullrequired

      Who sent an inbound message (in group chats, one of the members).

    • textstring or nullrequired

    • attachmentsarray of Attachmentrequired

      Fields of attachments
      • idstringrequired

        att_…

      • file_namestring or nullrequired

      • mime_typestring or nullrequired

      • size_bytesinteger or nullrequired

      • urlstringrequired

        A path on the API: GET it with your key and follow the 302 to a short-lived download link.

    • servicestring or nullrequired

      How it went or came: iMessage, RCS or SMS. Null until known.

    • requested_servicestring or nullrequired

      The service the send asked for, if any.

    • fallback_fromstring or nullrequired

      Set when the message failed over: the service it started on (iMessage).

    • reactionsarray of Reactionrequired

      Fields of reactions
      • kind"love" | "like" | "dislike" | "laugh" | "emphasize" | "question" or "emoji"required

        One of the six tapbacks, or emoji for an emoji reaction.

      • emojistring or nullrequired

        The emoji, when kind is emoji.

      • fromstringrequired

        "me" for the line's own reaction, else the person's address.

      • attimestamp or nullrequired

    • status"queued" | "dispatched" | "sent" | "delivered" | "read" | "failed" | "unconfirmed" | "received"required

      queued → dispatched → sent → delivered → read (iMessage only), or failed / unconfirmed. Inbound messages are received.

    • errorobject or nullrequired

      Why a message failed: line_unavailable, recipient_not_allowed, sending_paused, unconfirmed or send_failed.

      Fields of error
      • codestringrequired

      • messagestringrequired

    • guidstring or nullrequired

      The message's id in Messages, once it has one.

    • created_attimestamprequired

    • sent_attimestamp or nullrequired

    • delivered_attimestamp or nullrequired

    • read_attimestamp or nullrequired

    • queue_untiltimestamp or nullrequired

      While queued: when the send gives up if the line is still unavailable.

  • has_morebooleanrequired

    More items exist after this page.

  • next_beforestring or nullrequired

    Pass as before for the next page; null on the last one.

Errors

StatusCodeMeans
400validation_failedA field is missing or invalid.
401unauthorizedThe API key is missing, unknown or revoked.
403insufficient_scopeThe API key lacks the scope this needs.
404not_foundNo such object, or the key can't see it.

Every error is { "error": { "code", "message" } }. All error codes.

Keys come with your first line.

Request an invite and we'll set up a line for your team. API access is part of every plan.

Request an invite