agentmail 0.1.18 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +20 -0
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/api/resources/attachments/types/Attachment.d.ts +1 -1
  4. package/dist/cjs/api/resources/attachments/types/AttachmentResponse.d.ts +13 -0
  5. package/dist/cjs/api/resources/attachments/types/AttachmentResponse.js +3 -0
  6. package/dist/cjs/api/resources/attachments/types/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/attachments/types/index.js +1 -0
  8. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +9 -1
  9. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +18 -2
  10. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +9 -1
  11. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +18 -2
  12. package/dist/cjs/api/resources/pods/resources/threads/client/Client.d.ts +9 -1
  13. package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +18 -2
  14. package/dist/cjs/api/resources/threads/client/Client.d.ts +8 -1
  15. package/dist/cjs/api/resources/threads/client/Client.js +17 -2
  16. package/dist/cjs/serialization/resources/attachments/types/Attachment.d.ts +1 -1
  17. package/dist/cjs/serialization/resources/attachments/types/Attachment.js +1 -1
  18. package/dist/cjs/serialization/resources/attachments/types/AttachmentResponse.d.ts +22 -0
  19. package/dist/cjs/serialization/resources/attachments/types/AttachmentResponse.js +54 -0
  20. package/dist/cjs/serialization/resources/attachments/types/index.d.ts +1 -0
  21. package/dist/cjs/serialization/resources/attachments/types/index.js +1 -0
  22. package/dist/cjs/version.d.ts +1 -1
  23. package/dist/cjs/version.js +1 -1
  24. package/dist/esm/BaseClient.mjs +2 -2
  25. package/dist/esm/api/resources/attachments/types/Attachment.d.mts +1 -1
  26. package/dist/esm/api/resources/attachments/types/AttachmentResponse.d.mts +13 -0
  27. package/dist/esm/api/resources/attachments/types/AttachmentResponse.mjs +2 -0
  28. package/dist/esm/api/resources/attachments/types/index.d.mts +1 -0
  29. package/dist/esm/api/resources/attachments/types/index.mjs +1 -0
  30. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +9 -1
  31. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +18 -2
  32. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +9 -1
  33. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +18 -2
  34. package/dist/esm/api/resources/pods/resources/threads/client/Client.d.mts +9 -1
  35. package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +18 -2
  36. package/dist/esm/api/resources/threads/client/Client.d.mts +8 -1
  37. package/dist/esm/api/resources/threads/client/Client.mjs +17 -2
  38. package/dist/esm/serialization/resources/attachments/types/Attachment.d.mts +1 -1
  39. package/dist/esm/serialization/resources/attachments/types/Attachment.mjs +1 -1
  40. package/dist/esm/serialization/resources/attachments/types/AttachmentResponse.d.mts +22 -0
  41. package/dist/esm/serialization/resources/attachments/types/AttachmentResponse.mjs +18 -0
  42. package/dist/esm/serialization/resources/attachments/types/index.d.mts +1 -0
  43. package/dist/esm/serialization/resources/attachments/types/index.mjs +1 -0
  44. package/dist/esm/version.d.mts +1 -1
  45. package/dist/esm/version.mjs +1 -1
  46. package/dist/llms-full.txt +2250 -310
  47. package/dist/llms.txt +3 -0
  48. package/package.json +1 -1
  49. package/reference.md +4 -4
@@ -1862,6 +1862,244 @@ Here's the step-by-step logic for a polling-based conversational agent.
1862
1862
  </Callout>
1863
1863
 
1864
1864
 
