curl --request GET \
--url https://api.isnap.ai/v1/lines/{id}/queue \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.isnap.ai/v1/lines/{id}/queue"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.isnap.ai/v1/lines/{id}/queue', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.isnap.ai/v1/lines/{id}/queue",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.isnap.ai/v1/lines/{id}/queue"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.isnap.ai/v1/lines/{id}/queue")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.isnap.ai/v1/lines/{id}/queue")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"line_id": "<string>",
"summary": {
"total_queued": 1,
"total_scheduled": 1,
"total_delivered_to_device": 1,
"next_scheduled_at": "<string>",
"timezone": "<string>",
"daily_new_contacts_used": 1,
"daily_new_contact_limit": 1,
"daily_known_contacts_used": 1,
"daily_known_contact_limit": 1,
"daily_messages_used": 1,
"daily_total_message_limit": 1,
"hourly_messages_used": 1,
"hourly_message_limit": 1,
"minute_messages_used": 1,
"minute_message_limit": 1,
"daily_replies_used": 1,
"daily_reply_limit": 1,
"buckets_warning": {
"new_contacts_at_80_percent": true,
"known_contacts_at_80_percent": true,
"messages_at_80_percent": true,
"hourly_at_80_percent": true,
"minute_at_80_percent": true
}
},
"items": [
{
"id": "<string>",
"to": "<string>",
"body": "<string>",
"status": "queued",
"scheduled_for": "<string>",
"schedule_reason": "<string>",
"queue_position": 1,
"is_new_contact": true,
"target_activity_hour": 11,
"timezone": "<string>",
"created_at": "<string>"
}
],
"has_more": true,
"next_cursor": "<string>"
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}List the queue of a line
Lists a line’s outbound messages that are held, waiting for its device, or sent without a delivery receipt, with a summary of its counters.
curl --request GET \
--url https://api.isnap.ai/v1/lines/{id}/queue \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.isnap.ai/v1/lines/{id}/queue"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.isnap.ai/v1/lines/{id}/queue', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.isnap.ai/v1/lines/{id}/queue",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.isnap.ai/v1/lines/{id}/queue"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.isnap.ai/v1/lines/{id}/queue")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.isnap.ai/v1/lines/{id}/queue")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"line_id": "<string>",
"summary": {
"total_queued": 1,
"total_scheduled": 1,
"total_delivered_to_device": 1,
"next_scheduled_at": "<string>",
"timezone": "<string>",
"daily_new_contacts_used": 1,
"daily_new_contact_limit": 1,
"daily_known_contacts_used": 1,
"daily_known_contact_limit": 1,
"daily_messages_used": 1,
"daily_total_message_limit": 1,
"hourly_messages_used": 1,
"hourly_message_limit": 1,
"minute_messages_used": 1,
"minute_message_limit": 1,
"daily_replies_used": 1,
"daily_reply_limit": 1,
"buckets_warning": {
"new_contacts_at_80_percent": true,
"known_contacts_at_80_percent": true,
"messages_at_80_percent": true,
"hourly_at_80_percent": true,
"minute_at_80_percent": true
}
},
"items": [
{
"id": "<string>",
"to": "<string>",
"body": "<string>",
"status": "queued",
"scheduled_for": "<string>",
"schedule_reason": "<string>",
"queue_position": 1,
"is_new_contact": true,
"target_activity_hour": 11,
"timezone": "<string>",
"created_at": "<string>"
}
],
"has_more": true,
"next_cursor": "<string>"
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}- Credential: an API key of the owner of the line. See Reading the limits and the queue.
- Line-scoped keys: a line-scoped key gets
403 forbiddenunless the line is in its list, even when the line does not exist. - Events: none.
- Personal data: each item carries the recipient’s number in
toand the text inbody. Request them only when needed, do not copy them into logs, tickets or other tools, and refer to a contact by an id of your own. - Item
status:scheduledfor a held message.queuedfor a message that waits for the line’s device, or that the device has and has not confirmed.delivered_to_devicefor a message whosestatusissent: the device confirmed the send, and no delivery receipt has arrived. Adelivered_to_deviceitem stays listed until a receipt arrives or iSnap deletes the message, at least 72 hours after it recorded it. - Order: by
scheduled_for, earliest first.queue_positionstarts at 1 and counts the items of the earlier pages. Without astatusfilter, it counts thedelivered_to_deviceitems too. - Pagination: a cursor, not tied to the
statusfilter.limitis 1 to 100, 50 by default. An item can come back on a later page when iSnap holds its message again with a laterscheduled_for: deduplicate onid. See Cursors. - Items: a queue item is not a message object: its
bodyis""where the message hasnull. Reaction entries are listed too.
Errors
| Status | error.code | When |
|---|---|---|
| 400 | validation_failed | limit is outside 1 to 100, or status is not scheduled, queued or delivered_to_device. A cursor that cannot be read is not an error: the list restarts from the first page. |
| 403 | forbidden | The request uses a line-scoped key, and the line is not in its list. |
| 404 | not_found | No line has this id, or the line is not yours. |
Authorizations
An API key created in the iSnap dashboard, or a trial key, sent as Authorization: Bearer <key>. An API key starts with isnap_live_ or isnap_test_; both act on the same account, lines and billing. A trial key acts on its trial only.
Path Parameters
Id of a line: line_ followed by 25 letters or digits.
^line_[0-9A-Za-z]{25}$Query Parameters
Number of items per page, from 1 to 100.
1 <= x <= 100The next_cursor of the previous page. Omit it for the first page. A value that cannot be read restarts the list from the first page.
Keep the items of one status: scheduled, queued or delivered_to_device. Omit it for all three.
queued, scheduled, delivered_to_device Response
The queue of the line: a summary and one page of items.
Always true on a success response.
true The queue of a line: a summary and one page of items.
Show child attributes
Show child attributes
Trace id of the request that produced this response: 32 lowercase hexadecimal characters. Quote it when you report a problem to iSnap.
Id of the request that produced this response: req_ followed by 25 letters or digits.