รับอีเมล: การอ่าน
Search
ค้นหาในกล่องจดหมายตามผู้ส่ง โดเมน หัวเรื่อง เนื้อหา หรือป้ายกำกับ ด้วยตัวดำเนินการเดียวกับช่องค้นหาของ webmail
https://g.sendcorex.com/v1command: searchหากไม่มี field การค้นหาจะอัตโนมัติ: ที่อยู่อีเมลเต็มค้นตามผู้ส่งตรงตัว domain.com ค้นตามโดเมน และอย่างอื่นค้นในหัวเรื่อง เนื้อหา และชื่อผู้ส่ง
เมื่อใช้ตัวดำเนินการ (from:, is:unread…) ผลลัพธ์จะจัดกลุ่มตามบทสนทนา: หนึ่งแถวต่อเธรด ข้อความล่าสุดที่ตรง หากไม่มี in: จะไม่รวม Spam และถังขยะ
อาร์กิวเมนต์
querystringจำเป็นสิ่งที่ต้องการค้นหา สูงสุด 256 ตัวอักษร หากมีหลายคำ คำแรกมาจากดัชนีและคำอื่นกรองตามหัวเรื่องและตัวอย่าง
fieldstringไม่บังคับจำกัดการค้นหาธรรมดาให้เป็น
from,to,subject,body,senderหรือlabelไม่ใช้เมื่อคิวรีมีตัวดำเนินการlimitnumberไม่บังคับขนาดหน้า 1 ถึง 100 ค่าเริ่มต้น 25
cursorstringไม่บังคับnext_cursorของหน้าก่อน
เริ่มต้นอย่างรวดเร็ว
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1',
{
commands: [
{
command: "search",
args: {
query: "ana@client.com",
field: "from",
limit: 5
}
}
]
},
{ headers: { Authorization: process.env.SENDCOREX_TOKEN } },
);
const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);การตอบกลับ
{
"type": "SUCCESS",
"results": [
{
"command": "search",
"id": "0",
"type": "SUCCESS",
"data": {
"messages": [
{
"message_uid": "Vj0xQUJDMTIz",
"thread_id": "thr_9a1c4e72",
"subject": "Invoice for September",
"preview": "Hi, attached is the invoice for September…",
"from_name": "Ana Costa",
"from_email": "ana@client.com",
"folders": [
"INBOX"
],
"is_read": false,
"is_starred": false,
"is_important": false,
"received_at": "2026-10-09T14:21:07Z"
}
],
"has_more": false,
"next_cursor": null
}
}
]
}ฟิลด์การตอบกลับ
messages[]ข้อความที่ตรง ใหม่สุดก่อน แต่ละรายการมี
message_uid,thread_id,subject,preview,from_name,from_email,foldersแฟล็กอ่านแล้ว/ดาว/สำคัญ และreceived_athas_more / next_cursorการแบ่งหน้า
ตัวดำเนินการ
ใช้ร่วมกับคำธรรมดาได้ ค่าที่มีช่องว่างใส่ในเครื่องหมายคำพูด: subject:"new proposal" ใส่ - ข้างหน้าเพื่อตัดออก: -from:noreply, -newsletter
body ของคำขอ
{
"commands": [
{
"command": "search",
"args": {
"query": "from:ana@client.com has:attachment newer_than:30d invoice"
}
}
]
}from: / to:ผู้ส่ง / ผู้รับ (to หรือ cc) ส่วนหนึ่งของชื่อหรือที่อยู่
subject: / label:ข้อความหัวเรื่อง / ป้ายกำกับ
in:inbox,sent,archive,trash,spam,drafts,promotions,snoozed,scheduled,agents,not-subscribingหรือ id ของโฟลเดอร์กำหนดเองhas:attachmentเฉพาะข้อความที่มีไฟล์แนบ
is:unread / is:read / is:starred / is:importantสถานะข้อความ
after: / before:วันที่
YYYY/MM/DD(หรือYYYY-MM-DD) UTCnewer_than: / older_than:7d,2w,3m(30 วัน) หรือ1y
มีเฉพาะตัวกรองโดยไม่มีคำค้น (is:unread in:archive) จะส่ง threads (รายการบทสนทนาของโฟลเดอร์นั้น) แทน messages
ตัวอย่างการค้นหา
body ของคำขอ
// subject + body + sender name
{
"commands": [
{
"command": "search",
"args": {
"query": "invoice september"
}
}
]
}
// exact sender
{
"commands": [
{
"command": "search",
"args": {
"query": "ana@client.com",
"field": "from"
}
}
]
}
// everyone from a domain
{
"commands": [
{
"command": "search",
"args": {
"query": "client.com"
}
}
]
}
// messages with a label
{
"commands": [
{
"command": "search",
"args": {
"query": "cliente-vip",
"field": "label"
}
}
]
}ข้อผิดพลาด
ข้อผิดพลาดระดับ HTTP ส่งกลับ type, code และ message ข้อผิดพลาดที่มีเครื่องหมาย CMD จะกลับมาในผลลัพธ์ของคำสั่ง พร้อม HTTP 200
- 401
TOKEN_EXPIREDaccess token หมดอายุแล้ว เรียก Refresh Token แล้วส่งคำขอซ้ำ
- 401
INVALID_TOKENโทเค็นผิดรูปแบบ ไม่รู้จัก หรือถูกเพิกถอน
- 429
RATE_LIMITEDเกิน 15 คำขอ/วินาที หรือ 15 คำขอพร้อมกันสำหรับ IP + กล่องจดหมายเดียวกัน รอจำนวนวินาทีใน Retry-After
- CMD
INVALID_ARGSอาร์กิวเมนต์ที่จำเป็นหายไปหรือไม่ถูกต้อง
- CMD
INVALID_CURSORcursor ผิดรูปแบบหรือเป็นของบัญชีหรือโฟลเดอร์อื่น
- CMD
INTERNALข้อผิดพลาดของเซิร์ฟเวอร์ รายละเอียดเขียนเฉพาะในล็อกเซิร์ฟเวอร์