IM
EN
Docs Home
Menu
Guides

Search Read Body And Parts

Search synced metadata, then fetch full message body and part content on demand.

inbox-manager client-flow

Search Read Body And Parts

Purpose: search synced metadata, then fetch full body and part content on demand.

UI Flow

  1. User searches by subject/sender.
  2. UI calls /api/accounts/:account_id/emails/search.
  3. User opens a message.
  4. UI calls /body for full parsed message.
  5. UI calls /parts then /parts/:part_id/content for 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_mismatch
  • 409 email_part_metadata_out_of_sync

Validation Script

  • scripts/provider_parts_content_flow.sh