{"openapi":"3.1.0","info":{"title":"TropMail API","description":"Private inbound email API for TropMail.\n\nCreate addresses that only receive mail. List, search, read, and update messages; scan and download attachments. Official SDKs and MCP use the same contract.\n\n## Base URL\n- **Production**: `https://api.tropmail.com/api/v1`\n\n## Authentication\nAPI keys from the TropMail dashboard (Pro and above). Keys are 32 alphanumeric characters, optionally prefixed with `tm_live_`. Send `Authorization: Bearer <API_KEY>`.\n\n## Rate limiting\nPer **account** by plan (Pro 3 / Ultimate 10 / Enterprise 50 requests per second) — not per mailbox or per key. Headers: `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`. On **429**, honor `Retry-After`.\n\n## Response envelope\nJSON responses use `{success,message,data,error}`. `success` is `true` and `error` is `null` on 200; on errors `success` is `false`, `data` is `null`, and `message`/`error` explain what happened. Correlate with `X-Request-ID`.\n\nMCP tools receive the unwrapped `data` object, not this envelope. Attachment **download** routes return raw bytes, not JSON.","version":"1.0.0","contact":{"name":"TropMail Support","url":"https://tropmail.com"}},"servers":[{"url":"https://api.tropmail.com/api/v1","description":"Production server"}],"tags":[{"name":"Health","description":"Health check endpoints"},{"name":"Mailbox","description":"List inboxes at `GET /mailboxes`. Mail, search, and attachments use `/mailbox/{id}/…`."},{"name":"Emails","description":"Email listing, details, and status updates"},{"name":"Attachments","description":"Attachment metadata, scanning, and downloading"}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API_KEY","description":"TropMail API key from the dashboard. Send `Authorization: Bearer <API_KEY>`. Required on every `/api/v1/*` route except `GET /health`."}},"schemas":{"StandardResponse":{"type":"object","description":"Standard JSON envelope. On success `error` is `null` and `data` holds the payload. On failure `success` is false, `data` is `null`, and `message` / `error` explain the problem.","properties":{"success":{"type":"boolean","description":"`true` for successful requests, `false` for errors."},"message":{"type":"string","description":"Human-readable summary for UI toasts/logging."},"data":{"type":"object","description":"The actual payload for successful responses, or `null` on errors."},"error":{"type":["string","null"],"description":"Error message string if `success` is false."}}},"EmailListItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Email UUID"},"timestamp":{"type":"string","format":"date-time","description":"Email timestamp (RFC3339)"},"subject":{"type":"string","description":"Email subject"},"from":{"type":"object","properties":{"name":{"type":"string","description":"Sender display name"},"address":{"type":"string","format":"email","description":"Sender email address"}}},"attachmentsCount":{"type":"integer","description":"Number of attachments"},"email_state":{"type":"string","enum":["Open","Close"],"description":"Open or Close"},"action_status":{"type":["string","null"],"enum":["Favorite","Block","Phishing","Scam","Malicious",null],"description":"Favorite, Block, Phishing, Scam, Malicious, or null"},"status":{"type":"string","description":"Convenience field for UI. If `action_status` is set, matches that; otherwise matches `email_state`."},"preview":{"type":"string","description":"First ~100 characters of plain text"}}},"EmailDetail":{"allOf":[{"$ref":"#/components/schemas/EmailListItem"},{"type":"object","properties":{"to":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"address":{"type":"string","format":"email"}}}},"cc":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"address":{"type":"string","format":"email"}}}},"content":{"type":"string","description":"Body content in the requested view (text/html/markdown)."},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/Attachment"}},"parts":{"$ref":"#/components/schemas/EmailParts","description":"Optional extras from inbound (unsubscribe, calendar, inline images). Omitted when empty."},"headers":{"type":"object","description":"Parsed email headers"},"security":{"type":"object","description":"Security analysis results (SPF/DKIM/DMARC/spam score)"}}}]},"EmailParts":{"type":"object","description":"Optional MIME extras written when the message arrived.","properties":{"listUnsubscribe":{"type":"object","properties":{"https":{"type":["string","null"]},"mailto":{"type":["string","null"],"description":"Address only (no mailto: prefix)."},"oneClick":{"type":"boolean"}}},"calendar":{"type":"object","properties":{"method":{"type":"string","example":"REQUEST"},"uid":{"type":"string"},"path":{"type":"string","description":"R2 object key for the .ics file."}},"required":["method","path"]},"inlineCids":{"type":"object","additionalProperties":{"type":"string","format":"uuid"},"description":"Content-ID → attachment_id. Use to resolve cid: images."}}},"Attachment":{"type":"object","properties":{"attachment_id":{"type":"string","format":"uuid"},"email_id":{"type":"string","format":"uuid"},"filename":{"type":"string"},"size":{"type":"integer","minimum":0,"description":"Size in bytes. `0` is a real empty file and can be downloaded."},"mime_type":{"type":"string"},"content_id":{"type":["string","null"],"description":"MIME Content-ID when present (inline images)."},"disposition":{"type":["string","null"],"enum":["inline","attachment",null],"description":"`inline` or `attachment`. Null on older mail."},"scan_status":{"type":"string","enum":["NotScanned","Processing","Clean","Malicious","Suspicious","Unknown"],"description":"Whether the file has been scanned. After you start a scan this is `Processing` until the result is ready."},"scan_result":{"$ref":"#/components/schemas/ScanReport","description":"Shaped scan report when a scan has completed (or failed)."},"scanned_at":{"type":["string","null"],"format":"date-time"}}},"MailboxSummary":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"opened_count":{"type":"integer"},"closed_count":{"type":"integer"},"favorite_count":{"type":"integer"}}},"ScanReport":{"type":"object","description":"Malware scan report for an attachment (engine summaries and optional file hashes).","properties":{"status":{"type":"string","enum":["NotScanned","Processing","Clean","Malicious","Suspicious","Unknown"]},"scannedAt":{"type":"string","format":"date-time"},"stats":{"type":"object","properties":{"harmless":{"type":"integer"},"malicious":{"type":"integer"},"suspicious":{"type":"integer"},"undetected":{"type":"integer"}},"required":["harmless","malicious","suspicious","undetected"]},"engines":{"type":"array","items":{"type":"object","properties":{"engine":{"type":"string"},"category":{"type":"string","enum":["harmless","malicious","suspicious","undetected","timeout"]},"result":{"type":["string","null"]}},"required":["engine","category","result"]}},"hashes":{"type":"object","properties":{"sha256":{"type":"string"},"sha1":{"type":"string"},"md5":{"type":"string"}}},"error":{"type":"string","description":"Machine-readable failure code when the scan could not complete"}},"required":["status","scannedAt","stats","engines"]},"MailboxList":{"type":"object","description":"Inboxes this API key may see. An empty array means this key has no inboxes yet.","required":["mailboxes"],"properties":{"mailboxes":{"type":"array","items":{"$ref":"#/components/schemas/MailboxSummary"}}},"example":{"mailboxes":[{"id":"11111111-1111-1111-1111-111111111111","email":"quiet-otter-1423@tropmail.com","opened_count":10,"closed_count":5,"favorite_count":2}]}},"ErrorEnvelope":{"type":"object","description":"Error envelope. `success` is false; `data` is null.","properties":{"success":{"type":"boolean","description":"Always `false` on errors.","example":false},"message":{"type":"string","description":"Human-readable summary for UI toasts and logs."},"data":{"nullable":true,"description":"Always `null` on errors.","example":null},"error":{"type":["string","null"],"description":"Error detail string when `success` is false."}},"required":["success","message","data","error"],"example":{"success":false,"message":"Unauthorized","data":null,"error":"Missing or invalid API key"}}},"responses":{"BadRequest":{"description":"Invalid request — missing search `query`, malformed UUID, or `limit`/`page` out of range. Envelope with `success: false`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"example":{"success":false,"message":"Missing or invalid query","data":null,"error":"Missing or invalid query"}}}},"Unauthorized":{"description":"Missing, malformed, or unknown Bearer API key. Envelope with `success: false`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"example":{"success":false,"message":"Unauthorized","data":null,"error":"Missing or invalid API key"}}}},"Forbidden":{"description":"Plan cannot use the API (Basic/guest) or this key cannot access the mailbox. Envelope with `success: false`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"example":{"success":false,"message":"API access requires Pro or above","data":null,"error":"Tier not allowed"}}}},"NotFound":{"description":"Mailbox, email, or attachment UUID unknown or out of this key’s scope. Envelope with `success: false`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"example":{"success":false,"message":"Mailbox not found","data":null,"error":"Mailbox not found"}}}},"RateLimited":{"description":"Account rate limit exceeded (Pro 3/s, Ultimate 10/s, Enterprise 50/s — per account, not per mailbox). Honor `Retry-After` and `X-RateLimit-*`.","headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Requests per second allowed for this account.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp when the current window resets.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"example":{"success":false,"message":"Rate limit exceeded","data":null,"error":"Rate limit exceeded"}}}},"AttachmentUnavailable":{"description":"Attachment exists but has no stored object (empty path). A file whose `size` is `0` is still downloadable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"example":{"success":false,"message":"Attachment unavailable","data":null,"error":"Attachment unavailable"}}}}}},"security":[{"BearerAuth":[]}],"paths":{"/health":{"get":{"tags":["Health"],"summary":"Health check","description":"Service status check. Returns service version and timestamp. **No authentication required.**","security":[],"responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardResponse"}}}}},"parameters":[],"x-sourcey-code-samples":[{"lang":"bash","label":"cURL","source":"curl -sS 'https://api.tropmail.com/api/v1/health'"},{"lang":"typescript","label":"TypeScript","source":"import { TropMail } from \"@tropmail/sdk\";\n\nconst client = new TropMail();\nconst health = await client.health();\nconsole.log(health.status);"},{"lang":"python","label":"Python","source":"from tropmail import TropMail\n\nwith TropMail() as client:\n    print(client.health().status)"},{"lang":"go","label":"Go","source":"package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\ttropmail \"github.com/tropmail/tropmail-go\"\n)\n\nfunc main() {\n\tclient, err := tropmail.New(\"\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\th, err := client.Health(context.Background())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(h.Status)\n}"}]}},"/mailboxes":{"get":{"tags":["Mailbox"],"summary":"List mailboxes","description":"Inboxes this API key may see. `data.mailboxes` is an array of inbox summaries (it may be empty). Use an `id` from that list on `/mailbox/{id}` routes.","responses":{"200":{"description":"List retrieved. `data.mailboxes` is an array of inbox summaries (may be empty).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string","example":"Mailboxes retrieved successfully"},"data":{"$ref":"#/components/schemas/MailboxList"},"error":{"type":["string","null"],"example":null}}},"example":{"success":true,"message":"Mailboxes retrieved successfully","data":{"mailboxes":[{"id":"11111111-1111-1111-1111-111111111111","email":"quiet-otter-1423@tropmail.com","opened_count":10,"closed_count":5,"favorite_count":2}]},"error":null}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}},"parameters":[],"security":[{"BearerAuth":[]}],"x-sourcey-code-samples":[{"lang":"bash","label":"cURL","source":"curl -sS -X GET 'https://api.tropmail.com/api/v1/mailboxes' \\\n  -H 'Authorization: Bearer $TROPMAIL_API_KEY' \\\n  -H 'Accept: application/json'"},{"lang":"typescript","label":"TypeScript","source":"import { TropMail } from \"@tropmail/sdk\";\n\nconst client = new TropMail({ apiKey: process.env.TROPMAIL_API_KEY! });\n\nconst { mailboxes } = await client.mailboxes.list();\nconsole.log(mailboxes[0]?.email);"},{"lang":"python","label":"Python","source":"from tropmail import TropMail\n\nwith TropMail() as client:\n    boxes = client.mailboxes.list()\n    print(boxes[0].email)"},{"lang":"go","label":"Go","source":"package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\ttropmail \"github.com/tropmail/tropmail-go\"\n)\n\nfunc main() {\n\tclient, err := tropmail.New(os.Getenv(\"TROPMAIL_API_KEY\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx := context.Background()\n\tlisted, err := client.Mailboxes.List(ctx)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(listed.Mailboxes[0].Email)\n\n}"}]}},"/mailbox/{id}":{"get":{"tags":["Mailbox"],"summary":"Get mailbox summary","description":"Summary for one mailbox (opened / closed / favorite counts). Unknown or out-of-scope `{id}` → 404.","responses":{"200":{"description":"One mailbox summary in `data` (not wrapped in `mailboxes`).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/MailboxSummary"},"error":{"type":["string","null"]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Mailbox UUID"}],"security":[{"BearerAuth":[]}],"x-sourcey-code-samples":[{"lang":"bash","label":"cURL","source":"curl -sS -X GET 'https://api.tropmail.com/api/v1/mailbox/11111111-1111-1111-1111-111111111111' \\\n  -H 'Authorization: Bearer $TROPMAIL_API_KEY' \\\n  -H 'Accept: application/json'"},{"lang":"typescript","label":"TypeScript","source":"import { TropMail } from \"@tropmail/sdk\";\n\nconst client = new TropMail({ apiKey: process.env.TROPMAIL_API_KEY! });\nconst mailboxId = \"11111111-1111-1111-1111-111111111111\";\n\nconst mailbox = await client.mailboxes.get(mailboxId);\nconsole.log(mailbox.email, mailbox.opened_count);"},{"lang":"python","label":"Python","source":"from tropmail import TropMail\n\nwith TropMail() as client:\n    mailbox_id = \"11111111-1111-1111-1111-111111111111\"\n    mailbox = client.mailboxes.get(mailbox_id)\n    print(mailbox.email, mailbox.opened_count)"},{"lang":"go","label":"Go","source":"package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\ttropmail \"github.com/tropmail/tropmail-go\"\n)\n\nfunc main() {\n\tclient, err := tropmail.New(os.Getenv(\"TROPMAIL_API_KEY\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx := context.Background()\n\tmailboxID := \"11111111-1111-1111-1111-111111111111\"\n\tmailbox, err := client.Mailboxes.Get(ctx, mailboxID)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(mailbox.Email, mailbox.OpenedCount)\n\n}"}]}},"/mailbox/{id}/emails":{"get":{"tags":["Emails"],"summary":"List emails","description":"Fetch inbox list with pagination and status filtering. \n\nStandard success envelope.","responses":{"200":{"description":"Emails retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"emails":{"type":"array","items":{"$ref":"#/components/schemas/EmailListItem"}},"limit":{"type":"integer"},"page":{"type":"integer"},"total":{"type":"integer","description":"Search match count. Independent of limit and page, so an empty page still reports how many messages matched."}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Mailbox UUID"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":10,"description":"Items per page (1-100)"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"description":"Page number (>= 1)"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["all","Open","Close","Favorite","Block","Phishing","Scam","Malicious"],"default":"all","description":"Filter by status: all, Open, Close, Favorite, Block, Phishing, Scam, Malicious"}}],"x-sourcey-code-samples":[{"lang":"bash","label":"cURL","source":"curl -sS -X GET 'https://api.tropmail.com/api/v1/mailbox/11111111-1111-1111-1111-111111111111/emails?limit=10&page=1&status=Open' \\\n  -H 'Authorization: Bearer $TROPMAIL_API_KEY' \\\n  -H 'Accept: application/json'"},{"lang":"typescript","label":"TypeScript","source":"import { TropMail } from \"@tropmail/sdk\";\n\nconst client = new TropMail({ apiKey: process.env.TROPMAIL_API_KEY! });\nconst mailboxId = \"11111111-1111-1111-1111-111111111111\";\n\nconst page = await client.emails.list({ mailboxId, limit: 10, page: 1, status: \"Open\" });\nconsole.log(page.emails[0]?.subject);"},{"lang":"python","label":"Python","source":"from tropmail import TropMail\n\nwith TropMail() as client:\n    mailbox_id = \"11111111-1111-1111-1111-111111111111\"\n    page = client.emails.list(mailbox_id=mailbox_id, limit=10, page=1, status=\"Open\")\n    print(page.emails[0].subject)"},{"lang":"go","label":"Go","source":"package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\ttropmail \"github.com/tropmail/tropmail-go\"\n)\n\nfunc main() {\n\tclient, err := tropmail.New(os.Getenv(\"TROPMAIL_API_KEY\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx := context.Background()\n\tmailboxID := \"11111111-1111-1111-1111-111111111111\"\n\tpage, err := client.Emails.List(ctx, tropmail.ListOptions{MailboxID: mailboxID, Limit: 10, Page: 1, Status: \"Open\"})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(page.Emails[0].Subject)\n\n}"}]}},"/mailbox/{id}/emails/search":{"get":{"tags":["Emails"],"summary":"Search emails","description":"Full-text search across the authenticated mailbox.\n\nRequires a non-empty `query`. Pagination mirrors list emails (`limit` 1-100, `page` >= 1).","responses":{"200":{"description":"Search completed successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"emails":{"type":"array","items":{"$ref":"#/components/schemas/EmailListItem"}},"limit":{"type":"integer"},"page":{"type":"integer"}}},"error":{"type":["string","null"]}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Mailbox UUID"},{"name":"query","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"Full-text search query"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":10}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}}],"x-sourcey-code-samples":[{"lang":"bash","label":"cURL","source":"curl -sS -X GET 'https://api.tropmail.com/api/v1/mailbox/11111111-1111-1111-1111-111111111111/emails/search?query=verification&limit=10&page=1' \\\n  -H 'Authorization: Bearer $TROPMAIL_API_KEY' \\\n  -H 'Accept: application/json'"},{"lang":"typescript","label":"TypeScript","source":"import { TropMail } from \"@tropmail/sdk\";\n\nconst client = new TropMail({ apiKey: process.env.TROPMAIL_API_KEY! });\nconst mailboxId = \"11111111-1111-1111-1111-111111111111\";\n\nconst page = await client.emails.search({ mailboxId, query: \"verification\", limit: 10 });\nconsole.log(page.emails[0]?.subject);"},{"lang":"python","label":"Python","source":"from tropmail import TropMail\n\nwith TropMail() as client:\n    mailbox_id = \"11111111-1111-1111-1111-111111111111\"\n    page = client.emails.search(mailbox_id=mailbox_id, query=\"verification\", limit=10)\n    print(page.emails[0].subject)"},{"lang":"go","label":"Go","source":"package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\ttropmail \"github.com/tropmail/tropmail-go\"\n)\n\nfunc main() {\n\tclient, err := tropmail.New(os.Getenv(\"TROPMAIL_API_KEY\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx := context.Background()\n\tmailboxID := \"11111111-1111-1111-1111-111111111111\"\n\tpage, err := client.Emails.Search(ctx, \"verification\", tropmail.ListOptions{MailboxID: mailboxID, Limit: 10})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(page.Emails[0].Subject)\n\n}"}]}},"/mailbox/{id}/emails/{emailId}":{"get":{"tags":["Emails"],"summary":"Get email detail","description":"Retrieve full email details including content, headers, and attachments. Defaults to HTML view if no view specified.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Mailbox UUID"},{"name":"emailId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Email UUID"},{"name":"timestamp","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Optional email timestamp from list/detail (speeds up lookup)"}],"responses":{"200":{"description":"Email retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/EmailDetail"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[{"BearerAuth":[]}],"x-sourcey-code-samples":[{"lang":"bash","label":"cURL","source":"curl -sS -X GET 'https://api.tropmail.com/api/v1/mailbox/11111111-1111-1111-1111-111111111111/emails/550e8400-e29b-41d4-a716-446655440001' \\\n  -H 'Authorization: Bearer $TROPMAIL_API_KEY' \\\n  -H 'Accept: application/json'"},{"lang":"typescript","label":"TypeScript","source":"import { TropMail } from \"@tropmail/sdk\";\n\nconst client = new TropMail({ apiKey: process.env.TROPMAIL_API_KEY! });\nconst mailboxId = \"11111111-1111-1111-1111-111111111111\";\nconst emailId = \"550e8400-e29b-41d4-a716-446655440001\";\n\nconst detail = await client.emails.get(mailboxId, emailId);\nconsole.log(detail.subject);"},{"lang":"python","label":"Python","source":"from tropmail import TropMail\n\nwith TropMail() as client:\n    mailbox_id = \"11111111-1111-1111-1111-111111111111\"\n    detail = client.emails.get(mailbox_id, \"550e8400-e29b-41d4-a716-446655440001\")\n    print(detail.subject)"},{"lang":"go","label":"Go","source":"package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\ttropmail \"github.com/tropmail/tropmail-go\"\n)\n\nfunc main() {\n\tclient, err := tropmail.New(os.Getenv(\"TROPMAIL_API_KEY\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx := context.Background()\n\tmailboxID := \"11111111-1111-1111-1111-111111111111\"\n\tdetail, err := client.Emails.Get(ctx, mailboxID, \"550e8400-e29b-41d4-a716-446655440001\", tropmail.GetOptions{})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(detail.Subject)\n}\n"}]},"post":{"tags":["Emails"],"summary":"Update email actions","description":"Update `email_state` (Open/Close) or `action_status` (Favorite, Delete, Block, etc.).\n\n- Provide **at least one** field in the body.\n- Optional `timestamp` (RFC3339) from list/detail speeds up the update.\n- `Block` marks the message and blocks that sender from future delivery to the mailbox.\n- To clear `action_status`, send an empty string `\"\"` (also unblocks the sender if it was Blocked).","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Mailbox UUID"},{"name":"emailId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Email UUID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email_state":{"type":"string","enum":["Open","Close"],"description":"Open or Close"},"action_status":{"type":"string","enum":["Favorite","Delete","Block","Phishing","Scam","Malicious",""],"description":"Apply action. Empty string clears status."},"timestamp":{"type":"string","format":"date-time","description":"Optional email timestamp from list/detail (speeds up lookup)"}}}}}},"responses":{"200":{"description":"Email updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[{"BearerAuth":[]}],"x-sourcey-code-samples":[{"lang":"bash","label":"cURL","source":"curl -sS -X POST 'https://api.tropmail.com/api/v1/mailbox/11111111-1111-1111-1111-111111111111/emails/550e8400-e29b-41d4-a716-446655440001' \\\n  -H 'Authorization: Bearer $TROPMAIL_API_KEY' \\\n  -H 'Accept: application/json' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"email_state\":\"Open\",\"action_status\":\"Favorite\"}'"},{"lang":"typescript","label":"TypeScript","source":"import { TropMail } from \"@tropmail/sdk\";\n\nconst client = new TropMail({ apiKey: process.env.TROPMAIL_API_KEY! });\nconst mailboxId = \"11111111-1111-1111-1111-111111111111\";\nconst emailId = \"550e8400-e29b-41d4-a716-446655440001\";\n\nawait client.emails.update(mailboxId, emailId, {\n  emailState: \"Open\",\n  actionStatus: \"Favorite\",\n});"},{"lang":"python","label":"Python","source":"from tropmail import TropMail\n\nwith TropMail() as client:\n    mailbox_id = \"11111111-1111-1111-1111-111111111111\"\n    client.emails.update(mailbox_id, \"550e8400-e29b-41d4-a716-446655440001\", email_state=\"Open\", action_status=\"Favorite\")"},{"lang":"go","label":"Go","source":"package main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"os\"\n\n\ttropmail \"github.com/tropmail/tropmail-go\"\n)\n\nfunc main() {\n\tclient, err := tropmail.New(os.Getenv(\"TROPMAIL_API_KEY\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx := context.Background()\n\tmailboxID := \"11111111-1111-1111-1111-111111111111\"\n\tstatus := tropmail.ActionFavorite\n\t_, err = client.Emails.Update(ctx, mailboxID, \"550e8400-e29b-41d4-a716-446655440001\", tropmail.UpdateOptions{\n\t\tEmailState:   tropmail.StateOpen,\n\t\tActionStatus: &status,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n"}]}},"/mailbox/{id}/emails/{emailId}/{view}":{"get":{"tags":["Emails"],"summary":"Get email detail in specific view","description":"Retrieve email details with content rendered in a specific format (`text`, `html`, `markdown`).\n\nFor `markdown`: returns markdown immediately when already available. If not, this request waits until conversion finishes (up to about 60 seconds). Timeout is 504; retry the same GET.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Mailbox UUID"},{"name":"emailId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Email UUID"},{"name":"view","in":"path","required":true,"schema":{"type":"string","enum":["text","html","markdown"]},"description":"Content format: text, html, or markdown"},{"name":"timestamp","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Optional email timestamp from list/detail (speeds up lookup)"}],"responses":{"200":{"description":"Email retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/EmailDetail"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[{"BearerAuth":[]}],"x-sourcey-code-samples":[{"lang":"bash","label":"cURL","source":"curl -sS -X GET 'https://api.tropmail.com/api/v1/mailbox/11111111-1111-1111-1111-111111111111/emails/550e8400-e29b-41d4-a716-446655440001/text' \\\n  -H 'Authorization: Bearer $TROPMAIL_API_KEY' \\\n  -H 'Accept: application/json'"},{"lang":"typescript","label":"TypeScript","source":"import { TropMail } from \"@tropmail/sdk\";\n\nconst client = new TropMail({ apiKey: process.env.TROPMAIL_API_KEY! });\nconst mailboxId = \"11111111-1111-1111-1111-111111111111\";\nconst emailId = \"550e8400-e29b-41d4-a716-446655440001\";\n\nconst detail = await client.emails.get(mailboxId, emailId, { view: \"text\" });\nconsole.log(detail.content);"},{"lang":"python","label":"Python","source":"from tropmail import TropMail\n\nwith TropMail() as client:\n    mailbox_id = \"11111111-1111-1111-1111-111111111111\"\n    detail = client.emails.get(mailbox_id, \"550e8400-e29b-41d4-a716-446655440001\", view=\"text\")\n    print(detail.content)"},{"lang":"go","label":"Go","source":"package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\ttropmail \"github.com/tropmail/tropmail-go\"\n)\n\nfunc main() {\n\tclient, err := tropmail.New(os.Getenv(\"TROPMAIL_API_KEY\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx := context.Background()\n\tmailboxID := \"11111111-1111-1111-1111-111111111111\"\n\tdetail, err := client.Emails.Get(ctx, mailboxID, \"550e8400-e29b-41d4-a716-446655440001\", tropmail.GetOptions{View: \"text\"})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(detail.Content)\n\n}"}]}},"/mailbox/{id}/emails/{emailId}/scan-attachments":{"post":{"tags":["Attachments"],"summary":"Scan all attachments","description":"Start malware scans for every attachment on an email that is still `NotScanned`. Each new scan returns `Processing` right away. Read `GET /mailbox/{id}/attachments/{attId}` until `scan_status` is `Clean`, `Malicious`, `Suspicious`, or `Unknown`. Attachments that already have a result are skipped.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Mailbox UUID"},{"name":"emailId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Email UUID"}],"responses":{"200":{"description":"Scans initiated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[{"BearerAuth":[]}],"x-sourcey-code-samples":[{"lang":"bash","label":"cURL","source":"curl -sS -X POST 'https://api.tropmail.com/api/v1/mailbox/11111111-1111-1111-1111-111111111111/emails/550e8400-e29b-41d4-a716-446655440001/scan-attachments' \\\n  -H 'Authorization: Bearer $TROPMAIL_API_KEY' \\\n  -H 'Accept: application/json'"},{"lang":"typescript","label":"TypeScript","source":"import { TropMail } from \"@tropmail/sdk\";\n\nconst client = new TropMail({ apiKey: process.env.TROPMAIL_API_KEY! });\nconst mailboxId = \"11111111-1111-1111-1111-111111111111\";\nconst emailId = \"550e8400-e29b-41d4-a716-446655440001\";\n\nconst scans = await client.emails.scanAttachments(mailboxId, emailId);\nconsole.log(scans);"},{"lang":"python","label":"Python","source":"from tropmail import TropMail\n\nwith TropMail() as client:\n    mailbox_id = \"11111111-1111-1111-1111-111111111111\"\n    print(client.emails.scan_attachments(mailbox_id, \"550e8400-e29b-41d4-a716-446655440001\"))"},{"lang":"go","label":"Go","source":"package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\ttropmail \"github.com/tropmail/tropmail-go\"\n)\n\nfunc main() {\n\tclient, err := tropmail.New(os.Getenv(\"TROPMAIL_API_KEY\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx := context.Background()\n\tmailboxID := \"11111111-1111-1111-1111-111111111111\"\n\tscans, err := client.Emails.ScanAttachments(ctx, mailboxID, \"550e8400-e29b-41d4-a716-446655440001\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(scans)\n\n}"}]}},"/mailbox/{id}/emails/{emailId}/download-attachments":{"get":{"tags":["Attachments"],"summary":"List attachments for download","description":"List attachments on an email with an `available` flag (`true` when the object is stored, including empty files). Fetch bytes via GET /mailbox/{id}/attachments/{attId}/download.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Mailbox UUID"},{"name":"emailId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Email UUID"}],"responses":{"200":{"description":"Download links retrieved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[{"BearerAuth":[]}],"x-sourcey-code-samples":[{"lang":"bash","label":"cURL","source":"curl -sS -X GET 'https://api.tropmail.com/api/v1/mailbox/11111111-1111-1111-1111-111111111111/emails/550e8400-e29b-41d4-a716-446655440001/download-attachments' \\\n  -H 'Authorization: Bearer $TROPMAIL_API_KEY' \\\n  -H 'Accept: application/json'"},{"lang":"typescript","label":"TypeScript","source":"import { TropMail } from \"@tropmail/sdk\";\n\nconst client = new TropMail({ apiKey: process.env.TROPMAIL_API_KEY! });\nconst mailboxId = \"11111111-1111-1111-1111-111111111111\";\nconst emailId = \"550e8400-e29b-41d4-a716-446655440001\";\n\nconst files = await client.emails.downloadAttachments(mailboxId, emailId);\nconsole.log(files[0]?.filename);"},{"lang":"python","label":"Python","source":"from tropmail import TropMail\n\nwith TropMail() as client:\n    mailbox_id = \"11111111-1111-1111-1111-111111111111\"\n    files = client.emails.download_attachments(mailbox_id, \"550e8400-e29b-41d4-a716-446655440001\")\n    print(files[0].filename)"},{"lang":"go","label":"Go","source":"package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\ttropmail \"github.com/tropmail/tropmail-go\"\n)\n\nfunc main() {\n\tclient, err := tropmail.New(os.Getenv(\"TROPMAIL_API_KEY\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx := context.Background()\n\tmailboxID := \"11111111-1111-1111-1111-111111111111\"\n\tfiles, err := client.Emails.DownloadAttachments(ctx, mailboxID, \"550e8400-e29b-41d4-a716-446655440001\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(files[0].Filename)\n\n}"}]}},"/mailbox/{id}/attachments/{attId}":{"get":{"tags":["Attachments"],"summary":"Get attachment metadata","description":"Read one attachment: filename, size, scan status, and the scan report once the scan has finished.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Mailbox UUID"},{"name":"attId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Attachment UUID"}],"responses":{"200":{"description":"Attachment retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/Attachment"},"error":{"type":["string","null"]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[{"BearerAuth":[]}],"x-sourcey-code-samples":[{"lang":"bash","label":"cURL","source":"curl -sS -X GET 'https://api.tropmail.com/api/v1/mailbox/11111111-1111-1111-1111-111111111111/attachments/660e8400-e29b-41d4-a716-446655440002' \\\n  -H 'Authorization: Bearer $TROPMAIL_API_KEY' \\\n  -H 'Accept: application/json'"},{"lang":"typescript","label":"TypeScript","source":"import { TropMail } from \"@tropmail/sdk\";\n\nconst client = new TropMail({ apiKey: process.env.TROPMAIL_API_KEY! });\nconst mailboxId = \"11111111-1111-1111-1111-111111111111\";\nconst attachmentId = \"660e8400-e29b-41d4-a716-446655440002\";\n\nconst meta = await client.attachments.get(mailboxId, attachmentId);\nconsole.log(meta.filename, meta.scan_status);"},{"lang":"python","label":"Python","source":"from tropmail import TropMail\n\nwith TropMail() as client:\n    mailbox_id = \"11111111-1111-1111-1111-111111111111\"\n    meta = client.attachments.get(mailbox_id, \"660e8400-e29b-41d4-a716-446655440002\")\n    print(meta.filename, meta.scan_status)"},{"lang":"go","label":"Go","source":"package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\ttropmail \"github.com/tropmail/tropmail-go\"\n)\n\nfunc main() {\n\tclient, err := tropmail.New(os.Getenv(\"TROPMAIL_API_KEY\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx := context.Background()\n\tmailboxID := \"11111111-1111-1111-1111-111111111111\"\n\tmeta, err := client.Attachments.Get(ctx, mailboxID, \"660e8400-e29b-41d4-a716-446655440002\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(meta.Filename, meta.ScanStatus)\n\n}"}]}},"/mailbox/{id}/attachments/{attId}/scan":{"post":{"tags":["Attachments"],"summary":"Scan attachment","description":"Start a malware scan for an attachment.\n\nThe response is immediate. A new scan comes back as `Processing`, and `scan_result` is empty until the scan completes (usually 1–2 minutes). Keep reading `GET /mailbox/{id}/attachments/{attId}` until `scan_status` is `Clean`, `Malicious`, `Suspicious`, or `Unknown`.\n\n- Already `Processing`: success, the scan is still running.\n- `NotScanned`: starts the scan and returns `Processing`.\n- Already finished: returns the existing status. The file is not scanned again.\n- `Processing` for more than 30 minutes: calling scan again starts a new scan.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Mailbox UUID"},{"name":"attId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Attachment UUID"}],"responses":{"200":{"description":"Scan initiated or already in progress","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[{"BearerAuth":[]}],"x-sourcey-code-samples":[{"lang":"bash","label":"cURL","source":"curl -sS -X POST 'https://api.tropmail.com/api/v1/mailbox/11111111-1111-1111-1111-111111111111/attachments/660e8400-e29b-41d4-a716-446655440002/scan' \\\n  -H 'Authorization: Bearer $TROPMAIL_API_KEY' \\\n  -H 'Accept: application/json'"},{"lang":"typescript","label":"TypeScript","source":"import { TropMail } from \"@tropmail/sdk\";\n\nconst client = new TropMail({ apiKey: process.env.TROPMAIL_API_KEY! });\nconst mailboxId = \"11111111-1111-1111-1111-111111111111\";\nconst attachmentId = \"660e8400-e29b-41d4-a716-446655440002\";\n\nawait client.attachments.scan(mailboxId, attachmentId);\nlet info = await client.attachments.get(mailboxId, attachmentId);\nwhile (info.scan_status === \"Processing\") {\n  await new Promise((r) => setTimeout(r, 2000));\n  info = await client.attachments.get(mailboxId, attachmentId);\n}\nconsole.log(info.scan_status);"},{"lang":"python","label":"Python","source":"from tropmail import TropMail\nimport time\n\nwith TropMail() as client:\n    mailbox_id = \"11111111-1111-1111-1111-111111111111\"\n    att_id = \"660e8400-e29b-41d4-a716-446655440002\"\n    client.attachments.scan(mailbox_id, att_id)\n    info = client.attachments.get(mailbox_id, att_id)\n    while info.scan_status == \"Processing\":\n        time.sleep(2)\n        info = client.attachments.get(mailbox_id, att_id)\n    print(info.scan_status)"},{"lang":"go","label":"Go","source":"package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\ttropmail \"github.com/tropmail/tropmail-go\"\n)\n\nfunc main() {\n\tclient, err := tropmail.New(os.Getenv(\"TROPMAIL_API_KEY\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx := context.Background()\n\tmailboxID := \"11111111-1111-1111-1111-111111111111\"\n\tscan, err := client.Attachments.Scan(ctx, mailboxID, \"660e8400-e29b-41d4-a716-446655440002\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(scan.ScanStatus)\n\n}"}]}},"/mailbox/{id}/attachments/{attId}/download":{"get":{"tags":["Attachments"],"summary":"Download attachment bytes","description":"Download attachment file bytes. Requires Bearer auth. Response is the raw file body, not a JSON envelope. A file whose `size` is `0` returns 200 with an empty body. 400 means there is no stored object.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Mailbox UUID"},{"name":"attId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Attachment UUID"}],"responses":{"200":{"description":"Attachment file bytes","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}},"headers":{"Content-Disposition":{"schema":{"type":"string"},"description":"attachment; filename=\"...\""}}},"400":{"$ref":"#/components/responses/AttachmentUnavailable"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}},"security":[{"BearerAuth":[]}],"x-sourcey-code-samples":[{"lang":"bash","label":"cURL","source":"curl -sS -X GET 'https://api.tropmail.com/api/v1/mailbox/11111111-1111-1111-1111-111111111111/attachments/660e8400-e29b-41d4-a716-446655440002/download' \\\n  -H 'Authorization: Bearer $TROPMAIL_API_KEY'"},{"lang":"typescript","label":"TypeScript","source":"import { TropMail } from \"@tropmail/sdk\";\n\nconst client = new TropMail({ apiKey: process.env.TROPMAIL_API_KEY! });\nconst mailboxId = \"11111111-1111-1111-1111-111111111111\";\nconst attachmentId = \"660e8400-e29b-41d4-a716-446655440002\";\n\nconst res = await client.attachments.download(mailboxId, attachmentId);\nconst bytes = await res.arrayBuffer();\nconsole.log(bytes.byteLength);"},{"lang":"python","label":"Python","source":"from tropmail import TropMail\n\nwith TropMail() as client:\n    mailbox_id = \"11111111-1111-1111-1111-111111111111\"\n    path = client.attachments.download_to(mailbox_id, \"660e8400-e29b-41d4-a716-446655440002\", \"/tmp/attachment.bin\")\n    print(path)\n"},{"lang":"go","label":"Go","source":"package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\ttropmail \"github.com/tropmail/tropmail-go\"\n)\n\nfunc main() {\n\tclient, err := tropmail.New(os.Getenv(\"TROPMAIL_API_KEY\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tctx := context.Background()\n\tmailboxID := \"11111111-1111-1111-1111-111111111111\"\n\tn, err := client.Attachments.DownloadTo(ctx, mailboxID, \"660e8400-e29b-41d4-a716-446655440002\", \"/tmp/attachment.bin\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(n)\n}\n"}]}}}}