Search Read Body And Parts
Purpose: search synced metadata, then fetch full body and part content on demand.
UI Flow
- User searches by subject/sender.
- UI calls
/api/accounts/:account_id/emails/search. - User opens a message.
- UI calls
/bodyfor full parsed message. - UI calls
/partsthen/parts/:part_id/contentfor selected part previews or downloads.
Client Library Flow
const results = await api.emails.search(accountId, {
query: "invoice",
limit: 20,
});
const emailId = results.data[0]?.id;
if (emailId) {
const body = await api.emails.getBody(accountId, emailId);
const parts = await api.emails.listParts(accountId, emailId);
const firstPart = parts.data[0];
if (firstPart) {
await api.emails.getPartContent(accountId, emailId, firstPart.id);
}
}
HTTP/curl Flow
API_BASE_URL="https://api.inbox-manager.com"
curl -sS -X POST "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/emails/search" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data '{"query":"invoice","limit":20,"offset":0}'
curl -sS "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/emails/${EMAIL_ID}/body" \
-H "authorization: Bearer ${BEARER_TOKEN}"
curl -sS "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/emails/${EMAIL_ID}/parts" \
-H "authorization: Bearer ${BEARER_TOKEN}"
curl -sS "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/emails/${EMAIL_ID}/parts/${PART_ID}/content" \
-H "authorization: Bearer ${BEARER_TOKEN}"
Expected Conflict Cases
409 email_part_content_hash_mismatch409 email_part_metadata_out_of_sync
Validation Script
scripts/provider_parts_content_flow.sh