agentmail 0.4.11 → 0.4.13

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 (84) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +27 -22
  4. package/dist/cjs/api/resources/agent/client/Client.d.ts +50 -0
  5. package/dist/cjs/api/resources/agent/client/Client.js +199 -0
  6. package/dist/cjs/api/resources/agent/client/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/agent/client/index.js +2 -0
  8. package/dist/cjs/api/resources/agent/index.d.ts +2 -0
  9. package/dist/cjs/api/resources/agent/index.js +18 -0
  10. package/dist/cjs/api/resources/agent/types/AgentSignupRequest.d.ts +9 -0
  11. package/dist/cjs/api/resources/agent/types/AgentSignupRequest.js +3 -0
  12. package/dist/cjs/api/resources/agent/types/AgentSignupResponse.d.ts +11 -0
  13. package/dist/cjs/api/resources/agent/types/AgentSignupResponse.js +3 -0
  14. package/dist/cjs/api/resources/agent/types/AgentVerifyRequest.d.ts +7 -0
  15. package/dist/cjs/api/resources/agent/types/AgentVerifyRequest.js +3 -0
  16. package/dist/cjs/api/resources/agent/types/AgentVerifyResponse.d.ts +7 -0
  17. package/dist/cjs/api/resources/agent/types/AgentVerifyResponse.js +3 -0
  18. package/dist/cjs/api/resources/agent/types/index.d.ts +4 -0
  19. package/dist/cjs/api/resources/agent/types/index.js +20 -0
  20. package/dist/cjs/api/resources/apiKeys/types/ApiKeyPermissions.d.ts +35 -35
  21. package/dist/cjs/api/resources/index.d.ts +2 -0
  22. package/dist/cjs/api/resources/index.js +6 -4
  23. package/dist/cjs/serialization/resources/agent/index.d.ts +1 -0
  24. package/dist/cjs/serialization/resources/agent/index.js +17 -0
  25. package/dist/cjs/serialization/resources/agent/types/AgentSignupRequest.d.ts +10 -0
  26. package/dist/cjs/serialization/resources/agent/types/AgentSignupRequest.js +42 -0
  27. package/dist/cjs/serialization/resources/agent/types/AgentSignupResponse.d.ts +11 -0
  28. package/dist/cjs/serialization/resources/agent/types/AgentSignupResponse.js +43 -0
  29. package/dist/cjs/serialization/resources/agent/types/AgentVerifyRequest.d.ts +9 -0
  30. package/dist/cjs/serialization/resources/agent/types/AgentVerifyRequest.js +41 -0
  31. package/dist/cjs/serialization/resources/agent/types/AgentVerifyResponse.d.ts +9 -0
  32. package/dist/cjs/serialization/resources/agent/types/AgentVerifyResponse.js +41 -0
  33. package/dist/cjs/serialization/resources/agent/types/index.d.ts +4 -0
  34. package/dist/cjs/serialization/resources/agent/types/index.js +20 -0
  35. package/dist/cjs/serialization/resources/apiKeys/types/ApiKeyPermissions.d.ts +35 -35
  36. package/dist/cjs/serialization/resources/apiKeys/types/ApiKeyPermissions.js +35 -35
  37. package/dist/cjs/serialization/resources/index.d.ts +2 -0
  38. package/dist/cjs/serialization/resources/index.js +3 -1
  39. package/dist/cjs/version.d.ts +1 -1
  40. package/dist/cjs/version.js +1 -1
  41. package/dist/esm/BaseClient.mjs +2 -2
  42. package/dist/esm/Client.d.mts +3 -0
  43. package/dist/esm/Client.mjs +5 -0
  44. package/dist/esm/api/resources/agent/client/Client.d.mts +50 -0
  45. package/dist/esm/api/resources/agent/client/Client.mjs +162 -0
  46. package/dist/esm/api/resources/agent/client/index.d.mts +1 -0
  47. package/dist/esm/api/resources/agent/client/index.mjs +1 -0
  48. package/dist/esm/api/resources/agent/index.d.mts +2 -0
  49. package/dist/esm/api/resources/agent/index.mjs +2 -0
  50. package/dist/esm/api/resources/agent/types/AgentSignupRequest.d.mts +9 -0
  51. package/dist/esm/api/resources/agent/types/AgentSignupRequest.mjs +2 -0
  52. package/dist/esm/api/resources/agent/types/AgentSignupResponse.d.mts +11 -0
  53. package/dist/esm/api/resources/agent/types/AgentSignupResponse.mjs +2 -0
  54. package/dist/esm/api/resources/agent/types/AgentVerifyRequest.d.mts +7 -0
  55. package/dist/esm/api/resources/agent/types/AgentVerifyRequest.mjs +2 -0
  56. package/dist/esm/api/resources/agent/types/AgentVerifyResponse.d.mts +7 -0
  57. package/dist/esm/api/resources/agent/types/AgentVerifyResponse.mjs +2 -0
  58. package/dist/esm/api/resources/agent/types/index.d.mts +4 -0
  59. package/dist/esm/api/resources/agent/types/index.mjs +4 -0
  60. package/dist/esm/api/resources/apiKeys/types/ApiKeyPermissions.d.mts +35 -35
  61. package/dist/esm/api/resources/index.d.mts +2 -0
  62. package/dist/esm/api/resources/index.mjs +2 -0
  63. package/dist/esm/serialization/resources/agent/index.d.mts +1 -0
  64. package/dist/esm/serialization/resources/agent/index.mjs +1 -0
  65. package/dist/esm/serialization/resources/agent/types/AgentSignupRequest.d.mts +10 -0
  66. package/dist/esm/serialization/resources/agent/types/AgentSignupRequest.mjs +6 -0
  67. package/dist/esm/serialization/resources/agent/types/AgentSignupResponse.d.mts +11 -0
  68. package/dist/esm/serialization/resources/agent/types/AgentSignupResponse.mjs +7 -0
  69. package/dist/esm/serialization/resources/agent/types/AgentVerifyRequest.d.mts +9 -0
  70. package/dist/esm/serialization/resources/agent/types/AgentVerifyRequest.mjs +5 -0
  71. package/dist/esm/serialization/resources/agent/types/AgentVerifyResponse.d.mts +9 -0
  72. package/dist/esm/serialization/resources/agent/types/AgentVerifyResponse.mjs +5 -0
  73. package/dist/esm/serialization/resources/agent/types/index.d.mts +4 -0
  74. package/dist/esm/serialization/resources/agent/types/index.mjs +4 -0
  75. package/dist/esm/serialization/resources/apiKeys/types/ApiKeyPermissions.d.mts +35 -35
  76. package/dist/esm/serialization/resources/apiKeys/types/ApiKeyPermissions.mjs +35 -35
  77. package/dist/esm/serialization/resources/index.d.mts +2 -0
  78. package/dist/esm/serialization/resources/index.mjs +2 -0
  79. package/dist/esm/version.d.mts +1 -1
  80. package/dist/esm/version.mjs +1 -1
  81. package/dist/llms-full.txt +1793 -10
  82. package/dist/llms.txt +4 -0
  83. package/package.json +1 -1
  84. package/reference.md +140 -0
@@ -581,6 +581,34 @@ Here at AgentMail we've now made an `Inbox` an API resource, meaning you can per
581
581
  domains](/guides/domains/managing-domains) to learn more.
582
582
  </Tip>
583
583
 
