agentmail 0.4.1 → 0.4.2

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 (24) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +4 -1
  3. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +12 -5
  4. package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.d.ts +8 -0
  5. package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.js +3 -0
  6. package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/threads/client/Client.js +2 -1
  8. package/dist/cjs/api/resources/threads/client/requests/ListThreadsRequest.d.ts +1 -0
  9. package/dist/cjs/version.d.ts +1 -1
  10. package/dist/cjs/version.js +1 -1
  11. package/dist/esm/BaseClient.mjs +2 -2
  12. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +4 -1
  13. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +12 -5
  14. package/dist/esm/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.d.mts +8 -0
  15. package/dist/esm/api/resources/inboxes/resources/threads/client/requests/DeleteThreadRequest.mjs +2 -0
  16. package/dist/esm/api/resources/inboxes/resources/threads/client/requests/index.d.mts +1 -0
  17. package/dist/esm/api/resources/threads/client/Client.mjs +2 -1
  18. package/dist/esm/api/resources/threads/client/requests/ListThreadsRequest.d.mts +1 -0
  19. package/dist/esm/version.d.mts +1 -1
  20. package/dist/esm/version.mjs +1 -1
  21. package/dist/llms-full.txt +856 -32
  22. package/dist/llms.txt +3 -0
  23. package/package.json +1 -1
  24. package/reference.md +23 -1
@@ -763,7 +763,7 @@ Replying to an existing `Message` adds your new `Message` to the same `Thread`,
763
763
  # Python example
