Docs menu

Approve a draft

POST/v1/drafts/{draft_id}/approve

  • Scope messages:send

Sends the draft, optionally with edited text, under the approving key's own limits. The key needs messages:send and must not be draft-only. Approving again answers 200 with the same message.

Parameters

Path

  • draft_idstringrequired

    The draft (drf_…).

Request body

  • textstring

    Send this text instead of the draft's.

Response

200 OKAlready approved: the same message.

  • draftDraftrequired

    A message a draft-only key wrote, waiting for a person to approve it.

    Fields of draft
    • idstringrequired

      drf_…

    • object"draft"required

    • profile_idstringrequired

      prf_…

    • chat_idstring or nullrequired

    • tostringrequired

    • textstring or nullrequired

    • attachmentsarray of objectrequired

    • reply_tostring or nullrequired

    • servicestring or nullrequired

    • effectstring or nullrequired

    • status"pending" | "approved" | "rejected"required

    • reasonstring or nullrequired

      Why it was rejected, if the person said.

    • message_idstring or nullrequired

      Once approved: the message it became.

    • created_bystringrequired

      api_key:key_… (the draft-only key that wrote it).

    • decided_bystring or nullrequired

      user:usr_… or api_key:key_….

    • decided_attimestamp or nullrequired

    • created_attimestamprequired

  • messageMessagerequired

    A message sent or received on a line.

    Fields of message
    • 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.

202 AcceptedApproved and queued.

  • draftDraftrequired

    A message a draft-only key wrote, waiting for a person to approve it.

    Fields of draft
    • idstringrequired

      drf_…

    • object"draft"required

    • profile_idstringrequired

      prf_…

    • chat_idstring or nullrequired

    • tostringrequired

    • textstring or nullrequired

    • attachmentsarray of objectrequired

    • reply_tostring or nullrequired

    • servicestring or nullrequired

    • effectstring or nullrequired

    • status"pending" | "approved" | "rejected"required

    • reasonstring or nullrequired

      Why it was rejected, if the person said.

    • message_idstring or nullrequired

      Once approved: the message it became.

    • created_bystringrequired

      api_key:key_… (the draft-only key that wrote it).

    • decided_bystring or nullrequired

      user:usr_… or api_key:key_….

    • decided_attimestamp or nullrequired

    • created_attimestamprequired

  • messageMessagerequired

    A message sent or received on a line.

    Fields of message
    • 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.

Errors

StatusCodeMeans
409draft_rejectedThe draft was rejected.
403draft_only_keyThis key can only write drafts; typing, reactions and read receipts aren't drafts.
409draft_conflictA message already uses the draft's idempotency key.
429rate_limitedThe key's sends for this window are used up.
429new_conversation_limitThe line started as many new conversations in the last 24 hours as it may. Replies, and messages to anyone who already wrote to the line, still go.
403sending_pausedWe paused sending on your account (or this line) while we review recent activity that looked like mass texting. Incoming messages still arrive. details.scope is team or line.
402payment_requiredThe team's subscription isn't paid up, so sending is paused.
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