1865
+ # IMAP & SMTP
1866
+
1867
+ > Configure IMAP and SMTP to access your AgentMail inboxes using email clients or programmatic access.
1868
+
1869
+ AgentMail supports standard IMAP and SMTP protocols, allowing you to connect using traditional email clients or integrate with existing systems that rely on these protocols.
1870
+
1871
+ ## What are IMAP and SMTP?
1872
+
1873
+ **IMAP (Internet Message Access Protocol)** and **SMTP (Simple Mail Transfer Protocol)** are the standard protocols that power email communication across the internet.
1874
+
1875
+ * **IMAP** is used to **read and manage emails**. It allows email clients to sync with a mail server, keeping your messages organized across multiple devices. When you check your inbox in Outlook or Thunderbird, you're using IMAP.
1876
+
1877
+ * **SMTP** is used to **send emails**. When you hit "Send" on an email, SMTP handles delivering that message to the recipient's mail server.
1878
+
1879
+ ### Why Use IMAP/SMTP with AgentMail?
1880
+
1881
+ * **Email Client Integration**: Connect Outlook, Thunderbird, Apple Mail, or any IMAP/SMTP-compatible client to your AgentMail inbox
1882
+ * **Programmatic Access**: Send and receive emails using standard libraries (like Python's `imaplib` or `smtplib`) in any programming language
1883
+ * **Legacy System Integration**: Bridge AgentMail with existing systems that only support IMAP/SMTP protocols
1884
+ * **Familiar Tooling**: Use email tools you already know during development and testing
1885
+
1886
+ ## Finding Your Credentials
1887
+
1888
+ Before configuring IMAP or SMTP, you'll need two pieces of information from the [AgentMail Console](https://console.agentmail.to):
1889
+
1890
+ <Steps>
1891
+ <Step title="Get Your Inbox ID (Username)">
1892
+ Navigate to **Dashboard → Inboxes** and find the **Inbox ID** column. Your
1893
+ inbox ID is your inbox's email address (e.g., `myinbox@agentmail.to`). This
1894
+ will be your username for IMAP authentication.
1895
+ </Step>
1896
+
1897
+ <Step title="Get Your API Key (Password)">
1898
+ Navigate to **Dashboard → API Keys** and create or copy an API key—this will
1899
+ be your password.
1900
+ </Step>
1901
+ </Steps>
1902
+
1903
+ ## IMAP Configuration
1904
+
1905
+ Use IMAP to read emails from your AgentMail inbox.
1906
+
1907
+ <Callout intent="warning" title="SSL/TLS Required">
1908
+ SSL/TLS is **required** for all IMAP connections. Connections without SSL will
1909
+ be rejected. Make sure to enable SSL/TLS in your email client settings.
1910
+ </Callout>
1911
+
1912
+ | Setting | Value |
1913
+ | ------------ | ----------------------------------------------- |
1914
+ | **Host** | `imap.agentmail.to` |
1915
+ | **Port** | `993` |
1916
+ | **Username** | Your inbox email (e.g., `myinbox@agentmail.to`) |
1917
+ | **Password** | Your API key |
1918
+ | **SSL/TLS** | **Required** (must be enabled) |
1919
+
1920
+ <Callout intent="tip" title="Folder Support">
1921
+ Currently, only the **INBOX** folder is accessible via IMAP. Other folders
1922
+ (Sent, Drafts, Trash) are not available through IMAP. Use the [AgentMail
1923
+ API](/introduction) for full folder access.
1924
+ </Callout>
1925
+
1926
+ ### Python IMAP Example
1927
+
1928
+ ```python
1929
+ import imaplib
1930
+ import os
1931
+ import email
1932
+
1933
+ # Your credentials from AgentMail Console
1934
+ inbox_email = "myinbox@agentmail.to" # From Dashboard → Inboxes
1935
+ api_key = os.getenv("AGENTMAIL_API_KEY") # From Dashboard → API Keys
1936
+
1937
+ # Connect with SSL (required)
1938
+ imap = imaplib.IMAP4_SSL("imap.agentmail.to", 993)
1939
+
1940
+ try:
1941
+ # Authenticate using inbox email as username
1942
+ imap.login(inbox_email, api_key)
1943
+
1944
+ # Select INBOX (only supported folder)
1945
+ imap.select("INBOX")
1946
+
1947
+ # Search for all messages
1948
+ status, message_ids = imap.search(None, "ALL")
1949
+
1950
+ if status == "OK":
1951
+ for msg_id in message_ids[0].split():
1952
+ # Fetch message
1953
+ status, msg_data = imap.fetch(msg_id, "(RFC822)")
1954
+ if status == "OK":
1955
+ email_body = msg_data[0][1]
1956
+ message = email.message_from_bytes(email_body)
1957
+ print(f"Subject: {message['subject']}")
1958
+ finally:
1959
+ imap.logout()
1960
+ ```
1961
+
1962
+ ### TypeScript IMAP Example
1963
+
1964
+ ```typescript
1965
+ import Imap from "imap";
1966
+
1967
+ // Your credentials from AgentMail Console
1968
+ const inboxEmail = "myinbox@agentmail.to"; // From Dashboard → Inboxes
1969
+ const apiKey = process.env.AGENTMAIL_API_KEY!; // From Dashboard → API Keys
1970
+
1971
+ const imap = new Imap({
1972
+ user: inboxEmail,
1973
+ password: apiKey,
1974
+ host: "imap.agentmail.to",
1975
+ port: 993,
1976
+ tls: true, // SSL required
1977
+ });
1978
+
1979
+ imap.once("ready", () => {
1980
+ imap.openBox("INBOX", false, (err, box) => {
1981
+ if (err) throw err;
1982
+ console.log(`${box.messages.total} messages in INBOX`);
1983
+ imap.end();
1984
+ });
1985
+ });
1986
+
1987
+ imap.once("error", (err: Error) => {
1988
+ console.error("IMAP error:", err.message);
1989
+ });
1990
+
1991
+ imap.connect();
1992
+ ```
1993
+
1994
+ ## SMTP Configuration
1995
+
1996
+ Use SMTP to send emails from your AgentMail inbox.
1997
+
1998
+ <Callout intent="warning" title="SSL/TLS Required">
1999
+ SSL/TLS is **required** for all SMTP connections. Connections without SSL will
2000
+ be rejected. Make sure to enable SSL/TLS in your email client settings.
2001
+ </Callout>
2002
+
2003
+ | Setting | Value |
2004
+ | ------------ | ------------------------------ |
2005
+ | **Host** | `smtp.agentmail.to` |
2006
+ | **Port** | `465` |
2007
+ | **Username** | agentmail |
2008
+ | **Password** | Your API key |
2009
+ | **SSL/TLS** | **Required** (must be enabled) |
2010
+
2011
+ <Callout intent="warning" title="From Address">
2012
+ The "From" address in your email should match the email address of your inbox
2013
+ (e.g., `myinbox@agentmail.to`). Using a different From address may result in
2014
+ delivery failures.
2015
+ </Callout>
2016
+
2017
+ ### SMTP Limits
2018
+
2019
+ * **Max recipients**: 50 per email
2020
+ * **Max message size**: 10MB
2021
+ * **Session timeout**: 30 minutes
2022
+
2023
+ ### Python SMTP Example
2024
+
2025
+ ```python
2026
+ import smtplib
2027
+ import os
2028
+ from email.mime.text import MIMEText
2029
+ from email.mime.multipart import MIMEMultipart
2030
+
2031
+ # Your credentials from AgentMail Console
2032
+ inbox_email = "myinbox@agentmail.to" # From Dashboard → Inboxes
2033
+ api_key = os.getenv("AGENTMAIL_API_KEY") # From Dashboard → API Keys
2034
+
2035
+ # Create message
2036
+ msg = MIMEMultipart()
2037
+ msg["Subject"] = "Hello from AgentMail"
2038
+ msg["From"] = inbox_email # Use your inbox email as the From address
2039
+ msg["To"] = "recipient@example.com"
2040
+ msg.attach(MIMEText("This is a test email sent via SMTP.", "plain"))
2041
+
2042
+ # Connect with SSL (required) and send
2043
+ with smtplib.SMTP_SSL("smtp.agentmail.to", 465) as server:
2044
+ server.login(inbox_email, api_key)
2045
+ server.send_message(msg)
2046
+ print("Email sent successfully!")
2047
+ ```
2048
+
2049
+ ### TypeScript SMTP Example
2050
+
2051
+ ```typescript
2052
+ import nodemailer from "nodemailer";
2053
+
2054
+ // Your credentials from AgentMail Console
2055
+ const inboxEmail = "myinbox@agentmail.to"; // From Dashboard → Inboxes
2056
+ const apiKey = process.env.AGENTMAIL_API_KEY!; // From Dashboard → API Keys
2057
+
2058
+ const transporter = nodemailer.createTransport({
2059
+ host: "smtp.agentmail.to",
2060
+ port: 465,
2061
+ secure: true, // SSL required
2062
+ auth: {
2063
+ user: inboxEmail,
2064
+ pass: apiKey,
2065
+ },
2066
+ });
2067
+
2068
+ async function sendEmail() {
2069
+ const info = await transporter.sendMail({
2070
+ from: inboxEmail, // Use your inbox email as the From address
2071
+ to: "recipient@example.com",
2072
+ subject: "Hello from AgentMail",
2073
+ text: "This is a test email sent via SMTP.",
2074
+ });
2075
+ console.log("Email sent:", info.messageId);
2076
+ }
2077
+
2078
+ sendEmail().catch(console.error);
2079
+ ```
2080
+
2081
+ ## Troubleshooting
2082
+
2083
+ | Error | Cause | Solution |
2084
+ | ----------------------- | ----------------------- | ------------------------------------------------------ |
2085
+ | "Authentication failed" | Invalid credentials | Verify your inbox email and API key from the console |
2086
+ | "Connection refused" | SSL not enabled | Enable SSL/TLS in your client settings |
2087
+ | "Connection timeout" | Firewall blocking ports | Ensure ports 993 (IMAP) and 465/587 (SMTP) are open |
2088
+ | "Sender not authorized" | Wrong From address | Use your inbox's email address as the From address |
2089
+ | "Folder not found" | Non-INBOX folder | Only INBOX is supported; use the API for other folders |
2090
+
2091
+ ## When to Use IMAP/SMTP vs API
2092
+
2093
+ | Use Case | Recommendation |
2094
+ | --------------------------- | -------------- |
2095
+ | Email client integration | IMAP/SMTP |
2096
+ | Simple programmatic sending | SMTP |
2097
+ | Full inbox management | API |
2098
+ | Real-time notifications | API (Webhooks) |
2099
+ | Access to all folders | API |
2100
+ | Bulk operations | API |
2101
+
2102
+
1865
2103
  # Using Custom Domains
1866
2104
 
1867
2105
  > A step-by-step guide to configuring your custom domain with AgentMail for enhanced branding and trust.
@@ -2574,6 +2812,10 @@ When AgentMail sends a webhook, the payload will have the following structure.
2574
2812
  Explore the full list of available event types and their data payloads.
2575
2813
  </Card>
2576
2814
 
2815
+ <Card title="Verifying Webhooks" href="/webhook-verification">
2816
+ Learn how to verify webhook signatures to secure your endpoints.
2817
+ </Card>
2818
+
2577
2819
  <Card title="Example: Event-Driven Agent" href="/github-star-agent">
2578
2820
  Build a fully deployable, event-driven agent that can respond to emails in
2579
2821
  real time.
@@ -3067,12 +3309,16 @@ To test your webhook setup:
3067
3309
  For production deployments:
3068
3310
 
3069
3311
  * **Use a dedicated server**: Deploy your webhook receiver to a cloud service (AWS, GCP, Heroku, etc.) instead of using ngrok
3070
- * **Implement webhook verification**: Validate incoming requests are from AgentMail
3312
+ * **Implement webhook verification**: [Validate incoming requests](/webhook-verification) are authentically from AgentMail
3071
3313
  * **Add error handling**: Implement retry logic and error reporting
3072
3314
  * **Use async processing**: Return 200 immediately and process webhooks in background jobs
3073
3315
  * **Monitor webhook health**: Set up logging and alerting for failed webhook deliveries
3074
3316
 
3075
3317
  <CardGroup>
3318
+ <Card title="Verifying Webhooks" href="/webhook-verification">
3319
+ Learn how to verify webhook signatures for secure endpoints.
3320
+ </Card>
3321
+
3076
3322
  <Card title="Webhooks Overview" href="/overview">
3077
3323
  Learn more about how webhooks work and their payload structure.
3078
3324
  </Card>
@@ -3080,9 +3326,367 @@ For production deployments:
3080
3326
  <Card title="Webhook Events" href="/events">
3081
3327
  Explore the full list of webhook event types.
3082
3328
  </Card>
3329
+ </CardGroup>
3330
+
3331
+
3332
+ # Verifying Webhooks
3333
+
3334
+ > Learn how to verify webhook signatures to secure your webhook endpoints and prevent spoofed requests.
3335
+
3336
+ When building webhook receivers, it's critical to verify that incoming requests actually originate from AgentMail and haven't been tampered with. AgentMail uses [Svix](https://www.svix.com/) to deliver webhooks, which provides cryptographic signature verification.
3337
+
3338
+ ## Why Verify Webhooks?
3339
+
3340
+ Without verification, anyone who discovers your webhook URL could send fake requests to your endpoint, potentially causing:
3341
+
3342
+ * **Data manipulation:** Malicious actors could trigger actions based on fake events
3343
+ * **Security breaches:** Spoofed messages could inject harmful data into your systems
3344
+ * **Resource exhaustion:** Attackers could flood your endpoint with fake requests
3345
+
3346
+ Always verify webhook signatures in production environments.
3347
+
3348
+ ## Getting Your Signing Secret
3349
+
3350
+ Each webhook endpoint has a unique signing secret that you'll use to verify requests. You can find this secret in the AgentMail console when you create your webhook or by fetching your webhook details:
3351
+
3352
+ <CodeBlocks>
3353
+ ```python
3354
+ from agentmail import AgentMail
3355
+
3356
+ client = AgentMail()
3357
+
3358
+ # Get webhook details including the signing secret
3359
+ webhook = client.webhooks.get(webhook_id="ep_xxx")
3360
+
3361
+ # The secret starts with "whsec_"
3362
+ signing_secret = webhook.secret
3363
+ print(f"Signing secret: {signing_secret}")
3364
+ ```
3365
+
3366
+ ```typescript
3367
+ import AgentMail from "agentmail";
3368
+
3369
+ const client = new AgentMail();
3370
+
3371
+ // Get webhook details including the signing secret
3372
+ const webhook = await client.webhooks.get("ep_xxx");
3373
+
3374
+ // The secret starts with "whsec_"
3375
+ const signingSecret = webhook.secret;
3376
+ console.log(`Signing secret: ${signingSecret}`);
3377
+ ```
3378
+ </CodeBlocks>
3379
+
3380
+ <Callout intent="warning" title="Keep your secret safe">
3381
+ Store your signing secret securely in environment variables. Never commit it to version control or expose it in client-side code.
3382
+ </Callout>
3383
+
3384
+ ## Verification Headers
3385
+
3386
+ Every webhook request from AgentMail includes three headers used for verification:
3387
+
3388
+ | Header | Description |
3389
+ | ---------------- | --------------------------------------------------------------------------------------------- |
3390
+ | `svix-id` | Unique message identifier. Same ID is used for retries of the same message. |
3391
+ | `svix-timestamp` | Unix timestamp (seconds) when the message was sent. |
3392
+ | `svix-signature` | Space-delimited list of signatures in the format `v1,<base64>` (e.g., `v1,abc123 v1,def456`). |
3393
+
3394
+ ## Verifying with the Svix Library (Recommended)
3395
+
3396
+ The easiest way to verify webhooks is using the official Svix library, which handles all the cryptographic details for you.
3397
+
3398
+ <CodeBlocks>
3399
+ ```python
3400
+ import os
3401
+ from dotenv import load_dotenv
3402
+ from flask import Flask, request
3403
+
3404
+ from svix.webhooks import Webhook, WebhookVerificationError
3405
+
3406
+ load_dotenv()
3407
+
3408
+ app = Flask(__name__)
3409
+
3410
+ secret = os.environ["AGENTMAIL_WEBHOOK_SECRET"]
3411
+
3412
+ @app.route('/webhooks', methods=['POST'])
3413
+ def webhook_handler():
3414
+ headers = request.headers
3415
+ payload = request.get_data()
3416
+
3417
+ try:
3418
+ wh = Webhook(secret)
3419
+ msg = wh.verify(payload, headers)
3420
+ except WebhookVerificationError as e:
3421
+ return ('', 400)
3422
+
3423
+ # Do something with the message...
3424
+
3425
+ return ('', 204)
3426
+
3427
+ if __name__ == '__main__':
3428
+ app.run(port=3000)
3429
+
3430
+ ```
3431
+
3432
+ ```typescript
3433
+ import "dotenv/config";
3434
+ import express, { Request, Response } from "express";
3435
+ import { Webhook } from "svix";
3436
+
3437
+ const app = express();
3438
+ const port = 3000;
3439
+
3440
+ const secret = process.env.AGENTMAIL_WEBHOOK_SECRET;
3441
+
3442
+ if (!secret) {
3443
+ throw new Error("AGENTMAIL_WEBHOOK_SECRET environment variable is required");
3444
+ }
3445
+
3446
+ app.post(
3447
+ "/webhooks",
3448
+ express.raw({ type: "application/json" }),
3449
+ (req: Request, res: Response) => {
3450
+ const payload = req.body;
3451
+ const headers = req.headers as Record<string, string>;
3452
+
3453
+ try {
3454
+ const wh = new Webhook(secret);
3455
+ const msg = wh.verify(payload, headers);
3456
+
3457
+ // Do something with the message...
3458
+ console.log("Webhook verified:", msg);
3459
+
3460
+ res.status(204).send();
3461
+ } catch (err) {
3462
+ console.error("Webhook verification failed:", err);
3463
+ res.status(400).send();
3464
+ }
3465
+ }
3466
+ );
3467
+
3468
+ app.listen(port, () => {
3469
+ console.log(`Webhook server listening on port ${port}`);
3470
+ });
3471
+ ```
3472
+ </CodeBlocks>
3473
+
3474
+ <Callout intent="info" title="Raw body required">
3475
+ Signature verification requires the exact request body. If you're using body-parsing middleware (like `express.json()`), make sure to capture the raw body before parsing, or use `express.raw()` for your webhook endpoint.
3476
+ </Callout>
3477
+
3478
+ ## Testing Locally with ngrok
3479
+
3480
+ During development, you'll need a way for AgentMail to reach your local server. [ngrok](https://ngrok.com/) creates a public URL that tunnels to your local machine.
3481
+
3482
+ ### Step 1: Save Your Webhook Server
3483
+
3484
+ Create a webhook server file:
3485
+
3486
+ <CodeBlocks>
3487
+ ```python title="webhook_server.py"
3488
+ import os
3489
+ from dotenv import load_dotenv
3490
+ from flask import Flask, request
3491
+
3492
+ from svix.webhooks import Webhook, WebhookVerificationError
3493
+
3494
+ load_dotenv()
3495
+
3496
+ app = Flask(__name__)
3497
+
3498
+ secret = os.environ.get("AGENTMAIL_WEBHOOK_SECRET")
3499
+
3500
+ @app.route('/webhooks', methods=['POST'])
3501
+ def webhook_handler():
3502
+ headers = request.headers
3503
+ payload = request.get_data()
3504
+
3505
+ try:
3506
+ wh = Webhook(secret)
3507
+ msg = wh.verify(payload, headers)
3508
+ print(f"Received event: {msg}")
3509
+ except WebhookVerificationError as e:
3510
+ print(f"Verification failed: {e}")
3511
+ return ('', 400)
3512
+
3513
+ # Do something with the message...
3514
+
3515
+ return ('', 204)
3516
+
3517
+ if __name__ == '__main__':
3518
+ app.run(port=3000)
3519
+ ```
3520
+
3521
+ ```typescript title="webhook_server.ts"
3522
+ import "dotenv/config";
3523
+ import express, { Request, Response } from "express";
3524
+ import { Webhook } from "svix";
3525
+
3526
+ const app = express();
3527
+ const port = 3000;
3528
+
3529
+ const secret = process.env.AGENTMAIL_WEBHOOK_SECRET;
3530
+
3531
+ if (!secret) {
3532
+ throw new Error("AGENTMAIL_WEBHOOK_SECRET environment variable is required");
3533
+ }
3534
+
3535
+ app.post(
3536
+ "/webhooks",
3537
+ express.raw({ type: "application/json" }),
3538
+ (req: Request, res: Response) => {
3539
+ const payload = req.body;
3540
+ const headers = req.headers as Record<string, string>;
3541
+
3542
+ try {
3543
+ const wh = new Webhook(secret);
3544
+ const msg = wh.verify(payload, headers);
3545
+
3546
+ // Do something with the message...
3547
+ console.log("Webhook verified:", msg);
3548
+
3549
+ res.status(204).send();
3550
+ } catch (err) {
3551
+ console.error("Webhook verification failed:", err);
3552
+ res.status(400).send();
3553
+ }
3554
+ }
3555
+ );
3556
+
3557
+ app.listen(port, () => {
3558
+ console.log(`Webhook server listening on port ${port}`);
3559
+ });
3560
+ ```
3561
+ </CodeBlocks>
3562
+
3563
+ ### Step 2: Install Dependencies and Run the Server
3564
+
3565
+ <CodeBlocks>
3566
+ ```bash title="Python"
3567
+ pip install flask python-dotenv svix
3568
+ python webhook_server.py
3569
+ ```
3570
+
3571
+ ```bash title="TypeScript"
3572
+ npm install express svix dotenv
3573
+ npx ts-node webhook_server.ts
3574
+ ```
3575
+ </CodeBlocks>
3576
+
3577
+ You should see output like:
3578
+
3579
+ <CodeBlocks>
3580
+ ```bash title="Python"
3581
+ * Serving Flask app 'webhook_server'
3582
+ * Debug mode: off
3583
+ * Running on http://127.0.0.1:3000
3584
+ Press CTRL+C to quit
3585
+ ```
3586
+
3587
+ ```bash title="TypeScript"
3588
+ Webhook server listening on port 3000
3589
+ ```
3590
+ </CodeBlocks>
3591
+
3592
+ ### Step 3: Start ngrok
3593
+
3594
+ In a new terminal window, start ngrok to create a public tunnel to your local server:
3595
+
3596
+ ```bash
3597
+ ngrok http 3000
3598
+ ```
3599
+
3600
+ ngrok will display a forwarding URL:
3601
+
3602
+ ```
3603
+ Session Status online
3604
+ Account your-email@example.com (Plan: Free)
3605
+ Version 3.22.1
3606
+ Region United States (California) (us-cal-1)
3607
+ Forwarding https://da550b82a183.ngrok.app -> http://localhost:3000
3608
+ ```
3609
+
3610
+ Copy the `https://` forwarding URL (e.g., `https://da550b82a183.ngrok.app`).
3611
+
3612
+ ### Step 4: Add the URL to AgentMail Console
3613
+
3614
+ 1. Go to the [AgentMail Console](https://console.agentmail.to)
3615
+ 2. Navigate to **Webhooks** in the sidebar
3616
+ 3. Click **Create Webhook** (or edit an existing one)
3617
+ 4. Paste your ngrok URL with the `/webhooks` path: `https://da550b82a183.ngrok.app/webhooks`
3618
+ 5. Select the events you want to receive
3619
+ 6. Save the webhook
3620
+ 7. Copy the signing secret and add it to your `.env` file:
3621
+
3622
+ ```bash
3623
+ AGENTMAIL_WEBHOOK_SECRET=whsec_your_secret_here
3624
+ ```
3625
+
3626
+ ### Step 5: Trigger a Test Event
3627
+
3628
+ Send an email to one of your AgentMail inboxes, or use the console to send a test event. You should see the webhook received in your terminal:
3629
+
3630
+ ```
3631
+ 127.0.0.1 - - [19/Jan/2026 16:57:20] "POST /webhooks HTTP/1.1" 204 -
3632
+ Received event: {'event_type': 'message.received', ...}
3633
+ ```
3634
+
3635
+ <Callout intent="info" title="Ready for production?">
3636
+ ngrok is great for local development, but for production you'll need to deploy your webhook server to a hosting provider. See the next section for deployment options.
3637
+ </Callout>
3638
+
3639
+ ## Deploying to Production
3640
+
3641
+ For production, you'll need to deploy your webhook server to a hosting provider that gives you a stable, public HTTPS URL. We recommend [Render](https://render.com/) for its simplicity and generous free tier.
3642
+
3643
+ <Callout intent="info" title="Other hosting options">
3644
+ You can also deploy to other platforms like [Railway](https://railway.app/), [Fly.io](https://fly.io/), [Heroku](https://heroku.com/), or any cloud provider that supports Python web applications. The key requirements are a stable public HTTPS URL and the ability to set environment variables.
3645
+ </Callout>
3646
+
3647
+ ## Best Practices
3648
+
3649
+ <AccordionGroup>
3650
+ <Accordion title="Always verify in production">
3651
+ While you might skip verification during local development, always enable it in production environments. A compromised webhook endpoint can be a serious security vulnerability.
3652
+ </Accordion>
3653
+
3654
+ <Accordion title="Use environment variables">
3655
+ Never hardcode your signing secret. Use environment variables or a secrets manager:
3656
+
3657
+ ```python
3658
+ import os
3659
+ WEBHOOK_SECRET = os.environ["AGENTMAIL_WEBHOOK_SECRET"]
3660
+ ```
3661
+ </Accordion>
3662
+ </AccordionGroup>
3663
+
3664
+ ## Troubleshooting
3665
+
3666
+ <AccordionGroup>
3667
+ <Accordion title="Signature verification fails">
3668
+ * Ensure you're using the raw request body, not a parsed/modified version
3669
+ * Check that your signing secret is correct and matches the webhook endpoint
3670
+ * Verify you're extracting headers correctly (they're case-insensitive)
3671
+ * Make sure the timestamp hasn't expired (default tolerance is 5 minutes)
3672
+ </Accordion>
3673
+
3674
+ <Accordion title="Missing headers">
3675
+ If headers are missing, ensure your server/framework isn't stripping them. Some reverse proxies may need configuration to pass through custom headers.
3676
+ </Accordion>
3677
+
3678
+ <Accordion title="Body parsing issues">
3679
+ If you're using body-parsing middleware, make sure to access the raw body for verification. In Express, use `express.raw()` for your webhook route.
3680
+ </Accordion>
3681
+ </AccordionGroup>
3682
+
3683
+ <CardGroup>
3684
+ <Card title="Webhook Setup" href="/webhook-setup">
3685
+ Complete guide to setting up webhooks with ngrok.
3686
+ </Card>
3083
3687
 
3084
- <Card title="Event-Driven Agent" href="/webhook-agent">
3085
- Build a complete agent that uses webhooks for real-time responses.
3688
+ <Card title="Webhook Events" href="/events">
3689
+ Explore all available webhook event types.
3086
3690
  </Card>
3087
3691
  </CardGroup>
3088
3692
 
@@ -5545,70 +6149,791 @@ Go to your AgentMail inbox and filter by labels to organize your emails:
5545
6149
 
5546
6150
  **Filter by priority, by department...**
5547
6151
 
5548
- **Combine filters for powerful queries:**
6152
+ **Combine filters for powerful queries:**
6153
+
6154
+ * `urgent` + `negative` → Critical customer issues
6155
+ * `sales` + `high` → Hot leads requiring fast response
6156
+ * `technical` + `bug-report` → Engineering backlog
6157
+
6158
+ <Callout intent="success">
6159
+ **Pro tip:** You can use AgentMail's API to programmatically fetch emails by labels and build custom workflows, dashboards, and analytics.
6160
+ </Callout>
6161
+
6162
+ ## Building on Labels
6163
+
6164
+ Once your emails are automatically labeled, you can build powerful automation on top:
6165
+
6166
+ ### Example 1: Priority Notifications
6167
+
6168
+ **Scenario**: Alert your team instantly when urgent issues arrive.
6169
+
6170
+ When an email is labeled `urgent` + `negative`, automatically send a Slack notification to your support channel. Include the sender's email and subject line so your team can respond immediately. This ensures critical customer issues never slip through the cracks.
6171
+
6172
+ ### Example 2: Sentiment Escalation
6173
+
6174
+ **Scenario**: Escalate negative sentiment to management.
6175
+
6176
+ Track all emails labeled `negative` and automatically notify customer success managers when sentiment trends downward. If a single customer sends 3+ negative emails in a week, trigger a personal outreach from leadership to address their concerns proactively.
6177
+
6178
+ ### Example 3: Department Routing
6179
+
6180
+ **Scenario**: Auto-forward emails to the right team.
6181
+
6182
+ Create rules that automatically forward emails based on department labels:
6183
+
6184
+ * `sales` → Forward to [sales@yourcompany.com](mailto:sales@yourcompany.com)
6185
+ * `billing` → Create a ticket in your billing system
6186
+ * `technical` → Post to #engineering Slack channel
6187
+ * `support` → Add to support queue with appropriate SLA
6188
+
6189
+ ### Example 4: Smart Auto-Reply
6190
+
6191
+ **Scenario**: Send contextual automated responses.
6192
+
6193
+ Instead of generic auto-replies, craft responses based on classification:
6194
+
6195
+ * `question` → "Thanks for your question! We'll respond within 24 hours."
6196
+ * `bug-report` → "Thanks for reporting this. Our engineering team has been notified."
6197
+ * `complaint` → "We're sorry to hear that. A senior support agent will contact you within 4 hours."
6198
+ * `feature-request` → "Great idea! We've added this to our product roadmap."
6199
+
6200
+ ### Example 5: Analytics Dashboard
6201
+
6202
+ **Scenario**: Track email metrics and trends.
6203
+
6204
+ Build a dashboard that queries emails by labels to analyze:
6205
+
6206
+ * **Sentiment trends**: Are customers getting happier or more frustrated?
6207
+ * **Volume by department**: Which team is handling the most emails?
6208
+ * **Response times by priority**: Are you meeting SLAs for urgent issues?
6209
+ * **Common categories**: What are customers asking about most?
6210
+
6211
+ Use this data to identify bottlenecks, improve processes, and make data-driven decisions about staffing and product priorities.
6212
+
6213
+ ***
6214
+
6215
+ Congratulations! You've built an AI-powered email classification system. This agent showcases how AgentMail's labeling feature can power sophisticated inbox automation and analytics.
6216
+
6217
+
6218
+ # Sales Agent with WebSocket
6219
+
6220
+ > A step-by-step guide to building an AI-powered sales agent that uses WebSocket for real-time email processing without polling or webhooks.
6221
+
6222
+ ## Overview
6223
+
6224
+ Learn how to build a real-time sales agent that processes emails instantly using WebSocket connections. Unlike webhook-based agents that require ngrok and public URLs, this WebSocket approach connects directly to AgentMail for true real-time processing with minimal setup.
6225
+
6226
+ This agent demonstrates a practical sales workflow: a manager delegates customer outreach to the agent, which then handles the entire conversation autonomously while keeping the manager informed of key signals.
6227
+
6228
+ ## What You'll Build
6229
+
6230
+ By the end of this guide, you'll have a working sales agent that:
6231
+
6232
+ 1. **Connects via WebSocket** for instant, real-time email processing
6233
+ 2. **Handles manager emails** by extracting customer info and sending personalized outreach
6234
+ 3. **Processes customer replies** with AI-powered, context-aware responses
6235
+ 4. **Notifies the manager** when customers show strong buying signals
6236
+
6237
+ Here's the workflow:
6238
+
6239
+ ```
6240
+ Manager sends email with customer info
6241
+
6242
+ Agent extracts customer email
6243
+
6244
+ Agent generates AI sales pitch → Sends to customer
6245
+
6246
+ Agent confirms to manager
6247
+
6248
+ [Customer replies]
6249
+
6250
+ Agent detects intent + generates AI response
6251
+
6252
+ If interested → Notifies manager
6253
+ ```
6254
+
6255
+ ## WebSocket vs Webhook: Why WebSocket?
6256
+
6257
+ | Feature | Webhook Approach | WebSocket Approach |
6258
+ | ------------ | --------------------------- | ------------------------ |
6259
+ | Setup | Requires ngrok + public URL | No external tools needed |
6260
+ | Architecture | Flask server + HTTP | Pure async Python |
6261
+ | Latency | HTTP round-trip | Instant streaming |
6262
+ | Firewall | Must expose port | Outbound only |
6263
+
6264
+ For more details, see the [WebSocket API Reference](/api-reference/websockets) and the [Python SDK WebSocket documentation](https://github.com/agentmail-to/agentmail-python?tab=readme-ov-file#websockets).
6265
+
6266
+ ## Prerequisites
6267
+
6268
+ Before you begin, make sure you have:
6269
+
6270
+ <Callout intent="info">
6271
+ **Required:**
6272
+
6273
+ * Python 3.11 or higher installed
6274
+ * An [AgentMail account](https://console.agentmail.to) and API key
6275
+ * An [OpenAI account](https://platform.openai.com) and API key
6276
+ </Callout>
6277
+
6278
+ ## Project Setup
6279
+
6280
+ ### Step 1: Create Project Directory
6281
+
6282
+ Create a new directory for your agent:
6283
+
6284
+ ```bash
6285
+ mkdir sales-agent-websocket
6286
+ cd sales-agent-websocket
6287
+ ```
6288
+
6289
+ ### Step 2: Create the Agent Code
6290
+
6291
+ Create a file named `main.py` and paste the following code:
6292
+
6293
+ <Accordion title="Click to view full main.py code">
6294
+ ```python
6295
+ """
6296
+ Sales Agent using AgentMail WebSocket
6297
+
6298
+ This is a simple example showing how to:
6299
+ - Connect to AgentMail via WebSocket for real-time email processing
6300
+ - Use OpenAI to handle sales conversations
6301
+ - Send emails to customers and respond to replies
6302
+ """
6303
+
6304
+ import asyncio
6305
+ import os
6306
+ import re
6307
+ from dotenv import load_dotenv
6308
+ from agentmail import AsyncAgentMail, Subscribe, Subscribed, MessageReceivedEvent
6309
+ from openai import AsyncOpenAI
6310
+
6311
+ # Load environment variables
6312
+ load_dotenv()
6313
+
6314
+ # Initialize clients
6315
+ agentmail = AsyncAgentMail(api_key=os.getenv("AGENTMAIL_API_KEY"))
6316
+ openai = AsyncOpenAI(api_key=os.getenv("OPENAI_API_KEY"))
6317
+
6318
+ # Simple conversation history (thread_id -> messages)
6319
+ conversations = {}
6320
+
6321
+ # Store manager email for notifications
6322
+ manager_email = None
6323
+
6324
+
6325
+ def extract_email(from_field):
6326
+ """Extract email address from 'Name <email@example.com>' format"""
6327
+ match = re.search(r'<(.+?)>', from_field)
6328
+ return match.group(1) if match else from_field
6329
+
6330
+
6331
+ def is_from_manager(email_body):
6332
+ """Simple check if email is from sales manager (contains customer info)"""
6333
+ keywords = ['customer', 'lead', 'contact', 'reach out', 'email']
6334
+ return any(keyword in email_body.lower() for keyword in keywords)
6335
+
6336
+
6337
+ def extract_customer_info(email_body):
6338
+ """Extract customer email from manager's message"""
6339
+ email_pattern = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
6340
+ emails = re.findall(email_pattern, email_body)
6341
+
6342
+ # Return the first email found (should be the customer's email in the message body)
6343
+ if emails:
6344
+ return emails[0]
6345
+ return None
6346
+
6347
+
6348
+ async def get_ai_response(messages, system_prompt):
6349
+ """Get response from OpenAI"""
6350
+ try:
6351
+ response = await openai.chat.completions.create(
6352
+ model="gpt-4o-mini",
6353
+ messages=[
6354
+ {"role": "system", "content": system_prompt},
6355
+ *messages
6356
+ ],
6357
+ temperature=0.7,
6358
+ )
6359
+ return response.choices[0].message.content
6360
+ except Exception as e:
6361
+ print(f"Error getting AI response: {e}")
6362
+ return "I apologize, but I encountered an error. Please try again."
6363
+
6364
+
6365
+ async def send_email(inbox_id, to_email, subject, body):
6366
+ """Send a new email"""
6367
+ try:
6368
+ await agentmail.inboxes.messages.send(
6369
+ inbox_id=inbox_id,
6370
+ to=[to_email],
6371
+ subject=subject,
6372
+ text=body
6373
+ )
6374
+ print(f"✓ Sent email to {to_email}")
6375
+ except Exception as e:
6376
+ print(f"Error sending email: {e}")
6377
+
6378
+
6379
+ async def reply_to_email(inbox_id, message_id, to_email, body):
6380
+ """Reply to an email"""
6381
+ try:
6382
+ await agentmail.inboxes.messages.reply(
6383
+ inbox_id=inbox_id,
6384
+ message_id=message_id,
6385
+ to=[to_email], # Required parameter for replies
6386
+ text=body
6387
+ )
6388
+ print(f"✓ Sent reply to {to_email}")
6389
+ except Exception as e:
6390
+ print(f"Error replying: {e}")
6391
+
6392
+
6393
+ async def handle_manager_email(inbox_id, message_id, from_email, subject, body):
6394
+ """Handle email from sales manager - extract customer and send sales pitch"""
6395
+ global manager_email
6396
+ manager_email = from_email # Remember manager for future notifications
6397
+
6398
+ print(f"\n📧 Email from MANAGER: {from_email}")
6399
+
6400
+ # Extract customer email
6401
+ customer_email = extract_customer_info(body)
6402
+ print(f"→ Extracted customer email: {customer_email}")
6403
+
6404
+ if not customer_email:
6405
+ await reply_to_email(
6406
+ inbox_id,
6407
+ message_id,
6408
+ from_email, # Reply back to the manager
6409
+ "I couldn't find a customer email address. Please include it in your message."
6410
+ )
6411
+ return
6412
+
6413
+ # Generate sales pitch using AI
6414
+ system_prompt = """You are a helpful sales agent. Generate a brief, professional sales email
6415
+ based on the manager's request. Keep it under 150 words. Be friendly and professional."""
6416
+
6417
+ messages = [{"role": "user", "content": f"Create a sales email based on this: {body}"}]
6418
+ sales_pitch = await get_ai_response(messages, system_prompt)
6419
+
6420
+ # Send email to customer
6421
+ await send_email(
6422
+ inbox_id,
6423
+ customer_email,
6424
+ f"Introduction: {subject}" if subject else "Quick Introduction",
6425
+ sales_pitch
6426
+ )
6427
+
6428
+ # Confirm to manager
6429
+ await reply_to_email(
6430
+ inbox_id,
6431
+ message_id,
6432
+ from_email, # Reply back to the manager
6433
+ f"✓ I've sent an introduction email to {customer_email}.\n\nHere's what I sent:\n\n{sales_pitch}"
6434
+ )
6435
+
6436
+
6437
+ async def handle_customer_email(inbox_id, message_id, thread_id, from_email, subject, body):
6438
+ """Handle email from customer - track conversation, detect intent, and notify manager"""
6439
+ print(f"\n📧 Email from CUSTOMER: {from_email}")
6440
+
6441
+ # Track conversation history
6442
+ if thread_id not in conversations:
6443
+ conversations[thread_id] = []
6444
+ conversations[thread_id].append({"role": "user", "content": body})
6445
+
6446
+ # Detect customer intent
6447
+ intent_keywords = {
6448
+ 'interested': ['interested', 'demo', 'meeting', 'tell me more', 'sounds good'],
6449
+ 'not_interested': ['not interested', 'no thank', 'not right now', 'maybe later'],
6450
+ 'question': ['?', 'how', 'what', 'when', 'why', 'can you']
6451
+ }
6452
+
6453
+ body_lower = body.lower()
6454
+ intent = 'question' # default
6455
+ for key, keywords in intent_keywords.items():
6456
+ if any(keyword in body_lower for keyword in keywords):
6457
+ intent = key
6458
+ break
6459
+
6460
+ # Generate AI response
6461
+ system_prompt = """You are a helpful sales agent. Answer customer questions professionally
6462
+ and helpfully. Keep responses brief (under 100 words). Be friendly but professional."""
6463
+
6464
+ response = await get_ai_response(conversations[thread_id], system_prompt)
6465
+
6466
+ # Reply to customer
6467
+ await reply_to_email(inbox_id, message_id, from_email, response)
6468
+
6469
+ # Notify manager if strong intent signal
6470
+ if manager_email and intent in ['interested', 'not_interested']:
6471
+ status = "showing interest" if intent == 'interested' else "not interested at this time"
6472
+ await send_email(
6473
+ inbox_id,
6474
+ manager_email,
6475
+ f"Update: {from_email}",
6476
+ f"Customer {from_email} is {status}.\n\nTheir message:\n{body}\n\nMy response:\n{response}"
6477
+ )
6478
+ print(f"→ Notified manager about customer's {intent}")
6479
+
6480
+ # Update conversation history
6481
+ conversations[thread_id].append({"role": "assistant", "content": response})
6482
+
6483
+
6484
+ async def handle_new_email(message):
6485
+ """Process incoming email from WebSocket"""
6486
+ try:
6487
+ # Extract message data using object attributes
6488
+ inbox_id = message.inbox_id
6489
+ message_id = message.message_id
6490
+ thread_id = message.thread_id
6491
+ from_field = message.from_ or "" # SDK uses from_
6492
+ from_email = extract_email(from_field)
6493
+ subject = message.subject or ""
6494
+ body = message.text or "" # SDK uses text for the body
6495
+
6496
+ print(f"\n{'='*60}")
6497
+ print(f"New email from: {from_email}")
6498
+ print(f"Subject: {subject}")
6499
+ print(f"{'='*60}")
6500
+
6501
+ # Determine if from manager or customer
6502
+ if is_from_manager(body):
6503
+ await handle_manager_email(inbox_id, message_id, from_email, subject, body)
6504
+ else:
6505
+ await handle_customer_email(inbox_id, message_id, thread_id, from_email, subject, body)
6506
+
6507
+ except Exception as e:
6508
+ print(f"Error handling email: {e}")
6509
+
6510
+
6511
+ async def main():
6512
+ """Main WebSocket loop"""
6513
+ inbox_username = os.getenv("INBOX_USERNAME", "sales-agent")
6514
+ inbox_id = f"{inbox_username}@agentmail.to"
6515
+
6516
+ print(f"\nSales Agent starting...")
6517
+ print(f"Inbox: {inbox_id}")
6518
+ print(f"✓ Connecting to AgentMail WebSocket...")
6519
+
6520
+ # Connect to WebSocket
6521
+ try:
6522
+ async with agentmail.websockets.connect() as socket:
6523
+ print(f"✓ Connected! Listening for emails...\n")
6524
+
6525
+ # Subscribe to inbox
6526
+ await socket.send_subscribe(Subscribe(inbox_ids=[inbox_id]))
6527
+
6528
+ # Listen for events
6529
+ async for event in socket:
6530
+ if isinstance(event, Subscribed):
6531
+ print(f"✓ Subscribed to: {event.inbox_ids}\n")
6532
+
6533
+ elif isinstance(event, MessageReceivedEvent):
6534
+ print(f"📨 New email received!")
6535
+ await handle_new_email(event.message)
6536
+
6537
+ except (KeyboardInterrupt, asyncio.CancelledError):
6538
+ print("\n\nShutting down gracefully...")
6539
+ except Exception as e:
6540
+ print(f"\nError: {e}")
6541
+
6542
+
6543
+ def run():
6544
+ """Run the main function"""
6545
+ try:
6546
+ asyncio.run(main())
6547
+ except KeyboardInterrupt:
6548
+ print("\n✓ Shutdown complete")
6549
+
6550
+
6551
+ if __name__ == "__main__":
6552
+ run()
6553
+ ```
6554
+ </Accordion>
6555
+
6556
+ ### Step 3: Create Requirements File
6557
+
6558
+ Create a file named `requirements.txt`:
6559
+
6560
+ ```txt
6561
+ agentmail>=0.0.19
6562
+ openai>=1.0.0
6563
+ python-dotenv>=1.0.0
6564
+ ```
6565
+
6566
+ ### Step 4: Install Dependencies
6567
+
6568
+ Install the required Python packages:
6569
+
6570
+ ```bash
6571
+ pip install -r requirements.txt
6572
+ # or with pyproject.toml
6573
+ pip install .
6574
+ ```
6575
+
6576
+ ### Step 5: Configure Environment Variables
6577
+
6578
+ Create a `.env` file with your credentials:
6579
+
6580
+ ```env
6581
+ # AgentMail Configuration
6582
+ AGENTMAIL_API_KEY=your_agentmail_api_key_here
6583
+
6584
+ # OpenAI Configuration
6585
+ OPENAI_API_KEY=your_openai_api_key_here
6586
+
6587
+ # Inbox Settings
6588
+ INBOX_USERNAME=sales-agent
6589
+ ```
6590
+
6591
+ <Callout intent="info">
6592
+ **Note:** Unlike webhook-based agents, you don't need ngrok or a public URL. The WebSocket connection is outbound only, so it works behind firewalls without any port forwarding.
6593
+ </Callout>
6594
+
6595
+ ## Code Walkthrough
6596
+
6597
+ Let's understand how the agent works by breaking down the key components.
6598
+
6599
+ ### Architecture Overview
6600
+
6601
+ ```
6602
+ ┌─────────────────────────────────────────────────────────────┐
6603
+ │ Your Python Script │
6604
+ │ │
6605
+ │ ┌──────────────┐ ┌──────────────┐ ┌─────────────┐ │
6606
+ │ │ AsyncAgent │────▶│ WebSocket │────▶│ Event │ │
6607
+ │ │ Mail Client │ │ Connection │ │ Handler │ │
6608
+ │ └──────────────┘ └──────────────┘ └─────────────┘ │
6609
+ │ │ ▲ │ │
6610
+ │ │ │ ▼ │
6611
+ │ │ Real-time ┌─────────────┐ │
6612
+ │ │ Events │ OpenAI │ │
6613
+ │ │ │ Integration │ │
6614
+ │ ▼ └─────────────┘ │
6615
+ │ ┌──────────────┐ │
6616
+ │ │ Send/Reply │◀──────────────────────────────────────────│
6617
+ │ │ Emails │ │
6618
+ │ └──────────────┘ │
6619
+ └─────────────────────────────────────────────────────────────┘
6620
+
6621
+
6622
+ ┌──────────────────┐
6623
+ │ AgentMail │
6624
+ │ Cloud │
6625
+ └──────────────────┘
6626
+ ```
6627
+
6628
+ ### 1. WebSocket Connection Setup
6629
+
6630
+ The core of this agent is the WebSocket connection:
6631
+
6632
+ ```python
6633
+ from agentmail import AsyncAgentMail, Subscribe, Subscribed, MessageReceivedEvent
6634
+
6635
+ # Initialize the async client
6636
+ agentmail = AsyncAgentMail(api_key=os.getenv("AGENTMAIL_API_KEY"))
6637
+
6638
+ # Connect and subscribe
6639
+ async with agentmail.websockets.connect() as socket:
6640
+ await socket.send_subscribe(Subscribe(inbox_ids=[inbox_id]))
6641
+ ```
6642
+
6643
+ **Key points:**
6644
+
6645
+ * `AsyncAgentMail` is the async version of the client
6646
+ * `agentmail.websockets.connect()` creates the WebSocket connection
6647
+ * `Subscribe` specifies which inboxes to monitor
6648
+
6649
+ ### 2. Event Handling Loop
6650
+
6651
+ The agent uses an async iterator pattern to process events:
6652
+
6653
+ ```python
6654
+ async for event in socket:
6655
+ if isinstance(event, Subscribed):
6656
+ print(f"✓ Subscribed to: {event.inbox_ids}")
6657
+
6658
+ elif isinstance(event, MessageReceivedEvent):
6659
+ await handle_new_email(event.message)
6660
+ ```
6661
+
6662
+ **Event types:**
6663
+
6664
+ * `Subscribed` - Confirmation that subscription was successful
6665
+ * `MessageReceivedEvent` - A new email arrived in the inbox
6666
+
6667
+ ### 3. Email Processing Flow
6668
+
6669
+ The agent routes emails based on content:
6670
+
6671
+ ```python
6672
+ async def handle_new_email(message):
6673
+ # Extract fields from the message object
6674
+ inbox_id = message.inbox_id
6675
+ message_id = message.message_id
6676
+ thread_id = message.thread_id
6677
+ from_field = message.from_ or "" # Note: SDK uses from_
6678
+ from_email = extract_email(from_field)
6679
+ subject = message.subject or ""
6680
+ body = message.text or ""
6681
+
6682
+ # Route based on email content
6683
+ if is_from_manager(body):
6684
+ await handle_manager_email(inbox_id, message_id, from_email, subject, body)
6685
+ else:
6686
+ await handle_customer_email(inbox_id, message_id, thread_id, from_email, subject, body)
6687
+ ```
6688
+
6689
+ **Email extraction helper:**
6690
+
6691
+ ```python
6692
+ def extract_email(from_field):
6693
+ """Extract email from 'Name <email@example.com>' format"""
6694
+ match = re.search(r'<(.+?)>', from_field)
6695
+ return match.group(1) if match else from_field
6696
+ ```
6697
+
6698
+ ### 4. Manager Email Handler
6699
+
6700
+ When the manager sends an email with customer info:
6701
+
6702
+ ```python
6703
+ async def handle_manager_email(inbox_id, message_id, from_email, subject, body):
6704
+ global manager_email
6705
+ manager_email = from_email # Remember for notifications
6706
+
6707
+ # Extract customer email using regex
6708
+ customer_email = extract_customer_info(body)
6709
+
6710
+ if not customer_email:
6711
+ await reply_to_email(inbox_id, message_id, from_email,
6712
+ "I couldn't find a customer email. Please include it.")
6713
+ return
6714
+
6715
+ # Generate AI sales pitch
6716
+ sales_pitch = await get_ai_response(
6717
+ [{"role": "user", "content": f"Create a sales email based on: {body}"}],
6718
+ "You are a helpful sales agent. Generate a brief, professional email..."
6719
+ )
6720
+
6721
+ # Send to customer
6722
+ await send_email(inbox_id, customer_email, f"Introduction: {subject}", sales_pitch)
6723
+
6724
+ # Confirm to manager
6725
+ await reply_to_email(inbox_id, message_id, from_email,
6726
+ f"✓ Sent email to {customer_email}.\n\nContent:\n{sales_pitch}")
6727
+ ```
6728
+
6729
+ ### 5. Customer Email Handler with Intent Detection
6730
+
6731
+ The agent tracks conversations and detects customer intent:
6732
+
6733
+ ```python
6734
+ async def handle_customer_email(inbox_id, message_id, thread_id, from_email, subject, body):
6735
+ # Track conversation history per thread
6736
+ if thread_id not in conversations:
6737
+ conversations[thread_id] = []
6738
+ conversations[thread_id].append({"role": "user", "content": body})
6739
+
6740
+ # Detect intent with keyword matching
6741
+ intent_keywords = {
6742
+ 'interested': ['interested', 'demo', 'meeting', 'tell me more'],
6743
+ 'not_interested': ['not interested', 'no thank', 'maybe later'],
6744
+ 'question': ['?', 'how', 'what', 'when', 'why']
6745
+ }
6746
+
6747
+ intent = 'question' # default
6748
+ for key, keywords in intent_keywords.items():
6749
+ if any(kw in body.lower() for kw in keywords):
6750
+ intent = key
6751
+ break
6752
+
6753
+ # Generate contextual AI response using conversation history
6754
+ response = await get_ai_response(conversations[thread_id], system_prompt)
6755
+
6756
+ # Reply to customer
6757
+ await reply_to_email(inbox_id, message_id, from_email, response)
6758
+
6759
+ # Notify manager of strong signals
6760
+ if manager_email and intent in ['interested', 'not_interested']:
6761
+ await send_email(inbox_id, manager_email, f"Update: {from_email}",
6762
+ f"Customer is {intent}.\n\nTheir message:\n{body}")
6763
+ ```
6764
+
6765
+ ### 6. AI Response Generation
6766
+
6767
+ The agent uses OpenAI for generating responses:
6768
+
6769
+ ```python
6770
+ async def get_ai_response(messages, system_prompt):
6771
+ try:
6772
+ response = await openai.chat.completions.create(
6773
+ model="gpt-4o-mini",
6774
+ messages=[
6775
+ {"role": "system", "content": system_prompt},
6776
+ *messages # Include conversation history
6777
+ ],
6778
+ temperature=0.7,
6779
+ )
6780
+ return response.choices[0].message.content
6781
+ except Exception as e:
6782
+ print(f"Error: {e}")
6783
+ return "I apologize, but I encountered an error."
6784
+ ```
6785
+
6786
+ **Key points:**
6787
+
6788
+ * Includes full conversation history for context
6789
+ * Graceful error handling with fallback message
6790
+
6791
+ ## Running the Agent
6792
+
6793
+ Start the agent:
6794
+
6795
+ ```bash
6796
+ python main.py
6797
+ ```
6798
+
6799
+ You should see output like this:
6800
+
6801
+ ```
6802
+ Sales Agent starting...
6803
+ Inbox: sales-agent@agentmail.to
6804
+ ✓ Connecting to AgentMail WebSocket...
6805
+ ✓ Connected! Listening for emails...
6806
+
6807
+ ✓ Subscribed to: ['sales-agent@agentmail.to']
6808
+ ```
6809
+
6810
+ <Callout intent="success">
6811
+ **Success!** Your agent is now running and listening for emails in real-time.
6812
+
6813
+ Leave this terminal window open - closing it will stop the agent.
6814
+ </Callout>
6815
+
6816
+ ## Testing Your Agent
6817
+
6818
+ Let's verify everything works with some test scenarios.
6819
+
6820
+ ### Test Scenario: Manager Outreach Request
6821
+
6822
+ **Send this email from your personal email:**
6823
+
6824
+ ```
6825
+ To: sales-agent@agentmail.to
6826
+ Subject: New lead - AI startup
6827
+ Body: Please reach out to this customer: customer-email@gmail.com
6828
+ They're interested in our API platform.
6829
+ ```
6830
+
6831
+ **Expected console output:**
6832
+
6833
+ ```
6834
+ ============================================================
6835
+ New email from: your-email@gmail.com
6836
+ Subject: New lead - AI startup
6837
+ ============================================================
6838
+
6839
+ 📧 Email from MANAGER: your-email@gmail.com
6840
+ → Extracted customer email: customer-email@gmail.com
6841
+ ✓ Sent email to customer-email@gmail.com
6842
+ ✓ Sent reply to your-email@gmail.com
6843
+ ```
5549
6844
 
5550
- * `urgent` + `negative` Critical customer issues
5551
- * `sales` + `high` → Hot leads requiring fast response
5552
- * `technical` + `bug-report` → Engineering backlog
6845
+ **You'll receive:** A confirmation email with the sales pitch that was sent.
5553
6846
 
5554
6847
  <Callout intent="success">
5555
- **Pro tip:** You can use AgentMail's API to programmatically fetch emails by labels and build custom workflows, dashboards, and analytics.
6848
+ **It works!** The agent processed emails in real-time, generated AI responses, and notified you about the interested customer.
5556
6849
  </Callout>
5557
6850
 
5558
- ## Building on Labels
6851
+ ## Customization
5559
6852
 
5560
- Once your emails are automatically labeled, you can build powerful automation on top:
6853
+ ### Modifying Intent Detection
5561
6854
 
5562
- ### Example 1: Priority Notifications
6855
+ Update the `intent_keywords` dictionary in `handle_customer_email()`:
5563
6856
 
5564
- **Scenario**: Alert your team instantly when urgent issues arrive.
6857
+ ```python
6858
+ intent_keywords = {
6859
+ 'interested': ['interested', 'demo', 'meeting', 'pricing', 'sign up'],
6860
+ 'not_interested': ['not interested', 'unsubscribe', 'remove me'],
6861
+ 'question': ['?', 'how', 'what', 'when', 'can you'],
6862
+ 'urgent': ['urgent', 'asap', 'immediately'] # Add new intent
6863
+ }
6864
+ ```
5565
6865
 
5566
- When an email is labeled `urgent` + `negative`, automatically send a Slack notification to your support channel. Include the sender's email and subject line so your team can respond immediately. This ensures critical customer issues never slip through the cracks.
6866
+ ### Adding More Inbox Subscriptions
5567
6867
 
5568
- ### Example 2: Sentiment Escalation
6868
+ Subscribe to multiple inboxes:
5569
6869
 
5570
- **Scenario**: Escalate negative sentiment to management.
6870
+ ```python
6871
+ await socket.send_subscribe(Subscribe(inbox_ids=[
6872
+ "sales-agent@agentmail.to",
6873
+ "support-agent@agentmail.to",
6874
+ "info@yourdomain.com"
6875
+ ]))
6876
+ ```
5571
6877
 
5572
- Track all emails labeled `negative` and automatically notify customer success managers when sentiment trends downward. If a single customer sends 3+ negative emails in a week, trigger a personal outreach from leadership to address their concerns proactively.
6878
+ ## Troubleshooting
5573
6879
 
5574
- ### Example 3: Department Routing
6880
+ ### Common Issues
5575
6881
 
5576
- **Scenario**: Auto-forward emails to the right team.
6882
+ <Accordion title="WebSocket connection refused or timeout">
6883
+ **Problem:** Cannot connect to AgentMail WebSocket.
5577
6884
 
5578
- Create rules that automatically forward emails based on department labels:
6885
+ **Solutions:**
5579
6886
 
5580
- * `sales` Forward to [sales@yourcompany.com](mailto:sales@yourcompany.com)
5581
- * `billing` → Create a ticket in your billing system
5582
- * `technical` → Post to #engineering Slack channel
5583
- * `support` → Add to support queue with appropriate SLA
6887
+ 1. Verify your API key is correct:
5584
6888
 
5585
- ### Example 4: Smart Auto-Reply
6889
+ ```python
6890
+ client = AsyncAgentMail(api_key="your-key")
6891
+ print(await client.inboxes.list()) # Should succeed
6892
+ ```
5586
6893
 
5587
- **Scenario**: Send contextual automated responses.
6894
+ 2. Check your internet connection and firewall settings
6895
+ 3. Ensure you're using `agentmail>=0.0.19` which includes WebSocket support:
5588
6896
 
5589
- Instead of generic auto-replies, craft responses based on classification:
6897
+ ```bash
6898
+ pip show agentmail
6899
+ ```
6900
+ </Accordion>
5590
6901
 
5591
- * `question` → "Thanks for your question! We'll respond within 24 hours."
5592
- * `bug-report` "Thanks for reporting this. Our engineering team has been notified."
5593
- * `complaint` → "We're sorry to hear that. A senior support agent will contact you within 4 hours."
5594
- * `feature-request` → "Great idea! We've added this to our product roadmap."
6902
+ <Accordion title="Emails not being received">
6903
+ **Problem:** Agent is running but not receiving emails.
5595
6904
 
5596
- ### Example 5: Analytics Dashboard
6905
+ **Checklist:**
5597
6906
 
5598
- **Scenario**: Track email metrics and trends.
6907
+ 1. Verify the inbox exists:
5599
6908
 
5600
- Build a dashboard that queries emails by labels to analyze:
6909
+ ```python
6910
+ client = AsyncAgentMail()
6911
+ print(await client.inboxes.get("sales-agent@agentmail.to"))
6912
+ ```
5601
6913
 
5602
- * **Sentiment trends**: Are customers getting happier or more frustrated?
5603
- * **Volume by department**: Which team is handling the most emails?
5604
- * **Response times by priority**: Are you meeting SLAs for urgent issues?
5605
- * **Common categories**: What are customers asking about most?
6914
+ 2. Check subscription confirmation in console output
6915
+ 3. Send test email to the correct inbox address
6916
+ 4. Verify the email isn't being filtered as spam
6917
+ </Accordion>
5606
6918
 
5607
- Use this data to identify bottlenecks, improve processes, and make data-driven decisions about staffing and product priorities.
6919
+ <Accordion title="Agent crashes with asyncio errors">
6920
+ **Problem:** Async-related exceptions.
6921
+
6922
+ **Solutions:**
6923
+
6924
+ 1. Ensure Python 3.11+ is installed:
6925
+
6926
+ ```bash
6927
+ python --version
6928
+ ```
6929
+
6930
+ 2. Don't mix sync and async code improperly
6931
+ 3. Use `asyncio.run(main())` as the entry point
6932
+ </Accordion>
5608
6933
 
5609
6934
  ***
5610
6935
 
5611
- Congratulations! You've built an AI-powered email classification system. This agent showcases how AgentMail's labeling feature can power sophisticated inbox automation and analytics.
6936
+ If you build something cool with AgentMail, we'd love to hear about it. Share in our [Discord community](https://discord.gg/hTYatWYWBc)!
5612
6937
 
5613
6938
 
5614
6939
  # Live AgentMail Examples
@@ -6662,6 +7987,7 @@ package main
6662
7987
 
6663
7988
  import (
6664
7989
  "fmt"
7990
+ "strings"
6665
7991
  "net/http"
6666
7992
  "io"
6667
7993
  )
@@ -6670,9 +7996,12 @@ func main() {
6670
7996
 
6671
7997
  url := "https://api.agentmail.to/v0/inboxes"
6672
7998
 
6673
- req, _ := http.NewRequest("GET", url, nil)
7999
+ payload := strings.NewReader("{}")
8000
+
8001
+ req, _ := http.NewRequest("GET", url, payload)
6674
8002
 
6675
8003
  req.Header.Add("Authorization", "Bearer <api_key>")
8004
+ req.Header.Add("Content-Type", "application/json")
6676
8005
 
6677
8006
  res, _ := http.DefaultClient.Do(req)
6678
8007
 
@@ -6696,6 +8025,8 @@ http.use_ssl = true
6696
8025
 
6697
8026
  request = Net::HTTP::Get.new(url)
6698
8027
  request["Authorization"] = 'Bearer <api_key>'
8028
+ request["Content-Type"] = 'application/json'
8029
+ request.body = "{}"
6699
8030
 
6700
8031
  response = http.request(request)
6701
8032
  puts response.read_body
@@ -6704,6 +8035,8 @@ puts response.read_body
6704
8035
  ```java
6705
8036
  HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/inboxes")
6706
8037
  .header("Authorization", "Bearer <api_key>")
8038
+ .header("Content-Type", "application/json")
8039
+ .body("{}")
6707
8040
  .asString();
6708
8041
  ```
6709
8042
 
@@ -6713,8 +8046,10 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/inboxes
6713
8046
  $client = new \GuzzleHttp\Client();
6714
8047
 
6715
8048
  $response = $client->request('GET', 'https://api.agentmail.to/v0/inboxes', [
8049
+ 'body' => '{}',
6716
8050
  'headers' => [
6717
8051
  'Authorization' => 'Bearer <api_key>',
8052
+ 'Content-Type' => 'application/json',
6718
8053
  ],
6719
8054
  ]);
6720
8055
 
@@ -6725,19 +8060,28 @@ echo $response->getBody();
6725
8060
  var client = new RestClient("https://api.agentmail.to/v0/inboxes");
6726
8061
  var request = new RestRequest(Method.GET);
6727
8062
  request.AddHeader("Authorization", "Bearer <api_key>");
8063
+ request.AddHeader("Content-Type", "application/json");
8064
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
6728
8065
  IRestResponse response = client.Execute(request);
6729
8066
  ```
6730
8067
 
6731
8068
  ```swift
6732
8069
  import Foundation
6733
8070
 
6734
- let headers = ["Authorization": "Bearer <api_key>"]
8071
+ let headers = [
8072
+ "Authorization": "Bearer <api_key>",
8073
+ "Content-Type": "application/json"
8074
+ ]
8075
+ let parameters = [] as [String : Any]
8076
+
8077
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
6735
8078
 
6736
8079
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/inboxes")! as URL,
6737
8080
  cachePolicy: .useProtocolCachePolicy,
6738
8081
  timeoutInterval: 10.0)
6739
8082
  request.httpMethod = "GET"
6740
8083
  request.allHTTPHeaderFields = headers
8084
+ request.httpBody = postData as Data
6741
8085
 
6742
8086
  let session = URLSession.shared
6743
8087
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
@@ -6868,6 +8212,7 @@ package main
6868
8212
 
6869
8213
  import (
6870
8214
  "fmt"
8215
+ "strings"
6871
8216
  "net/http"
6872
8217
  "io"
6873
8218
  )
@@ -6876,9 +8221,12 @@ func main() {
6876
8221
 
6877
8222
  url := "https://api.agentmail.to/v0/inboxes/inbox_id"
6878
8223
 
6879
- req, _ := http.NewRequest("GET", url, nil)
8224
+ payload := strings.NewReader("{}")
8225
+
8226
+ req, _ := http.NewRequest("GET", url, payload)
6880
8227
 
6881
8228
  req.Header.Add("Authorization", "Bearer <api_key>")
8229
+ req.Header.Add("Content-Type", "application/json")
6882
8230
 
6883
8231
  res, _ := http.DefaultClient.Do(req)
6884
8232
 
@@ -6902,6 +8250,8 @@ http.use_ssl = true
6902
8250
 
6903
8251
  request = Net::HTTP::Get.new(url)
6904
8252
  request["Authorization"] = 'Bearer <api_key>'
8253
+ request["Content-Type"] = 'application/json'
8254
+ request.body = "{}"
6905
8255
 
6906
8256
  response = http.request(request)
6907
8257
  puts response.read_body
@@ -6910,6 +8260,8 @@ puts response.read_body
6910
8260
  ```java
6911
8261
  HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/inboxes/inbox_id")
6912
8262
  .header("Authorization", "Bearer <api_key>")
8263
+ .header("Content-Type", "application/json")
8264
+ .body("{}")
6913
8265
  .asString();
6914
8266
  ```
6915
8267
 
@@ -6919,8 +8271,10 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/inboxes
6919
8271
  $client = new \GuzzleHttp\Client();
6920
8272
 
6921
8273
  $response = $client->request('GET', 'https://api.agentmail.to/v0/inboxes/inbox_id', [
8274
+ 'body' => '{}',
6922
8275
  'headers' => [
6923
8276
  'Authorization' => 'Bearer <api_key>',
8277
+ 'Content-Type' => 'application/json',
6924
8278
  ],
6925
8279
  ]);
6926
8280
 
@@ -6931,19 +8285,28 @@ echo $response->getBody();
6931
8285
  var client = new RestClient("https://api.agentmail.to/v0/inboxes/inbox_id");
6932
8286
  var request = new RestRequest(Method.GET);
6933
8287
  request.AddHeader("Authorization", "Bearer <api_key>");
8288
+ request.AddHeader("Content-Type", "application/json");
8289
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
6934
8290
  IRestResponse response = client.Execute(request);
6935
8291
  ```
6936
8292
 
6937
8293
  ```swift
6938
8294
  import Foundation
6939
8295
 
6940
- let headers = ["Authorization": "Bearer <api_key>"]
8296
+ let headers = [
8297
+ "Authorization": "Bearer <api_key>",
8298
+ "Content-Type": "application/json"
8299
+ ]
8300
+ let parameters = [] as [String : Any]
8301
+
8302
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
6941
8303
 
6942
8304
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/inboxes/inbox_id")! as URL,
6943
8305
  cachePolicy: .useProtocolCachePolicy,
6944
8306
  timeoutInterval: 10.0)
6945
8307
  request.httpMethod = "GET"
6946
8308
  request.allHTTPHeaderFields = headers
8309
+ request.httpBody = postData as Data
6947
8310
 
6948
8311
  let session = URLSession.shared
6949
8312
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
@@ -7065,7 +8428,10 @@ async function main() {
7065
8428
  environment: "https://api.agentmail.to",
7066
8429
  apiKey: "YOUR_TOKEN_HERE",
7067
8430
  });
7068
- await client.inboxes.create();
8431
+ await client.inboxes.create({
8432
+ displayName: "Support Team Inbox",
8433
+ clientId: "client-abcde",
8434
+ });
7069
8435
  }
7070
8436
  main();
7071
8437
 
@@ -7079,7 +8445,10 @@ client = AgentMail(
7079
8445
  api_key="YOUR_TOKEN_HERE"
7080
8446
  )
7081
8447
 
7082
- client.inboxes.create()
8448
+ client.inboxes.create(
8449
+ display_name="Support Team Inbox",
8450
+ client_id="client-abcde"
8451
+ )
7083
8452
 
7084
8453
  ```
7085
8454
 
@@ -7088,6 +8457,7 @@ package main
7088
8457
 
7089
8458
  import (
7090
8459
  "fmt"
8460
+ "strings"
7091
8461
  "net/http"
7092
8462
  "io"
7093
8463
  )
@@ -7096,7 +8466,9 @@ func main() {
7096
8466
 
7097
8467
  url := "https://api.agentmail.to/v0/inboxes"
7098
8468
 
7099
- req, _ := http.NewRequest("POST", url, nil)
8469
+ payload := strings.NewReader("{\n \"display_name\": \"Support Team Inbox\",\n \"client_id\": \"client-abcde\",\n \"pod_id\": \"pod-12345\",\n \"inbox_id\": \"inbox-67890\"\n}")
8470
+
8471
+ req, _ := http.NewRequest("POST", url, payload)
7100
8472
 
7101
8473
  req.Header.Add("Authorization", "Bearer <api_key>")
7102
8474
  req.Header.Add("Content-Type", "application/json")
@@ -7124,6 +8496,7 @@ http.use_ssl = true
7124
8496
  request = Net::HTTP::Post.new(url)
7125
8497
  request["Authorization"] = 'Bearer <api_key>'
7126
8498
  request["Content-Type"] = 'application/json'
8499
+ request.body = "{\n \"display_name\": \"Support Team Inbox\",\n \"client_id\": \"client-abcde\",\n \"pod_id\": \"pod-12345\",\n \"inbox_id\": \"inbox-67890\"\n}"
7127
8500
 
7128
8501
  response = http.request(request)
7129
8502
  puts response.read_body
@@ -7133,6 +8506,7 @@ puts response.read_body
7133
8506
  HttpResponse<String> response = Unirest.post("https://api.agentmail.to/v0/inboxes")
7134
8507
  .header("Authorization", "Bearer <api_key>")
7135
8508
  .header("Content-Type", "application/json")
8509
+ .body("{\n \"display_name\": \"Support Team Inbox\",\n \"client_id\": \"client-abcde\",\n \"pod_id\": \"pod-12345\",\n \"inbox_id\": \"inbox-67890\"\n}")
7136
8510
  .asString();
7137
8511
  ```
7138
8512
 
@@ -7142,6 +8516,12 @@ HttpResponse<String> response = Unirest.post("https://api.agentmail.to/v0/inboxe
7142
8516
  $client = new \GuzzleHttp\Client();
7143
8517
 
7144
8518
  $response = $client->request('POST', 'https://api.agentmail.to/v0/inboxes', [
8519
+ 'body' => '{
8520
+ "display_name": "Support Team Inbox",
8521
+ "client_id": "client-abcde",
8522
+ "pod_id": "pod-12345",
8523
+ "inbox_id": "inbox-67890"
8524
+ }',
7145
8525
  'headers' => [
7146
8526
  'Authorization' => 'Bearer <api_key>',
7147
8527
  'Content-Type' => 'application/json',
@@ -7156,6 +8536,7 @@ var client = new RestClient("https://api.agentmail.to/v0/inboxes");
7156
8536
  var request = new RestRequest(Method.POST);
7157
8537
  request.AddHeader("Authorization", "Bearer <api_key>");
7158
8538
  request.AddHeader("Content-Type", "application/json");
8539
+ request.AddParameter("application/json", "{\n \"display_name\": \"Support Team Inbox\",\n \"client_id\": \"client-abcde\",\n \"pod_id\": \"pod-12345\",\n \"inbox_id\": \"inbox-67890\"\n}", ParameterType.RequestBody);
7159
8540
  IRestResponse response = client.Execute(request);
7160
8541
  ```
7161
8542
 
@@ -7166,12 +8547,21 @@ let headers = [
7166
8547
  "Authorization": "Bearer <api_key>",
7167
8548
  "Content-Type": "application/json"
7168
8549
  ]
8550
+ let parameters = [
8551
+ "display_name": "Support Team Inbox",
8552
+ "client_id": "client-abcde",
8553
+ "pod_id": "pod-12345",
8554
+ "inbox_id": "inbox-67890"
8555
+ ] as [String : Any]
8556
+
8557
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
7169
8558
 
7170
8559
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/inboxes")! as URL,
7171
8560
  cachePolicy: .useProtocolCachePolicy,
7172
8561
  timeoutInterval: 10.0)
7173
8562
  request.httpMethod = "POST"
7174
8563
  request.allHTTPHeaderFields = headers
8564
+ request.httpBody = postData as Data
7175
8565
 
7176
8566
  let session = URLSession.shared
7177
8567
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
@@ -7736,12 +9126,17 @@ components:
7736
9126
  type: string
7737
9127
  type_attachments:AttachmentFilename:
7738
9128
  type: string
7739
- type_attachments:AttachmentContentType:
7740
- type: string
7741
9129
  type_attachments:AttachmentSize:
7742
9130
  type: integer
7743
- type_attachments:AttachmentInline:
7744
- type: boolean
9131
+ type_attachments:AttachmentContentType:
9132
+ type: string
9133
+ type_attachments:AttachmentContentDisposition:
9134
+ type: string
9135
+ enum:
9136
+ - value: inline
9137
+ - value: attachment
9138
+ type_attachments:AttachmentContentId:
9139
+ type: string
7745
9140
  type_attachments:Attachment:
7746
9141
  type: object
7747
9142
  properties:
@@ -7749,16 +9144,17 @@ components:
7749
9144
  $ref: '#/components/schemas/type_attachments:AttachmentId'
7750
9145
  filename:
7751
9146
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
7752
- content_type:
7753
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
7754
9147
  size:
7755
9148
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
7756
- inline:
7757
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
9149
+ content_type:
9150
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
9151
+ content_disposition:
9152
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
9153
+ content_id:
9154
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
7758
9155
  required:
7759
9156
  - attachment_id
7760
9157
  - size
7761
- - inline
7762
9158
  type_threads:ThreadAttachments:
7763
9159
  type: array
7764
9160
  items:
@@ -7879,6 +9275,7 @@ package main
7879
9275
 
7880
9276
  import (
7881
9277
  "fmt"
9278
+ "strings"
7882
9279
  "net/http"
7883
9280
  "io"
7884
9281
  )
@@ -7887,9 +9284,12 @@ func main() {
7887
9284
 
7888
9285
  url := "https://api.agentmail.to/v0/inboxes/inbox_id/threads"
7889
9286
 
7890
- req, _ := http.NewRequest("GET", url, nil)
9287
+ payload := strings.NewReader("{}")
9288
+
9289
+ req, _ := http.NewRequest("GET", url, payload)
7891
9290
 
7892
9291
  req.Header.Add("Authorization", "Bearer <api_key>")
9292
+ req.Header.Add("Content-Type", "application/json")
7893
9293
 
7894
9294
  res, _ := http.DefaultClient.Do(req)
7895
9295
 
@@ -7913,6 +9313,8 @@ http.use_ssl = true
7913
9313
 
7914
9314
  request = Net::HTTP::Get.new(url)
7915
9315
  request["Authorization"] = 'Bearer <api_key>'
9316
+ request["Content-Type"] = 'application/json'
9317
+ request.body = "{}"
7916
9318
 
7917
9319
  response = http.request(request)
7918
9320
  puts response.read_body
@@ -7921,6 +9323,8 @@ puts response.read_body
7921
9323
  ```java
7922
9324
  HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/inboxes/inbox_id/threads")
7923
9325
  .header("Authorization", "Bearer <api_key>")
9326
+ .header("Content-Type", "application/json")
9327
+ .body("{}")
7924
9328
  .asString();
7925
9329
  ```
7926
9330
 
@@ -7930,8 +9334,10 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/inboxes
7930
9334
  $client = new \GuzzleHttp\Client();
7931
9335
 
7932
9336
  $response = $client->request('GET', 'https://api.agentmail.to/v0/inboxes/inbox_id/threads', [
9337
+ 'body' => '{}',
7933
9338
  'headers' => [
7934
9339
  'Authorization' => 'Bearer <api_key>',
9340
+ 'Content-Type' => 'application/json',
7935
9341
  ],
7936
9342
  ]);
7937
9343
 
@@ -7942,19 +9348,28 @@ echo $response->getBody();
7942
9348
  var client = new RestClient("https://api.agentmail.to/v0/inboxes/inbox_id/threads");
7943
9349
  var request = new RestRequest(Method.GET);
7944
9350
  request.AddHeader("Authorization", "Bearer <api_key>");
9351
+ request.AddHeader("Content-Type", "application/json");
9352
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
7945
9353
  IRestResponse response = client.Execute(request);
7946
9354
  ```
7947
9355
 
7948
9356
  ```swift
7949
9357
  import Foundation
7950
9358
 
7951
- let headers = ["Authorization": "Bearer <api_key>"]
9359
+ let headers = [
9360
+ "Authorization": "Bearer <api_key>",
9361
+ "Content-Type": "application/json"
9362
+ ]
9363
+ let parameters = [] as [String : Any]
9364
+
9365
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
7952
9366
 
7953
9367
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/inboxes/inbox_id/threads")! as URL,
7954
9368
  cachePolicy: .useProtocolCachePolicy,
7955
9369
  timeoutInterval: 10.0)
7956
9370
  request.httpMethod = "GET"
7957
9371
  request.allHTTPHeaderFields = headers
9372
+ request.httpBody = postData as Data
7958
9373
 
7959
9374
  let session = URLSession.shared
7960
9375
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
@@ -8054,12 +9469,17 @@ components:
8054
9469
  type: string
8055
9470
  type_attachments:AttachmentFilename:
8056
9471
  type: string
8057
- type_attachments:AttachmentContentType:
8058
- type: string
8059
9472
  type_attachments:AttachmentSize:
8060
9473
  type: integer
8061
- type_attachments:AttachmentInline:
8062
- type: boolean
9474
+ type_attachments:AttachmentContentType:
9475
+ type: string
9476
+ type_attachments:AttachmentContentDisposition:
9477
+ type: string
9478
+ enum:
9479
+ - value: inline
9480
+ - value: attachment
9481
+ type_attachments:AttachmentContentId:
9482
+ type: string
8063
9483
  type_attachments:Attachment:
8064
9484
  type: object
8065
9485
  properties:
@@ -8067,16 +9487,17 @@ components:
8067
9487
  $ref: '#/components/schemas/type_attachments:AttachmentId'
8068
9488
  filename:
8069
9489
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
8070
- content_type:
8071
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
8072
9490
  size:
8073
9491
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
8074
- inline:
8075
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
9492
+ content_type:
9493
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
9494
+ content_disposition:
9495
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
9496
+ content_id:
9497
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
8076
9498
  required:
8077
9499
  - attachment_id
8078
9500
  - size
8079
- - inline
8080
9501
  type_threads:ThreadAttachments:
8081
9502
  type: array
8082
9503
  items:
@@ -8446,10 +9867,9 @@ paths:
8446
9867
  '200':
8447
9868
  description: Response with status 200
8448
9869
  content:
8449
- application/octet-stream:
9870
+ application/json:
8450
9871
  schema:
8451
- type: string
8452
- format: binary
9872
+ $ref: '#/components/schemas/type_attachments:AttachmentResponse'
8453
9873
  '404':
8454
9874
  description: Error response with status 404
8455
9875
  content: {}
@@ -8461,6 +9881,46 @@ components:
8461
9881
  type: string
8462
9882
  type_attachments:AttachmentId:
8463
9883
  type: string
9884
+ type_attachments:AttachmentFilename:
9885
+ type: string
9886
+ type_attachments:AttachmentSize:
9887
+ type: integer
9888
+ type_attachments:AttachmentContentType:
9889
+ type: string
9890
+ type_attachments:AttachmentContentDisposition:
9891
+ type: string
9892
+ enum:
9893
+ - value: inline
9894
+ - value: attachment
9895
+ type_attachments:AttachmentContentId:
9896
+ type: string
9897
+ type_attachments:AttachmentResponse:
9898
+ type: object
9899
+ properties:
9900
+ attachment_id:
9901
+ $ref: '#/components/schemas/type_attachments:AttachmentId'
9902
+ filename:
9903
+ $ref: '#/components/schemas/type_attachments:AttachmentFilename'
9904
+ size:
9905
+ $ref: '#/components/schemas/type_attachments:AttachmentSize'
9906
+ content_type:
9907
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
9908
+ content_disposition:
9909
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
9910
+ content_id:
9911
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
9912
+ download_url:
9913
+ type: string
9914
+ description: URL to download the attachment.
9915
+ expires_at:
9916
+ type: string
9917
+ format: date-time
9918
+ description: Time at which the download URL expires.
9919
+ required:
9920
+ - attachment_id
9921
+ - size
9922
+ - download_url
9923
+ - expires_at
8464
9924
 
8465
9925
  ```
8466
9926
 
@@ -8474,7 +9934,7 @@ async function main() {
8474
9934
  environment: "https://api.agentmail.to",
8475
9935
  apiKey: "YOUR_TOKEN_HERE",
8476
9936
  });
8477
- await client.inboxes.threads.getAttachment(":inbox_id", ":thread_id", ":attachment_id");
9937
+ await client.inboxes.threads.getAttachment("inbox_id", "thread_id", "attachment_id");
8478
9938
  }
8479
9939
  main();
8480
9940
 
@@ -8489,9 +9949,9 @@ client = AgentMail(
8489
9949
  )
8490
9950
 
8491
9951
  client.inboxes.threads.get_attachment(
8492
- inbox_id=":inbox_id",
8493
- thread_id=":thread_id",
8494
- attachment_id=":attachment_id"
9952
+ inbox_id="inbox_id",
9953
+ thread_id="thread_id",
9954
+ attachment_id="attachment_id"
8495
9955
  )
8496
9956
 
8497
9957
  ```
@@ -8507,7 +9967,7 @@ import (
8507
9967
 
8508
9968
  func main() {
8509
9969
 
8510
- url := "https://api.agentmail.to/v0/inboxes/%3Ainbox_id/threads/%3Athread_id/attachments/%3Aattachment_id"
9970
+ url := "https://api.agentmail.to/v0/inboxes/inbox_id/threads/thread_id/attachments/attachment_id"
8511
9971
 
8512
9972
  req, _ := http.NewRequest("GET", url, nil)
8513
9973
 
@@ -8528,7 +9988,7 @@ func main() {
8528
9988
  require 'uri'
8529
9989
  require 'net/http'
8530
9990
 
8531
- url = URI("https://api.agentmail.to/v0/inboxes/%3Ainbox_id/threads/%3Athread_id/attachments/%3Aattachment_id")
9991
+ url = URI("https://api.agentmail.to/v0/inboxes/inbox_id/threads/thread_id/attachments/attachment_id")
8532
9992
 
8533
9993
  http = Net::HTTP.new(url.host, url.port)
8534
9994
  http.use_ssl = true
@@ -8541,7 +10001,7 @@ puts response.read_body
8541
10001
  ```
8542
10002
 
8543
10003
  ```java
8544
- HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/inboxes/%3Ainbox_id/threads/%3Athread_id/attachments/%3Aattachment_id")
10004
+ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/inboxes/inbox_id/threads/thread_id/attachments/attachment_id")
8545
10005
  .header("Authorization", "Bearer <api_key>")
8546
10006
  .asString();
8547
10007
  ```
@@ -8551,7 +10011,7 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/inboxes
8551
10011
 
8552
10012
  $client = new \GuzzleHttp\Client();
8553
10013
 
8554
- $response = $client->request('GET', 'https://api.agentmail.to/v0/inboxes/%3Ainbox_id/threads/%3Athread_id/attachments/%3Aattachment_id', [
10014
+ $response = $client->request('GET', 'https://api.agentmail.to/v0/inboxes/inbox_id/threads/thread_id/attachments/attachment_id', [
8555
10015
  'headers' => [
8556
10016
  'Authorization' => 'Bearer <api_key>',
8557
10017
  ],
@@ -8561,7 +10021,7 @@ echo $response->getBody();
8561
10021
  ```
8562
10022
 
8563
10023
  ```csharp
8564
- var client = new RestClient("https://api.agentmail.to/v0/inboxes/%3Ainbox_id/threads/%3Athread_id/attachments/%3Aattachment_id");
10024
+ var client = new RestClient("https://api.agentmail.to/v0/inboxes/inbox_id/threads/thread_id/attachments/attachment_id");
8565
10025
  var request = new RestRequest(Method.GET);
8566
10026
  request.AddHeader("Authorization", "Bearer <api_key>");
8567
10027
  IRestResponse response = client.Execute(request);
@@ -8572,7 +10032,7 @@ import Foundation
8572
10032
 
8573
10033
  let headers = ["Authorization": "Bearer <api_key>"]
8574
10034
 
8575
- let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/inboxes/%3Ainbox_id/threads/%3Athread_id/attachments/%3Aattachment_id")! as URL,
10035
+ let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/inboxes/inbox_id/threads/thread_id/attachments/attachment_id")! as URL,
8576
10036
  cachePolicy: .useProtocolCachePolicy,
8577
10037
  timeoutInterval: 10.0)
8578
10038
  request.httpMethod = "GET"
@@ -8909,12 +10369,17 @@ components:
8909
10369
  type: string
8910
10370
  type_attachments:AttachmentFilename:
8911
10371
  type: string
8912
- type_attachments:AttachmentContentType:
8913
- type: string
8914
10372
  type_attachments:AttachmentSize:
8915
10373
  type: integer
8916
- type_attachments:AttachmentInline:
8917
- type: boolean
10374
+ type_attachments:AttachmentContentType:
10375
+ type: string
10376
+ type_attachments:AttachmentContentDisposition:
10377
+ type: string
10378
+ enum:
10379
+ - value: inline
10380
+ - value: attachment
10381
+ type_attachments:AttachmentContentId:
10382
+ type: string
8918
10383
  type_attachments:Attachment:
8919
10384
  type: object
8920
10385
  properties:
@@ -8922,16 +10387,17 @@ components:
8922
10387
  $ref: '#/components/schemas/type_attachments:AttachmentId'
8923
10388
  filename:
8924
10389
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
8925
- content_type:
8926
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
8927
10390
  size:
8928
10391
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
8929
- inline:
8930
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
10392
+ content_type:
10393
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
10394
+ content_disposition:
10395
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
10396
+ content_id:
10397
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
8931
10398
  required:
8932
10399
  - attachment_id
8933
10400
  - size
8934
- - inline
8935
10401
  type_messages:MessageAttachments:
8936
10402
  type: array
8937
10403
  items:
@@ -9240,12 +10706,17 @@ components:
9240
10706
  type: string
9241
10707
  type_attachments:AttachmentFilename:
9242
10708
  type: string
9243
- type_attachments:AttachmentContentType:
9244
- type: string
9245
10709
  type_attachments:AttachmentSize:
9246
10710
  type: integer
9247
- type_attachments:AttachmentInline:
9248
- type: boolean
10711
+ type_attachments:AttachmentContentType:
10712
+ type: string
10713
+ type_attachments:AttachmentContentDisposition:
10714
+ type: string
10715
+ enum:
10716
+ - value: inline
10717
+ - value: attachment
10718
+ type_attachments:AttachmentContentId:
10719
+ type: string
9249
10720
  type_attachments:Attachment:
9250
10721
  type: object
9251
10722
  properties:
@@ -9253,16 +10724,17 @@ components:
9253
10724
  $ref: '#/components/schemas/type_attachments:AttachmentId'
9254
10725
  filename:
9255
10726
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
9256
- content_type:
9257
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
9258
10727
  size:
9259
10728
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
9260
- inline:
9261
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
10729
+ content_type:
10730
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
10731
+ content_disposition:
10732
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
10733
+ content_id:
10734
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
9262
10735
  required:
9263
10736
  - attachment_id
9264
10737
  - size
9265
- - inline
9266
10738
  type_messages:MessageAttachments:
9267
10739
  type: array
9268
10740
  items:
@@ -9530,10 +11002,9 @@ paths:
9530
11002
  '200':
9531
11003
  description: Response with status 200
9532
11004
  content:
9533
- application/octet-stream:
11005
+ application/json:
9534
11006
  schema:
9535
- type: string
9536
- format: binary
11007
+ $ref: '#/components/schemas/type_attachments:AttachmentResponse'
9537
11008
  '404':
9538
11009
  description: Error response with status 404
9539
11010
  content: {}
@@ -9545,6 +11016,46 @@ components:
9545
11016
  type: string
9546
11017
  type_attachments:AttachmentId:
9547
11018
  type: string
11019
+ type_attachments:AttachmentFilename:
11020
+ type: string
11021
+ type_attachments:AttachmentSize:
11022
+ type: integer
11023
+ type_attachments:AttachmentContentType:
11024
+ type: string
11025
+ type_attachments:AttachmentContentDisposition:
11026
+ type: string
11027
+ enum:
11028
+ - value: inline
11029
+ - value: attachment
11030
+ type_attachments:AttachmentContentId:
11031
+ type: string
11032
+ type_attachments:AttachmentResponse:
11033
+ type: object
11034
+ properties:
11035
+ attachment_id:
11036
+ $ref: '#/components/schemas/type_attachments:AttachmentId'
11037
+ filename:
11038
+ $ref: '#/components/schemas/type_attachments:AttachmentFilename'
11039
+ size:
11040
+ $ref: '#/components/schemas/type_attachments:AttachmentSize'
11041
+ content_type:
11042
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
11043
+ content_disposition:
11044
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
11045
+ content_id:
11046
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
11047
+ download_url:
11048
+ type: string
11049
+ description: URL to download the attachment.
11050
+ expires_at:
11051
+ type: string
11052
+ format: date-time
11053
+ description: Time at which the download URL expires.
11054
+ required:
11055
+ - attachment_id
11056
+ - size
11057
+ - download_url
11058
+ - expires_at
9548
11059
 
9549
11060
  ```
9550
11061
 
@@ -9558,7 +11069,7 @@ async function main() {
9558
11069
  environment: "https://api.agentmail.to",
9559
11070
  apiKey: "YOUR_TOKEN_HERE",
9560
11071
  });
9561
- await client.inboxes.messages.getAttachment(":inbox_id", ":message_id", ":attachment_id");
11072
+ await client.inboxes.messages.getAttachment("inbox_id", "message_id", "attachment_id");
9562
11073
  }
9563
11074
  main();
9564
11075
 
@@ -9573,9 +11084,9 @@ client = AgentMail(
9573
11084
  )
9574
11085
 
9575
11086
  client.inboxes.messages.get_attachment(
9576
- inbox_id=":inbox_id",
9577
- message_id=":message_id",
9578
- attachment_id=":attachment_id"
11087
+ inbox_id="inbox_id",
11088
+ message_id="message_id",
11089
+ attachment_id="attachment_id"
9579
11090
  )
9580
11091
 
9581
11092
  ```
@@ -9591,7 +11102,7 @@ import (
9591
11102
 
9592
11103
  func main() {
9593
11104
 
9594
- url := "https://api.agentmail.to/v0/inboxes/%3Ainbox_id/messages/%3Amessage_id/attachments/%3Aattachment_id"
11105
+ url := "https://api.agentmail.to/v0/inboxes/inbox_id/messages/message_id/attachments/attachment_id"
9595
11106
 
9596
11107
  req, _ := http.NewRequest("GET", url, nil)
9597
11108
 
@@ -9612,7 +11123,7 @@ func main() {
9612
11123
  require 'uri'
9613
11124
  require 'net/http'
9614
11125
 
9615
- url = URI("https://api.agentmail.to/v0/inboxes/%3Ainbox_id/messages/%3Amessage_id/attachments/%3Aattachment_id")
11126
+ url = URI("https://api.agentmail.to/v0/inboxes/inbox_id/messages/message_id/attachments/attachment_id")
9616
11127
 
9617
11128
  http = Net::HTTP.new(url.host, url.port)
9618
11129
  http.use_ssl = true
@@ -9625,7 +11136,7 @@ puts response.read_body
9625
11136
  ```
9626
11137
 
9627
11138
  ```java
9628
- HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/inboxes/%3Ainbox_id/messages/%3Amessage_id/attachments/%3Aattachment_id")
11139
+ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/inboxes/inbox_id/messages/message_id/attachments/attachment_id")
9629
11140
  .header("Authorization", "Bearer <api_key>")
9630
11141
  .asString();
9631
11142
  ```
@@ -9635,7 +11146,7 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/inboxes
9635
11146
 
9636
11147
  $client = new \GuzzleHttp\Client();
9637
11148
 
9638
- $response = $client->request('GET', 'https://api.agentmail.to/v0/inboxes/%3Ainbox_id/messages/%3Amessage_id/attachments/%3Aattachment_id', [
11149
+ $response = $client->request('GET', 'https://api.agentmail.to/v0/inboxes/inbox_id/messages/message_id/attachments/attachment_id', [
9639
11150
  'headers' => [
9640
11151
  'Authorization' => 'Bearer <api_key>',
9641
11152
  ],
@@ -9645,7 +11156,7 @@ echo $response->getBody();
9645
11156
  ```
9646
11157
 
9647
11158
  ```csharp
9648
- var client = new RestClient("https://api.agentmail.to/v0/inboxes/%3Ainbox_id/messages/%3Amessage_id/attachments/%3Aattachment_id");
11159
+ var client = new RestClient("https://api.agentmail.to/v0/inboxes/inbox_id/messages/message_id/attachments/attachment_id");
9649
11160
  var request = new RestRequest(Method.GET);
9650
11161
  request.AddHeader("Authorization", "Bearer <api_key>");
9651
11162
  IRestResponse response = client.Execute(request);
@@ -9656,7 +11167,7 @@ import Foundation
9656
11167
 
9657
11168
  let headers = ["Authorization": "Bearer <api_key>"]
9658
11169
 
9659
- let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/inboxes/%3Ainbox_id/messages/%3Amessage_id/attachments/%3Aattachment_id")! as URL,
11170
+ let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/inboxes/inbox_id/messages/message_id/attachments/attachment_id")! as URL,
9660
11171
  cachePolicy: .useProtocolCachePolicy,
9661
11172
  timeoutInterval: 10.0)
9662
11173
  request.httpMethod = "GET"
@@ -9950,6 +11461,13 @@ components:
9950
11461
  type: string
9951
11462
  type_attachments:AttachmentContentType:
9952
11463
  type: string
11464
+ type_attachments:AttachmentContentDisposition:
11465
+ type: string
11466
+ enum:
11467
+ - value: inline
11468
+ - value: attachment
11469
+ type_attachments:AttachmentContentId:
11470
+ type: string
9953
11471
  type_attachments:AttachmentContent:
9954
11472
  type: string
9955
11473
  type_attachments:SendAttachment:
@@ -9959,6 +11477,10 @@ components:
9959
11477
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
9960
11478
  content_type:
9961
11479
  $ref: '#/components/schemas/type_attachments:AttachmentContentType'
11480
+ content_disposition:
11481
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
11482
+ content_id:
11483
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
9962
11484
  content:
9963
11485
  $ref: '#/components/schemas/type_attachments:AttachmentContent'
9964
11486
  required:
@@ -10251,6 +11773,13 @@ components:
10251
11773
  type: string
10252
11774
  type_attachments:AttachmentContentType:
10253
11775
  type: string
11776
+ type_attachments:AttachmentContentDisposition:
11777
+ type: string
11778
+ enum:
11779
+ - value: inline
11780
+ - value: attachment
11781
+ type_attachments:AttachmentContentId:
11782
+ type: string
10254
11783
  type_attachments:AttachmentContent:
10255
11784
  type: string
10256
11785
  type_attachments:SendAttachment:
@@ -10260,6 +11789,10 @@ components:
10260
11789
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
10261
11790
  content_type:
10262
11791
  $ref: '#/components/schemas/type_attachments:AttachmentContentType'
11792
+ content_disposition:
11793
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
11794
+ content_id:
11795
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
10263
11796
  content:
10264
11797
  $ref: '#/components/schemas/type_attachments:AttachmentContent'
10265
11798
  required:
@@ -10543,6 +12076,13 @@ components:
10543
12076
  type: string
10544
12077
  type_attachments:AttachmentContentType:
10545
12078
  type: string
12079
+ type_attachments:AttachmentContentDisposition:
12080
+ type: string
12081
+ enum:
12082
+ - value: inline
12083
+ - value: attachment
12084
+ type_attachments:AttachmentContentId:
12085
+ type: string
10546
12086
  type_attachments:AttachmentContent:
10547
12087
  type: string
10548
12088
  type_attachments:SendAttachment:
@@ -10552,6 +12092,10 @@ components:
10552
12092
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
10553
12093
  content_type:
10554
12094
  $ref: '#/components/schemas/type_attachments:AttachmentContentType'
12095
+ content_disposition:
12096
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
12097
+ content_id:
12098
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
10555
12099
  content:
10556
12100
  $ref: '#/components/schemas/type_attachments:AttachmentContent'
10557
12101
  required:
@@ -10852,12 +12396,17 @@ components:
10852
12396
  type: string
10853
12397
  type_attachments:AttachmentFilename:
10854
12398
  type: string
10855
- type_attachments:AttachmentContentType:
10856
- type: string
10857
12399
  type_attachments:AttachmentSize:
10858
12400
  type: integer
10859
- type_attachments:AttachmentInline:
10860
- type: boolean
12401
+ type_attachments:AttachmentContentType:
12402
+ type: string
12403
+ type_attachments:AttachmentContentDisposition:
12404
+ type: string
12405
+ enum:
12406
+ - value: inline
12407
+ - value: attachment
12408
+ type_attachments:AttachmentContentId:
12409
+ type: string
10861
12410
  type_attachments:Attachment:
10862
12411
  type: object
10863
12412
  properties:
@@ -10865,16 +12414,17 @@ components:
10865
12414
  $ref: '#/components/schemas/type_attachments:AttachmentId'
10866
12415
  filename:
10867
12416
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
10868
- content_type:
10869
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
10870
12417
  size:
10871
12418
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
10872
- inline:
10873
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
12419
+ content_type:
12420
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
12421
+ content_disposition:
12422
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
12423
+ content_id:
12424
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
10874
12425
  required:
10875
12426
  - attachment_id
10876
12427
  - size
10877
- - inline
10878
12428
  type_messages:MessageAttachments:
10879
12429
  type: array
10880
12430
  items:
@@ -11237,12 +12787,17 @@ components:
11237
12787
  type: string
11238
12788
  type_attachments:AttachmentFilename:
11239
12789
  type: string
11240
- type_attachments:AttachmentContentType:
11241
- type: string
11242
12790
  type_attachments:AttachmentSize:
11243
12791
  type: integer
11244
- type_attachments:AttachmentInline:
11245
- type: boolean
12792
+ type_attachments:AttachmentContentType:
12793
+ type: string
12794
+ type_attachments:AttachmentContentDisposition:
12795
+ type: string
12796
+ enum:
12797
+ - value: inline
12798
+ - value: attachment
12799
+ type_attachments:AttachmentContentId:
12800
+ type: string
11246
12801
  type_attachments:Attachment:
11247
12802
  type: object
11248
12803
  properties:
@@ -11250,16 +12805,17 @@ components:
11250
12805
  $ref: '#/components/schemas/type_attachments:AttachmentId'
11251
12806
  filename:
11252
12807
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
11253
- content_type:
11254
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
11255
12808
  size:
11256
12809
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
11257
- inline:
11258
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
12810
+ content_type:
12811
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
12812
+ content_disposition:
12813
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
12814
+ content_id:
12815
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
11259
12816
  required:
11260
12817
  - attachment_id
11261
12818
  - size
11262
- - inline
11263
12819
  type_drafts:DraftAttachments:
11264
12820
  type: array
11265
12821
  items:
@@ -11548,12 +13104,17 @@ components:
11548
13104
  type: string
11549
13105
  type_attachments:AttachmentFilename:
11550
13106
  type: string
11551
- type_attachments:AttachmentContentType:
11552
- type: string
11553
13107
  type_attachments:AttachmentSize:
11554
13108
  type: integer
11555
- type_attachments:AttachmentInline:
11556
- type: boolean
13109
+ type_attachments:AttachmentContentType:
13110
+ type: string
13111
+ type_attachments:AttachmentContentDisposition:
13112
+ type: string
13113
+ enum:
13114
+ - value: inline
13115
+ - value: attachment
13116
+ type_attachments:AttachmentContentId:
13117
+ type: string
11557
13118
  type_attachments:Attachment:
11558
13119
  type: object
11559
13120
  properties:
@@ -11561,16 +13122,17 @@ components:
11561
13122
  $ref: '#/components/schemas/type_attachments:AttachmentId'
11562
13123
  filename:
11563
13124
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
11564
- content_type:
11565
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
11566
13125
  size:
11567
13126
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
11568
- inline:
11569
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
13127
+ content_type:
13128
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
13129
+ content_disposition:
13130
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
13131
+ content_id:
13132
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
11570
13133
  required:
11571
13134
  - attachment_id
11572
13135
  - size
11573
- - inline
11574
13136
  type_drafts:DraftAttachments:
11575
13137
  type: array
11576
13138
  items:
@@ -11896,12 +13458,17 @@ components:
11896
13458
  type: string
11897
13459
  type_attachments:AttachmentFilename:
11898
13460
  type: string
11899
- type_attachments:AttachmentContentType:
11900
- type: string
11901
13461
  type_attachments:AttachmentSize:
11902
13462
  type: integer
11903
- type_attachments:AttachmentInline:
11904
- type: boolean
13463
+ type_attachments:AttachmentContentType:
13464
+ type: string
13465
+ type_attachments:AttachmentContentDisposition:
13466
+ type: string
13467
+ enum:
13468
+ - value: inline
13469
+ - value: attachment
13470
+ type_attachments:AttachmentContentId:
13471
+ type: string
11905
13472
  type_attachments:Attachment:
11906
13473
  type: object
11907
13474
  properties:
@@ -11909,16 +13476,17 @@ components:
11909
13476
  $ref: '#/components/schemas/type_attachments:AttachmentId'
11910
13477
  filename:
11911
13478
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
11912
- content_type:
11913
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
11914
13479
  size:
11915
13480
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
11916
- inline:
11917
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
13481
+ content_type:
13482
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
13483
+ content_disposition:
13484
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
13485
+ content_id:
13486
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
11918
13487
  required:
11919
13488
  - attachment_id
11920
13489
  - size
11921
- - inline
11922
13490
  type_drafts:DraftAttachments:
11923
13491
  type: array
11924
13492
  items:
@@ -12254,12 +13822,17 @@ components:
12254
13822
  type: string
12255
13823
  type_attachments:AttachmentFilename:
12256
13824
  type: string
12257
- type_attachments:AttachmentContentType:
12258
- type: string
12259
13825
  type_attachments:AttachmentSize:
12260
13826
  type: integer
12261
- type_attachments:AttachmentInline:
12262
- type: boolean
13827
+ type_attachments:AttachmentContentType:
13828
+ type: string
13829
+ type_attachments:AttachmentContentDisposition:
13830
+ type: string
13831
+ enum:
13832
+ - value: inline
13833
+ - value: attachment
13834
+ type_attachments:AttachmentContentId:
13835
+ type: string
12263
13836
  type_attachments:Attachment:
12264
13837
  type: object
12265
13838
  properties:
@@ -12267,16 +13840,17 @@ components:
12267
13840
  $ref: '#/components/schemas/type_attachments:AttachmentId'
12268
13841
  filename:
12269
13842
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
12270
- content_type:
12271
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
12272
13843
  size:
12273
13844
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
12274
- inline:
12275
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
13845
+ content_type:
13846
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
13847
+ content_disposition:
13848
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
13849
+ content_id:
13850
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
12276
13851
  required:
12277
13852
  - attachment_id
12278
13853
  - size
12279
- - inline
12280
13854
  type_drafts:DraftAttachments:
12281
13855
  type: array
12282
13856
  items:
@@ -13097,6 +14671,7 @@ package main
13097
14671
 
13098
14672
  import (
13099
14673
  "fmt"
14674
+ "strings"
13100
14675
  "net/http"
13101
14676
  "io"
13102
14677
  )
@@ -13105,9 +14680,12 @@ func main() {
13105
14680
 
13106
14681
  url := "https://api.agentmail.to/v0/inboxes/inbox_id/metrics?start_timestamp=2024-01-15T09%3A30%3A00Z&end_timestamp=2024-01-15T09%3A30%3A00Z"
13107
14682
 
13108
- req, _ := http.NewRequest("GET", url, nil)
14683
+ payload := strings.NewReader("{}")
14684
+
14685
+ req, _ := http.NewRequest("GET", url, payload)
13109
14686
 
13110
14687
  req.Header.Add("Authorization", "Bearer <api_key>")
14688
+ req.Header.Add("Content-Type", "application/json")
13111
14689
 
13112
14690
  res, _ := http.DefaultClient.Do(req)
13113
14691
 
@@ -13131,6 +14709,8 @@ http.use_ssl = true
13131
14709
 
13132
14710
  request = Net::HTTP::Get.new(url)
13133
14711
  request["Authorization"] = 'Bearer <api_key>'
14712
+ request["Content-Type"] = 'application/json'
14713
+ request.body = "{}"
13134
14714
 
13135
14715
  response = http.request(request)
13136
14716
  puts response.read_body
@@ -13139,6 +14719,8 @@ puts response.read_body
13139
14719
  ```java
13140
14720
  HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/inboxes/inbox_id/metrics?start_timestamp=2024-01-15T09%3A30%3A00Z&end_timestamp=2024-01-15T09%3A30%3A00Z")
13141
14721
  .header("Authorization", "Bearer <api_key>")
14722
+ .header("Content-Type", "application/json")
14723
+ .body("{}")
13142
14724
  .asString();
13143
14725
  ```
13144
14726
 
@@ -13148,8 +14730,10 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/inboxes
13148
14730
  $client = new \GuzzleHttp\Client();
13149
14731
 
13150
14732
  $response = $client->request('GET', 'https://api.agentmail.to/v0/inboxes/inbox_id/metrics?start_timestamp=2024-01-15T09%3A30%3A00Z&end_timestamp=2024-01-15T09%3A30%3A00Z', [
14733
+ 'body' => '{}',
13151
14734
  'headers' => [
13152
14735
  'Authorization' => 'Bearer <api_key>',
14736
+ 'Content-Type' => 'application/json',
13153
14737
  ],
13154
14738
  ]);
13155
14739
 
@@ -13160,19 +14744,28 @@ echo $response->getBody();
13160
14744
  var client = new RestClient("https://api.agentmail.to/v0/inboxes/inbox_id/metrics?start_timestamp=2024-01-15T09%3A30%3A00Z&end_timestamp=2024-01-15T09%3A30%3A00Z");
13161
14745
  var request = new RestRequest(Method.GET);
13162
14746
  request.AddHeader("Authorization", "Bearer <api_key>");
14747
+ request.AddHeader("Content-Type", "application/json");
14748
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
13163
14749
  IRestResponse response = client.Execute(request);
13164
14750
  ```
13165
14751
 
13166
14752
  ```swift
13167
14753
  import Foundation
13168
14754
 
13169
- let headers = ["Authorization": "Bearer <api_key>"]
14755
+ let headers = [
14756
+ "Authorization": "Bearer <api_key>",
14757
+ "Content-Type": "application/json"
14758
+ ]
14759
+ let parameters = [] as [String : Any]
14760
+
14761
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
13170
14762
 
13171
14763
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/inboxes/inbox_id/metrics?start_timestamp=2024-01-15T09%3A30%3A00Z&end_timestamp=2024-01-15T09%3A30%3A00Z")! as URL,
13172
14764
  cachePolicy: .useProtocolCachePolicy,
13173
14765
  timeoutInterval: 10.0)
13174
14766
  request.httpMethod = "GET"
13175
14767
  request.allHTTPHeaderFields = headers
14768
+ request.httpBody = postData as Data
13176
14769
 
13177
14770
  let session = URLSession.shared
13178
14771
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
@@ -13316,12 +14909,17 @@ components:
13316
14909
  type: string
13317
14910
  type_attachments:AttachmentFilename:
13318
14911
  type: string
13319
- type_attachments:AttachmentContentType:
13320
- type: string
13321
14912
  type_attachments:AttachmentSize:
13322
14913
  type: integer
13323
- type_attachments:AttachmentInline:
13324
- type: boolean
14914
+ type_attachments:AttachmentContentType:
14915
+ type: string
14916
+ type_attachments:AttachmentContentDisposition:
14917
+ type: string
14918
+ enum:
14919
+ - value: inline
14920
+ - value: attachment
14921
+ type_attachments:AttachmentContentId:
14922
+ type: string
13325
14923
  type_attachments:Attachment:
13326
14924
  type: object
13327
14925
  properties:
@@ -13329,16 +14927,17 @@ components:
13329
14927
  $ref: '#/components/schemas/type_attachments:AttachmentId'
13330
14928
  filename:
13331
14929
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
13332
- content_type:
13333
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
13334
14930
  size:
13335
14931
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
13336
- inline:
13337
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
14932
+ content_type:
14933
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
14934
+ content_disposition:
14935
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
14936
+ content_id:
14937
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
13338
14938
  required:
13339
14939
  - attachment_id
13340
14940
  - size
13341
- - inline
13342
14941
  type_threads:ThreadAttachments:
13343
14942
  type: array
13344
14943
  items:
@@ -13457,6 +15056,7 @@ package main
13457
15056
 
13458
15057
  import (
13459
15058
  "fmt"
15059
+ "strings"
13460
15060
  "net/http"
13461
15061
  "io"
13462
15062
  )
@@ -13465,9 +15065,12 @@ func main() {
13465
15065
 
13466
15066
  url := "https://api.agentmail.to/v0/threads"
13467
15067
 
13468
- req, _ := http.NewRequest("GET", url, nil)
15068
+ payload := strings.NewReader("{}")
15069
+
15070
+ req, _ := http.NewRequest("GET", url, payload)
13469
15071
 
13470
15072
  req.Header.Add("Authorization", "Bearer <api_key>")
15073
+ req.Header.Add("Content-Type", "application/json")
13471
15074
 
13472
15075
  res, _ := http.DefaultClient.Do(req)
13473
15076
 
@@ -13491,6 +15094,8 @@ http.use_ssl = true
13491
15094
 
13492
15095
  request = Net::HTTP::Get.new(url)
13493
15096
  request["Authorization"] = 'Bearer <api_key>'
15097
+ request["Content-Type"] = 'application/json'
15098
+ request.body = "{}"
13494
15099
 
13495
15100
  response = http.request(request)
13496
15101
  puts response.read_body
@@ -13499,6 +15104,8 @@ puts response.read_body
13499
15104
  ```java
13500
15105
  HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/threads")
13501
15106
  .header("Authorization", "Bearer <api_key>")
15107
+ .header("Content-Type", "application/json")
15108
+ .body("{}")
13502
15109
  .asString();
13503
15110
  ```
13504
15111
 
@@ -13508,8 +15115,10 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/threads
13508
15115
  $client = new \GuzzleHttp\Client();
13509
15116
 
13510
15117
  $response = $client->request('GET', 'https://api.agentmail.to/v0/threads', [
15118
+ 'body' => '{}',
13511
15119
  'headers' => [
13512
15120
  'Authorization' => 'Bearer <api_key>',
15121
+ 'Content-Type' => 'application/json',
13513
15122
  ],
13514
15123
  ]);
13515
15124
 
@@ -13520,19 +15129,28 @@ echo $response->getBody();
13520
15129
  var client = new RestClient("https://api.agentmail.to/v0/threads");
13521
15130
  var request = new RestRequest(Method.GET);
13522
15131
  request.AddHeader("Authorization", "Bearer <api_key>");
15132
+ request.AddHeader("Content-Type", "application/json");
15133
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
13523
15134
  IRestResponse response = client.Execute(request);
13524
15135
  ```
13525
15136
 
13526
15137
  ```swift
13527
15138
  import Foundation
13528
15139
 
13529
- let headers = ["Authorization": "Bearer <api_key>"]
15140
+ let headers = [
15141
+ "Authorization": "Bearer <api_key>",
15142
+ "Content-Type": "application/json"
15143
+ ]
15144
+ let parameters = [] as [String : Any]
15145
+
15146
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
13530
15147
 
13531
15148
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/threads")! as URL,
13532
15149
  cachePolicy: .useProtocolCachePolicy,
13533
15150
  timeoutInterval: 10.0)
13534
15151
  request.httpMethod = "GET"
13535
15152
  request.allHTTPHeaderFields = headers
15153
+ request.httpBody = postData as Data
13536
15154
 
13537
15155
  let session = URLSession.shared
13538
15156
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
@@ -13626,12 +15244,17 @@ components:
13626
15244
  type: string
13627
15245
  type_attachments:AttachmentFilename:
13628
15246
  type: string
13629
- type_attachments:AttachmentContentType:
13630
- type: string
13631
15247
  type_attachments:AttachmentSize:
13632
15248
  type: integer
13633
- type_attachments:AttachmentInline:
13634
- type: boolean
15249
+ type_attachments:AttachmentContentType:
15250
+ type: string
15251
+ type_attachments:AttachmentContentDisposition:
15252
+ type: string
15253
+ enum:
15254
+ - value: inline
15255
+ - value: attachment
15256
+ type_attachments:AttachmentContentId:
15257
+ type: string
13635
15258
  type_attachments:Attachment:
13636
15259
  type: object
13637
15260
  properties:
@@ -13639,16 +15262,17 @@ components:
13639
15262
  $ref: '#/components/schemas/type_attachments:AttachmentId'
13640
15263
  filename:
13641
15264
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
13642
- content_type:
13643
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
13644
15265
  size:
13645
15266
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
13646
- inline:
13647
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
15267
+ content_type:
15268
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
15269
+ content_disposition:
15270
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
15271
+ content_id:
15272
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
13648
15273
  required:
13649
15274
  - attachment_id
13650
15275
  - size
13651
- - inline
13652
15276
  type_threads:ThreadAttachments:
13653
15277
  type: array
13654
15278
  items:
@@ -14011,10 +15635,9 @@ paths:
14011
15635
  '200':
14012
15636
  description: Response with status 200
14013
15637
  content:
14014
- application/octet-stream:
15638
+ application/json:
14015
15639
  schema:
14016
- type: string
14017
- format: binary
15640
+ $ref: '#/components/schemas/type_attachments:AttachmentResponse'
14018
15641
  '404':
14019
15642
  description: Error response with status 404
14020
15643
  content: {}
@@ -14024,6 +15647,46 @@ components:
14024
15647
  type: string
14025
15648
  type_attachments:AttachmentId:
14026
15649
  type: string
15650
+ type_attachments:AttachmentFilename:
15651
+ type: string
15652
+ type_attachments:AttachmentSize:
15653
+ type: integer
15654
+ type_attachments:AttachmentContentType:
15655
+ type: string
15656
+ type_attachments:AttachmentContentDisposition:
15657
+ type: string
15658
+ enum:
15659
+ - value: inline
15660
+ - value: attachment
15661
+ type_attachments:AttachmentContentId:
15662
+ type: string
15663
+ type_attachments:AttachmentResponse:
15664
+ type: object
15665
+ properties:
15666
+ attachment_id:
15667
+ $ref: '#/components/schemas/type_attachments:AttachmentId'
15668
+ filename:
15669
+ $ref: '#/components/schemas/type_attachments:AttachmentFilename'
15670
+ size:
15671
+ $ref: '#/components/schemas/type_attachments:AttachmentSize'
15672
+ content_type:
15673
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
15674
+ content_disposition:
15675
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
15676
+ content_id:
15677
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
15678
+ download_url:
15679
+ type: string
15680
+ description: URL to download the attachment.
15681
+ expires_at:
15682
+ type: string
15683
+ format: date-time
15684
+ description: Time at which the download URL expires.
15685
+ required:
15686
+ - attachment_id
15687
+ - size
15688
+ - download_url
15689
+ - expires_at
14027
15690
 
14028
15691
  ```
14029
15692
 
@@ -14037,7 +15700,7 @@ async function main() {
14037
15700
  environment: "https://api.agentmail.to",
14038
15701
  apiKey: "YOUR_TOKEN_HERE",
14039
15702
  });
14040
- await client.threads.getAttachment(":thread_id", ":attachment_id");
15703
+ await client.threads.getAttachment("thread_id", "attachment_id");
14041
15704
  }
14042
15705
  main();
14043
15706
 
@@ -14052,8 +15715,8 @@ client = AgentMail(
14052
15715
  )
14053
15716
 
14054
15717
  client.threads.get_attachment(
14055
- thread_id=":thread_id",
14056
- attachment_id=":attachment_id"
15718
+ thread_id="thread_id",
15719
+ attachment_id="attachment_id"
14057
15720
  )
14058
15721
 
14059
15722
  ```
@@ -14069,7 +15732,7 @@ import (
14069
15732
 
14070
15733
  func main() {
14071
15734
 
14072
- url := "https://api.agentmail.to/v0/threads/%3Athread_id/attachments/%3Aattachment_id"
15735
+ url := "https://api.agentmail.to/v0/threads/thread_id/attachments/attachment_id"
14073
15736
 
14074
15737
  req, _ := http.NewRequest("GET", url, nil)
14075
15738
 
@@ -14090,7 +15753,7 @@ func main() {
14090
15753
  require 'uri'
14091
15754
  require 'net/http'
14092
15755
 
14093
- url = URI("https://api.agentmail.to/v0/threads/%3Athread_id/attachments/%3Aattachment_id")
15756
+ url = URI("https://api.agentmail.to/v0/threads/thread_id/attachments/attachment_id")
14094
15757
 
14095
15758
  http = Net::HTTP.new(url.host, url.port)
14096
15759
  http.use_ssl = true
@@ -14103,7 +15766,7 @@ puts response.read_body
14103
15766
  ```
14104
15767
 
14105
15768
  ```java
14106
- HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/threads/%3Athread_id/attachments/%3Aattachment_id")
15769
+ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/threads/thread_id/attachments/attachment_id")
14107
15770
  .header("Authorization", "Bearer <api_key>")
14108
15771
  .asString();
14109
15772
  ```
@@ -14113,7 +15776,7 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/threads
14113
15776
 
14114
15777
  $client = new \GuzzleHttp\Client();
14115
15778
 
14116
- $response = $client->request('GET', 'https://api.agentmail.to/v0/threads/%3Athread_id/attachments/%3Aattachment_id', [
15779
+ $response = $client->request('GET', 'https://api.agentmail.to/v0/threads/thread_id/attachments/attachment_id', [
14117
15780
  'headers' => [
14118
15781
  'Authorization' => 'Bearer <api_key>',
14119
15782
  ],
@@ -14123,7 +15786,7 @@ echo $response->getBody();
14123
15786
  ```
14124
15787
 
14125
15788
  ```csharp
14126
- var client = new RestClient("https://api.agentmail.to/v0/threads/%3Athread_id/attachments/%3Aattachment_id");
15789
+ var client = new RestClient("https://api.agentmail.to/v0/threads/thread_id/attachments/attachment_id");
14127
15790
  var request = new RestRequest(Method.GET);
14128
15791
  request.AddHeader("Authorization", "Bearer <api_key>");
14129
15792
  IRestResponse response = client.Execute(request);
@@ -14134,7 +15797,7 @@ import Foundation
14134
15797
 
14135
15798
  let headers = ["Authorization": "Bearer <api_key>"]
14136
15799
 
14137
- let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/threads/%3Athread_id/attachments/%3Aattachment_id")! as URL,
15800
+ let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/threads/thread_id/attachments/attachment_id")! as URL,
14138
15801
  cachePolicy: .useProtocolCachePolicy,
14139
15802
  timeoutInterval: 10.0)
14140
15803
  request.httpMethod = "GET"
@@ -14272,12 +15935,17 @@ components:
14272
15935
  type: string
14273
15936
  type_attachments:AttachmentFilename:
14274
15937
  type: string
14275
- type_attachments:AttachmentContentType:
14276
- type: string
14277
15938
  type_attachments:AttachmentSize:
14278
15939
  type: integer
14279
- type_attachments:AttachmentInline:
14280
- type: boolean
15940
+ type_attachments:AttachmentContentType:
15941
+ type: string
15942
+ type_attachments:AttachmentContentDisposition:
15943
+ type: string
15944
+ enum:
15945
+ - value: inline
15946
+ - value: attachment
15947
+ type_attachments:AttachmentContentId:
15948
+ type: string
14281
15949
  type_attachments:Attachment:
14282
15950
  type: object
14283
15951
  properties:
@@ -14285,16 +15953,17 @@ components:
14285
15953
  $ref: '#/components/schemas/type_attachments:AttachmentId'
14286
15954
  filename:
14287
15955
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
14288
- content_type:
14289
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
14290
15956
  size:
14291
15957
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
14292
- inline:
14293
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
15958
+ content_type:
15959
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
15960
+ content_disposition:
15961
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
15962
+ content_id:
15963
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
14294
15964
  required:
14295
15965
  - attachment_id
14296
15966
  - size
14297
- - inline
14298
15967
  type_drafts:DraftAttachments:
14299
15968
  type: array
14300
15969
  items:
@@ -14575,12 +16244,17 @@ components:
14575
16244
  type: string
14576
16245
  type_attachments:AttachmentFilename:
14577
16246
  type: string
14578
- type_attachments:AttachmentContentType:
14579
- type: string
14580
16247
  type_attachments:AttachmentSize:
14581
16248
  type: integer
14582
- type_attachments:AttachmentInline:
14583
- type: boolean
16249
+ type_attachments:AttachmentContentType:
16250
+ type: string
16251
+ type_attachments:AttachmentContentDisposition:
16252
+ type: string
16253
+ enum:
16254
+ - value: inline
16255
+ - value: attachment
16256
+ type_attachments:AttachmentContentId:
16257
+ type: string
14584
16258
  type_attachments:Attachment:
14585
16259
  type: object
14586
16260
  properties:
@@ -14588,16 +16262,17 @@ components:
14588
16262
  $ref: '#/components/schemas/type_attachments:AttachmentId'
14589
16263
  filename:
14590
16264
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
14591
- content_type:
14592
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
14593
16265
  size:
14594
16266
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
14595
- inline:
14596
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
16267
+ content_type:
16268
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
16269
+ content_disposition:
16270
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
16271
+ content_id:
16272
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
14597
16273
  required:
14598
16274
  - attachment_id
14599
16275
  - size
14600
- - inline
14601
16276
  type_drafts:DraftAttachments:
14602
16277
  type: array
14603
16278
  items:
@@ -14938,6 +16613,7 @@ package main
14938
16613
 
14939
16614
  import (
14940
16615
  "fmt"
16616
+ "strings"
14941
16617
  "net/http"
14942
16618
  "io"
14943
16619
  )
@@ -14946,9 +16622,12 @@ func main() {
14946
16622
 
14947
16623
  url := "https://api.agentmail.to/v0/domains"
14948
16624
 
14949
- req, _ := http.NewRequest("GET", url, nil)
16625
+ payload := strings.NewReader("{}")
16626
+
16627
+ req, _ := http.NewRequest("GET", url, payload)
14950
16628
 
14951
16629
  req.Header.Add("Authorization", "Bearer <api_key>")
16630
+ req.Header.Add("Content-Type", "application/json")
14952
16631
 
14953
16632
  res, _ := http.DefaultClient.Do(req)
14954
16633
 
@@ -14972,6 +16651,8 @@ http.use_ssl = true
14972
16651
 
14973
16652
  request = Net::HTTP::Get.new(url)
14974
16653
  request["Authorization"] = 'Bearer <api_key>'
16654
+ request["Content-Type"] = 'application/json'
16655
+ request.body = "{}"
14975
16656
 
14976
16657
  response = http.request(request)
14977
16658
  puts response.read_body
@@ -14980,6 +16661,8 @@ puts response.read_body
14980
16661
  ```java
14981
16662
  HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/domains")
14982
16663
  .header("Authorization", "Bearer <api_key>")
16664
+ .header("Content-Type", "application/json")
16665
+ .body("{}")
14983
16666
  .asString();
14984
16667
  ```
14985
16668
 
@@ -14989,8 +16672,10 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/domains
14989
16672
  $client = new \GuzzleHttp\Client();
14990
16673
 
14991
16674
  $response = $client->request('GET', 'https://api.agentmail.to/v0/domains', [
16675
+ 'body' => '{}',
14992
16676
  'headers' => [
14993
16677
  'Authorization' => 'Bearer <api_key>',
16678
+ 'Content-Type' => 'application/json',
14994
16679
  ],
14995
16680
  ]);
14996
16681
 
@@ -15001,19 +16686,28 @@ echo $response->getBody();
15001
16686
  var client = new RestClient("https://api.agentmail.to/v0/domains");
15002
16687
  var request = new RestRequest(Method.GET);
15003
16688
  request.AddHeader("Authorization", "Bearer <api_key>");
16689
+ request.AddHeader("Content-Type", "application/json");
16690
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
15004
16691
  IRestResponse response = client.Execute(request);
15005
16692
  ```
15006
16693
 
15007
16694
  ```swift
15008
16695
  import Foundation
15009
16696
 
15010
- let headers = ["Authorization": "Bearer <api_key>"]
16697
+ let headers = [
16698
+ "Authorization": "Bearer <api_key>",
16699
+ "Content-Type": "application/json"
16700
+ ]
16701
+ let parameters = [] as [String : Any]
16702
+
16703
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
15011
16704
 
15012
16705
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/domains")! as URL,
15013
16706
  cachePolicy: .useProtocolCachePolicy,
15014
16707
  timeoutInterval: 10.0)
15015
16708
  request.httpMethod = "GET"
15016
16709
  request.allHTTPHeaderFields = headers
16710
+ request.httpBody = postData as Data
15017
16711
 
15018
16712
  let session = URLSession.shared
15019
16713
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
@@ -15624,7 +17318,7 @@ async function main() {
15624
17318
  apiKey: "YOUR_TOKEN_HERE",
15625
17319
  });
15626
17320
  await client.domains.create({
15627
- domain: "domain",
17321
+ domain: "example.com",
15628
17322
  feedbackEnabled: true,
15629
17323
  });
15630
17324
  }
@@ -15641,7 +17335,7 @@ client = AgentMail(
15641
17335
  )
15642
17336
 
15643
17337
  client.domains.create(
15644
- domain="domain",
17338
+ domain="example.com",
15645
17339
  feedback_enabled=True
15646
17340
  )
15647
17341
 
@@ -15661,7 +17355,7 @@ func main() {
15661
17355
 
15662
17356
  url := "https://api.agentmail.to/v0/domains"
15663
17357
 
15664
- payload := strings.NewReader("{\n \"domain\": \"domain\",\n \"feedback_enabled\": true\n}")
17358
+ payload := strings.NewReader("{\n \"domain\": \"example.com\",\n \"feedback_enabled\": true\n}")
15665
17359
 
15666
17360
  req, _ := http.NewRequest("POST", url, payload)
15667
17361
 
@@ -15691,7 +17385,7 @@ http.use_ssl = true
15691
17385
  request = Net::HTTP::Post.new(url)
15692
17386
  request["Authorization"] = 'Bearer <api_key>'
15693
17387
  request["Content-Type"] = 'application/json'
15694
- request.body = "{\n \"domain\": \"domain\",\n \"feedback_enabled\": true\n}"
17388
+ request.body = "{\n \"domain\": \"example.com\",\n \"feedback_enabled\": true\n}"
15695
17389
 
15696
17390
  response = http.request(request)
15697
17391
  puts response.read_body
@@ -15701,7 +17395,7 @@ puts response.read_body
15701
17395
  HttpResponse<String> response = Unirest.post("https://api.agentmail.to/v0/domains")
15702
17396
  .header("Authorization", "Bearer <api_key>")
15703
17397
  .header("Content-Type", "application/json")
15704
- .body("{\n \"domain\": \"domain\",\n \"feedback_enabled\": true\n}")
17398
+ .body("{\n \"domain\": \"example.com\",\n \"feedback_enabled\": true\n}")
15705
17399
  .asString();
15706
17400
  ```
15707
17401
 
@@ -15712,7 +17406,7 @@ $client = new \GuzzleHttp\Client();
15712
17406
 
15713
17407
  $response = $client->request('POST', 'https://api.agentmail.to/v0/domains', [
15714
17408
  'body' => '{
15715
- "domain": "domain",
17409
+ "domain": "example.com",
15716
17410
  "feedback_enabled": true
15717
17411
  }',
15718
17412
  'headers' => [
@@ -15729,7 +17423,7 @@ var client = new RestClient("https://api.agentmail.to/v0/domains");
15729
17423
  var request = new RestRequest(Method.POST);
15730
17424
  request.AddHeader("Authorization", "Bearer <api_key>");
15731
17425
  request.AddHeader("Content-Type", "application/json");
15732
- request.AddParameter("application/json", "{\n \"domain\": \"domain\",\n \"feedback_enabled\": true\n}", ParameterType.RequestBody);
17426
+ request.AddParameter("application/json", "{\n \"domain\": \"example.com\",\n \"feedback_enabled\": true\n}", ParameterType.RequestBody);
15733
17427
  IRestResponse response = client.Execute(request);
15734
17428
  ```
15735
17429
 
@@ -15741,7 +17435,7 @@ let headers = [
15741
17435
  "Content-Type": "application/json"
15742
17436
  ]
15743
17437
  let parameters = [
15744
- "domain": "domain",
17438
+ "domain": "example.com",
15745
17439
  "feedback_enabled": true
15746
17440
  ] as [String : Any]
15747
17441
 
@@ -17169,12 +18863,17 @@ components:
17169
18863
  type: string
17170
18864
  type_attachments:AttachmentFilename:
17171
18865
  type: string
17172
- type_attachments:AttachmentContentType:
17173
- type: string
17174
18866
  type_attachments:AttachmentSize:
17175
18867
  type: integer
17176
- type_attachments:AttachmentInline:
17177
- type: boolean
18868
+ type_attachments:AttachmentContentType:
18869
+ type: string
18870
+ type_attachments:AttachmentContentDisposition:
18871
+ type: string
18872
+ enum:
18873
+ - value: inline
18874
+ - value: attachment
18875
+ type_attachments:AttachmentContentId:
18876
+ type: string
17178
18877
  type_attachments:Attachment:
17179
18878
  type: object
17180
18879
  properties:
@@ -17182,16 +18881,17 @@ components:
17182
18881
  $ref: '#/components/schemas/type_attachments:AttachmentId'
17183
18882
  filename:
17184
18883
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
17185
- content_type:
17186
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
17187
18884
  size:
17188
18885
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
17189
- inline:
17190
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
18886
+ content_type:
18887
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
18888
+ content_disposition:
18889
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
18890
+ content_id:
18891
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
17191
18892
  required:
17192
18893
  - attachment_id
17193
18894
  - size
17194
- - inline
17195
18895
  type_messages:MessageAttachments:
17196
18896
  type: array
17197
18897
  items:
@@ -18318,12 +20018,17 @@ components:
18318
20018
  type: string
18319
20019
  type_attachments:AttachmentFilename:
18320
20020
  type: string
18321
- type_attachments:AttachmentContentType:
18322
- type: string
18323
20021
  type_attachments:AttachmentSize:
18324
20022
  type: integer
18325
- type_attachments:AttachmentInline:
18326
- type: boolean
20023
+ type_attachments:AttachmentContentType:
20024
+ type: string
20025
+ type_attachments:AttachmentContentDisposition:
20026
+ type: string
20027
+ enum:
20028
+ - value: inline
20029
+ - value: attachment
20030
+ type_attachments:AttachmentContentId:
20031
+ type: string
18327
20032
  type_attachments:Attachment:
18328
20033
  type: object
18329
20034
  properties:
@@ -18331,16 +20036,17 @@ components:
18331
20036
  $ref: '#/components/schemas/type_attachments:AttachmentId'
18332
20037
  filename:
18333
20038
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
18334
- content_type:
18335
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
18336
20039
  size:
18337
20040
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
18338
- inline:
18339
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
20041
+ content_type:
20042
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
20043
+ content_disposition:
20044
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
20045
+ content_id:
20046
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
18340
20047
  required:
18341
20048
  - attachment_id
18342
20049
  - size
18343
- - inline
18344
20050
  type_messages:MessageAttachments:
18345
20051
  type: array
18346
20052
  items:
@@ -19087,6 +20793,7 @@ package main
19087
20793
 
19088
20794
  import (
19089
20795
  "fmt"
20796
+ "strings"
19090
20797
  "net/http"
19091
20798
  "io"
19092
20799
  )
@@ -19095,9 +20802,12 @@ func main() {
19095
20802
 
19096
20803
  url := "https://api.agentmail.to/v0/metrics?start_timestamp=2024-01-15T09%3A30%3A00Z&end_timestamp=2024-01-15T09%3A30%3A00Z"
19097
20804
 
19098
- req, _ := http.NewRequest("GET", url, nil)
20805
+ payload := strings.NewReader("{}")
20806
+
20807
+ req, _ := http.NewRequest("GET", url, payload)
19099
20808
 
19100
20809
  req.Header.Add("Authorization", "Bearer <api_key>")
20810
+ req.Header.Add("Content-Type", "application/json")
19101
20811
 
19102
20812
  res, _ := http.DefaultClient.Do(req)
19103
20813
 
@@ -19121,6 +20831,8 @@ http.use_ssl = true
19121
20831
 
19122
20832
  request = Net::HTTP::Get.new(url)
19123
20833
  request["Authorization"] = 'Bearer <api_key>'
20834
+ request["Content-Type"] = 'application/json'
20835
+ request.body = "{}"
19124
20836
 
19125
20837
  response = http.request(request)
19126
20838
  puts response.read_body
@@ -19129,6 +20841,8 @@ puts response.read_body
19129
20841
  ```java
19130
20842
  HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/metrics?start_timestamp=2024-01-15T09%3A30%3A00Z&end_timestamp=2024-01-15T09%3A30%3A00Z")
19131
20843
  .header("Authorization", "Bearer <api_key>")
20844
+ .header("Content-Type", "application/json")
20845
+ .body("{}")
19132
20846
  .asString();
19133
20847
  ```
19134
20848
 
@@ -19138,8 +20852,10 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/metrics
19138
20852
  $client = new \GuzzleHttp\Client();
19139
20853
 
19140
20854
  $response = $client->request('GET', 'https://api.agentmail.to/v0/metrics?start_timestamp=2024-01-15T09%3A30%3A00Z&end_timestamp=2024-01-15T09%3A30%3A00Z', [
20855
+ 'body' => '{}',
19141
20856
  'headers' => [
19142
20857
  'Authorization' => 'Bearer <api_key>',
20858
+ 'Content-Type' => 'application/json',
19143
20859
  ],
19144
20860
  ]);
19145
20861
 
@@ -19150,19 +20866,28 @@ echo $response->getBody();
19150
20866
  var client = new RestClient("https://api.agentmail.to/v0/metrics?start_timestamp=2024-01-15T09%3A30%3A00Z&end_timestamp=2024-01-15T09%3A30%3A00Z");
19151
20867
  var request = new RestRequest(Method.GET);
19152
20868
  request.AddHeader("Authorization", "Bearer <api_key>");
20869
+ request.AddHeader("Content-Type", "application/json");
20870
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
19153
20871
  IRestResponse response = client.Execute(request);
19154
20872
  ```
19155
20873
 
19156
20874
  ```swift
19157
20875
  import Foundation
19158
20876
 
19159
- let headers = ["Authorization": "Bearer <api_key>"]
20877
+ let headers = [
20878
+ "Authorization": "Bearer <api_key>",
20879
+ "Content-Type": "application/json"
20880
+ ]
20881
+ let parameters = [] as [String : Any]
20882
+
20883
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
19160
20884
 
19161
20885
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/metrics?start_timestamp=2024-01-15T09%3A30%3A00Z&end_timestamp=2024-01-15T09%3A30%3A00Z")! as URL,
19162
20886
  cachePolicy: .useProtocolCachePolicy,
19163
20887
  timeoutInterval: 10.0)
19164
20888
  request.httpMethod = "GET"
19165
20889
  request.allHTTPHeaderFields = headers
20890
+ request.httpBody = postData as Data
19166
20891
 
19167
20892
  let session = URLSession.shared
19168
20893
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
@@ -19311,6 +21036,7 @@ package main
19311
21036
 
19312
21037
  import (
19313
21038
  "fmt"
21039
+ "strings"
19314
21040
  "net/http"
19315
21041
  "io"
19316
21042
  )
@@ -19319,9 +21045,12 @@ func main() {
19319
21045
 
19320
21046
  url := "https://api.agentmail.to/v0/api-keys"
19321
21047
 
19322
- req, _ := http.NewRequest("GET", url, nil)
21048
+ payload := strings.NewReader("{}")
21049
+
21050
+ req, _ := http.NewRequest("GET", url, payload)
19323
21051
 
19324
21052
  req.Header.Add("Authorization", "Bearer <api_key>")
21053
+ req.Header.Add("Content-Type", "application/json")
19325
21054
 
19326
21055
  res, _ := http.DefaultClient.Do(req)
19327
21056
 
@@ -19345,6 +21074,8 @@ http.use_ssl = true
19345
21074
 
19346
21075
  request = Net::HTTP::Get.new(url)
19347
21076
  request["Authorization"] = 'Bearer <api_key>'
21077
+ request["Content-Type"] = 'application/json'
21078
+ request.body = "{}"
19348
21079
 
19349
21080
  response = http.request(request)
19350
21081
  puts response.read_body
@@ -19353,6 +21084,8 @@ puts response.read_body
19353
21084
  ```java
19354
21085
  HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/api-keys")
19355
21086
  .header("Authorization", "Bearer <api_key>")
21087
+ .header("Content-Type", "application/json")
21088
+ .body("{}")
19356
21089
  .asString();
19357
21090
  ```
19358
21091
 
@@ -19362,8 +21095,10 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/api-key
19362
21095
  $client = new \GuzzleHttp\Client();
19363
21096
 
19364
21097
  $response = $client->request('GET', 'https://api.agentmail.to/v0/api-keys', [
21098
+ 'body' => '{}',
19365
21099
  'headers' => [
19366
21100
  'Authorization' => 'Bearer <api_key>',
21101
+ 'Content-Type' => 'application/json',
19367
21102
  ],
19368
21103
  ]);
19369
21104
 
@@ -19374,19 +21109,28 @@ echo $response->getBody();
19374
21109
  var client = new RestClient("https://api.agentmail.to/v0/api-keys");
19375
21110
  var request = new RestRequest(Method.GET);
19376
21111
  request.AddHeader("Authorization", "Bearer <api_key>");
21112
+ request.AddHeader("Content-Type", "application/json");
21113
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
19377
21114
  IRestResponse response = client.Execute(request);
19378
21115
  ```
19379
21116
 
19380
21117
  ```swift
19381
21118
  import Foundation
19382
21119
 
19383
- let headers = ["Authorization": "Bearer <api_key>"]
21120
+ let headers = [
21121
+ "Authorization": "Bearer <api_key>",
21122
+ "Content-Type": "application/json"
21123
+ ]
21124
+ let parameters = [] as [String : Any]
21125
+
21126
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
19384
21127
 
19385
21128
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/api-keys")! as URL,
19386
21129
  cachePolicy: .useProtocolCachePolicy,
19387
21130
  timeoutInterval: 10.0)
19388
21131
  request.httpMethod = "GET"
19389
21132
  request.allHTTPHeaderFields = headers
21133
+ request.httpBody = postData as Data
19390
21134
 
19391
21135
  let session = URLSession.shared
19392
21136
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
@@ -19942,6 +21686,7 @@ package main
19942
21686
 
19943
21687
  import (
19944
21688
  "fmt"
21689
+ "strings"
19945
21690
  "net/http"
19946
21691
  "io"
19947
21692
  )
@@ -19950,9 +21695,12 @@ func main() {
19950
21695
 
19951
21696
  url := "https://api.agentmail.to/v0/pods"
19952
21697
 
19953
- req, _ := http.NewRequest("GET", url, nil)
21698
+ payload := strings.NewReader("{}")
21699
+
21700
+ req, _ := http.NewRequest("GET", url, payload)
19954
21701
 
19955
21702
  req.Header.Add("Authorization", "Bearer <api_key>")
21703
+ req.Header.Add("Content-Type", "application/json")
19956
21704
 
19957
21705
  res, _ := http.DefaultClient.Do(req)
19958
21706
 
@@ -19976,6 +21724,8 @@ http.use_ssl = true
19976
21724
 
19977
21725
  request = Net::HTTP::Get.new(url)
19978
21726
  request["Authorization"] = 'Bearer <api_key>'
21727
+ request["Content-Type"] = 'application/json'
21728
+ request.body = "{}"
19979
21729
 
19980
21730
  response = http.request(request)
19981
21731
  puts response.read_body
@@ -19984,6 +21734,8 @@ puts response.read_body
19984
21734
  ```java
19985
21735
  HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods")
19986
21736
  .header("Authorization", "Bearer <api_key>")
21737
+ .header("Content-Type", "application/json")
21738
+ .body("{}")
19987
21739
  .asString();
19988
21740
  ```
19989
21741
 
@@ -19993,8 +21745,10 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods")
19993
21745
  $client = new \GuzzleHttp\Client();
19994
21746
 
19995
21747
  $response = $client->request('GET', 'https://api.agentmail.to/v0/pods', [
21748
+ 'body' => '{}',
19996
21749
  'headers' => [
19997
21750
  'Authorization' => 'Bearer <api_key>',
21751
+ 'Content-Type' => 'application/json',
19998
21752
  ],
19999
21753
  ]);
20000
21754
 
@@ -20005,19 +21759,28 @@ echo $response->getBody();
20005
21759
  var client = new RestClient("https://api.agentmail.to/v0/pods");
20006
21760
  var request = new RestRequest(Method.GET);
20007
21761
  request.AddHeader("Authorization", "Bearer <api_key>");
21762
+ request.AddHeader("Content-Type", "application/json");
21763
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
20008
21764
  IRestResponse response = client.Execute(request);
20009
21765
  ```
20010
21766
 
20011
21767
  ```swift
20012
21768
  import Foundation
20013
21769
 
20014
- let headers = ["Authorization": "Bearer <api_key>"]
21770
+ let headers = [
21771
+ "Authorization": "Bearer <api_key>",
21772
+ "Content-Type": "application/json"
21773
+ ]
21774
+ let parameters = [] as [String : Any]
21775
+
21776
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
20015
21777
 
20016
21778
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods")! as URL,
20017
21779
  cachePolicy: .useProtocolCachePolicy,
20018
21780
  timeoutInterval: 10.0)
20019
21781
  request.httpMethod = "GET"
20020
21782
  request.allHTTPHeaderFields = headers
21783
+ request.httpBody = postData as Data
20021
21784
 
20022
21785
  let session = URLSession.shared
20023
21786
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
@@ -20144,6 +21907,7 @@ package main
20144
21907
 
20145
21908
  import (
20146
21909
  "fmt"
21910
+ "strings"
20147
21911
  "net/http"
20148
21912
  "io"
20149
21913
  )
@@ -20152,9 +21916,12 @@ func main() {
20152
21916
 
20153
21917
  url := "https://api.agentmail.to/v0/pods/pod_id"
20154
21918
 
20155
- req, _ := http.NewRequest("GET", url, nil)
21919
+ payload := strings.NewReader("{}")
21920
+
21921
+ req, _ := http.NewRequest("GET", url, payload)
20156
21922
 
20157
21923
  req.Header.Add("Authorization", "Bearer <api_key>")
21924
+ req.Header.Add("Content-Type", "application/json")
20158
21925
 
20159
21926
  res, _ := http.DefaultClient.Do(req)
20160
21927
 
@@ -20178,6 +21945,8 @@ http.use_ssl = true
20178
21945
 
20179
21946
  request = Net::HTTP::Get.new(url)
20180
21947
  request["Authorization"] = 'Bearer <api_key>'
21948
+ request["Content-Type"] = 'application/json'
21949
+ request.body = "{}"
20181
21950
 
20182
21951
  response = http.request(request)
20183
21952
  puts response.read_body
@@ -20186,6 +21955,8 @@ puts response.read_body
20186
21955
  ```java
20187
21956
  HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/pod_id")
20188
21957
  .header("Authorization", "Bearer <api_key>")
21958
+ .header("Content-Type", "application/json")
21959
+ .body("{}")
20189
21960
  .asString();
20190
21961
  ```
20191
21962
 
@@ -20195,8 +21966,10 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/po
20195
21966
  $client = new \GuzzleHttp\Client();
20196
21967
 
20197
21968
  $response = $client->request('GET', 'https://api.agentmail.to/v0/pods/pod_id', [
21969
+ 'body' => '{}',
20198
21970
  'headers' => [
20199
21971
  'Authorization' => 'Bearer <api_key>',
21972
+ 'Content-Type' => 'application/json',
20200
21973
  ],
20201
21974
  ]);
20202
21975
 
@@ -20207,19 +21980,28 @@ echo $response->getBody();
20207
21980
  var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id");
20208
21981
  var request = new RestRequest(Method.GET);
20209
21982
  request.AddHeader("Authorization", "Bearer <api_key>");
21983
+ request.AddHeader("Content-Type", "application/json");
21984
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
20210
21985
  IRestResponse response = client.Execute(request);
20211
21986
  ```
20212
21987
 
20213
21988
  ```swift
20214
21989
  import Foundation
20215
21990
 
20216
- let headers = ["Authorization": "Bearer <api_key>"]
21991
+ let headers = [
21992
+ "Authorization": "Bearer <api_key>",
21993
+ "Content-Type": "application/json"
21994
+ ]
21995
+ let parameters = [] as [String : Any]
21996
+
21997
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
20217
21998
 
20218
21999
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id")! as URL,
20219
22000
  cachePolicy: .useProtocolCachePolicy,
20220
22001
  timeoutInterval: 10.0)
20221
22002
  request.httpMethod = "GET"
20222
22003
  request.allHTTPHeaderFields = headers
22004
+ request.httpBody = postData as Data
20223
22005
 
20224
22006
  let session = URLSession.shared
20225
22007
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
@@ -20783,6 +22565,7 @@ package main
20783
22565
 
20784
22566
  import (
20785
22567
  "fmt"
22568
+ "strings"
20786
22569
  "net/http"
20787
22570
  "io"
20788
22571
  )
@@ -20791,9 +22574,12 @@ func main() {
20791
22574
 
20792
22575
  url := "https://api.agentmail.to/v0/pods/pod_id/inboxes"
20793
22576
 
20794
- req, _ := http.NewRequest("GET", url, nil)
22577
+ payload := strings.NewReader("{}")
22578
+
22579
+ req, _ := http.NewRequest("GET", url, payload)
20795
22580
 
20796
22581
  req.Header.Add("Authorization", "Bearer <api_key>")
22582
+ req.Header.Add("Content-Type", "application/json")
20797
22583
 
20798
22584
  res, _ := http.DefaultClient.Do(req)
20799
22585
 
@@ -20817,6 +22603,8 @@ http.use_ssl = true
20817
22603
 
20818
22604
  request = Net::HTTP::Get.new(url)
20819
22605
  request["Authorization"] = 'Bearer <api_key>'
22606
+ request["Content-Type"] = 'application/json'
22607
+ request.body = "{}"
20820
22608
 
20821
22609
  response = http.request(request)
20822
22610
  puts response.read_body
@@ -20825,6 +22613,8 @@ puts response.read_body
20825
22613
  ```java
20826
22614
  HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/pod_id/inboxes")
20827
22615
  .header("Authorization", "Bearer <api_key>")
22616
+ .header("Content-Type", "application/json")
22617
+ .body("{}")
20828
22618
  .asString();
20829
22619
  ```
20830
22620
 
@@ -20834,8 +22624,10 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/po
20834
22624
  $client = new \GuzzleHttp\Client();
20835
22625
 
20836
22626
  $response = $client->request('GET', 'https://api.agentmail.to/v0/pods/pod_id/inboxes', [
22627
+ 'body' => '{}',
20837
22628
  'headers' => [
20838
22629
  'Authorization' => 'Bearer <api_key>',
22630
+ 'Content-Type' => 'application/json',
20839
22631
  ],
20840
22632
  ]);
20841
22633
 
@@ -20846,19 +22638,28 @@ echo $response->getBody();
20846
22638
  var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/inboxes");
20847
22639
  var request = new RestRequest(Method.GET);
20848
22640
  request.AddHeader("Authorization", "Bearer <api_key>");
22641
+ request.AddHeader("Content-Type", "application/json");
22642
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
20849
22643
  IRestResponse response = client.Execute(request);
20850
22644
  ```
20851
22645
 
20852
22646
  ```swift
20853
22647
  import Foundation
20854
22648
 
20855
- let headers = ["Authorization": "Bearer <api_key>"]
22649
+ let headers = [
22650
+ "Authorization": "Bearer <api_key>",
22651
+ "Content-Type": "application/json"
22652
+ ]
22653
+ let parameters = [] as [String : Any]
22654
+
22655
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
20856
22656
 
20857
22657
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/inboxes")! as URL,
20858
22658
  cachePolicy: .useProtocolCachePolicy,
20859
22659
  timeoutInterval: 10.0)
20860
22660
  request.httpMethod = "GET"
20861
22661
  request.allHTTPHeaderFields = headers
22662
+ request.httpBody = postData as Data
20862
22663
 
20863
22664
  let session = URLSession.shared
20864
22665
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
@@ -20996,6 +22797,7 @@ package main
20996
22797
 
20997
22798
  import (
20998
22799
  "fmt"
22800
+ "strings"
20999
22801
  "net/http"
21000
22802
  "io"
21001
22803
  )
@@ -21004,9 +22806,12 @@ func main() {
21004
22806
 
21005
22807
  url := "https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id"
21006
22808
 
21007
- req, _ := http.NewRequest("GET", url, nil)
22809
+ payload := strings.NewReader("{}")
22810
+
22811
+ req, _ := http.NewRequest("GET", url, payload)
21008
22812
 
21009
22813
  req.Header.Add("Authorization", "Bearer <api_key>")
22814
+ req.Header.Add("Content-Type", "application/json")
21010
22815
 
21011
22816
  res, _ := http.DefaultClient.Do(req)
21012
22817
 
@@ -21030,6 +22835,8 @@ http.use_ssl = true
21030
22835
 
21031
22836
  request = Net::HTTP::Get.new(url)
21032
22837
  request["Authorization"] = 'Bearer <api_key>'
22838
+ request["Content-Type"] = 'application/json'
22839
+ request.body = "{}"
21033
22840
 
21034
22841
  response = http.request(request)
21035
22842
  puts response.read_body
@@ -21038,6 +22845,8 @@ puts response.read_body
21038
22845
  ```java
21039
22846
  HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id")
21040
22847
  .header("Authorization", "Bearer <api_key>")
22848
+ .header("Content-Type", "application/json")
22849
+ .body("{}")
21041
22850
  .asString();
21042
22851
  ```
21043
22852
 
@@ -21047,8 +22856,10 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/po
21047
22856
  $client = new \GuzzleHttp\Client();
21048
22857
 
21049
22858
  $response = $client->request('GET', 'https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id', [
22859
+ 'body' => '{}',
21050
22860
  'headers' => [
21051
22861
  'Authorization' => 'Bearer <api_key>',
22862
+ 'Content-Type' => 'application/json',
21052
22863
  ],
21053
22864
  ]);
21054
22865
 
@@ -21059,19 +22870,28 @@ echo $response->getBody();
21059
22870
  var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id");
21060
22871
  var request = new RestRequest(Method.GET);
21061
22872
  request.AddHeader("Authorization", "Bearer <api_key>");
22873
+ request.AddHeader("Content-Type", "application/json");
22874
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
21062
22875
  IRestResponse response = client.Execute(request);
21063
22876
  ```
21064
22877
 
21065
22878
  ```swift
21066
22879
  import Foundation
21067
22880
 
21068
- let headers = ["Authorization": "Bearer <api_key>"]
22881
+ let headers = [
22882
+ "Authorization": "Bearer <api_key>",
22883
+ "Content-Type": "application/json"
22884
+ ]
22885
+ let parameters = [] as [String : Any]
22886
+
22887
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
21069
22888
 
21070
22889
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id")! as URL,
21071
22890
  cachePolicy: .useProtocolCachePolicy,
21072
22891
  timeoutInterval: 10.0)
21073
22892
  request.httpMethod = "GET"
21074
22893
  request.allHTTPHeaderFields = headers
22894
+ request.httpBody = postData as Data
21075
22895
 
21076
22896
  let session = URLSession.shared
21077
22897
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
@@ -21651,12 +23471,17 @@ components:
21651
23471
  type: string
21652
23472
  type_attachments:AttachmentFilename:
21653
23473
  type: string
21654
- type_attachments:AttachmentContentType:
21655
- type: string
21656
23474
  type_attachments:AttachmentSize:
21657
23475
  type: integer
21658
- type_attachments:AttachmentInline:
21659
- type: boolean
23476
+ type_attachments:AttachmentContentType:
23477
+ type: string
23478
+ type_attachments:AttachmentContentDisposition:
23479
+ type: string
23480
+ enum:
23481
+ - value: inline
23482
+ - value: attachment
23483
+ type_attachments:AttachmentContentId:
23484
+ type: string
21660
23485
  type_attachments:Attachment:
21661
23486
  type: object
21662
23487
  properties:
@@ -21664,16 +23489,17 @@ components:
21664
23489
  $ref: '#/components/schemas/type_attachments:AttachmentId'
21665
23490
  filename:
21666
23491
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
21667
- content_type:
21668
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
21669
23492
  size:
21670
23493
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
21671
- inline:
21672
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
23494
+ content_type:
23495
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
23496
+ content_disposition:
23497
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
23498
+ content_id:
23499
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
21673
23500
  required:
21674
23501
  - attachment_id
21675
23502
  - size
21676
- - inline
21677
23503
  type_threads:ThreadAttachments:
21678
23504
  type: array
21679
23505
  items:
@@ -21794,6 +23620,7 @@ package main
21794
23620
 
21795
23621
  import (
21796
23622
  "fmt"
23623
+ "strings"
21797
23624
  "net/http"
21798
23625
  "io"
21799
23626
  )
@@ -21802,9 +23629,12 @@ func main() {
21802
23629
 
21803
23630
  url := "https://api.agentmail.to/v0/pods/pod_id/threads"
21804
23631
 
21805
- req, _ := http.NewRequest("GET", url, nil)
23632
+ payload := strings.NewReader("{}")
23633
+
23634
+ req, _ := http.NewRequest("GET", url, payload)
21806
23635
 
21807
23636
  req.Header.Add("Authorization", "Bearer <api_key>")
23637
+ req.Header.Add("Content-Type", "application/json")
21808
23638
 
21809
23639
  res, _ := http.DefaultClient.Do(req)
21810
23640
 
@@ -21828,6 +23658,8 @@ http.use_ssl = true
21828
23658
 
21829
23659
  request = Net::HTTP::Get.new(url)
21830
23660
  request["Authorization"] = 'Bearer <api_key>'
23661
+ request["Content-Type"] = 'application/json'
23662
+ request.body = "{}"
21831
23663
 
21832
23664
  response = http.request(request)
21833
23665
  puts response.read_body
@@ -21836,6 +23668,8 @@ puts response.read_body
21836
23668
  ```java
21837
23669
  HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/pod_id/threads")
21838
23670
  .header("Authorization", "Bearer <api_key>")
23671
+ .header("Content-Type", "application/json")
23672
+ .body("{}")
21839
23673
  .asString();
21840
23674
  ```
21841
23675
 
@@ -21845,8 +23679,10 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/po
21845
23679
  $client = new \GuzzleHttp\Client();
21846
23680
 
21847
23681
  $response = $client->request('GET', 'https://api.agentmail.to/v0/pods/pod_id/threads', [
23682
+ 'body' => '{}',
21848
23683
  'headers' => [
21849
23684
  'Authorization' => 'Bearer <api_key>',
23685
+ 'Content-Type' => 'application/json',
21850
23686
  ],
21851
23687
  ]);
21852
23688
 
@@ -21857,19 +23693,28 @@ echo $response->getBody();
21857
23693
  var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/threads");
21858
23694
  var request = new RestRequest(Method.GET);
21859
23695
  request.AddHeader("Authorization", "Bearer <api_key>");
23696
+ request.AddHeader("Content-Type", "application/json");
23697
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
21860
23698
  IRestResponse response = client.Execute(request);
21861
23699
  ```
21862
23700
 
21863
23701
  ```swift
21864
23702
  import Foundation
21865
23703
 
21866
- let headers = ["Authorization": "Bearer <api_key>"]
23704
+ let headers = [
23705
+ "Authorization": "Bearer <api_key>",
23706
+ "Content-Type": "application/json"
23707
+ ]
23708
+ let parameters = [] as [String : Any]
23709
+
23710
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
21867
23711
 
21868
23712
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/threads")! as URL,
21869
23713
  cachePolicy: .useProtocolCachePolicy,
21870
23714
  timeoutInterval: 10.0)
21871
23715
  request.httpMethod = "GET"
21872
23716
  request.allHTTPHeaderFields = headers
23717
+ request.httpBody = postData as Data
21873
23718
 
21874
23719
  let session = URLSession.shared
21875
23720
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
@@ -21971,12 +23816,17 @@ components:
21971
23816
  type: string
21972
23817
  type_attachments:AttachmentFilename:
21973
23818
  type: string
21974
- type_attachments:AttachmentContentType:
21975
- type: string
21976
23819
  type_attachments:AttachmentSize:
21977
23820
  type: integer
21978
- type_attachments:AttachmentInline:
21979
- type: boolean
23821
+ type_attachments:AttachmentContentType:
23822
+ type: string
23823
+ type_attachments:AttachmentContentDisposition:
23824
+ type: string
23825
+ enum:
23826
+ - value: inline
23827
+ - value: attachment
23828
+ type_attachments:AttachmentContentId:
23829
+ type: string
21980
23830
  type_attachments:Attachment:
21981
23831
  type: object
21982
23832
  properties:
@@ -21984,16 +23834,17 @@ components:
21984
23834
  $ref: '#/components/schemas/type_attachments:AttachmentId'
21985
23835
  filename:
21986
23836
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
21987
- content_type:
21988
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
21989
23837
  size:
21990
23838
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
21991
- inline:
21992
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
23839
+ content_type:
23840
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
23841
+ content_disposition:
23842
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
23843
+ content_id:
23844
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
21993
23845
  required:
21994
23846
  - attachment_id
21995
23847
  - size
21996
- - inline
21997
23848
  type_threads:ThreadAttachments:
21998
23849
  type: array
21999
23850
  items:
@@ -22363,10 +24214,9 @@ paths:
22363
24214
  '200':
22364
24215
  description: Response with status 200
22365
24216
  content:
22366
- application/octet-stream:
24217
+ application/json:
22367
24218
  schema:
22368
- type: string
22369
- format: binary
24219
+ $ref: '#/components/schemas/type_attachments:AttachmentResponse'
22370
24220
  '404':
22371
24221
  description: Error response with status 404
22372
24222
  content: {}
@@ -22378,6 +24228,46 @@ components:
22378
24228
  type: string
22379
24229
  type_attachments:AttachmentId:
22380
24230
  type: string
24231
+ type_attachments:AttachmentFilename:
24232
+ type: string
24233
+ type_attachments:AttachmentSize:
24234
+ type: integer
24235
+ type_attachments:AttachmentContentType:
24236
+ type: string
24237
+ type_attachments:AttachmentContentDisposition:
24238
+ type: string
24239
+ enum:
24240
+ - value: inline
24241
+ - value: attachment
24242
+ type_attachments:AttachmentContentId:
24243
+ type: string
24244
+ type_attachments:AttachmentResponse:
24245
+ type: object
24246
+ properties:
24247
+ attachment_id:
24248
+ $ref: '#/components/schemas/type_attachments:AttachmentId'
24249
+ filename:
24250
+ $ref: '#/components/schemas/type_attachments:AttachmentFilename'
24251
+ size:
24252
+ $ref: '#/components/schemas/type_attachments:AttachmentSize'
24253
+ content_type:
24254
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
24255
+ content_disposition:
24256
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
24257
+ content_id:
24258
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
24259
+ download_url:
24260
+ type: string
24261
+ description: URL to download the attachment.
24262
+ expires_at:
24263
+ type: string
24264
+ format: date-time
24265
+ description: Time at which the download URL expires.
24266
+ required:
24267
+ - attachment_id
24268
+ - size
24269
+ - download_url
24270
+ - expires_at
22381
24271
 
22382
24272
  ```
22383
24273
 
@@ -22391,7 +24281,7 @@ async function main() {
22391
24281
  environment: "https://api.agentmail.to",
22392
24282
  apiKey: "YOUR_TOKEN_HERE",
22393
24283
  });
22394
- await client.pods.threads.getAttachment(":pod_id", ":thread_id", ":attachment_id");
24284
+ await client.pods.threads.getAttachment("pod_id", "thread_id", "attachment_id");
22395
24285
  }
22396
24286
  main();
22397
24287
 
@@ -22406,9 +24296,9 @@ client = AgentMail(
22406
24296
  )
22407
24297
 
22408
24298
  client.pods.threads.get_attachment(
22409
- pod_id=":pod_id",
22410
- thread_id=":thread_id",
22411
- attachment_id=":attachment_id"
24299
+ pod_id="pod_id",
24300
+ thread_id="thread_id",
24301
+ attachment_id="attachment_id"
22412
24302
  )
22413
24303
 
22414
24304
  ```
@@ -22424,7 +24314,7 @@ import (
22424
24314
 
22425
24315
  func main() {
22426
24316
 
22427
- url := "https://api.agentmail.to/v0/pods/%3Apod_id/threads/%3Athread_id/attachments/%3Aattachment_id"
24317
+ url := "https://api.agentmail.to/v0/pods/pod_id/threads/thread_id/attachments/attachment_id"
22428
24318
 
22429
24319
  req, _ := http.NewRequest("GET", url, nil)
22430
24320
 
@@ -22445,7 +24335,7 @@ func main() {
22445
24335
  require 'uri'
22446
24336
  require 'net/http'
22447
24337
 
22448
- url = URI("https://api.agentmail.to/v0/pods/%3Apod_id/threads/%3Athread_id/attachments/%3Aattachment_id")
24338
+ url = URI("https://api.agentmail.to/v0/pods/pod_id/threads/thread_id/attachments/attachment_id")
22449
24339
 
22450
24340
  http = Net::HTTP.new(url.host, url.port)
22451
24341
  http.use_ssl = true
@@ -22458,7 +24348,7 @@ puts response.read_body
22458
24348
  ```
22459
24349
 
22460
24350
  ```java
22461
- HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/%3Apod_id/threads/%3Athread_id/attachments/%3Aattachment_id")
24351
+ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/pod_id/threads/thread_id/attachments/attachment_id")
22462
24352
  .header("Authorization", "Bearer <api_key>")
22463
24353
  .asString();
22464
24354
  ```
@@ -22468,7 +24358,7 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/%3
22468
24358
 
22469
24359
  $client = new \GuzzleHttp\Client();
22470
24360
 
22471
- $response = $client->request('GET', 'https://api.agentmail.to/v0/pods/%3Apod_id/threads/%3Athread_id/attachments/%3Aattachment_id', [
24361
+ $response = $client->request('GET', 'https://api.agentmail.to/v0/pods/pod_id/threads/thread_id/attachments/attachment_id', [
22472
24362
  'headers' => [
22473
24363
  'Authorization' => 'Bearer <api_key>',
22474
24364
  ],
@@ -22478,7 +24368,7 @@ echo $response->getBody();
22478
24368
  ```
22479
24369
 
22480
24370
  ```csharp
22481
- var client = new RestClient("https://api.agentmail.to/v0/pods/%3Apod_id/threads/%3Athread_id/attachments/%3Aattachment_id");
24371
+ var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/threads/thread_id/attachments/attachment_id");
22482
24372
  var request = new RestRequest(Method.GET);
22483
24373
  request.AddHeader("Authorization", "Bearer <api_key>");
22484
24374
  IRestResponse response = client.Execute(request);
@@ -22489,7 +24379,7 @@ import Foundation
22489
24379
 
22490
24380
  let headers = ["Authorization": "Bearer <api_key>"]
22491
24381
 
22492
- let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/%3Apod_id/threads/%3Athread_id/attachments/%3Aattachment_id")! as URL,
24382
+ let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/threads/thread_id/attachments/attachment_id")! as URL,
22493
24383
  cachePolicy: .useProtocolCachePolicy,
22494
24384
  timeoutInterval: 10.0)
22495
24385
  request.httpMethod = "GET"
@@ -22635,12 +24525,17 @@ components:
22635
24525
  type: string
22636
24526
  type_attachments:AttachmentFilename:
22637
24527
  type: string
22638
- type_attachments:AttachmentContentType:
22639
- type: string
22640
24528
  type_attachments:AttachmentSize:
22641
24529
  type: integer
22642
- type_attachments:AttachmentInline:
22643
- type: boolean
24530
+ type_attachments:AttachmentContentType:
24531
+ type: string
24532
+ type_attachments:AttachmentContentDisposition:
24533
+ type: string
24534
+ enum:
24535
+ - value: inline
24536
+ - value: attachment
24537
+ type_attachments:AttachmentContentId:
24538
+ type: string
22644
24539
  type_attachments:Attachment:
22645
24540
  type: object
22646
24541
  properties:
@@ -22648,16 +24543,17 @@ components:
22648
24543
  $ref: '#/components/schemas/type_attachments:AttachmentId'
22649
24544
  filename:
22650
24545
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
22651
- content_type:
22652
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
22653
24546
  size:
22654
24547
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
22655
- inline:
22656
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
24548
+ content_type:
24549
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
24550
+ content_disposition:
24551
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
24552
+ content_id:
24553
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
22657
24554
  required:
22658
24555
  - attachment_id
22659
24556
  - size
22660
- - inline
22661
24557
  type_drafts:DraftAttachments:
22662
24558
  type: array
22663
24559
  items:
@@ -22948,12 +24844,17 @@ components:
22948
24844
  type: string
22949
24845
  type_attachments:AttachmentFilename:
22950
24846
  type: string
22951
- type_attachments:AttachmentContentType:
22952
- type: string
22953
24847
  type_attachments:AttachmentSize:
22954
24848
  type: integer
22955
- type_attachments:AttachmentInline:
22956
- type: boolean
24849
+ type_attachments:AttachmentContentType:
24850
+ type: string
24851
+ type_attachments:AttachmentContentDisposition:
24852
+ type: string
24853
+ enum:
24854
+ - value: inline
24855
+ - value: attachment
24856
+ type_attachments:AttachmentContentId:
24857
+ type: string
22957
24858
  type_attachments:Attachment:
22958
24859
  type: object
22959
24860
  properties:
@@ -22961,16 +24862,17 @@ components:
22961
24862
  $ref: '#/components/schemas/type_attachments:AttachmentId'
22962
24863
  filename:
22963
24864
  $ref: '#/components/schemas/type_attachments:AttachmentFilename'
22964
- content_type:
22965
- $ref: '#/components/schemas/type_attachments:AttachmentContentType'
22966
24865
  size:
22967
24866
  $ref: '#/components/schemas/type_attachments:AttachmentSize'
22968
- inline:
22969
- $ref: '#/components/schemas/type_attachments:AttachmentInline'
24867
+ content_type:
24868
+ $ref: '#/components/schemas/type_attachments:AttachmentContentType'
24869
+ content_disposition:
24870
+ $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
24871
+ content_id:
24872
+ $ref: '#/components/schemas/type_attachments:AttachmentContentId'
22970
24873
  required:
22971
24874
  - attachment_id
22972
24875
  - size
22973
- - inline
22974
24876
  type_drafts:DraftAttachments:
22975
24877
  type: array
22976
24878
  items:
@@ -23323,6 +25225,7 @@ package main
23323
25225
 
23324
25226
  import (
23325
25227
  "fmt"
25228
+ "strings"
23326
25229
  "net/http"
23327
25230
  "io"
23328
25231
  )
@@ -23331,9 +25234,12 @@ func main() {
23331
25234
 
23332
25235
  url := "https://api.agentmail.to/v0/pods/pod_id/domains"
23333
25236
 
23334
- req, _ := http.NewRequest("GET", url, nil)
25237
+ payload := strings.NewReader("{}")
25238
+
25239
+ req, _ := http.NewRequest("GET", url, payload)
23335
25240
 
23336
25241
  req.Header.Add("Authorization", "Bearer <api_key>")
25242
+ req.Header.Add("Content-Type", "application/json")
23337
25243
 
23338
25244
  res, _ := http.DefaultClient.Do(req)
23339
25245
 
@@ -23357,6 +25263,8 @@ http.use_ssl = true
23357
25263
 
23358
25264
  request = Net::HTTP::Get.new(url)
23359
25265
  request["Authorization"] = 'Bearer <api_key>'
25266
+ request["Content-Type"] = 'application/json'
25267
+ request.body = "{}"
23360
25268
 
23361
25269
  response = http.request(request)
23362
25270
  puts response.read_body
@@ -23365,6 +25273,8 @@ puts response.read_body
23365
25273
  ```java
23366
25274
  HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/pod_id/domains")
23367
25275
  .header("Authorization", "Bearer <api_key>")
25276
+ .header("Content-Type", "application/json")
25277
+ .body("{}")
23368
25278
  .asString();
23369
25279
  ```
23370
25280
 
@@ -23374,8 +25284,10 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/po
23374
25284
  $client = new \GuzzleHttp\Client();
23375
25285
 
23376
25286
  $response = $client->request('GET', 'https://api.agentmail.to/v0/pods/pod_id/domains', [
25287
+ 'body' => '{}',
23377
25288
  'headers' => [
23378
25289
  'Authorization' => 'Bearer <api_key>',
25290
+ 'Content-Type' => 'application/json',
23379
25291
  ],
23380
25292
  ]);
23381
25293
 
@@ -23386,19 +25298,28 @@ echo $response->getBody();
23386
25298
  var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/domains");
23387
25299
  var request = new RestRequest(Method.GET);
23388
25300
  request.AddHeader("Authorization", "Bearer <api_key>");
25301
+ request.AddHeader("Content-Type", "application/json");
25302
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
23389
25303
  IRestResponse response = client.Execute(request);
23390
25304
  ```
23391
25305
 
23392
25306
  ```swift
23393
25307
  import Foundation
23394
25308
 
23395
- let headers = ["Authorization": "Bearer <api_key>"]
25309
+ let headers = [
25310
+ "Authorization": "Bearer <api_key>",
25311
+ "Content-Type": "application/json"
25312
+ ]
25313
+ let parameters = [] as [String : Any]
25314
+
25315
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
23396
25316
 
23397
25317
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/domains")! as URL,
23398
25318
  cachePolicy: .useProtocolCachePolicy,
23399
25319
  timeoutInterval: 10.0)
23400
25320
  request.httpMethod = "GET"
23401
25321
  request.allHTTPHeaderFields = headers
25322
+ request.httpBody = postData as Data
23402
25323
 
23403
25324
  let session = URLSession.shared
23404
25325
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
@@ -23578,7 +25499,7 @@ async function main() {
23578
25499
  apiKey: "YOUR_TOKEN_HERE",
23579
25500
  });
23580
25501
  await client.pods.domains.create("pod_id", {
23581
- domain: "domain",
25502
+ domain: "example.com",
23582
25503
  feedbackEnabled: true,
23583
25504
  });
23584
25505
  }
@@ -23596,7 +25517,7 @@ client = AgentMail(
23596
25517
 
23597
25518
  client.pods.domains.create(
23598
25519
  pod_id="pod_id",
23599
- domain="domain",
25520
+ domain="example.com",
23600
25521
  feedback_enabled=True
23601
25522
  )
23602
25523
 
@@ -23616,7 +25537,7 @@ func main() {
23616
25537
 
23617
25538
  url := "https://api.agentmail.to/v0/pods/pod_id/domains"
23618
25539
 
23619
- payload := strings.NewReader("{\n \"domain\": \"domain\",\n \"feedback_enabled\": true\n}")
25540
+ payload := strings.NewReader("{\n \"domain\": \"example.com\",\n \"feedback_enabled\": true\n}")
23620
25541
 
23621
25542
  req, _ := http.NewRequest("POST", url, payload)
23622
25543
 
@@ -23646,7 +25567,7 @@ http.use_ssl = true
23646
25567
  request = Net::HTTP::Post.new(url)
23647
25568
  request["Authorization"] = 'Bearer <api_key>'
23648
25569
  request["Content-Type"] = 'application/json'
23649
- request.body = "{\n \"domain\": \"domain\",\n \"feedback_enabled\": true\n}"
25570
+ request.body = "{\n \"domain\": \"example.com\",\n \"feedback_enabled\": true\n}"
23650
25571
 
23651
25572
  response = http.request(request)
23652
25573
  puts response.read_body
@@ -23656,7 +25577,7 @@ puts response.read_body
23656
25577
  HttpResponse<String> response = Unirest.post("https://api.agentmail.to/v0/pods/pod_id/domains")
23657
25578
  .header("Authorization", "Bearer <api_key>")
23658
25579
  .header("Content-Type", "application/json")
23659
- .body("{\n \"domain\": \"domain\",\n \"feedback_enabled\": true\n}")
25580
+ .body("{\n \"domain\": \"example.com\",\n \"feedback_enabled\": true\n}")
23660
25581
  .asString();
23661
25582
  ```
23662
25583
 
@@ -23667,7 +25588,7 @@ $client = new \GuzzleHttp\Client();
23667
25588
 
23668
25589
  $response = $client->request('POST', 'https://api.agentmail.to/v0/pods/pod_id/domains', [
23669
25590
  'body' => '{
23670
- "domain": "domain",
25591
+ "domain": "example.com",
23671
25592
  "feedback_enabled": true
23672
25593
  }',
23673
25594
  'headers' => [
@@ -23684,7 +25605,7 @@ var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/domains");
23684
25605
  var request = new RestRequest(Method.POST);
23685
25606
  request.AddHeader("Authorization", "Bearer <api_key>");
23686
25607
  request.AddHeader("Content-Type", "application/json");
23687
- request.AddParameter("application/json", "{\n \"domain\": \"domain\",\n \"feedback_enabled\": true\n}", ParameterType.RequestBody);
25608
+ request.AddParameter("application/json", "{\n \"domain\": \"example.com\",\n \"feedback_enabled\": true\n}", ParameterType.RequestBody);
23688
25609
  IRestResponse response = client.Execute(request);
23689
25610
  ```
23690
25611
 
@@ -23696,7 +25617,7 @@ let headers = [
23696
25617
  "Content-Type": "application/json"
23697
25618
  ]
23698
25619
  let parameters = [
23699
- "domain": "domain",
25620
+ "domain": "example.com",
23700
25621
  "feedback_enabled": true
23701
25622
  ] as [String : Any]
23702
25623
 
@@ -24013,6 +25934,7 @@ package main
24013
25934
 
24014
25935
  import (
24015
25936
  "fmt"
25937
+ "strings"
24016
25938
  "net/http"
24017
25939
  "io"
24018
25940
  )
@@ -24021,9 +25943,12 @@ func main() {
24021
25943
 
24022
25944
  url := "https://api.agentmail.to/v0/organizations"
24023
25945
 
24024
- req, _ := http.NewRequest("GET", url, nil)
25946
+ payload := strings.NewReader("{}")
25947
+
25948
+ req, _ := http.NewRequest("GET", url, payload)
24025
25949
 
24026
25950
  req.Header.Add("Authorization", "Bearer <api_key>")
25951
+ req.Header.Add("Content-Type", "application/json")
24027
25952
 
24028
25953
  res, _ := http.DefaultClient.Do(req)
24029
25954
 
@@ -24047,6 +25972,8 @@ http.use_ssl = true
24047
25972
 
24048
25973
  request = Net::HTTP::Get.new(url)
24049
25974
  request["Authorization"] = 'Bearer <api_key>'
25975
+ request["Content-Type"] = 'application/json'
25976
+ request.body = "{}"
24050
25977
 
24051
25978
  response = http.request(request)
24052
25979
  puts response.read_body
@@ -24055,6 +25982,8 @@ puts response.read_body
24055
25982
  ```java
24056
25983
  HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/organizations")
24057
25984
  .header("Authorization", "Bearer <api_key>")
25985
+ .header("Content-Type", "application/json")
25986
+ .body("{}")
24058
25987
  .asString();
24059
25988
  ```
24060
25989
 
@@ -24064,8 +25993,10 @@ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/organiz
24064
25993
  $client = new \GuzzleHttp\Client();
24065
25994
 
24066
25995
  $response = $client->request('GET', 'https://api.agentmail.to/v0/organizations', [
25996
+ 'body' => '{}',
24067
25997
  'headers' => [
24068
25998
  'Authorization' => 'Bearer <api_key>',
25999
+ 'Content-Type' => 'application/json',
24069
26000
  ],
24070
26001
  ]);
24071
26002
 
@@ -24076,19 +26007,28 @@ echo $response->getBody();
24076
26007
  var client = new RestClient("https://api.agentmail.to/v0/organizations");
24077
26008
  var request = new RestRequest(Method.GET);
24078
26009
  request.AddHeader("Authorization", "Bearer <api_key>");
26010
+ request.AddHeader("Content-Type", "application/json");
26011
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
24079
26012
  IRestResponse response = client.Execute(request);
24080
26013
  ```
24081
26014
 
24082
26015
  ```swift
24083
26016
  import Foundation
24084
26017
 
24085
- let headers = ["Authorization": "Bearer <api_key>"]
26018
+ let headers = [
26019
+ "Authorization": "Bearer <api_key>",
26020
+ "Content-Type": "application/json"
26021
+ ]
26022
+ let parameters = [] as [String : Any]
26023
+
26024
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
24086
26025
 
24087
26026
  let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/organizations")! as URL,
24088
26027
  cachePolicy: .useProtocolCachePolicy,
24089
26028
  timeoutInterval: 10.0)
24090
26029
  request.httpMethod = "GET"
24091
26030
  request.allHTTPHeaderFields = headers
26031
+ request.httpBody = postData as Data
24092
26032
 
24093
26033
  let session = URLSession.shared
24094
26034
  let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in