764
764
  reply = client.inboxes.messages.reply(
765
765
  inbox_id='my_inbox@domain.com'
766
- message_id='msg_id',
766
+ message_id='<abc123@agentmail.to>',
767
767
  text="Thanks for the referral!",
768
768
  attachments=[
769
769
  SendAttachment(
@@ -781,7 +781,7 @@ Replying to an existing `Message` adds your new `Message` to the same `Thread`,
781
781
 
782
782
  const reply = await client.inboxes.messages.reply(
783
783
  "my_inbox@domain.com",
784
- "msg_id",
784
+ "<abc123@agentmail.to>",
785
785
  {
786
786
  text: "Thanks for the referral!",
787
787
  attachments: [
@@ -810,7 +810,7 @@ You can retrieve the details of any specific `Message` by providing its ID along
810
810
  <CodeBlocks>
811
811
  ```python title="Python"
812
812
 
813
- message = client.inboxes.messages.get(inbox_id = 'my_inbox@agentmail.to', message_id = 'msg_id')
813
+ message = client.inboxes.messages.get(inbox_id = 'my_inbox@agentmail.to', message_id = '<abc123@agentmail.to>')
814
814
 
815
815
  print(f"Retrieved message with subject: {message.subject}")
816
816
 
@@ -820,7 +820,7 @@ You can retrieve the details of any specific `Message` by providing its ID along
820
820
 
821
821
  await client.inboxes.messages.get(
822
822
  "my_inbox@domain.com",
823
- "msg_id"
823
+ "<abc123@agentmail.to>"
824
824
  )
825
825
 
826
826
  console.log(`Retrieved message with subject: ${message.subject}`);
@@ -1568,7 +1568,7 @@ You can modify the `Labels` on a `Message` that has already been sent using the
1568
1568
 
1569
1569
  client.messages.update(
1570
1570
  inbox_id='outbound@domain.com',
1571
- message_id='msg_id_123',
1571
+ message_id='<abc123@agentmail.to>',
1572
1572
  add_labels=["resolved"],
1573
1573
  remove_labels=['unresolved']
1574
1574
  )
@@ -1581,7 +1581,7 @@ You can modify the `Labels` on a `Message` that has already been sent using the
1581
1581
 
1582
1582
  await client.inboxes.messages.update(
1583
1583
  "my_inbox@domain.com",
1584
- "msg_id_123",
1584
+ "<abc123@agentmail.to>",
1585
1585
  {
1586
1586
  addLabels: [
1587
1587
  "resolved"
@@ -1656,7 +1656,7 @@ Copy one of the blocks below into Cursor or Claude for complete Labels usage in
1656
1656
  client.inboxes.messages.send("out@agentmail.to", to="user@example.com", subject="Hi", text="Body", labels=["q4-campaign"])
1657
1657
 
1658
1658
  # Update labels
1659
- client.inboxes.messages.update("out@agentmail.to", "msg_123", add_labels=["resolved"], remove_labels=["pending"])
1659
+ client.inboxes.messages.update("out@agentmail.to", "<abc123@agentmail.to>", add_labels=["resolved"], remove_labels=["pending"])
1660
1660
 
1661
1661
  # Filter by labels
1662
1662
  threads = client.inboxes.threads.list("out@agentmail.to", labels=["q4-campaign", "follow-up"])
@@ -1685,7 +1685,7 @@ Copy one of the blocks below into Cursor or Claude for complete Labels usage in
1685
1685
  text: "Body",
1686
1686
  labels: ["q4-campaign"],
1687
1687
  });
1688
- await client.inboxes.messages.update("out@agentmail.to", "msg_123", {
1688
+ await client.inboxes.messages.update("out@agentmail.to", "<abc123@agentmail.to>", {
1689
1689
  addLabels: ["resolved"],
1690
1690
  removeLabels: ["pending"],
1691
1691
  });
@@ -1941,7 +1941,7 @@ If you know the `Message` an `Attachment` belongs to, you can retrieve it direct
1941
1941
  <CodeBlocks>
1942
1942
  ```python
1943
1943
  inbox_id = "inbox_123"
1944
- message_id = "msg_456"
1944
+ message_id = "<def456@agentmail.to>"
1945
1945
  attachment_id = "attach_789" # From the message object
1946
1946
 
1947
1947
  file_data = client.inboxes.messages.get_attachment(
@@ -1959,7 +1959,7 @@ If you know the `Message` an `Attachment` belongs to, you can retrieve it direct
1959
1959
 
1960
1960
  ```typescript title="TypeScript"
1961
1961
  const inboxId = "inbox_123";
1962
- const messageId = "msg_456";
1962
+ const messageId = "<def456@agentmail.to>";
1963
1963
  const attachmentId = "attach_789"; // From the message object
1964
1964
 
1965
1965
  const fileData = await client.inboxes.messages.get_attachment(
@@ -2035,7 +2035,7 @@ Copy one of the blocks below into Cursor or Claude for complete Attachments usag
2035
2035
  attachments=[{"content": encoded, "filename": "report.txt", "content_type": "text/plain"}],
2036
2036
  )
2037
2037
 
2038
- data = client.inboxes.messages.get_attachment("inbox@am.to", "msg_123", "att_456")
2038
+ data = client.inboxes.messages.get_attachment("inbox@am.to", "<abc123@agentmail.to>", "att_456")
2039
2039
  with open("downloaded.pdf", "wb") as f:
2040
2040
  f.write(data)
2041
2041
  ```
@@ -2062,7 +2062,7 @@ Copy one of the blocks below into Cursor or Claude for complete Attachments usag
2062
2062
  attachments: [{ content: encoded, filename: "report.txt", contentType: "text/plain" }],
2063
2063
  });
2064
2064
 
2065
- const data = await client.inboxes.messages.get_attachment("inbox@am.to", "msg_123", "att_456");
2065
+ const data = await client.inboxes.messages.get_attachment("inbox@am.to", "<abc123@agentmail.to>", "att_456");
2066
2066
  ```
2067
2067
  </CodeBlocks>
2068
2068
 
@@ -3049,7 +3049,7 @@ curl -X POST -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
3049
3049
  -H "Content-Type: application/json" \
3050
3050
  -d '{
3051
3051
  "url": "https://your-openclaw-webhook-url",
3052
- "events": ["message.received"]
3052
+ "event_types": ["message.received"]
3053
3053
  }' \
3054
3054
  https://api.agentmail.to/v0/webhooks
3055
3055
  ```
@@ -4502,19 +4502,19 @@ The process is straightforward:
4502
4502
  ```python
4503
4503
  client.webhooks.create(
4504
4504
  url="https://<your-ngrok-url>.ngrok-free.app/webhooks",
4505
- events=["message.received", "message.sent"],
4505
+ event_types=["message.received", "message.sent"],
4506
4506
  )
4507
4507
  ```
4508
4508
 
4509
4509
  ```typescript
4510
4510
  await client.webhooks.create({
4511
4511
  url: "https://<your-ngrok-url>.ngrok-free.app/webhooks",
4512
- events: ["message.received", "message.sent"],
4512
+ eventTypes: ["message.received", "message.sent"],
4513
4513
  });
4514
4514
  ```
4515
4515
  </CodeBlocks>
4516
4516
 
4517
- Specify which events to receive; omit `events` to subscribe to all event types.
4517
+ Specify which events to receive; omit `event_types` to subscribe to all event types.
4518
4518
  </Step>
4519
4519
 
4520
4520
  <Step title="3. AgentMail Sends Events">
@@ -4535,7 +4535,7 @@ When AgentMail sends a webhook, the payload includes `event_type` and `event_id`
4535
4535
  "organization_id": "org_abc123...",
4536
4536
  "inbox_id": "inbox_def456...",
4537
4537
  "thread_id": "thd_ghi789...",
4538
- "message_id": "msg_jkl012...",
4538
+ "message_id": "<jkl012@agentmail.to>",
4539
4539
  "labels": ["received"],
4540
4540
  "timestamp": "2023-10-27T10:00:00Z",
4541
4541
  "reply_to": ["reply-to@example.com"],
@@ -4555,8 +4555,8 @@ When AgentMail sends a webhook, the payload includes `event_type` and `event_id`
4555
4555
  "inline": false
4556
4556
  }
4557
4557
  ],
4558
- "in_reply_to": "msg_parent456...",
4559
- "references": ["msg_ref1...", "msg_ref2..."],
4558
+ "in_reply_to": "<parent456@agentmail.to>",
4559
+ "references": ["<ref001@agentmail.to>", "<ref002@agentmail.to>"],
4560
4560
  "sort_key": "some-sort-key",
4561
4561
  "updated_at": "2023-10-27T10:00:05Z",
4562
4562
  "created_at": "2023-10-27T10:00:00Z"
@@ -4595,7 +4595,7 @@ Copy one of the blocks below into Cursor or Claude for complete Webhooks API kno
4595
4595
  Return 200 immediately; process payload in background.
4596
4596
 
4597
4597
  API reference:
4598
- - webhooks.create(url, events?, inbox_ids?, pod_ids?, client_id?)
4598
+ - webhooks.create(url, event_types?, inbox_ids?, pod_ids?, client_id?)
4599
4599
  - webhooks.get(webhook_id), webhooks.list(limit?, page_token?)
4600
4600
  - webhooks.update(webhook_id, add_inbox_ids?, remove_inbox_ids?, add_pod_ids?, remove_pod_ids?)
4601
4601
  - webhooks.delete(webhook_id)
@@ -4610,7 +4610,7 @@ Copy one of the blocks below into Cursor or Claude for complete Webhooks API kno
4610
4610
  load_dotenv()
4611
4611
  client = AgentMail(api_key=os.getenv("AGENTMAIL_API_KEY"))
4612
4612
 
4613
- wh = client.webhooks.create(url="https://your-server.com/webhooks", events=["message.received"], client_id="my-webhook-v1")
4613
+ wh = client.webhooks.create(url="https://your-server.com/webhooks", event_types=["message.received"], client_id="my-webhook-v1")
4614
4614
  all_wh = client.webhooks.list()
4615
4615
  secret = client.webhooks.get(wh.webhook_id).secret
4616
4616
  ```
@@ -4855,7 +4855,7 @@ Copy one of the blocks below into Cursor or Claude for webhook event parsing in
4855
4855
  "message": {
4856
4856
  "inbox_id": "inbox_456def",
4857
4857
  "thread_id": "thd_789ghi",
4858
- "message_id": "msg_123abc",
4858
+ "message_id": "<abc123@agentmail.to>",
4859
4859
  "labels": ["received"],
4860
4860
  "timestamp": "2023-10-27T10:00:00Z",
4861
4861
  "from": "Jane Doe <jane@example.com>",
@@ -4877,7 +4877,7 @@ Copy one of the blocks below into Cursor or Claude for webhook event parsing in
4877
4877
  "recipients": ["Support Agent <support@agentmail.to>"],
4878
4878
  "subject": "Question about my account",
4879
4879
  "preview": "A short preview of the email text...",
4880
- "last_message_id": "msg_123abc",
4880
+ "last_message_id": "<abc123@agentmail.to>",
4881
4881
  "message_count": 1,
4882
4882
  "size": 2048,
4883
4883
  "updated_at": "2023-10-27T10:00:00Z",
@@ -4901,7 +4901,7 @@ Copy one of the blocks below into Cursor or Claude for webhook event parsing in
4901
4901
  "send": {
4902
4902
  "inbox_id": "inbox_456def",
4903
4903
  "thread_id": "thd_789ghi",
4904
- "message_id": "msg_123abc",
4904
+ "message_id": "<abc123@agentmail.to>",
4905
4905
  "timestamp": "2023-10-27T10:05:00Z",
4906
4906
  "recipients": [
4907
4907
  "recipient@example.com"
@@ -4925,7 +4925,7 @@ Copy one of the blocks below into Cursor or Claude for webhook event parsing in
4925
4925
  "delivery": {
4926
4926
  "inbox_id": "inbox_456def",
4927
4927
  "thread_id": "thd_789ghi",
4928
- "message_id": "msg_123abc",
4928
+ "message_id": "<abc123@agentmail.to>",
4929
4929
  "timestamp": "2023-10-27T10:06:00Z",
4930
4930
  "recipients": [
4931
4931
  "recipient@example.com"
@@ -4968,7 +4968,7 @@ Copy one of the blocks below into Cursor or Claude for webhook event parsing in
4968
4968
  "bounce": {
4969
4969
  "inbox_id": "inbox_456def",
4970
4970
  "thread_id": "thd_789ghi",
4971
- "message_id": "msg_123abc",
4971
+ "message_id": "<abc123@agentmail.to>",
4972
4972
  "timestamp": "2023-10-27T10:07:00Z",
4973
4973
  "type": "Permanent",
4974
4974
  "sub_type": "General",
@@ -4997,7 +4997,7 @@ Copy one of the blocks below into Cursor or Claude for webhook event parsing in
4997
4997
  "complaint": {
4998
4998
  "inbox_id": "inbox_456def",
4999
4999
  "thread_id": "thd_789ghi",
5000
- "message_id": "msg_123abc",
5000
+ "message_id": "<abc123@agentmail.to>",
5001
5001
  "timestamp": "2023-10-27T10:08:00Z",
5002
5002
  "type": "abuse",
5003
5003
  "sub_type": "spam",
@@ -5023,7 +5023,7 @@ Copy one of the blocks below into Cursor or Claude for webhook event parsing in
5023
5023
  "reject": {
5024
5024
  "inbox_id": "inbox_456def",
5025
5025
  "thread_id": "thd_789ghi",
5026
- "message_id": "msg_123abc",
5026
+ "message_id": "<abc123@agentmail.to>",
5027
5027
  "timestamp": "2023-10-27T10:09:00Z",
5028
5028
  "reason": "Invalid recipient address"
5029
5029
  }
@@ -5186,7 +5186,7 @@ webhook_url = "https://your-subdomain.ngrok-free.app/webhooks"
5186
5186
 
5187
5187
  webhook = client.webhooks.create(
5188
5188
  url=webhook_url,
5189
- events=["message.received"], # add others (e.g. message.sent) as needed
5189
+ event_types=["message.received"], # add others (e.g. message.sent) as needed
5190
5190
  client_id="webhook-demo-webhook" # Ensures idempotency
5191
5191
  )
5192
5192
 
@@ -5316,7 +5316,7 @@ Copy one of the blocks below into Cursor or Claude for webhook setup in one shot
5316
5316
  """
5317
5317
  AgentMail Webhook Setup — copy into Cursor/Claude.
5318
5318
 
5319
- Flow: 1) ngrok http 3000 → copy URL. 2) inboxes.create(client_id=...) 3) webhooks.create(url=ngrok+/webhooks, events=[...], client_id=...)
5319
+ Flow: 1) ngrok http 3000 → copy URL. 2) inboxes.create(client_id=...) 3) webhooks.create(url=ngrok+/webhooks, event_types=[...], client_id=...)
5320
5320
  4) Flask POST /webhooks: return 200 immediately, process request.json in background.
5321
5321
  Local: use http://127.0.0.1:3000 in browser, not ngrok URL.
5322
5322
  """
@@ -5327,7 +5327,7 @@ Copy one of the blocks below into Cursor or Claude for webhook setup in one shot
5327
5327
  client = AgentMail()
5328
5328
 
5329
5329
  inbox = client.inboxes.create(username="webhook-demo", client_id="webhook-demo-inbox")
5330
- wh = client.webhooks.create(url="https://YOUR_NGROK.ngrok-free.app/webhooks", events=["message.received"], client_id="webhook-demo-webhook")
5330
+ wh = client.webhooks.create(url="https://YOUR_NGROK.ngrok-free.app/webhooks", event_types=["message.received"], client_id="webhook-demo-webhook")
5331
5331
 
5332
5332
  @app.route("/webhooks", methods=["POST"])
5333
5333
  def receive():
@@ -7360,7 +7360,7 @@ def receive_webhook():
7360
7360
  {
7361
7361
  "type": "message.received",
7362
7362
  "message": {
7363
- "message_id": "abc123...",
7363
+ "message_id": "<abc123@agentmail.to>",
7364
7364
  "inbox_id": "auto-reply@agentmail.to",
7365
7365
  "from_": "John Doe <john@example.com>",
7366
7366
  "subject": "Hello",
@@ -28633,6 +28633,11 @@ components:
28633
28633
  $ref: '#/components/schemas/type_api-keys:Prefix'
28634
28634
  name:
28635
28635
  $ref: '#/components/schemas/type_api-keys:Name'
28636
+ pod_id:
28637
+ type: string
28638
+ description: >-
28639
+ Pod ID the api key is scoped to. If set, the key can only access
28640
+ resources within this pod.
28636
28641
  used_at:
28637
28642
  type: string
28638
28643
  format: date-time
@@ -28885,6 +28890,9 @@ components:
28885
28890
  $ref: '#/components/schemas/type_api-keys:Prefix'
28886
28891
  name:
28887
28892
  $ref: '#/components/schemas/type_api-keys:Name'
28893
+ pod_id:
28894
+ type: string
28895
+ description: Pod ID the api key is scoped to.
28888
28896
  created_at:
28889
28897
  $ref: '#/components/schemas/type_api-keys:CreatedAt'
28890
28898
  required:
@@ -36115,6 +36123,822 @@ let dataTask = session.dataTask(with: request as URLRequest, completionHandler:
36115
36123
  dataTask.resume()
36116
36124
  ```
36117
36125
 
36126
+ # Create API Key
36127
+
36128
+ POST https://api.agentmail.to/v0/pods/{pod_id}/api-keys
36129
+ Content-Type: application/json
36130
+
36131
+ Reference: https://docs.agentmail.to/api-reference/pods/api-keys/create
36132
+
36133
+ ## OpenAPI Specification
36134
+
36135
+ ```yaml
36136
+ openapi: 3.1.0
36137
+ info:
36138
+ title: api
36139
+ version: 1.0.0
36140
+ paths:
36141
+ /v0/pods/{pod_id}/api-keys:
36142
+ post:
36143
+ operationId: create
36144
+ summary: Create API Key
36145
+ tags:
36146
+ - subpackage_pods.subpackage_pods/api-keys
36147
+ parameters:
36148
+ - name: pod_id
36149
+ in: path
36150
+ required: true
36151
+ schema:
36152
+ $ref: '#/components/schemas/type_pods:PodId'
36153
+ - name: Authorization
36154
+ in: header
36155
+ description: Bearer authentication
36156
+ required: true
36157
+ schema:
36158
+ type: string
36159
+ responses:
36160
+ '200':
36161
+ description: Response with status 200
36162
+ content:
36163
+ application/json:
36164
+ schema:
36165
+ $ref: '#/components/schemas/type_api-keys:CreateApiKeyResponse'
36166
+ '400':
36167
+ description: Error response with status 400
36168
+ content:
36169
+ application/json:
36170
+ schema:
36171
+ $ref: '#/components/schemas/type_:ValidationErrorResponse'
36172
+ '404':
36173
+ description: Error response with status 404
36174
+ content:
36175
+ application/json:
36176
+ schema:
36177
+ $ref: '#/components/schemas/type_:ErrorResponse'
36178
+ requestBody:
36179
+ content:
36180
+ application/json:
36181
+ schema:
36182
+ $ref: '#/components/schemas/type_api-keys:CreateApiKeyRequest'
36183
+ servers:
36184
+ - url: https://api.agentmail.to
36185
+ - url: https://x402.api.agentmail.to
36186
+ - url: https://mpp.api.agentmail.to
36187
+ - url: https://api.agentmail.eu
36188
+ components:
36189
+ schemas:
36190
+ type_pods:PodId:
36191
+ type: string
36192
+ description: ID of pod.
36193
+ title: PodId
36194
+ type_api-keys:Name:
36195
+ type: string
36196
+ description: Name of api key.
36197
+ title: Name
36198
+ type_api-keys:CreateApiKeyRequest:
36199
+ type: object
36200
+ properties:
36201
+ name:
36202
+ $ref: '#/components/schemas/type_api-keys:Name'
36203
+ required:
36204
+ - name
36205
+ title: CreateApiKeyRequest
36206
+ type_api-keys:ApiKeyId:
36207
+ type: string
36208
+ description: ID of api key.
36209
+ title: ApiKeyId
36210
+ type_api-keys:Prefix:
36211
+ type: string
36212
+ description: Prefix of api key.
36213
+ title: Prefix
36214
+ type_api-keys:CreatedAt:
36215
+ type: string
36216
+ format: date-time
36217
+ description: Time at which api key was created.
36218
+ title: CreatedAt
36219
+ type_api-keys:CreateApiKeyResponse:
36220
+ type: object
36221
+ properties:
36222
+ api_key_id:
36223
+ $ref: '#/components/schemas/type_api-keys:ApiKeyId'
36224
+ api_key:
36225
+ type: string
36226
+ description: API key.
36227
+ prefix:
36228
+ $ref: '#/components/schemas/type_api-keys:Prefix'
36229
+ name:
36230
+ $ref: '#/components/schemas/type_api-keys:Name'
36231
+ pod_id:
36232
+ type: string
36233
+ description: Pod ID the api key is scoped to.
36234
+ created_at:
36235
+ $ref: '#/components/schemas/type_api-keys:CreatedAt'
36236
+ required:
36237
+ - api_key_id
36238
+ - api_key
36239
+ - prefix
36240
+ - name
36241
+ - created_at
36242
+ title: CreateApiKeyResponse
36243
+ type_:ErrorName:
36244
+ type: string
36245
+ description: Name of error.
36246
+ title: ErrorName
36247
+ type_:ErrorMessage:
36248
+ type: string
36249
+ description: Error message.
36250
+ title: ErrorMessage
36251
+ type_:ErrorResponse:
36252
+ type: object
36253
+ properties:
36254
+ name:
36255
+ $ref: '#/components/schemas/type_:ErrorName'
36256
+ message:
36257
+ $ref: '#/components/schemas/type_:ErrorMessage'
36258
+ required:
36259
+ - name
36260
+ - message
36261
+ title: ErrorResponse
36262
+ type_:ValidationErrorResponse:
36263
+ type: object
36264
+ properties:
36265
+ name:
36266
+ $ref: '#/components/schemas/type_:ErrorName'
36267
+ errors:
36268
+ description: Validation errors.
36269
+ required:
36270
+ - name
36271
+ - errors
36272
+ title: ValidationErrorResponse
36273
+ securitySchemes:
36274
+ Bearer:
36275
+ type: http
36276
+ scheme: bearer
36277
+
36278
+ ```
36279
+
36280
+ ## SDK Code Examples
36281
+
36282
+ ```typescript
36283
+ import { AgentMailClient } from "agentmail";
36284
+
36285
+ async function main() {
36286
+ const client = new AgentMailClient({
36287
+ apiKey: "YOUR_TOKEN_HERE",
36288
+ });
36289
+ await client.pods.apiKeys.create("pod_id", {
36290
+ name: "name",
36291
+ });
36292
+ }
36293
+ main();
36294
+
36295
+ ```
36296
+
36297
+ ```python
36298
+ from agentmail import AgentMail
36299
+
36300
+ client = AgentMail(
36301
+ api_key="YOUR_TOKEN_HERE"
36302
+ )
36303
+
36304
+ client.pods.api_keys.create(
36305
+ pod_id="pod_id",
36306
+ name="name"
36307
+ )
36308
+
36309
+ ```
36310
+
36311
+ ```go
36312
+ package main
36313
+
36314
+ import (
36315
+ "fmt"
36316
+ "strings"
36317
+ "net/http"
36318
+ "io"
36319
+ )
36320
+
36321
+ func main() {
36322
+
36323
+ url := "https://api.agentmail.to/v0/pods/pod_id/api-keys"
36324
+
36325
+ payload := strings.NewReader("{\n \"name\": \"name\"\n}")
36326
+
36327
+ req, _ := http.NewRequest("POST", url, payload)
36328
+
36329
+ req.Header.Add("Authorization", "Bearer <api_key>")
36330
+ req.Header.Add("Content-Type", "application/json")
36331
+
36332
+ res, _ := http.DefaultClient.Do(req)
36333
+
36334
+ defer res.Body.Close()
36335
+ body, _ := io.ReadAll(res.Body)
36336
+
36337
+ fmt.Println(res)
36338
+ fmt.Println(string(body))
36339
+
36340
+ }
36341
+ ```
36342
+
36343
+ ```ruby
36344
+ require 'uri'
36345
+ require 'net/http'
36346
+
36347
+ url = URI("https://api.agentmail.to/v0/pods/pod_id/api-keys")
36348
+
36349
+ http = Net::HTTP.new(url.host, url.port)
36350
+ http.use_ssl = true
36351
+
36352
+ request = Net::HTTP::Post.new(url)
36353
+ request["Authorization"] = 'Bearer <api_key>'
36354
+ request["Content-Type"] = 'application/json'
36355
+ request.body = "{\n \"name\": \"name\"\n}"
36356
+
36357
+ response = http.request(request)
36358
+ puts response.read_body
36359
+ ```
36360
+
36361
+ ```java
36362
+ import com.mashape.unirest.http.HttpResponse;
36363
+ import com.mashape.unirest.http.Unirest;
36364
+
36365
+ HttpResponse<String> response = Unirest.post("https://api.agentmail.to/v0/pods/pod_id/api-keys")
36366
+ .header("Authorization", "Bearer <api_key>")
36367
+ .header("Content-Type", "application/json")
36368
+ .body("{\n \"name\": \"name\"\n}")
36369
+ .asString();
36370
+ ```
36371
+
36372
+ ```php
36373
+ <?php
36374
+ require_once('vendor/autoload.php');
36375
+
36376
+ $client = new \GuzzleHttp\Client();
36377
+
36378
+ $response = $client->request('POST', 'https://api.agentmail.to/v0/pods/pod_id/api-keys', [
36379
+ 'body' => '{
36380
+ "name": "name"
36381
+ }',
36382
+ 'headers' => [
36383
+ 'Authorization' => 'Bearer <api_key>',
36384
+ 'Content-Type' => 'application/json',
36385
+ ],
36386
+ ]);
36387
+
36388
+ echo $response->getBody();
36389
+ ```
36390
+
36391
+ ```csharp
36392
+ using RestSharp;
36393
+
36394
+ var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/api-keys");
36395
+ var request = new RestRequest(Method.POST);
36396
+ request.AddHeader("Authorization", "Bearer <api_key>");
36397
+ request.AddHeader("Content-Type", "application/json");
36398
+ request.AddParameter("application/json", "{\n \"name\": \"name\"\n}", ParameterType.RequestBody);
36399
+ IRestResponse response = client.Execute(request);
36400
+ ```
36401
+
36402
+ ```swift
36403
+ import Foundation
36404
+
36405
+ let headers = [
36406
+ "Authorization": "Bearer <api_key>",
36407
+ "Content-Type": "application/json"
36408
+ ]
36409
+ let parameters = ["name": "name"] as [String : Any]
36410
+
36411
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
36412
+
36413
+ let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/api-keys")! as URL,
36414
+ cachePolicy: .useProtocolCachePolicy,
36415
+ timeoutInterval: 10.0)
36416
+ request.httpMethod = "POST"
36417
+ request.allHTTPHeaderFields = headers
36418
+ request.httpBody = postData as Data
36419
+
36420
+ let session = URLSession.shared
36421
+ let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
36422
+ if (error != nil) {
36423
+ print(error as Any)
36424
+ } else {
36425
+ let httpResponse = response as? HTTPURLResponse
36426
+ print(httpResponse)
36427
+ }
36428
+ })
36429
+
36430
+ dataTask.resume()
36431
+ ```
36432
+
36433
+ # List API Keys
36434
+
36435
+ GET https://api.agentmail.to/v0/pods/{pod_id}/api-keys
36436
+
36437
+ Reference: https://docs.agentmail.to/api-reference/pods/api-keys/list
36438
+
36439
+ ## OpenAPI Specification
36440
+
36441
+ ```yaml
36442
+ openapi: 3.1.0
36443
+ info:
36444
+ title: api
36445
+ version: 1.0.0
36446
+ paths:
36447
+ /v0/pods/{pod_id}/api-keys:
36448
+ get:
36449
+ operationId: list
36450
+ summary: List API Keys
36451
+ tags:
36452
+ - subpackage_pods.subpackage_pods/api-keys
36453
+ parameters:
36454
+ - name: pod_id
36455
+ in: path
36456
+ required: true
36457
+ schema:
36458
+ $ref: '#/components/schemas/type_pods:PodId'
36459
+ - name: limit
36460
+ in: query
36461
+ required: false
36462
+ schema:
36463
+ $ref: '#/components/schemas/type_:Limit'
36464
+ - name: page_token
36465
+ in: query
36466
+ required: false
36467
+ schema:
36468
+ $ref: '#/components/schemas/type_:PageToken'
36469
+ - name: Authorization
36470
+ in: header
36471
+ description: Bearer authentication
36472
+ required: true
36473
+ schema:
36474
+ type: string
36475
+ responses:
36476
+ '200':
36477
+ description: Response with status 200
36478
+ content:
36479
+ application/json:
36480
+ schema:
36481
+ $ref: '#/components/schemas/type_api-keys:ListApiKeysResponse'
36482
+ '404':
36483
+ description: Error response with status 404
36484
+ content:
36485
+ application/json:
36486
+ schema:
36487
+ $ref: '#/components/schemas/type_:ErrorResponse'
36488
+ servers:
36489
+ - url: https://api.agentmail.to
36490
+ - url: https://x402.api.agentmail.to
36491
+ - url: https://mpp.api.agentmail.to
36492
+ - url: https://api.agentmail.eu
36493
+ components:
36494
+ schemas:
36495
+ type_pods:PodId:
36496
+ type: string
36497
+ description: ID of pod.
36498
+ title: PodId
36499
+ type_:Limit:
36500
+ type: integer
36501
+ description: Limit of number of items returned.
36502
+ title: Limit
36503
+ type_:PageToken:
36504
+ type: string
36505
+ description: Page token for pagination.
36506
+ title: PageToken
36507
+ type_:Count:
36508
+ type: integer
36509
+ description: Number of items returned.
36510
+ title: Count
36511
+ type_api-keys:ApiKeyId:
36512
+ type: string
36513
+ description: ID of api key.
36514
+ title: ApiKeyId
36515
+ type_api-keys:Prefix:
36516
+ type: string
36517
+ description: Prefix of api key.
36518
+ title: Prefix
36519
+ type_api-keys:Name:
36520
+ type: string
36521
+ description: Name of api key.
36522
+ title: Name
36523
+ type_api-keys:CreatedAt:
36524
+ type: string
36525
+ format: date-time
36526
+ description: Time at which api key was created.
36527
+ title: CreatedAt
36528
+ type_api-keys:ApiKey:
36529
+ type: object
36530
+ properties:
36531
+ api_key_id:
36532
+ $ref: '#/components/schemas/type_api-keys:ApiKeyId'
36533
+ prefix:
36534
+ $ref: '#/components/schemas/type_api-keys:Prefix'
36535
+ name:
36536
+ $ref: '#/components/schemas/type_api-keys:Name'
36537
+ pod_id:
36538
+ type: string
36539
+ description: >-
36540
+ Pod ID the api key is scoped to. If set, the key can only access
36541
+ resources within this pod.
36542
+ used_at:
36543
+ type: string
36544
+ format: date-time
36545
+ description: Time at which api key was last used.
36546
+ created_at:
36547
+ $ref: '#/components/schemas/type_api-keys:CreatedAt'
36548
+ required:
36549
+ - api_key_id
36550
+ - prefix
36551
+ - name
36552
+ - created_at
36553
+ title: ApiKey
36554
+ type_api-keys:ListApiKeysResponse:
36555
+ type: object
36556
+ properties:
36557
+ count:
36558
+ $ref: '#/components/schemas/type_:Count'
36559
+ next_page_token:
36560
+ $ref: '#/components/schemas/type_:PageToken'
36561
+ api_keys:
36562
+ type: array
36563
+ items:
36564
+ $ref: '#/components/schemas/type_api-keys:ApiKey'
36565
+ description: Ordered by `created_at` descending.
36566
+ required:
36567
+ - count
36568
+ - api_keys
36569
+ title: ListApiKeysResponse
36570
+ type_:ErrorName:
36571
+ type: string
36572
+ description: Name of error.
36573
+ title: ErrorName
36574
+ type_:ErrorMessage:
36575
+ type: string
36576
+ description: Error message.
36577
+ title: ErrorMessage
36578
+ type_:ErrorResponse:
36579
+ type: object
36580
+ properties:
36581
+ name:
36582
+ $ref: '#/components/schemas/type_:ErrorName'
36583
+ message:
36584
+ $ref: '#/components/schemas/type_:ErrorMessage'
36585
+ required:
36586
+ - name
36587
+ - message
36588
+ title: ErrorResponse
36589
+ securitySchemes:
36590
+ Bearer:
36591
+ type: http
36592
+ scheme: bearer
36593
+
36594
+ ```
36595
+
36596
+ ## SDK Code Examples
36597
+
36598
+ ```typescript
36599
+ import { AgentMailClient } from "agentmail";
36600
+
36601
+ async function main() {
36602
+ const client = new AgentMailClient({
36603
+ apiKey: "YOUR_TOKEN_HERE",
36604
+ });
36605
+ await client.pods.apiKeys.list("pod_id", {});
36606
+ }
36607
+ main();
36608
+
36609
+ ```
36610
+
36611
+ ```python
36612
+ from agentmail import AgentMail
36613
+
36614
+ client = AgentMail(
36615
+ api_key="YOUR_TOKEN_HERE"
36616
+ )
36617
+
36618
+ client.pods.api_keys.list(
36619
+ pod_id="pod_id"
36620
+ )
36621
+
36622
+ ```
36623
+
36624
+ ```go
36625
+ package main
36626
+
36627
+ import (
36628
+ "fmt"
36629
+ "net/http"
36630
+ "io"
36631
+ )
36632
+
36633
+ func main() {
36634
+
36635
+ url := "https://api.agentmail.to/v0/pods/pod_id/api-keys"
36636
+
36637
+ req, _ := http.NewRequest("GET", url, nil)
36638
+
36639
+ req.Header.Add("Authorization", "Bearer <api_key>")
36640
+
36641
+ res, _ := http.DefaultClient.Do(req)
36642
+
36643
+ defer res.Body.Close()
36644
+ body, _ := io.ReadAll(res.Body)
36645
+
36646
+ fmt.Println(res)
36647
+ fmt.Println(string(body))
36648
+
36649
+ }
36650
+ ```
36651
+
36652
+ ```ruby
36653
+ require 'uri'
36654
+ require 'net/http'
36655
+
36656
+ url = URI("https://api.agentmail.to/v0/pods/pod_id/api-keys")
36657
+
36658
+ http = Net::HTTP.new(url.host, url.port)
36659
+ http.use_ssl = true
36660
+
36661
+ request = Net::HTTP::Get.new(url)
36662
+ request["Authorization"] = 'Bearer <api_key>'
36663
+
36664
+ response = http.request(request)
36665
+ puts response.read_body
36666
+ ```
36667
+
36668
+ ```java
36669
+ import com.mashape.unirest.http.HttpResponse;
36670
+ import com.mashape.unirest.http.Unirest;
36671
+
36672
+ HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/pod_id/api-keys")
36673
+ .header("Authorization", "Bearer <api_key>")
36674
+ .asString();
36675
+ ```
36676
+
36677
+ ```php
36678
+ <?php
36679
+ require_once('vendor/autoload.php');
36680
+
36681
+ $client = new \GuzzleHttp\Client();
36682
+
36683
+ $response = $client->request('GET', 'https://api.agentmail.to/v0/pods/pod_id/api-keys', [
36684
+ 'headers' => [
36685
+ 'Authorization' => 'Bearer <api_key>',
36686
+ ],
36687
+ ]);
36688
+
36689
+ echo $response->getBody();
36690
+ ```
36691
+
36692
+ ```csharp
36693
+ using RestSharp;
36694
+
36695
+ var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/api-keys");
36696
+ var request = new RestRequest(Method.GET);
36697
+ request.AddHeader("Authorization", "Bearer <api_key>");
36698
+ IRestResponse response = client.Execute(request);
36699
+ ```
36700
+
36701
+ ```swift
36702
+ import Foundation
36703
+
36704
+ let headers = ["Authorization": "Bearer <api_key>"]
36705
+
36706
+ let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/api-keys")! as URL,
36707
+ cachePolicy: .useProtocolCachePolicy,
36708
+ timeoutInterval: 10.0)
36709
+ request.httpMethod = "GET"
36710
+ request.allHTTPHeaderFields = headers
36711
+
36712
+ let session = URLSession.shared
36713
+ let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
36714
+ if (error != nil) {
36715
+ print(error as Any)
36716
+ } else {
36717
+ let httpResponse = response as? HTTPURLResponse
36718
+ print(httpResponse)
36719
+ }
36720
+ })
36721
+
36722
+ dataTask.resume()
36723
+ ```
36724
+
36725
+ # Delete API Key
36726
+
36727
+ DELETE https://api.agentmail.to/v0/pods/{pod_id}/api-keys/{api_key}
36728
+
36729
+ Reference: https://docs.agentmail.to/api-reference/pods/api-keys/delete
36730
+
36731
+ ## OpenAPI Specification
36732
+
36733
+ ```yaml
36734
+ openapi: 3.1.0
36735
+ info:
36736
+ title: api
36737
+ version: 1.0.0
36738
+ paths:
36739
+ /v0/pods/{pod_id}/api-keys/{api_key}:
36740
+ delete:
36741
+ operationId: delete
36742
+ summary: Delete API Key
36743
+ tags:
36744
+ - subpackage_pods.subpackage_pods/api-keys
36745
+ parameters:
36746
+ - name: pod_id
36747
+ in: path
36748
+ required: true
36749
+ schema:
36750
+ $ref: '#/components/schemas/type_pods:PodId'
36751
+ - name: api_key
36752
+ in: path
36753
+ required: true
36754
+ schema:
36755
+ $ref: '#/components/schemas/type_api-keys:ApiKeyId'
36756
+ - name: Authorization
36757
+ in: header
36758
+ description: Bearer authentication
36759
+ required: true
36760
+ schema:
36761
+ type: string
36762
+ responses:
36763
+ '200':
36764
+ description: Successful response
36765
+ '404':
36766
+ description: Error response with status 404
36767
+ content:
36768
+ application/json:
36769
+ schema:
36770
+ $ref: '#/components/schemas/type_:ErrorResponse'
36771
+ servers:
36772
+ - url: https://api.agentmail.to
36773
+ - url: https://x402.api.agentmail.to
36774
+ - url: https://mpp.api.agentmail.to
36775
+ - url: https://api.agentmail.eu
36776
+ components:
36777
+ schemas:
36778
+ type_pods:PodId:
36779
+ type: string
36780
+ description: ID of pod.
36781
+ title: PodId
36782
+ type_api-keys:ApiKeyId:
36783
+ type: string
36784
+ description: ID of api key.
36785
+ title: ApiKeyId
36786
+ type_:ErrorName:
36787
+ type: string
36788
+ description: Name of error.
36789
+ title: ErrorName
36790
+ type_:ErrorMessage:
36791
+ type: string
36792
+ description: Error message.
36793
+ title: ErrorMessage
36794
+ type_:ErrorResponse:
36795
+ type: object
36796
+ properties:
36797
+ name:
36798
+ $ref: '#/components/schemas/type_:ErrorName'
36799
+ message:
36800
+ $ref: '#/components/schemas/type_:ErrorMessage'
36801
+ required:
36802
+ - name
36803
+ - message
36804
+ title: ErrorResponse
36805
+ securitySchemes:
36806
+ Bearer:
36807
+ type: http
36808
+ scheme: bearer
36809
+
36810
+ ```
36811
+
36812
+ ## SDK Code Examples
36813
+
36814
+ ```typescript
36815
+ import { AgentMailClient } from "agentmail";
36816
+
36817
+ async function main() {
36818
+ const client = new AgentMailClient({
36819
+ apiKey: "YOUR_TOKEN_HERE",
36820
+ });
36821
+ await client.pods.apiKeys.delete("pod_id", "api_key");
36822
+ }
36823
+ main();
36824
+
36825
+ ```
36826
+
36827
+ ```python
36828
+ from agentmail import AgentMail
36829
+
36830
+ client = AgentMail(
36831
+ api_key="YOUR_TOKEN_HERE"
36832
+ )
36833
+
36834
+ client.pods.api_keys.delete(
36835
+ pod_id="pod_id",
36836
+ api_key="api_key"
36837
+ )
36838
+
36839
+ ```
36840
+
36841
+ ```go
36842
+ package main
36843
+
36844
+ import (
36845
+ "fmt"
36846
+ "net/http"
36847
+ "io"
36848
+ )
36849
+
36850
+ func main() {
36851
+
36852
+ url := "https://api.agentmail.to/v0/pods/pod_id/api-keys/api_key"
36853
+
36854
+ req, _ := http.NewRequest("DELETE", url, nil)
36855
+
36856
+ req.Header.Add("Authorization", "Bearer <api_key>")
36857
+
36858
+ res, _ := http.DefaultClient.Do(req)
36859
+
36860
+ defer res.Body.Close()
36861
+ body, _ := io.ReadAll(res.Body)
36862
+
36863
+ fmt.Println(res)
36864
+ fmt.Println(string(body))
36865
+
36866
+ }
36867
+ ```
36868
+
36869
+ ```ruby
36870
+ require 'uri'
36871
+ require 'net/http'
36872
+
36873
+ url = URI("https://api.agentmail.to/v0/pods/pod_id/api-keys/api_key")
36874
+
36875
+ http = Net::HTTP.new(url.host, url.port)
36876
+ http.use_ssl = true
36877
+
36878
+ request = Net::HTTP::Delete.new(url)
36879
+ request["Authorization"] = 'Bearer <api_key>'
36880
+
36881
+ response = http.request(request)
36882
+ puts response.read_body
36883
+ ```
36884
+
36885
+ ```java
36886
+ import com.mashape.unirest.http.HttpResponse;
36887
+ import com.mashape.unirest.http.Unirest;
36888
+
36889
+ HttpResponse<String> response = Unirest.delete("https://api.agentmail.to/v0/pods/pod_id/api-keys/api_key")
36890
+ .header("Authorization", "Bearer <api_key>")
36891
+ .asString();
36892
+ ```
36893
+
36894
+ ```php
36895
+ <?php
36896
+ require_once('vendor/autoload.php');
36897
+
36898
+ $client = new \GuzzleHttp\Client();
36899
+
36900
+ $response = $client->request('DELETE', 'https://api.agentmail.to/v0/pods/pod_id/api-keys/api_key', [
36901
+ 'headers' => [
36902
+ 'Authorization' => 'Bearer <api_key>',
36903
+ ],
36904
+ ]);
36905
+
36906
+ echo $response->getBody();
36907
+ ```
36908
+
36909
+ ```csharp
36910
+ using RestSharp;
36911
+
36912
+ var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/api-keys/api_key");
36913
+ var request = new RestRequest(Method.DELETE);
36914
+ request.AddHeader("Authorization", "Bearer <api_key>");
36915
+ IRestResponse response = client.Execute(request);
36916
+ ```
36917
+
36918
+ ```swift
36919
+ import Foundation
36920
+
36921
+ let headers = ["Authorization": "Bearer <api_key>"]
36922
+
36923
+ let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/api-keys/api_key")! as URL,
36924
+ cachePolicy: .useProtocolCachePolicy,
36925
+ timeoutInterval: 10.0)
36926
+ request.httpMethod = "DELETE"
36927
+ request.allHTTPHeaderFields = headers
36928
+
36929
+ let session = URLSession.shared
36930
+ let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
36931
+ if (error != nil) {
36932
+ print(error as Any)
36933
+ } else {
36934
+ let httpResponse = response as? HTTPURLResponse
36935
+ print(httpResponse)
36936
+ }
36937
+ })
36938
+
36939
+ dataTask.resume()
36940
+ ```
36941
+
36118
36942
  # Get Organization
36119
36943
 
36120
36944
  GET https://api.agentmail.to/v0/organizations