584
+ ## Inbox-scoped API keys
585
+
586
+ You can create API keys that are restricted to a single inbox. An inbox-scoped key can only access that inbox's threads, messages, and drafts. This is useful when you want to give an agent or integration the minimum access it needs.
587
+
588
+ <CodeBlocks>
589
+ ```python
590
+ # Create a key scoped to one inbox
591
+ key = client.inboxes.api_keys.create(
592
+ new_inbox.inbox_id,
593
+ name="support-agent-key"
594
+ )
595
+
596
+ # The full key is only returned once
597
+ print(key.api_key)
598
+ ```
599
+
600
+ ```typescript title="TypeScript"
601
+ const key = await client.inboxes.apiKeys.create(newInbox.id, {
602
+ name: "support-agent-key",
603
+ });
604
+
605
+ // The full key is only returned once
606
+ console.log(key.apiKey);
607
+ ```
608
+ </CodeBlocks>
609
+
610
+ See the [Multi-Tenancy guide](/multi-tenancy#inbox-scoped-keys) for more on scoped keys.
611
+
584
612
  ## Copy for Cursor / Claude
585
613
 
586
614
  Copy one of the blocks below into Cursor or Claude for complete Inboxes API knowledge in one shot.
@@ -598,6 +626,9 @@ Copy one of the blocks below into Cursor or Claude for complete Inboxes API know
598
626
  - inboxes.list(limit?, page_token?)
599
627
  - inboxes.update(inbox_id, display_name)
600
628
  - inboxes.delete(inbox_id)
629
+ - inboxes.api_keys.create(inbox_id, name) — inbox-scoped key
630
+ - inboxes.api_keys.list(inbox_id)
631
+ - inboxes.api_keys.delete(inbox_id, api_key_id)
601
632
 
602
633
  Errors: SDK raises on 4xx/5xx. Rate limit: 429 with Retry-After.
603
634
  """
@@ -629,6 +660,9 @@ Copy one of the blocks below into Cursor or Claude for complete Inboxes API know
629
660
  * - inboxes.list({ limit?, pageToken? })
630
661
  * - inboxes.update(inboxId, { displayName })
631
662
  * - inboxes.delete(inboxId)
663
+ * - inboxes.apiKeys.create(inboxId, { name }) — inbox-scoped key
664
+ * - inboxes.apiKeys.list(inboxId)
665
+ * - inboxes.apiKeys.delete(inboxId, apiKeyId)
632
666
  *
633
667
  * Errors: SDK throws on 4xx/5xx. Rate limit: 429 with Retry-After.
634
668
  */
@@ -2696,7 +2730,7 @@ async function offboardCustomer(podId: string) {
2696
2730
 
2697
2731
  **What's NOT Isolated to a Pod:**
2698
2732
 
2699
- * Organization-level API keys (these can access any resources in any pod). Use [scoped API keys](/multi-tenancy#step-3-create-scoped-api-keys) to restrict access to a single pod.
2733
+ * Organization-level API keys (these can access any resources in any pod). Use [pod-scoped API keys](/multi-tenancy#pod-scoped-keys) to restrict access to a single pod, or [inbox-scoped API keys](/multi-tenancy#inbox-scoped-keys) to restrict access to a single inbox.
2700
2734
 
2701
2735
  ## Common Patterns and Use Cases
2702
2736
 
@@ -2783,9 +2817,9 @@ Pod: "Marketing-Agent"
2783
2817
  </Accordion>
2784
2818
 
2785
2819
  <Accordion title="Can I set custom permissions per pod?">
2786
- Yes! You can create scoped API keys that are restricted to a single pod. A
2787
- scoped key can only access resources within its pod. See the
2788
- [Multi-Tenancy guide](/multi-tenancy) for details on provisioning scoped keys.
2820
+ Yes! You can create pod-scoped API keys that are restricted to a single pod, or
2821
+ inbox-scoped API keys that are restricted to a single inbox within a pod. See the
2822
+ [Multi-Tenancy guide](/multi-tenancy#scoped-api-keys) for details on provisioning scoped keys.
2789
2823
  </Accordion>
2790
2824
 
2791
2825
  ## Next Steps
@@ -2794,6 +2828,379 @@ Pod: "Marketing-Agent"
2794
2828
  * Explore [Domains](/custom-domains) to set up custom email domains for your pods
2795
2829
 
2796
2830
 
2831
+ ***
2832
+
2833
+ title: Permissions
2834
+ subtitle: Control what your API keys can access with granular permissions.
2835
+ slug: permissions
2836
+ description: >-
2837
+ Learn how to configure fine-grained permissions on API keys to restrict access
2838
+ to specific resources and operations.
2839
+ -------------------------------------
2840
+
2841
+ ## What are Permissions?
2842
+
2843
+ `Permissions` let you restrict what an API key can do. By default, an API key has full access within its scope (organization, pod, or inbox). When you provide a `permissions` object, it acts as a **whitelist**: only the permissions you explicitly set to `true` are granted. Everything else is denied.
2844
+
2845
+ This gives you fine-grained control over which resources and operations each key can access, on top of the existing scope-based isolation provided by [pod-scoped](/pods) and [inbox-scoped](/inboxes#inbox-scoped-api-keys) keys.
2846
+
2847
+ ## How Permissions Work
2848
+
2849
+ ### Whitelist model
2850
+
2851
+ When you create an API key with a `permissions` object, it switches from "full access" mode to "whitelist" mode:
2852
+
2853
+ * **No `permissions` field**: The key has full access within its scope. This is the default and is backward compatible with existing keys.
2854
+ * **`permissions` present**: Only permissions set to `true` are allowed. Any permission that is omitted or set to `false` is denied.
2855
+
2856
+ <Callout intent="info" title="Backward compatibility">
2857
+ Existing API keys without a `permissions` field continue to work exactly as before with full access. The whitelist only activates when you explicitly provide the `permissions` object.
2858
+ </Callout>
2859
+
2860
+ ### Intersection with scope
2861
+
2862
+ Permissions are intersected with the key's scope. A key scoped to a single inbox cannot gain organization-level capabilities (like `inbox_create` or `domain_create`) even if those permissions are set to `true`. The effective permissions are always the intersection of what the scope allows and what the `permissions` object grants.
2863
+
2864
+ ### Privilege escalation protection
2865
+
2866
+ A restricted API key cannot create a child key with more permissions than itself. When creating a new key, the child's permissions are automatically constrained to the parent's effective permissions. This prevents privilege escalation through key creation.
2867
+
2868
+ ## Permissions Reference
2869
+
2870
+ ### Inboxes
2871
+
2872
+ | Permission | Description |
2873
+ | -------------- | --------------------- |
2874
+ | `inbox_read` | Read inbox details |
2875
+ | `inbox_create` | Create new inboxes |
2876
+ | `inbox_update` | Update inbox settings |
2877
+ | `inbox_delete` | Delete inboxes |
2878
+
2879
+ ### Threads
2880
+
2881
+ | Permission | Description |
2882
+ | --------------- | -------------- |
2883
+ | `thread_read` | Read threads |
2884
+ | `thread_delete` | Delete threads |
2885
+
2886
+ ### Messages
2887
+
2888
+ | Permission | Description |
2889
+ | ---------------- | --------------------- |
2890
+ | `message_read` | Read messages |
2891
+ | `message_send` | Send messages |
2892
+ | `message_update` | Update message labels |
2893
+
2894
+ ### Label Visibility
2895
+
2896
+ | Permission | Description |
2897
+ | -------------------- | ---------------------------------- |
2898
+ | `label_spam_read` | Access messages labeled as spam |
2899
+ | `label_blocked_read` | Access messages labeled as blocked |
2900
+ | `label_trash_read` | Access messages labeled as trash |
2901
+
2902
+ <Info>
2903
+ When a label visibility permission is denied, items with that label are automatically excluded from list results and return "not found" on direct access. For example, setting `label_spam_read` to `false` means the key will never see spam messages in any listing or lookup.
2904
+ </Info>
2905
+
2906
+ ### Drafts
2907
+
2908
+ | Permission | Description |
2909
+ | -------------- | ------------- |
2910
+ | `draft_read` | Read drafts |
2911
+ | `draft_create` | Create drafts |
2912
+ | `draft_update` | Update drafts |
2913
+ | `draft_delete` | Delete drafts |
2914
+ | `draft_send` | Send drafts |
2915
+
2916
+ ### Webhooks
2917
+
2918
+ | Permission | Description |
2919
+ | ---------------- | --------------------------- |
2920
+ | `webhook_read` | Read webhook configurations |
2921
+ | `webhook_create` | Create webhooks |
2922
+ | `webhook_update` | Update webhooks |
2923
+ | `webhook_delete` | Delete webhooks |
2924
+
2925
+ ### Domains
2926
+
2927
+ | Permission | Description |
2928
+ | --------------- | ------------------- |
2929
+ | `domain_read` | Read domain details |
2930
+ | `domain_create` | Create domains |
2931
+ | `domain_update` | Update domains |
2932
+ | `domain_delete` | Delete domains |
2933
+
2934
+ ### Lists
2935
+
2936
+ | Permission | Description |
2937
+ | ------------------- | ------------------- |
2938
+ | `list_entry_read` | Read list entries |
2939
+ | `list_entry_create` | Create list entries |
2940
+ | `list_entry_delete` | Delete list entries |
2941
+
2942
+ ### Metrics
2943
+
2944
+ | Permission | Description |
2945
+ | -------------- | ------------ |
2946
+ | `metrics_read` | Read metrics |
2947
+
2948
+ ### API Keys
2949
+
2950
+ | Permission | Description |
2951
+ | ---------------- | --------------- |
2952
+ | `api_key_read` | Read API keys |
2953
+ | `api_key_create` | Create API keys |
2954
+ | `api_key_delete` | Delete API keys |
2955
+
2956
+ ### Pods
2957
+
2958
+ | Permission | Description |
2959
+ | ------------ | ----------- |
2960
+ | `pod_read` | Read pods |
2961
+ | `pod_create` | Create pods |
2962
+ | `pod_delete` | Delete pods |
2963
+
2964
+ ## Code Examples
2965
+
2966
+ ### Read-only key
2967
+
2968
+ Create an API key that can read all resources but cannot create, update, or delete anything.
2969
+
2970
+ <CodeBlocks>
2971
+ ```python title="Python"
2972
+ from agentmail import AgentMail
2973
+
2974
+ client = AgentMail(api_key="YOUR_API_KEY")
2975
+
2976
+ key = client.api_keys.create(
2977
+ name="read-only-agent",
2978
+ permissions={
2979
+ "inbox_read": True,
2980
+ "thread_read": True,
2981
+ "message_read": True,
2982
+ "draft_read": True,
2983
+ "webhook_read": True,
2984
+ "domain_read": True,
2985
+ "list_entry_read": True,
2986
+ "metrics_read": True,
2987
+ "api_key_read": True,
2988
+ "pod_read": True,
2989
+ "label_spam_read": True,
2990
+ "label_blocked_read": True,
2991
+ "label_trash_read": True,
2992
+ }
2993
+ )
2994
+
2995
+ print(key.api_key)
2996
+ ```
2997
+
2998
+ ```typescript title="TypeScript"
2999
+ import { AgentMailClient } from "agentmail";
3000
+
3001
+ const client = new AgentMailClient({ apiKey: "YOUR_API_KEY" });
3002
+
3003
+ const key = await client.apiKeys.create({
3004
+ name: "read-only-agent",
3005
+ permissions: {
3006
+ inboxRead: true,
3007
+ threadRead: true,
3008
+ messageRead: true,
3009
+ draftRead: true,
3010
+ webhookRead: true,
3011
+ domainRead: true,
3012
+ listEntryRead: true,
3013
+ metricsRead: true,
3014
+ apiKeyRead: true,
3015
+ podRead: true,
3016
+ labelSpamRead: true,
3017
+ labelBlockedRead: true,
3018
+ labelTrashRead: true,
3019
+ },
3020
+ });
3021
+
3022
+ console.log(key.apiKey);
3023
+ ```
3024
+ </CodeBlocks>
3025
+
3026
+ ### No-spam key
3027
+
3028
+ Create a key with full access but block visibility into spam, blocked, and trash content. This is useful for agent-facing keys where you want to prevent the agent from processing unwanted email.
3029
+
3030
+ <CodeBlocks>
3031
+ ```python title="Python"
3032
+ key = client.api_keys.create(
3033
+ name="clean-inbox-agent",
3034
+ permissions={
3035
+ "inbox_read": True,
3036
+ "inbox_create": True,
3037
+ "inbox_update": True,
3038
+ "inbox_delete": True,
3039
+ "thread_read": True,
3040
+ "thread_delete": True,
3041
+ "message_read": True,
3042
+ "message_send": True,
3043
+ "message_update": True,
3044
+ "label_spam_read": False,
3045
+ "label_blocked_read": False,
3046
+ "label_trash_read": False,
3047
+ "draft_read": True,
3048
+ "draft_create": True,
3049
+ "draft_update": True,
3050
+ "draft_delete": True,
3051
+ "draft_send": True,
3052
+ "webhook_read": True,
3053
+ "webhook_create": True,
3054
+ "webhook_update": True,
3055
+ "webhook_delete": True,
3056
+ "domain_read": True,
3057
+ "domain_create": True,
3058
+ "domain_update": True,
3059
+ "domain_delete": True,
3060
+ "list_entry_read": True,
3061
+ "list_entry_create": True,
3062
+ "list_entry_delete": True,
3063
+ "metrics_read": True,
3064
+ "api_key_read": True,
3065
+ "api_key_create": True,
3066
+ "api_key_delete": True,
3067
+ "pod_read": True,
3068
+ "pod_create": True,
3069
+ "pod_delete": True,
3070
+ }
3071
+ )
3072
+ ```
3073
+
3074
+ ```typescript title="TypeScript"
3075
+ const key = await client.apiKeys.create({
3076
+ name: "clean-inbox-agent",
3077
+ permissions: {
3078
+ inboxRead: true,
3079
+ inboxCreate: true,
3080
+ inboxUpdate: true,
3081
+ inboxDelete: true,
3082
+ threadRead: true,
3083
+ threadDelete: true,
3084
+ messageRead: true,
3085
+ messageSend: true,
3086
+ messageUpdate: true,
3087
+ labelSpamRead: false,
3088
+ labelBlockedRead: false,
3089
+ labelTrashRead: false,
3090
+ draftRead: true,
3091
+ draftCreate: true,
3092
+ draftUpdate: true,
3093
+ draftDelete: true,
3094
+ draftSend: true,
3095
+ webhookRead: true,
3096
+ webhookCreate: true,
3097
+ webhookUpdate: true,
3098
+ webhookDelete: true,
3099
+ domainRead: true,
3100
+ domainCreate: true,
3101
+ domainUpdate: true,
3102
+ domainDelete: true,
3103
+ listEntryRead: true,
3104
+ listEntryCreate: true,
3105
+ listEntryDelete: true,
3106
+ metricsRead: true,
3107
+ apiKeyRead: true,
3108
+ apiKeyCreate: true,
3109
+ apiKeyDelete: true,
3110
+ podRead: true,
3111
+ podCreate: true,
3112
+ podDelete: true,
3113
+ },
3114
+ });
3115
+ ```
3116
+ </CodeBlocks>
3117
+
3118
+ ## Copy for Cursor / Claude
3119
+
3120
+ Copy one of the blocks below into Cursor or Claude for complete Permissions API knowledge in one shot.
3121
+
3122
+ <CodeBlocks>
3123
+ ```python title="Python"
3124
+ """
3125
+ AgentMail Permissions — copy into Cursor/Claude.
3126
+
3127
+ Permissions are a whitelist on API keys. No `permissions` field = full access.
3128
+ When `permissions` is set, only `True` values are granted; omitted or `False` = denied.
3129
+ Permissions intersect with scope (pod/inbox). A restricted key cannot create a more privileged child key.
3130
+
3131
+ Permission fields (all optional<bool>, resource_action format):
3132
+ Inboxes: inbox_read, inbox_create, inbox_update, inbox_delete
3133
+ Threads: thread_read, thread_delete
3134
+ Messages: message_read, message_send, message_update
3135
+ Label visibility: label_spam_read, label_blocked_read, label_trash_read
3136
+ Drafts: draft_read, draft_create, draft_update, draft_delete, draft_send
3137
+ Webhooks: webhook_read, webhook_create, webhook_update, webhook_delete
3138
+ Domains: domain_read, domain_create, domain_update, domain_delete
3139
+ Lists: list_entry_read, list_entry_create, list_entry_delete
3140
+ Metrics: metrics_read
3141
+ API Keys: api_key_read, api_key_create, api_key_delete
3142
+ Pods: pod_read, pod_create, pod_delete
3143
+
3144
+ API: api_keys.create(name, permissions={...})
3145
+ """
3146
+ from agentmail import AgentMail
3147
+
3148
+ client = AgentMail(api_key="YOUR_API_KEY")
3149
+
3150
+ # read-only key
3151
+ key = client.api_keys.create(
3152
+ name="read-only",
3153
+ permissions={"inbox_read": True, "message_read": True, "thread_read": True}
3154
+ )
3155
+ print(key.api_key)
3156
+ ```
3157
+
3158
+ ```typescript title="TypeScript"
3159
+ /**
3160
+ * AgentMail Permissions — copy into Cursor/Claude.
3161
+ *
3162
+ * Permissions are a whitelist on API keys. No `permissions` field = full access.
3163
+ * When `permissions` is set, only `true` values are granted; omitted or `false` = denied.
3164
+ * Permissions intersect with scope (pod/inbox). A restricted key cannot create a more privileged child key.
3165
+ *
3166
+ * Permission fields (all optional boolean, resourceAction format):
3167
+ * Inboxes: inboxRead, inboxCreate, inboxUpdate, inboxDelete
3168
+ * Threads: threadRead, threadDelete
3169
+ * Messages: messageRead, messageSend, messageUpdate
3170
+ * Label visibility: labelSpamRead, labelBlockedRead, labelTrashRead
3171
+ * Drafts: draftRead, draftCreate, draftUpdate, draftDelete, draftSend
3172
+ * Webhooks: webhookRead, webhookCreate, webhookUpdate, webhookDelete
3173
+ * Domains: domainRead, domainCreate, domainUpdate, domainDelete
3174
+ * Lists: listEntryRead, listEntryCreate, listEntryDelete
3175
+ * Metrics: metricsRead
3176
+ * API Keys: apiKeyRead, apiKeyCreate, apiKeyDelete
3177
+ * Pods: podRead, podCreate, podDelete
3178
+ *
3179
+ * API: apiKeys.create({ name, permissions: {...} })
3180
+ */
3181
+ import { AgentMailClient } from "agentmail";
3182
+
3183
+ const client = new AgentMailClient({ apiKey: "YOUR_API_KEY" });
3184
+
3185
+ async function main() {
3186
+ // read-only key
3187
+ const key = await client.apiKeys.create({
3188
+ name: "read-only",
3189
+ permissions: { inboxRead: true, messageRead: true, threadRead: true },
3190
+ });
3191
+ console.log(key.apiKey);
3192
+ }
3193
+ main();
3194
+ ```
3195
+ </CodeBlocks>
3196
+
3197
+ ## Best Practices
3198
+
3199
+ * **Use the principle of least privilege.** Only grant the permissions your agent actually needs. A support agent that reads and replies to emails does not need `domain_create` or `inbox_delete`.
3200
+ * **Combine with scopes for defense in depth.** Pair permissions with [pod-scoped](/multi-tenancy#pod-scoped-keys) or [inbox-scoped](/multi-tenancy#inbox-scoped-keys) keys. Scopes limit *which* resources a key can see, while permissions limit *what* it can do.
3201
+ * **Filter unwanted content from agents.** Set `label_spam_read`, `label_blocked_read`, and `label_trash_read` to `false` on agent-facing keys. This prevents agents from seeing or processing unwanted email, keeping their context clean.
3202
+
3203
+
2797
3204
  ***
2798
3205
 
2799
3206
  title: Agent Onboarding
@@ -3369,6 +3776,124 @@ openclaw skills install agentmail-to/agentmail-skills/agentmail-cli
3369
3776
  This works with any compatible tool, including OpenClaw, Claude Code, Cursor, and Codex. See the [Skills](/integrations/skills) page for more details.
3370
3777
 
3371
3778
 
3779
+ ***
3780
+
3781
+ title: Google ADK
3782
+ subtitle: Give your Google ADK agent its own email inbox
3783
+ slug: integrations/google-adk
3784
+ description: AgentMail's Google Agent Development Kit (ADK) integration
3785
+ -----------------------------------------------------------------------
3786
+
3787
+ ## Getting started
3788
+
3789
+ [Google Agent Development Kit (ADK)](https://google.github.io/adk-docs/) is an open-source framework for building AI agents. By connecting AgentMail to your ADK agent via the [AgentMail MCP server](https://github.com/agentmail-to/agentmail-smithery-mcp), your agent can create inboxes, send and receive emails, manage threads, and handle attachments using natural language.
3790
+
3791
+ ## Use cases
3792
+
3793
+ * **Give agents their own inboxes:** Create dedicated email addresses for your agents so they can send and receive emails independently, just like a human team member.
3794
+ * **Automate email workflows:** Let your agent handle email conversations end to end, including sending initial outreach, reading replies, and following up on threads.
3795
+ * **Manage conversations across inboxes:** List and search across threads and messages, forward emails, and retrieve attachments to keep your agent informed and responsive.
3796
+
3797
+ ## Prerequisites
3798
+
3799
+ 1. An [AgentMail account](https://agentmail.to/) with an API key from the [AgentMail Console](https://console.agentmail.to)
3800
+ 2. [Google ADK](https://google.github.io/adk-docs/get-started/) installed (`pip install google-adk` or `npm install @google/adk`)
3801
+
3802
+ ## Setup
3803
+
3804
+ ADK supports AgentMail through the MCP tool interface. Connect the AgentMail MCP server as a local stdio transport:
3805
+
3806
+ <CodeBlocks>
3807
+ ```python title="Python"
3808
+ from google.adk.agents import Agent
3809
+ from google.adk.tools.mcp_tool import McpToolset
3810
+ from google.adk.tools.mcp_tool.mcp_session_manager import StdioConnectionParams
3811
+ from mcp import StdioServerParameters
3812
+
3813
+ AGENTMAIL_API_KEY = "YOUR_AGENTMAIL_API_KEY"
3814
+
3815
+ root_agent = Agent(
3816
+ model="gemini-2.5-pro",
3817
+ name="agentmail_agent",
3818
+ instruction="Help users manage email inboxes and send messages",
3819
+ tools=[
3820
+ McpToolset(
3821
+ connection_params=StdioConnectionParams(
3822
+ server_params=StdioServerParameters(
3823
+ command="npx",
3824
+ args=[
3825
+ "-y",
3826
+ "agentmail-mcp",
3827
+ ],
3828
+ env={
3829
+ "AGENTMAIL_API_KEY": AGENTMAIL_API_KEY,
3830
+ }
3831
+ ),
3832
+ timeout=30,
3833
+ ),
3834
+ )
3835
+ ],
3836
+ )
3837
+ ```
3838
+
3839
+ ```typescript title="TypeScript"
3840
+ import { LlmAgent, MCPToolset } from "@google/adk";
3841
+
3842
+ const AGENTMAIL_API_KEY = "YOUR_AGENTMAIL_API_KEY";
3843
+
3844
+ const rootAgent = new LlmAgent({
3845
+ model: "gemini-2.5-pro",
3846
+ name: "agentmail_agent",
3847
+ instruction: "Help users manage email inboxes and send messages",
3848
+ tools: [
3849
+ new MCPToolset({
3850
+ type: "StdioConnectionParams",
3851
+ serverParams: {
3852
+ command: "npx",
3853
+ args: ["-y", "agentmail-mcp"],
3854
+ env: {
3855
+ AGENTMAIL_API_KEY: AGENTMAIL_API_KEY,
3856
+ },
3857
+ },
3858
+ }),
3859
+ ],
3860
+ });
3861
+
3862
+ export { rootAgent };
3863
+ ```
3864
+ </CodeBlocks>
3865
+
3866
+ ## Available tools
3867
+
3868
+ Once connected, your ADK agent has access to the following AgentMail tools:
3869
+
3870
+ ### Inbox management
3871
+
3872
+ | Tool | Description |
3873
+ | -------------- | --------------------------------------------- |
3874
+ | `list_inboxes` | List all inboxes |
3875
+ | `get_inbox` | Get details for a specific inbox |
3876
+ | `create_inbox` | Create a new inbox with a username and domain |
3877
+ | `delete_inbox` | Delete an inbox |
3878
+
3879
+ ### Thread management
3880
+
3881
+ | Tool | Description |
3882
+ | ---------------- | --------------------------------------- |
3883
+ | `list_threads` | List threads in an inbox |
3884
+ | `get_thread` | Get a specific thread with its messages |
3885
+ | `get_attachment` | Download an attachment from a message |
3886
+
3887
+ ### Message operations
3888
+
3889
+ | Tool | Description |
3890
+ | ------------------ | --------------------------------------------- |
3891
+ | `send_message` | Send a new email from an inbox |
3892
+ | `reply_to_message` | Reply to an existing message |
3893
+ | `forward_message` | Forward a message to another recipient |
3894
+ | `update_message` | Update message properties such as read status |
3895
+
3896
+
3372
3897
  ***
3373
3898
 
3374
3899
  title: OpenClaw
@@ -4701,10 +5226,14 @@ Then provision their resources:
4701
5226
 
4702
5227
  ## Scoped API Keys
4703
5228
 
4704
- By default, API keys are organization-level and can access everything across all pods. Scoped API keys are restricted to a single pod. If a key is scoped to Acme's pod, it can only touch Acme's resources. Nothing else.
5229
+ By default, API keys are organization-level and can access everything across all pods. Scoped API keys restrict access to a single pod or a single inbox. If a key is scoped to Acme's pod, it can only touch Acme's resources. Nothing else.
4705
5230
 
4706
5231
  This is useful when you want to hand a key to a tenant's service or agent without exposing your whole org.
4707
5232
 
5233
+ ### Pod-scoped keys
5234
+
5235
+ Pod-scoped keys can access all resources within a pod (inboxes, threads, drafts, domains).
5236
+
4708
5237
  <CodeBlocks>
4709
5238
  ```python
4710
5239
  # Create a key that can only access Acme's pod
@@ -4727,21 +5256,55 @@ This is useful when you want to hand a key to a tenant's service or agent withou
4727
5256
  ```
4728
5257
  </CodeBlocks>
4729
5258
 
5259
+ ### Inbox-scoped keys
5260
+
5261
+ Inbox-scoped keys are even more restrictive: they only grant access to a single inbox and its threads, messages, and drafts. Use these when an agent or integration only needs to operate on one address.
5262
+
5263
+ <CodeBlocks>
5264
+ ```python
5265
+ # Create a key that can only access the support inbox
5266
+ inbox_key = client.inboxes.api_keys.create(
5267
+ inbox.inbox_id,
5268
+ name="support-inbox-key"
5269
+ )
5270
+
5271
+ print(inbox_key.api_key)
5272
+ ```
5273
+
5274
+ ```typescript
5275
+ const inboxKey = await client.inboxes.apiKeys.create(inbox.inboxId, {
5276
+ name: "support-inbox-key",
5277
+ });
5278
+
5279
+ console.log(inboxKey.apiKey);
5280
+ ```
5281
+ </CodeBlocks>
5282
+
4730
5283
  <Warning>
4731
5284
  The full API key is only returned **once** at creation. If you lose it, delete it and create a new one.
4732
5285
  </Warning>
4733
5286
 
4734
- You can list and delete scoped keys for any pod:
5287
+ You can list and delete scoped keys for any pod or inbox:
4735
5288
 
4736
5289
  <CodeBlocks>
4737
5290
  ```python
5291
+ # Pod-scoped keys
4738
5292
  keys = client.pods.api_keys.list(pod.pod_id)
4739
5293
  client.pods.api_keys.delete(pod.pod_id, scoped_key.api_key_id)
5294
+
5295
+ # Inbox-scoped keys
5296
+ inbox_keys = client.inboxes.api_keys.list(inbox.inbox_id)
5297
+ client.inboxes.api_keys.delete(inbox.inbox_id, inbox_key.api_key_id)
4740
5298
  ```
4741
5299
 
4742
5300
  ```typescript
5301
+ // Pod-scoped keys
4743
5302
  const keys = await client.pods.apiKeys.list(pod.podId);
4744
5303
  await client.pods.apiKeys.delete(pod.podId, scopedKey.apiKeyId);
5304
+
5305
+ // Inbox-scoped keys
5306
+ const inboxKeys = await client.inboxes.apiKeys.list(inbox.inboxId);
5307
+ await client.inboxes.apiKeys.delete(inbox.inboxId, inboxKey.apiKeyId);
4745
5308
  ```
4746
5309
  </CodeBlocks>
4747
5310
 
@@ -4804,9 +5367,14 @@ Here's what onboarding a new tenant looks like end to end:
4804
5367
  )
4805
5368
  domain = client.pods.domains.create(pod.pod_id, domain=domain_name)
4806
5369
 
4807
- # Scoped key for the tenant
5370
+ # Pod-scoped key for the tenant
4808
5371
  key = client.pods.api_keys.create(pod.pod_id, name=f"{tenant_id}-key")
4809
5372
 
5373
+ # Inbox-scoped key for the support inbox
5374
+ inbox_key = client.inboxes.api_keys.create(
5375
+ inbox.inbox_id, name=f"{tenant_id}-support-key"
5376
+ )
5377
+
4810
5378
  # Webhook for their events
4811
5379
  webhook = client.webhooks.create(
4812
5380
  url=f"https://your-server.com/webhooks/{tenant_id}",
@@ -4817,7 +5385,8 @@ Here's what onboarding a new tenant looks like end to end:
4817
5385
  return {
4818
5386
  "pod_id": pod.pod_id,
4819
5387
  "inbox_id": inbox.inbox_id,
4820
- "api_key": key.api_key, # deliver securely to tenant
5388
+ "pod_api_key": key.api_key, # deliver securely to tenant
5389
+ "inbox_api_key": inbox_key.api_key,
4821
5390
  "webhook_id": webhook.webhook_id,
4822
5391
  }
4823
5392
  ```
@@ -4840,11 +5409,16 @@ Here's what onboarding a new tenant looks like end to end:
4840
5409
  domain: domainName,
4841
5410
  });
4842
5411
 
4843
- // Scoped key for the tenant
5412
+ // Pod-scoped key for the tenant
4844
5413
  const key = await client.pods.apiKeys.create(pod.podId, {
4845
5414
  name: `${tenantId}-key`,
4846
5415
  });
4847
5416
 
5417
+ // Inbox-scoped key for the support inbox
5418
+ const inboxKey = await client.inboxes.apiKeys.create(inbox.inboxId, {
5419
+ name: `${tenantId}-support-key`,
5420
+ });
5421
+
4848
5422
  // Webhook for their events
4849
5423
  const webhook = await client.webhooks.create({
4850
5424
  url: `https://your-server.com/webhooks/${tenantId}`,
@@ -4855,7 +5429,8 @@ Here's what onboarding a new tenant looks like end to end:
4855
5429
  return {
4856
5430
  podId: pod.podId,
4857
5431
  inboxId: inbox.inboxId,
4858
- apiKey: key.apiKey, // deliver securely to tenant
5432
+ podApiKey: key.apiKey, // deliver securely to tenant
5433
+ inboxApiKey: inboxKey.apiKey,
4859
5434
  webhookId: webhook.webhookId,
4860
5435
  };
4861
5436
  }
@@ -11201,6 +11776,514 @@ If you have any other languages you would like us to support, please [reach out
11201
11776
  All of our SDKs are open source and available under the MIT license.
11202
11777
 
11203
11778
 
11779
+ # Sign Up
11780
+
11781
+ POST https://api.agentmail.to/v0/agent/sign-up
11782
+ Content-Type: application/json
11783
+
11784
+ Create a new agent organization with an inbox and API key. A 6-digit OTP is sent to the human's email for verification.
11785
+
11786
+ This endpoint is idempotent. Calling it again with the same `human_email` will rotate the API key and resend the OTP if expired.
11787
+
11788
+ The returned API key has limited permissions until the organization is verified via the verify endpoint.
11789
+
11790
+ Reference: https://docs.agentmail.to/api-reference/agent/sign-up
11791
+
11792
+ ## OpenAPI Specification
11793
+
11794
+ ```yaml
11795
+ openapi: 3.1.0
11796
+ info:
11797
+ title: api
11798
+ version: 1.0.0
11799
+ paths:
11800
+ /v0/agent/sign-up:
11801
+ post:
11802
+ operationId: sign-up
11803
+ summary: Sign Up
11804
+ description: >-
11805
+ Create a new agent organization with an inbox and API key. A 6-digit OTP
11806
+ is sent to the human's email for verification.
11807
+
11808
+
11809
+ This endpoint is idempotent. Calling it again with the same
11810
+ `human_email` will rotate the API key and resend the OTP if expired.
11811
+
11812
+
11813
+ The returned API key has limited permissions until the organization is
11814
+ verified via the verify endpoint.
11815
+ tags:
11816
+ - subpackage_agent
11817
+ responses:
11818
+ '200':
11819
+ description: Response with status 200
11820
+ content:
11821
+ application/json:
11822
+ schema:
11823
+ $ref: '#/components/schemas/type_agent:AgentSignupResponse'
11824
+ '400':
11825
+ description: Error response with status 400
11826
+ content:
11827
+ application/json:
11828
+ schema:
11829
+ $ref: '#/components/schemas/type_:ValidationErrorResponse'
11830
+ requestBody:
11831
+ content:
11832
+ application/json:
11833
+ schema:
11834
+ $ref: '#/components/schemas/type_agent:AgentSignupRequest'
11835
+ servers:
11836
+ - url: https://api.agentmail.to
11837
+ - url: https://x402.api.agentmail.to
11838
+ - url: https://mpp.api.agentmail.to
11839
+ - url: https://api.agentmail.eu
11840
+ components:
11841
+ schemas:
11842
+ type_agent:AgentSignupRequest:
11843
+ type: object
11844
+ properties:
11845
+ human_email:
11846
+ type: string
11847
+ description: >-
11848
+ Email address of the human who owns the agent. A 6-digit OTP will be
11849
+ sent to this address.
11850
+ username:
11851
+ type: string
11852
+ description: >-
11853
+ Username for the auto-created inbox (e.g. "my-agent" creates
11854
+ my-agent@agentmail.to).
11855
+ required:
11856
+ - human_email
11857
+ - username
11858
+ description: Request body to sign up an agent.
11859
+ title: AgentSignupRequest
11860
+ type_agent:AgentSignupResponse:
11861
+ type: object
11862
+ properties:
11863
+ organization_id:
11864
+ type: string
11865
+ description: ID of the created organization.
11866
+ inbox_id:
11867
+ type: string
11868
+ description: ID of the auto-created inbox.
11869
+ api_key:
11870
+ type: string
11871
+ description: >-
11872
+ API key for authenticating subsequent requests. Store this securely,
11873
+ it cannot be retrieved again.
11874
+ required:
11875
+ - organization_id
11876
+ - inbox_id
11877
+ - api_key
11878
+ description: Response after successful agent sign-up.
11879
+ title: AgentSignupResponse
11880
+ type_:ErrorName:
11881
+ type: string
11882
+ description: Name of error.
11883
+ title: ErrorName
11884
+ type_:ValidationErrorResponse:
11885
+ type: object
11886
+ properties:
11887
+ name:
11888
+ $ref: '#/components/schemas/type_:ErrorName'
11889
+ errors:
11890
+ description: Validation errors.
11891
+ required:
11892
+ - name
11893
+ - errors
11894
+ title: ValidationErrorResponse
11895
+
11896
+ ```
11897
+
11898
+ ## SDK Code Examples
11899
+
11900
+ ```typescript
11901
+ import { AgentMailClient } from "agentmail";
11902
+
11903
+ async function main() {
11904
+ const client = new AgentMailClient();
11905
+ await client.agent.signUp({
11906
+ humanEmail: "human_email",
11907
+ username: "username",
11908
+ });
11909
+ }
11910
+ main();
11911
+
11912
+ ```
11913
+
11914
+ ```python
11915
+ from agentmail import AgentMail
11916
+
11917
+ client = AgentMail()
11918
+
11919
+ client.agent.sign_up(
11920
+ human_email="human_email",
11921
+ username="username",
11922
+ )
11923
+
11924
+ ```
11925
+
11926
+ ```go
11927
+ package main
11928
+
11929
+ import (
11930
+ "fmt"
11931
+ "strings"
11932
+ "net/http"
11933
+ "io"
11934
+ )
11935
+
11936
+ func main() {
11937
+
11938
+ url := "https://api.agentmail.to/v0/agent/sign-up"
11939
+
11940
+ payload := strings.NewReader("{\n \"human_email\": \"human_email\",\n \"username\": \"username\"\n}")
11941
+
11942
+ req, _ := http.NewRequest("POST", url, payload)
11943
+
11944
+ req.Header.Add("Content-Type", "application/json")
11945
+
11946
+ res, _ := http.DefaultClient.Do(req)
11947
+
11948
+ defer res.Body.Close()
11949
+ body, _ := io.ReadAll(res.Body)
11950
+
11951
+ fmt.Println(res)
11952
+ fmt.Println(string(body))
11953
+
11954
+ }
11955
+ ```
11956
+
11957
+ ```ruby
11958
+ require 'uri'
11959
+ require 'net/http'
11960
+
11961
+ url = URI("https://api.agentmail.to/v0/agent/sign-up")
11962
+
11963
+ http = Net::HTTP.new(url.host, url.port)
11964
+ http.use_ssl = true
11965
+
11966
+ request = Net::HTTP::Post.new(url)
11967
+ request["Content-Type"] = 'application/json'
11968
+ request.body = "{\n \"human_email\": \"human_email\",\n \"username\": \"username\"\n}"
11969
+
11970
+ response = http.request(request)
11971
+ puts response.read_body
11972
+ ```
11973
+
11974
+ ```java
11975
+ import com.mashape.unirest.http.HttpResponse;
11976
+ import com.mashape.unirest.http.Unirest;
11977
+
11978
+ HttpResponse<String> response = Unirest.post("https://api.agentmail.to/v0/agent/sign-up")
11979
+ .header("Content-Type", "application/json")
11980
+ .body("{\n \"human_email\": \"human_email\",\n \"username\": \"username\"\n}")
11981
+ .asString();
11982
+ ```
11983
+
11984
+ ```php
11985
+ <?php
11986
+ require_once('vendor/autoload.php');
11987
+
11988
+ $client = new \GuzzleHttp\Client();
11989
+
11990
+ $response = $client->request('POST', 'https://api.agentmail.to/v0/agent/sign-up', [
11991
+ 'body' => '{
11992
+ "human_email": "human_email",
11993
+ "username": "username"
11994
+ }',
11995
+ 'headers' => [
11996
+ 'Content-Type' => 'application/json',
11997
+ ],
11998
+ ]);
11999
+
12000
+ echo $response->getBody();
12001
+ ```
12002
+
12003
+ ```csharp
12004
+ using RestSharp;
12005
+
12006
+ var client = new RestClient("https://api.agentmail.to/v0/agent/sign-up");
12007
+ var request = new RestRequest(Method.POST);
12008
+ request.AddHeader("Content-Type", "application/json");
12009
+ request.AddParameter("application/json", "{\n \"human_email\": \"human_email\",\n \"username\": \"username\"\n}", ParameterType.RequestBody);
12010
+ IRestResponse response = client.Execute(request);
12011
+ ```
12012
+
12013
+ ```swift
12014
+ import Foundation
12015
+
12016
+ let headers = ["Content-Type": "application/json"]
12017
+ let parameters = [
12018
+ "human_email": "human_email",
12019
+ "username": "username"
12020
+ ] as [String : Any]
12021
+
12022
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
12023
+
12024
+ let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/agent/sign-up")! as URL,
12025
+ cachePolicy: .useProtocolCachePolicy,
12026
+ timeoutInterval: 10.0)
12027
+ request.httpMethod = "POST"
12028
+ request.allHTTPHeaderFields = headers
12029
+ request.httpBody = postData as Data
12030
+
12031
+ let session = URLSession.shared
12032
+ let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
12033
+ if (error != nil) {
12034
+ print(error as Any)
12035
+ } else {
12036
+ let httpResponse = response as? HTTPURLResponse
12037
+ print(httpResponse)
12038
+ }
12039
+ })
12040
+
12041
+ dataTask.resume()
12042
+ ```
12043
+
12044
+ # Verify
12045
+
12046
+ POST https://api.agentmail.to/v0/agent/verify
12047
+ Content-Type: application/json
12048
+
12049
+ Verify an agent organization using the 6-digit OTP sent to the human's email during sign-up.
12050
+
12051
+ On success, the organization is upgraded from `agent_unverified` to `agent_verified`, the send allowlist is removed, and free plan entitlements are applied.
12052
+
12053
+ The OTP expires after 24 hours and allows a maximum of 10 attempts.
12054
+
12055
+ Reference: https://docs.agentmail.to/api-reference/agent/verify
12056
+
12057
+ ## OpenAPI Specification
12058
+
12059
+ ```yaml
12060
+ openapi: 3.1.0
12061
+ info:
12062
+ title: api
12063
+ version: 1.0.0
12064
+ paths:
12065
+ /v0/agent/verify:
12066
+ post:
12067
+ operationId: verify
12068
+ summary: Verify
12069
+ description: >-
12070
+ Verify an agent organization using the 6-digit OTP sent to the human's
12071
+ email during sign-up.
12072
+
12073
+
12074
+ On success, the organization is upgraded from `agent_unverified` to
12075
+ `agent_verified`, the send allowlist is removed, and free plan
12076
+ entitlements are applied.
12077
+
12078
+
12079
+ The OTP expires after 24 hours and allows a maximum of 10 attempts.
12080
+ tags:
12081
+ - subpackage_agent
12082
+ parameters:
12083
+ - name: Authorization
12084
+ in: header
12085
+ description: Bearer authentication
12086
+ required: true
12087
+ schema:
12088
+ type: string
12089
+ responses:
12090
+ '200':
12091
+ description: Response with status 200
12092
+ content:
12093
+ application/json:
12094
+ schema:
12095
+ $ref: '#/components/schemas/type_agent:AgentVerifyResponse'
12096
+ requestBody:
12097
+ content:
12098
+ application/json:
12099
+ schema:
12100
+ $ref: '#/components/schemas/type_agent:AgentVerifyRequest'
12101
+ servers:
12102
+ - url: https://api.agentmail.to
12103
+ - url: https://x402.api.agentmail.to
12104
+ - url: https://mpp.api.agentmail.to
12105
+ - url: https://api.agentmail.eu
12106
+ components:
12107
+ schemas:
12108
+ type_agent:AgentVerifyRequest:
12109
+ type: object
12110
+ properties:
12111
+ otp_code:
12112
+ type: string
12113
+ description: 6-digit verification code sent to the human's email address.
12114
+ required:
12115
+ - otp_code
12116
+ description: Request body to verify an agent with an OTP code.
12117
+ title: AgentVerifyRequest
12118
+ type_agent:AgentVerifyResponse:
12119
+ type: object
12120
+ properties:
12121
+ verified:
12122
+ type: boolean
12123
+ description: Whether the organization was verified.
12124
+ required:
12125
+ - verified
12126
+ description: Response after successful agent verification.
12127
+ title: AgentVerifyResponse
12128
+ securitySchemes:
12129
+ Bearer:
12130
+ type: http
12131
+ scheme: bearer
12132
+
12133
+ ```
12134
+
12135
+ ## SDK Code Examples
12136
+
12137
+ ```typescript
12138
+ import { AgentMailClient } from "agentmail";
12139
+
12140
+ async function main() {
12141
+ const client = new AgentMailClient({
12142
+ apiKey: "YOUR_TOKEN_HERE",
12143
+ });
12144
+ await client.agent.verify({
12145
+ otpCode: "otp_code",
12146
+ });
12147
+ }
12148
+ main();
12149
+
12150
+ ```
12151
+
12152
+ ```python
12153
+ from agentmail import AgentMail
12154
+
12155
+ client = AgentMail(
12156
+ api_key="YOUR_TOKEN_HERE",
12157
+ )
12158
+
12159
+ client.agent.verify(
12160
+ otp_code="otp_code",
12161
+ )
12162
+
12163
+ ```
12164
+
12165
+ ```go
12166
+ package main
12167
+
12168
+ import (
12169
+ "fmt"
12170
+ "strings"
12171
+ "net/http"
12172
+ "io"
12173
+ )
12174
+
12175
+ func main() {
12176
+
12177
+ url := "https://api.agentmail.to/v0/agent/verify"
12178
+
12179
+ payload := strings.NewReader("{\n \"otp_code\": \"otp_code\"\n}")
12180
+
12181
+ req, _ := http.NewRequest("POST", url, payload)
12182
+
12183
+ req.Header.Add("Authorization", "Bearer <api_key>")
12184
+ req.Header.Add("Content-Type", "application/json")
12185
+
12186
+ res, _ := http.DefaultClient.Do(req)
12187
+
12188
+ defer res.Body.Close()
12189
+ body, _ := io.ReadAll(res.Body)
12190
+
12191
+ fmt.Println(res)
12192
+ fmt.Println(string(body))
12193
+
12194
+ }
12195
+ ```
12196
+
12197
+ ```ruby
12198
+ require 'uri'
12199
+ require 'net/http'
12200
+
12201
+ url = URI("https://api.agentmail.to/v0/agent/verify")
12202
+
12203
+ http = Net::HTTP.new(url.host, url.port)
12204
+ http.use_ssl = true
12205
+
12206
+ request = Net::HTTP::Post.new(url)
12207
+ request["Authorization"] = 'Bearer <api_key>'
12208
+ request["Content-Type"] = 'application/json'
12209
+ request.body = "{\n \"otp_code\": \"otp_code\"\n}"
12210
+
12211
+ response = http.request(request)
12212
+ puts response.read_body
12213
+ ```
12214
+
12215
+ ```java
12216
+ import com.mashape.unirest.http.HttpResponse;
12217
+ import com.mashape.unirest.http.Unirest;
12218
+
12219
+ HttpResponse<String> response = Unirest.post("https://api.agentmail.to/v0/agent/verify")
12220
+ .header("Authorization", "Bearer <api_key>")
12221
+ .header("Content-Type", "application/json")
12222
+ .body("{\n \"otp_code\": \"otp_code\"\n}")
12223
+ .asString();
12224
+ ```
12225
+
12226
+ ```php
12227
+ <?php
12228
+ require_once('vendor/autoload.php');
12229
+
12230
+ $client = new \GuzzleHttp\Client();
12231
+
12232
+ $response = $client->request('POST', 'https://api.agentmail.to/v0/agent/verify', [
12233
+ 'body' => '{
12234
+ "otp_code": "otp_code"
12235
+ }',
12236
+ 'headers' => [
12237
+ 'Authorization' => 'Bearer <api_key>',
12238
+ 'Content-Type' => 'application/json',
12239
+ ],
12240
+ ]);
12241
+
12242
+ echo $response->getBody();
12243
+ ```
12244
+
12245
+ ```csharp
12246
+ using RestSharp;
12247
+
12248
+ var client = new RestClient("https://api.agentmail.to/v0/agent/verify");
12249
+ var request = new RestRequest(Method.POST);
12250
+ request.AddHeader("Authorization", "Bearer <api_key>");
12251
+ request.AddHeader("Content-Type", "application/json");
12252
+ request.AddParameter("application/json", "{\n \"otp_code\": \"otp_code\"\n}", ParameterType.RequestBody);
12253
+ IRestResponse response = client.Execute(request);
12254
+ ```
12255
+
12256
+ ```swift
12257
+ import Foundation
12258
+
12259
+ let headers = [
12260
+ "Authorization": "Bearer <api_key>",
12261
+ "Content-Type": "application/json"
12262
+ ]
12263
+ let parameters = ["otp_code": "otp_code"] as [String : Any]
12264
+
12265
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
12266
+
12267
+ let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/agent/verify")! as URL,
12268
+ cachePolicy: .useProtocolCachePolicy,
12269
+ timeoutInterval: 10.0)
12270
+ request.httpMethod = "POST"
12271
+ request.allHTTPHeaderFields = headers
12272
+ request.httpBody = postData as Data
12273
+
12274
+ let session = URLSession.shared
12275
+ let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
12276
+ if (error != nil) {
12277
+ print(error as Any)
12278
+ } else {
12279
+ let httpResponse = response as? HTTPURLResponse
12280
+ print(httpResponse)
12281
+ }
12282
+ })
12283
+
12284
+ dataTask.resume()
12285
+ ```
12286
+
11204
12287
  # List Inboxes
11205
12288
 
11206
12289
  GET https://api.agentmail.to/v0/inboxes
@@ -21700,6 +22783,118 @@ components:
21700
22783
  type: string
21701
22784
  description: Name of api key.
21702
22785
  title: Name
22786
+ type_api-keys:ApiKeyPermissions:
22787
+ type: object
22788
+ properties:
22789
+ inbox_read:
22790
+ type: boolean
22791
+ description: Read inbox details.
22792
+ inbox_create:
22793
+ type: boolean
22794
+ description: Create new inboxes.
22795
+ inbox_update:
22796
+ type: boolean
22797
+ description: Update inbox settings.
22798
+ inbox_delete:
22799
+ type: boolean
22800
+ description: Delete inboxes.
22801
+ thread_read:
22802
+ type: boolean
22803
+ description: Read threads.
22804
+ thread_delete:
22805
+ type: boolean
22806
+ description: Delete threads.
22807
+ message_read:
22808
+ type: boolean
22809
+ description: Read messages.
22810
+ message_send:
22811
+ type: boolean
22812
+ description: Send messages.
22813
+ message_update:
22814
+ type: boolean
22815
+ description: Update message labels.
22816
+ label_spam_read:
22817
+ type: boolean
22818
+ description: Access messages labeled spam.
22819
+ label_blocked_read:
22820
+ type: boolean
22821
+ description: Access messages labeled blocked.
22822
+ label_trash_read:
22823
+ type: boolean
22824
+ description: Access messages labeled trash.
22825
+ draft_read:
22826
+ type: boolean
22827
+ description: Read drafts.
22828
+ draft_create:
22829
+ type: boolean
22830
+ description: Create drafts.
22831
+ draft_update:
22832
+ type: boolean
22833
+ description: Update drafts.
22834
+ draft_delete:
22835
+ type: boolean
22836
+ description: Delete drafts.
22837
+ draft_send:
22838
+ type: boolean
22839
+ description: Send drafts.
22840
+ webhook_read:
22841
+ type: boolean
22842
+ description: Read webhook configurations.
22843
+ webhook_create:
22844
+ type: boolean
22845
+ description: Create webhooks.
22846
+ webhook_update:
22847
+ type: boolean
22848
+ description: Update webhooks.
22849
+ webhook_delete:
22850
+ type: boolean
22851
+ description: Delete webhooks.
22852
+ domain_read:
22853
+ type: boolean
22854
+ description: Read domain details.
22855
+ domain_create:
22856
+ type: boolean
22857
+ description: Create domains.
22858
+ domain_update:
22859
+ type: boolean
22860
+ description: Update domains.
22861
+ domain_delete:
22862
+ type: boolean
22863
+ description: Delete domains.
22864
+ list_entry_read:
22865
+ type: boolean
22866
+ description: Read list entries.
22867
+ list_entry_create:
22868
+ type: boolean
22869
+ description: Create list entries.
22870
+ list_entry_delete:
22871
+ type: boolean
22872
+ description: Delete list entries.
22873
+ metrics_read:
22874
+ type: boolean
22875
+ description: Read metrics.
22876
+ api_key_read:
22877
+ type: boolean
22878
+ description: Read API keys.
22879
+ api_key_create:
22880
+ type: boolean
22881
+ description: Create API keys.
22882
+ api_key_delete:
22883
+ type: boolean
22884
+ description: Delete API keys.
22885
+ pod_read:
22886
+ type: boolean
22887
+ description: Read pods.
22888
+ pod_create:
22889
+ type: boolean
22890
+ description: Create pods.
22891
+ pod_delete:
22892
+ type: boolean
22893
+ description: Delete pods.
22894
+ description: >-
22895
+ Granular permissions for the API key. When ommitted all permissions are
22896
+ granted. Otherwise, only permissions set to true are granted.
22897
+ title: ApiKeyPermissions
21703
22898
  type_api-keys:CreatedAt:
21704
22899
  type: string
21705
22900
  format: date-time
@@ -21728,6 +22923,8 @@ components:
21728
22923
  type: string
21729
22924
  format: date-time
21730
22925
  description: Time at which api key was last used.
22926
+ permissions:
22927
+ $ref: '#/components/schemas/type_api-keys:ApiKeyPermissions'
21731
22928
  created_at:
21732
22929
  $ref: '#/components/schemas/type_api-keys:CreatedAt'
21733
22930
  required:
@@ -21979,11 +23176,125 @@ components:
21979
23176
  type: string
21980
23177
  description: Name of api key.
21981
23178
  title: Name
23179
+ type_api-keys:ApiKeyPermissions:
23180
+ type: object
23181
+ properties:
23182
+ inbox_read:
23183
+ type: boolean
23184
+ description: Read inbox details.
23185
+ inbox_create:
23186
+ type: boolean
23187
+ description: Create new inboxes.
23188
+ inbox_update:
23189
+ type: boolean
23190
+ description: Update inbox settings.
23191
+ inbox_delete:
23192
+ type: boolean
23193
+ description: Delete inboxes.
23194
+ thread_read:
23195
+ type: boolean
23196
+ description: Read threads.
23197
+ thread_delete:
23198
+ type: boolean
23199
+ description: Delete threads.
23200
+ message_read:
23201
+ type: boolean
23202
+ description: Read messages.
23203
+ message_send:
23204
+ type: boolean
23205
+ description: Send messages.
23206
+ message_update:
23207
+ type: boolean
23208
+ description: Update message labels.
23209
+ label_spam_read:
23210
+ type: boolean
23211
+ description: Access messages labeled spam.
23212
+ label_blocked_read:
23213
+ type: boolean
23214
+ description: Access messages labeled blocked.
23215
+ label_trash_read:
23216
+ type: boolean
23217
+ description: Access messages labeled trash.
23218
+ draft_read:
23219
+ type: boolean
23220
+ description: Read drafts.
23221
+ draft_create:
23222
+ type: boolean
23223
+ description: Create drafts.
23224
+ draft_update:
23225
+ type: boolean
23226
+ description: Update drafts.
23227
+ draft_delete:
23228
+ type: boolean
23229
+ description: Delete drafts.
23230
+ draft_send:
23231
+ type: boolean
23232
+ description: Send drafts.
23233
+ webhook_read:
23234
+ type: boolean
23235
+ description: Read webhook configurations.
23236
+ webhook_create:
23237
+ type: boolean
23238
+ description: Create webhooks.
23239
+ webhook_update:
23240
+ type: boolean
23241
+ description: Update webhooks.
23242
+ webhook_delete:
23243
+ type: boolean
23244
+ description: Delete webhooks.
23245
+ domain_read:
23246
+ type: boolean
23247
+ description: Read domain details.
23248
+ domain_create:
23249
+ type: boolean
23250
+ description: Create domains.
23251
+ domain_update:
23252
+ type: boolean
23253
+ description: Update domains.
23254
+ domain_delete:
23255
+ type: boolean
23256
+ description: Delete domains.
23257
+ list_entry_read:
23258
+ type: boolean
23259
+ description: Read list entries.
23260
+ list_entry_create:
23261
+ type: boolean
23262
+ description: Create list entries.
23263
+ list_entry_delete:
23264
+ type: boolean
23265
+ description: Delete list entries.
23266
+ metrics_read:
23267
+ type: boolean
23268
+ description: Read metrics.
23269
+ api_key_read:
23270
+ type: boolean
23271
+ description: Read API keys.
23272
+ api_key_create:
23273
+ type: boolean
23274
+ description: Create API keys.
23275
+ api_key_delete:
23276
+ type: boolean
23277
+ description: Delete API keys.
23278
+ pod_read:
23279
+ type: boolean
23280
+ description: Read pods.
23281
+ pod_create:
23282
+ type: boolean
23283
+ description: Create pods.
23284
+ pod_delete:
23285
+ type: boolean
23286
+ description: Delete pods.
23287
+ description: >-
23288
+ Granular permissions for the API key. When ommitted all permissions are
23289
+ granted. Otherwise, only permissions set to true are granted.
23290
+ title: ApiKeyPermissions
21982
23291
  type_api-keys:CreateApiKeyRequest:
21983
23292
  type: object
21984
23293
  properties:
21985
23294
  name:
21986
23295
  $ref: '#/components/schemas/type_api-keys:Name'
23296
+ permissions:
23297
+ $ref: '#/components/schemas/type_api-keys:ApiKeyPermissions'
21987
23298
  required:
21988
23299
  - name
21989
23300
  title: CreateApiKeyRequest
@@ -22018,6 +23329,8 @@ components:
22018
23329
  inbox_id:
22019
23330
  type: string
22020
23331
  description: Inbox ID the api key is scoped to.
23332
+ permissions:
23333
+ $ref: '#/components/schemas/type_api-keys:ApiKeyPermissions'
22021
23334
  created_at:
22022
23335
  $ref: '#/components/schemas/type_api-keys:CreatedAt'
22023
23336
  required:
@@ -32163,6 +33476,118 @@ components:
32163
33476
  type: string
32164
33477
  description: Name of api key.
32165
33478
  title: Name
33479
+ type_api-keys:ApiKeyPermissions:
33480
+ type: object
33481
+ properties:
33482
+ inbox_read:
33483
+ type: boolean
33484
+ description: Read inbox details.
33485
+ inbox_create:
33486
+ type: boolean
33487
+ description: Create new inboxes.
33488
+ inbox_update:
33489
+ type: boolean
33490
+ description: Update inbox settings.
33491
+ inbox_delete:
33492
+ type: boolean
33493
+ description: Delete inboxes.
33494
+ thread_read:
33495
+ type: boolean
33496
+ description: Read threads.
33497
+ thread_delete:
33498
+ type: boolean
33499
+ description: Delete threads.
33500
+ message_read:
33501
+ type: boolean
33502
+ description: Read messages.
33503
+ message_send:
33504
+ type: boolean
33505
+ description: Send messages.
33506
+ message_update:
33507
+ type: boolean
33508
+ description: Update message labels.
33509
+ label_spam_read:
33510
+ type: boolean
33511
+ description: Access messages labeled spam.
33512
+ label_blocked_read:
33513
+ type: boolean
33514
+ description: Access messages labeled blocked.
33515
+ label_trash_read:
33516
+ type: boolean
33517
+ description: Access messages labeled trash.
33518
+ draft_read:
33519
+ type: boolean
33520
+ description: Read drafts.
33521
+ draft_create:
33522
+ type: boolean
33523
+ description: Create drafts.
33524
+ draft_update:
33525
+ type: boolean
33526
+ description: Update drafts.
33527
+ draft_delete:
33528
+ type: boolean
33529
+ description: Delete drafts.
33530
+ draft_send:
33531
+ type: boolean
33532
+ description: Send drafts.
33533
+ webhook_read:
33534
+ type: boolean
33535
+ description: Read webhook configurations.
33536
+ webhook_create:
33537
+ type: boolean
33538
+ description: Create webhooks.
33539
+ webhook_update:
33540
+ type: boolean
33541
+ description: Update webhooks.
33542
+ webhook_delete:
33543
+ type: boolean
33544
+ description: Delete webhooks.
33545
+ domain_read:
33546
+ type: boolean
33547
+ description: Read domain details.
33548
+ domain_create:
33549
+ type: boolean
33550
+ description: Create domains.
33551
+ domain_update:
33552
+ type: boolean
33553
+ description: Update domains.
33554
+ domain_delete:
33555
+ type: boolean
33556
+ description: Delete domains.
33557
+ list_entry_read:
33558
+ type: boolean
33559
+ description: Read list entries.
33560
+ list_entry_create:
33561
+ type: boolean
33562
+ description: Create list entries.
33563
+ list_entry_delete:
33564
+ type: boolean
33565
+ description: Delete list entries.
33566
+ metrics_read:
33567
+ type: boolean
33568
+ description: Read metrics.
33569
+ api_key_read:
33570
+ type: boolean
33571
+ description: Read API keys.
33572
+ api_key_create:
33573
+ type: boolean
33574
+ description: Create API keys.
33575
+ api_key_delete:
33576
+ type: boolean
33577
+ description: Delete API keys.
33578
+ pod_read:
33579
+ type: boolean
33580
+ description: Read pods.
33581
+ pod_create:
33582
+ type: boolean
33583
+ description: Create pods.
33584
+ pod_delete:
33585
+ type: boolean
33586
+ description: Delete pods.
33587
+ description: >-
33588
+ Granular permissions for the API key. When ommitted all permissions are
33589
+ granted. Otherwise, only permissions set to true are granted.
33590
+ title: ApiKeyPermissions
32166
33591
  type_api-keys:CreatedAt:
32167
33592
  type: string
32168
33593
  format: date-time
@@ -32191,6 +33616,8 @@ components:
32191
33616
  type: string
32192
33617
  format: date-time
32193
33618
  description: Time at which api key was last used.
33619
+ permissions:
33620
+ $ref: '#/components/schemas/type_api-keys:ApiKeyPermissions'
32194
33621
  created_at:
32195
33622
  $ref: '#/components/schemas/type_api-keys:CreatedAt'
32196
33623
  required:
@@ -32406,11 +33833,125 @@ components:
32406
33833
  type: string
32407
33834
  description: Name of api key.
32408
33835
  title: Name
33836
+ type_api-keys:ApiKeyPermissions:
33837
+ type: object
33838
+ properties:
33839
+ inbox_read:
33840
+ type: boolean
33841
+ description: Read inbox details.
33842
+ inbox_create:
33843
+ type: boolean
33844
+ description: Create new inboxes.
33845
+ inbox_update:
33846
+ type: boolean
33847
+ description: Update inbox settings.
33848
+ inbox_delete:
33849
+ type: boolean
33850
+ description: Delete inboxes.
33851
+ thread_read:
33852
+ type: boolean
33853
+ description: Read threads.
33854
+ thread_delete:
33855
+ type: boolean
33856
+ description: Delete threads.
33857
+ message_read:
33858
+ type: boolean
33859
+ description: Read messages.
33860
+ message_send:
33861
+ type: boolean
33862
+ description: Send messages.
33863
+ message_update:
33864
+ type: boolean
33865
+ description: Update message labels.
33866
+ label_spam_read:
33867
+ type: boolean
33868
+ description: Access messages labeled spam.
33869
+ label_blocked_read:
33870
+ type: boolean
33871
+ description: Access messages labeled blocked.
33872
+ label_trash_read:
33873
+ type: boolean
33874
+ description: Access messages labeled trash.
33875
+ draft_read:
33876
+ type: boolean
33877
+ description: Read drafts.
33878
+ draft_create:
33879
+ type: boolean
33880
+ description: Create drafts.
33881
+ draft_update:
33882
+ type: boolean
33883
+ description: Update drafts.
33884
+ draft_delete:
33885
+ type: boolean
33886
+ description: Delete drafts.
33887
+ draft_send:
33888
+ type: boolean
33889
+ description: Send drafts.
33890
+ webhook_read:
33891
+ type: boolean
33892
+ description: Read webhook configurations.
33893
+ webhook_create:
33894
+ type: boolean
33895
+ description: Create webhooks.
33896
+ webhook_update:
33897
+ type: boolean
33898
+ description: Update webhooks.
33899
+ webhook_delete:
33900
+ type: boolean
33901
+ description: Delete webhooks.
33902
+ domain_read:
33903
+ type: boolean
33904
+ description: Read domain details.
33905
+ domain_create:
33906
+ type: boolean
33907
+ description: Create domains.
33908
+ domain_update:
33909
+ type: boolean
33910
+ description: Update domains.
33911
+ domain_delete:
33912
+ type: boolean
33913
+ description: Delete domains.
33914
+ list_entry_read:
33915
+ type: boolean
33916
+ description: Read list entries.
33917
+ list_entry_create:
33918
+ type: boolean
33919
+ description: Create list entries.
33920
+ list_entry_delete:
33921
+ type: boolean
33922
+ description: Delete list entries.
33923
+ metrics_read:
33924
+ type: boolean
33925
+ description: Read metrics.
33926
+ api_key_read:
33927
+ type: boolean
33928
+ description: Read API keys.
33929
+ api_key_create:
33930
+ type: boolean
33931
+ description: Create API keys.
33932
+ api_key_delete:
33933
+ type: boolean
33934
+ description: Delete API keys.
33935
+ pod_read:
33936
+ type: boolean
33937
+ description: Read pods.
33938
+ pod_create:
33939
+ type: boolean
33940
+ description: Create pods.
33941
+ pod_delete:
33942
+ type: boolean
33943
+ description: Delete pods.
33944
+ description: >-
33945
+ Granular permissions for the API key. When ommitted all permissions are
33946
+ granted. Otherwise, only permissions set to true are granted.
33947
+ title: ApiKeyPermissions
32409
33948
  type_api-keys:CreateApiKeyRequest:
32410
33949
  type: object
32411
33950
  properties:
32412
33951
  name:
32413
33952
  $ref: '#/components/schemas/type_api-keys:Name'
33953
+ permissions:
33954
+ $ref: '#/components/schemas/type_api-keys:ApiKeyPermissions'
32414
33955
  required:
32415
33956
  - name
32416
33957
  title: CreateApiKeyRequest
@@ -32445,6 +33986,8 @@ components:
32445
33986
  inbox_id:
32446
33987
  type: string
32447
33988
  description: Inbox ID the api key is scoped to.
33989
+ permissions:
33990
+ $ref: '#/components/schemas/type_api-keys:ApiKeyPermissions'
32448
33991
  created_at:
32449
33992
  $ref: '#/components/schemas/type_api-keys:CreatedAt'
32450
33993
  required:
@@ -41441,6 +42984,118 @@ components:
41441
42984
  type: string
41442
42985
  description: Name of api key.
41443
42986
  title: Name
42987
+ type_api-keys:ApiKeyPermissions:
42988
+ type: object
42989
+ properties:
42990
+ inbox_read:
42991
+ type: boolean
42992
+ description: Read inbox details.
42993
+ inbox_create:
42994
+ type: boolean
42995
+ description: Create new inboxes.
42996
+ inbox_update:
42997
+ type: boolean
42998
+ description: Update inbox settings.
42999
+ inbox_delete:
43000
+ type: boolean
43001
+ description: Delete inboxes.
43002
+ thread_read:
43003
+ type: boolean
43004
+ description: Read threads.
43005
+ thread_delete:
43006
+ type: boolean
43007
+ description: Delete threads.
43008
+ message_read:
43009
+ type: boolean
43010
+ description: Read messages.
43011
+ message_send:
43012
+ type: boolean
43013
+ description: Send messages.
43014
+ message_update:
43015
+ type: boolean
43016
+ description: Update message labels.
43017
+ label_spam_read:
43018
+ type: boolean
43019
+ description: Access messages labeled spam.
43020
+ label_blocked_read:
43021
+ type: boolean
43022
+ description: Access messages labeled blocked.
43023
+ label_trash_read:
43024
+ type: boolean
43025
+ description: Access messages labeled trash.
43026
+ draft_read:
43027
+ type: boolean
43028
+ description: Read drafts.
43029
+ draft_create:
43030
+ type: boolean
43031
+ description: Create drafts.
43032
+ draft_update:
43033
+ type: boolean
43034
+ description: Update drafts.
43035
+ draft_delete:
43036
+ type: boolean
43037
+ description: Delete drafts.
43038
+ draft_send:
43039
+ type: boolean
43040
+ description: Send drafts.
43041
+ webhook_read:
43042
+ type: boolean
43043
+ description: Read webhook configurations.
43044
+ webhook_create:
43045
+ type: boolean
43046
+ description: Create webhooks.
43047
+ webhook_update:
43048
+ type: boolean
43049
+ description: Update webhooks.
43050
+ webhook_delete:
43051
+ type: boolean
43052
+ description: Delete webhooks.
43053
+ domain_read:
43054
+ type: boolean
43055
+ description: Read domain details.
43056
+ domain_create:
43057
+ type: boolean
43058
+ description: Create domains.
43059
+ domain_update:
43060
+ type: boolean
43061
+ description: Update domains.
43062
+ domain_delete:
43063
+ type: boolean
43064
+ description: Delete domains.
43065
+ list_entry_read:
43066
+ type: boolean
43067
+ description: Read list entries.
43068
+ list_entry_create:
43069
+ type: boolean
43070
+ description: Create list entries.
43071
+ list_entry_delete:
43072
+ type: boolean
43073
+ description: Delete list entries.
43074
+ metrics_read:
43075
+ type: boolean
43076
+ description: Read metrics.
43077
+ api_key_read:
43078
+ type: boolean
43079
+ description: Read API keys.
43080
+ api_key_create:
43081
+ type: boolean
43082
+ description: Create API keys.
43083
+ api_key_delete:
43084
+ type: boolean
43085
+ description: Delete API keys.
43086
+ pod_read:
43087
+ type: boolean
43088
+ description: Read pods.
43089
+ pod_create:
43090
+ type: boolean
43091
+ description: Create pods.
43092
+ pod_delete:
43093
+ type: boolean
43094
+ description: Delete pods.
43095
+ description: >-
43096
+ Granular permissions for the API key. When ommitted all permissions are
43097
+ granted. Otherwise, only permissions set to true are granted.
43098
+ title: ApiKeyPermissions
41444
43099
  type_api-keys:CreatedAt:
41445
43100
  type: string
41446
43101
  format: date-time
@@ -41469,6 +43124,8 @@ components:
41469
43124
  type: string
41470
43125
  format: date-time
41471
43126
  description: Time at which api key was last used.
43127
+ permissions:
43128
+ $ref: '#/components/schemas/type_api-keys:ApiKeyPermissions'
41472
43129
  created_at:
41473
43130
  $ref: '#/components/schemas/type_api-keys:CreatedAt'
41474
43131
  required:
@@ -41720,11 +43377,125 @@ components:
41720
43377
  type: string
41721
43378
  description: Name of api key.
41722
43379
  title: Name
43380
+ type_api-keys:ApiKeyPermissions:
43381
+ type: object
43382
+ properties:
43383
+ inbox_read:
43384
+ type: boolean
43385
+ description: Read inbox details.
43386
+ inbox_create:
43387
+ type: boolean
43388
+ description: Create new inboxes.
43389
+ inbox_update:
43390
+ type: boolean
43391
+ description: Update inbox settings.
43392
+ inbox_delete:
43393
+ type: boolean
43394
+ description: Delete inboxes.
43395
+ thread_read:
43396
+ type: boolean
43397
+ description: Read threads.
43398
+ thread_delete:
43399
+ type: boolean
43400
+ description: Delete threads.
43401
+ message_read:
43402
+ type: boolean
43403
+ description: Read messages.
43404
+ message_send:
43405
+ type: boolean
43406
+ description: Send messages.
43407
+ message_update:
43408
+ type: boolean
43409
+ description: Update message labels.
43410
+ label_spam_read:
43411
+ type: boolean
43412
+ description: Access messages labeled spam.
43413
+ label_blocked_read:
43414
+ type: boolean
43415
+ description: Access messages labeled blocked.
43416
+ label_trash_read:
43417
+ type: boolean
43418
+ description: Access messages labeled trash.
43419
+ draft_read:
43420
+ type: boolean
43421
+ description: Read drafts.
43422
+ draft_create:
43423
+ type: boolean
43424
+ description: Create drafts.
43425
+ draft_update:
43426
+ type: boolean
43427
+ description: Update drafts.
43428
+ draft_delete:
43429
+ type: boolean
43430
+ description: Delete drafts.
43431
+ draft_send:
43432
+ type: boolean
43433
+ description: Send drafts.
43434
+ webhook_read:
43435
+ type: boolean
43436
+ description: Read webhook configurations.
43437
+ webhook_create:
43438
+ type: boolean
43439
+ description: Create webhooks.
43440
+ webhook_update:
43441
+ type: boolean
43442
+ description: Update webhooks.
43443
+ webhook_delete:
43444
+ type: boolean
43445
+ description: Delete webhooks.
43446
+ domain_read:
43447
+ type: boolean
43448
+ description: Read domain details.
43449
+ domain_create:
43450
+ type: boolean
43451
+ description: Create domains.
43452
+ domain_update:
43453
+ type: boolean
43454
+ description: Update domains.
43455
+ domain_delete:
43456
+ type: boolean
43457
+ description: Delete domains.
43458
+ list_entry_read:
43459
+ type: boolean
43460
+ description: Read list entries.
43461
+ list_entry_create:
43462
+ type: boolean
43463
+ description: Create list entries.
43464
+ list_entry_delete:
43465
+ type: boolean
43466
+ description: Delete list entries.
43467
+ metrics_read:
43468
+ type: boolean
43469
+ description: Read metrics.
43470
+ api_key_read:
43471
+ type: boolean
43472
+ description: Read API keys.
43473
+ api_key_create:
43474
+ type: boolean
43475
+ description: Create API keys.
43476
+ api_key_delete:
43477
+ type: boolean
43478
+ description: Delete API keys.
43479
+ pod_read:
43480
+ type: boolean
43481
+ description: Read pods.
43482
+ pod_create:
43483
+ type: boolean
43484
+ description: Create pods.
43485
+ pod_delete:
43486
+ type: boolean
43487
+ description: Delete pods.
43488
+ description: >-
43489
+ Granular permissions for the API key. When ommitted all permissions are
43490
+ granted. Otherwise, only permissions set to true are granted.
43491
+ title: ApiKeyPermissions
41723
43492
  type_api-keys:CreateApiKeyRequest:
41724
43493
  type: object
41725
43494
  properties:
41726
43495
  name:
41727
43496
  $ref: '#/components/schemas/type_api-keys:Name'
43497
+ permissions:
43498
+ $ref: '#/components/schemas/type_api-keys:ApiKeyPermissions'
41728
43499
  required:
41729
43500
  - name
41730
43501
  title: CreateApiKeyRequest
@@ -41759,6 +43530,8 @@ components:
41759
43530
  inbox_id:
41760
43531
  type: string
41761
43532
  description: Inbox ID the api key is scoped to.
43533
+ permissions:
43534
+ $ref: '#/components/schemas/type_api-keys:ApiKeyPermissions'
41762
43535
  created_at:
41763
43536
  $ref: '#/components/schemas/type_api-keys:CreatedAt'
41764
43537
  required:
@@ -42809,6 +44582,15 @@ const inbox = await client.inboxes.create();
42809
44582
  console.log(`Connected! Created inbox: ${inbox.inboxId}`);
42810
44583
  ```
42811
44584
 
44585
+ ## Scoped API keys
44586
+
44587
+ In addition to organization-level keys, you can create keys scoped to a single pod or inbox. Scoped keys restrict access so that the key can only operate on resources within that pod or inbox.
44588
+
44589
+ * **Pod-scoped keys**: Create via `POST /pods/{pod_id}/api-keys` or `client.pods.api_keys.create()`
44590
+ * **Inbox-scoped keys**: Create via `POST /inboxes/{inbox_id}/api-keys` or `client.inboxes.api_keys.create()`
44591
+
44592
+ See the [Multi-Tenancy guide](/multi-tenancy#scoped-api-keys) for details.
44593
+
42812
44594
  ## Free tier
42813
44595
 
42814
44596
  No credit card required to get started. The free tier includes:
@@ -43430,6 +45212,7 @@ client.pods.delete(pod_id=pod.pod_id)
43430
45212
  * **Cross-pod email works normally.** Inboxes in different Pods can send and receive emails from each other, just like any other email addresses. Pods isolate data access, not email delivery.
43431
45213
  * **Inboxes cannot move between Pods.** If you need to reassign an inbox, create a new one in the target Pod.
43432
45214
  * **Pod-scoped API keys.** You can create API keys scoped to a specific Pod, so each tenant only has access to their own resources. Create them via `POST /pods/{pod_id}/api-keys`.
45215
+ * **Inbox-scoped API keys.** For even finer control, you can create keys scoped to a single inbox. These keys can only access that inbox's threads, messages, and drafts. Create them via `POST /inboxes/{inbox_id}/api-keys`.
43433
45216
  * **No limit on Pods.** You can create as many Pods as you need for your customers.
43434
45217
  * **Domains can be scoped to one Pod or all Pods.** A domain cannot be shared across a subset of Pods.
43435
45218