# Code examples > Small, complete examples to copy. Set DROPLINE_TOKEN to a token first. Source: https://dropline.cleforyx.com/docs/developers/examples · Section: Developers · All docs: https://dropline.cleforyx.com/llms.txt ## List mailboxes curl: ```bash curl https://dropline.cleforyx.com/api/v1/mailboxes \ -H "Authorization: Bearer $DROPLINE_TOKEN" ``` Node: ```js const res = await fetch("https://dropline.cleforyx.com/api/v1/mailboxes", { headers: { Authorization: `Bearer ${process.env.DROPLINE_TOKEN}` }, }); const { mailboxes } = await res.json(); ``` Python: ```python import os, requests r = requests.get( "https://dropline.cleforyx.com/api/v1/mailboxes", headers={"Authorization": f"Bearer {os.environ['DROPLINE_TOKEN']}"}, ) mailboxes = r.json()["mailboxes"] ``` ## Search unread mail from someone curl: ```bash curl "https://dropline.cleforyx.com/api/v1/mailboxes/$MB/messages?q=is:unread%20from:kofi" \ -H "Authorization: Bearer $DROPLINE_TOKEN" ``` Node: ```js const api = (path, init = {}) => fetch(`https://dropline.cleforyx.com/api/v1${path}`, { ...init, headers: { Authorization: `Bearer ${process.env.DROPLINE_TOKEN}`, "Content-Type": "application/json", ...init.headers }, }).then(async (r) => { const b = await r.json(); if (!r.ok) throw Object.assign(new Error(b.error.message), b.error); return b; }); const { mailboxes } = await api("/mailboxes"); const { messages } = await api(`/mailboxes/${mailboxes[0].id}/messages?q=is:unread`); ``` Python: ```python import os, requests s = requests.Session() s.headers["Authorization"] = f"Bearer {os.environ['DROPLINE_TOKEN']}" base = "https://dropline.cleforyx.com/api/v1" mb = s.get(f"{base}/mailboxes").json()["mailboxes"][0]["id"] messages = s.get(f"{base}/mailboxes/{mb}/messages", params={"q": "is:unread from:kofi"}).json()["messages"] ``` ## Send, safely retried Needs `mail.send` (paid plans). With send approval on, the response is `202 pending_approval` until you press Send in the inbox. curl: ```bash curl -X POST https://dropline.cleforyx.com/api/v1/mailboxes/$MB/send \ -H "Authorization: Bearer $DROPLINE_TOKEN" -H "Content-Type: application/json" \ -H "Idempotency-Key: order-4471-shipped" \ -d '{"to":[{"address":"kofi@example.com"}],"subject":"Your order shipped","text":"It is on its way."}' ``` Python: ```python r = s.post( f"{base}/mailboxes/{mb}/send", json={"to": [{"address": "kofi@example.com"}], "subject": "Hi", "text": "Hello"}, headers={"Idempotency-Key": "hello-kofi-1"}, ) print(r.status_code, r.json()) # 202 {'status': 'pending_approval', ...} unless approval is off ``` --- Previous: [Idempotency and pagination](https://dropline.cleforyx.com/docs/developers/idempotency.md)