Skip to content

Pods (Multi-Tenant)

Fresh 🌱

AgentMail REST API reference for Pods (Multi-Tenant). Base URL https://api.agentmail.to/v0. Authenticate with Authorization: Bearer <API_KEY>.

Create Pod

POST https://api.agentmail.to/v0/pods Content-Type: application/json

CLI:

bash
agentmail pods create --client-id my-pod

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/pods:
    post:
      operationId: create
      summary: Create Pod
      description: |-
        **CLI:**
        ```bash
        agentmail pods create --client-id my-pod
        ```
      tags:
        - subpackage_pods
      parameters:
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Response with status 200
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_pods:Pod'
        '400':
          description: Error response with status 400
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ValidationErrorResponse'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/type_pods:CreatePodRequest'
servers:
  - url: https://api.agentmail.to
    description: prod
  - url: https://x402.api.agentmail.to
    description: prod-x402
  - url: https://mpp.api.agentmail.to
    description: prod-mpp
  - url: https://api.agentmail.eu
    description: eu-prod
components:
  schemas:
    type_pods:Name:
      type: string
      description: Name of pod.
      title: Name
    type_pods:ClientId:
      type: string
      description: Client ID of pod.
      title: ClientId
    type_pods:CreatePodRequest:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_pods:Name'
        client_id:
          $ref: '#/components/schemas/type_pods:ClientId'
      title: CreatePodRequest
    type_pods:PodId:
      type: string
      description: ID of pod.
      title: PodId
    type_pods:Pod:
      type: object
      properties:
        pod_id:
          $ref: '#/components/schemas/type_pods:PodId'
        name:
          $ref: '#/components/schemas/type_pods:Name'
        updated_at:
          type: string
          format: date-time
          description: Time at which pod was last updated.
        created_at:
          type: string
          format: date-time
          description: Time at which pod was created.
        client_id:
          $ref: '#/components/schemas/type_pods:ClientId'
      required:
        - pod_id
        - name
        - updated_at
        - created_at
      title: Pod
    type_:ErrorName:
      type: string
      description: Name of error.
      title: ErrorName
    type_:ValidationErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        errors:
          description: Validation errors.
      required:
        - name
        - errors
      title: ValidationErrorResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

Request

json
{}

Response

json
{
  "pod_id": "pod_id",
  "name": "name",
  "updated_at": "2024-01-15T09:30:00Z",
  "created_at": "2024-01-15T09:30:00Z",
  "client_id": "client_id"
}

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.pods.create({});
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.pods.create()
go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/pods"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <api_key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/pods")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <api_key>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.agentmail.to/v0/pods")
  .header("Authorization", "Bearer <api_key>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.agentmail.to/v0/pods', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/pods");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <api_key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = [
  "Authorization": "Bearer <api_key>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()

Get Pod

GET https://api.agentmail.to/v0/pods/{pod_id}

CLI:

bash
agentmail pods get --pod-id <pod_id>

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/pods/{pod_id}:
    get:
      operationId: get
      summary: Get Pod
      description: |-
        **CLI:**
        ```bash
        agentmail pods get --pod-id <pod_id>
        ```
      tags:
        - subpackage_pods
      parameters:
        - name: pod_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_pods:PodId'
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Response with status 200
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_pods:Pod'
        '404':
          description: Error response with status 404
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ErrorResponse'
servers:
  - url: https://api.agentmail.to
    description: prod
  - url: https://x402.api.agentmail.to
    description: prod-x402
  - url: https://mpp.api.agentmail.to
    description: prod-mpp
  - url: https://api.agentmail.eu
    description: eu-prod
components:
  schemas:
    type_pods:PodId:
      type: string
      description: ID of pod.
      title: PodId
    type_pods:Name:
      type: string
      description: Name of pod.
      title: Name
    type_pods:ClientId:
      type: string
      description: Client ID of pod.
      title: ClientId
    type_pods:Pod:
      type: object
      properties:
        pod_id:
          $ref: '#/components/schemas/type_pods:PodId'
        name:
          $ref: '#/components/schemas/type_pods:Name'
        updated_at:
          type: string
          format: date-time
          description: Time at which pod was last updated.
        created_at:
          type: string
          format: date-time
          description: Time at which pod was created.
        client_id:
          $ref: '#/components/schemas/type_pods:ClientId'
      required:
        - pod_id
        - name
        - updated_at
        - created_at
      title: Pod
    type_:ErrorName:
      type: string
      description: Name of error.
      title: ErrorName
    type_:ErrorMessage:
      type: string
      description: Error message.
      title: ErrorMessage
    type_:ErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        message:
          $ref: '#/components/schemas/type_:ErrorMessage'
      required:
        - name
        - message
      title: ErrorResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

Response

json
{
  "pod_id": "pod_id",
  "name": "name",
  "updated_at": "2024-01-15T09:30:00Z",
  "created_at": "2024-01-15T09:30:00Z",
  "client_id": "client_id"
}

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.pods.get("pod_id");
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.pods.get(
    pod_id="pod_id",
)
go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/pods/pod_id"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <api_key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/pods/pod_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <api_key>'

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/pod_id")
  .header("Authorization", "Bearer <api_key>")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.agentmail.to/v0/pods/pod_id', [
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <api_key>");
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = ["Authorization": "Bearer <api_key>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()

List Pods

GET https://api.agentmail.to/v0/pods

CLI:

bash
agentmail pods list

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/pods:
    get:
      operationId: list
      summary: List Pods
      description: |-
        **CLI:**
        ```bash
        agentmail pods list
        ```
      tags:
        - subpackage_pods
      parameters:
        - name: limit
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:Limit'
        - name: page_token
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:PageToken'
        - name: ascending
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:Ascending'
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Response with status 200
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_pods:ListPodsResponse'
servers:
  - url: https://api.agentmail.to
    description: prod
  - url: https://x402.api.agentmail.to
    description: prod-x402
  - url: https://mpp.api.agentmail.to
    description: prod-mpp
  - url: https://api.agentmail.eu
    description: eu-prod
components:
  schemas:
    type_:Limit:
      type: integer
      description: Limit of number of items returned.
      title: Limit
    type_:PageToken:
      type: string
      description: Page token for pagination.
      title: PageToken
    type_:Ascending:
      type: boolean
      description: Sort in ascending temporal order.
      title: Ascending
    type_:Count:
      type: integer
      description: Number of items returned.
      title: Count
    type_pods:PodId:
      type: string
      description: ID of pod.
      title: PodId
    type_pods:Name:
      type: string
      description: Name of pod.
      title: Name
    type_pods:ClientId:
      type: string
      description: Client ID of pod.
      title: ClientId
    type_pods:Pod:
      type: object
      properties:
        pod_id:
          $ref: '#/components/schemas/type_pods:PodId'
        name:
          $ref: '#/components/schemas/type_pods:Name'
        updated_at:
          type: string
          format: date-time
          description: Time at which pod was last updated.
        created_at:
          type: string
          format: date-time
          description: Time at which pod was created.
        client_id:
          $ref: '#/components/schemas/type_pods:ClientId'
      required:
        - pod_id
        - name
        - updated_at
        - created_at
      title: Pod
    type_pods:ListPodsResponse:
      type: object
      properties:
        count:
          $ref: '#/components/schemas/type_:Count'
        limit:
          $ref: '#/components/schemas/type_:Limit'
        next_page_token:
          $ref: '#/components/schemas/type_:PageToken'
        pods:
          type: array
          items:
            $ref: '#/components/schemas/type_pods:Pod'
          description: Ordered by `created_at` descending.
      required:
        - count
        - pods
      title: ListPodsResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

Response

json
{
  "count": 1,
  "pods": [
    {
      "pod_id": "pod_id",
      "name": "name",
      "updated_at": "2024-01-15T09:30:00Z",
      "created_at": "2024-01-15T09:30:00Z",
      "client_id": "client_id"
    },
    {
      "pod_id": "pod_id",
      "name": "name",
      "updated_at": "2024-01-15T09:30:00Z",
      "created_at": "2024-01-15T09:30:00Z",
      "client_id": "client_id"
    }
  ],
  "limit": 1,
  "next_page_token": "next_page_token"
}

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.pods.list({});
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.pods.list()
go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/pods"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <api_key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/pods")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <api_key>'

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods")
  .header("Authorization", "Bearer <api_key>")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.agentmail.to/v0/pods', [
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/pods");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <api_key>");
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = ["Authorization": "Bearer <api_key>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()

Delete Pod

DELETE https://api.agentmail.to/v0/pods/{pod_id}

CLI:

bash
agentmail pods delete --pod-id <pod_id>

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/pods/{pod_id}:
    delete:
      operationId: delete
      summary: Delete Pod
      description: |-
        **CLI:**
        ```bash
        agentmail pods delete --pod-id <pod_id>
        ```
      tags:
        - subpackage_pods
      parameters:
        - name: pod_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_pods:PodId'
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
        '404':
          description: Error response with status 404
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ErrorResponse'
servers:
  - url: https://api.agentmail.to
    description: prod
  - url: https://x402.api.agentmail.to
    description: prod-x402
  - url: https://mpp.api.agentmail.to
    description: prod-mpp
  - url: https://api.agentmail.eu
    description: eu-prod
components:
  schemas:
    type_pods:PodId:
      type: string
      description: ID of pod.
      title: PodId
    type_:ErrorName:
      type: string
      description: Name of error.
      title: ErrorName
    type_:ErrorMessage:
      type: string
      description: Error message.
      title: ErrorMessage
    type_:ErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        message:
          $ref: '#/components/schemas/type_:ErrorMessage'
      required:
        - name
        - message
      title: ErrorResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.pods.delete("pod_id");
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.pods.delete(
    pod_id="pod_id",
)
go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/pods/pod_id"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("Authorization", "Bearer <api_key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/pods/pod_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <api_key>'

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://api.agentmail.to/v0/pods/pod_id")
  .header("Authorization", "Bearer <api_key>")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.agentmail.to/v0/pods/pod_id', [
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer <api_key>");
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = ["Authorization": "Bearer <api_key>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()

Pod Inboxes: Create

POST https://api.agentmail.to/v0/pods/{pod_id}/inboxes Content-Type: application/json

CLI:

bash
agentmail pods:inboxes create --pod-id <pod_id> --username myagent --domain example.com

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/pods/{pod_id}/inboxes:
    post:
      operationId: create
      summary: Create Inbox
      description: >-
        **CLI:**

        ```bash

        agentmail pods:inboxes create --pod-id <pod_id> --username myagent
        --domain example.com

        ```
      tags:
        - subpackage_pods.subpackage_pods/inboxes
      parameters:
        - name: pod_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_pods:PodId'
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Response with status 200
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_inboxes:Inbox'
        '400':
          description: Error response with status 400
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ValidationErrorResponse'
        '422':
          description: Error response with status 422
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ErrorResponse'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/type_inboxes:CreateInboxRequest'
servers:
  - url: https://api.agentmail.to
    description: prod
  - url: https://x402.api.agentmail.to
    description: prod-x402
  - url: https://mpp.api.agentmail.to
    description: prod-mpp
  - url: https://api.agentmail.eu
    description: eu-prod
components:
  schemas:
    type_pods:PodId:
      type: string
      description: ID of pod.
      title: PodId
    type_inboxes:DisplayName:
      type: string
      description: 'Display name: `Display Name <username@domain.com>`.'
      title: DisplayName
    type_inboxes:ClientId:
      type: string
      description: Client ID of inbox.
      title: ClientId
    type_inboxes:MetadataValue:
      oneOf:
        - type: string
        - type: number
          format: double
        - type: boolean
      description: A metadata value. May be a string, number, or boolean.
      title: MetadataValue
    type_inboxes:Metadata:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/type_inboxes:MetadataValue'
      description: >-
        Custom key-value pairs attached to the inbox. Up to 256 keys. Keys and

        string values are each limited to 256 characters. When updating
        metadata,

        send a key with a null value to remove that key.
      title: Metadata
    type_inboxes:CreateInboxRequest:
      type: object
      properties:
        username:
          type: string
          description: Username of address. Randomly generated if not specified.
        domain:
          type: string
          description: >-
            Domain of address. Must be a verified domain, or any subdomain of a

            verified domain that has subdomains enabled (e.g.,
            `bot.example.com`).

            Defaults to `agentmail.to`.
        display_name:
          $ref: '#/components/schemas/type_inboxes:DisplayName'
        client_id:
          $ref: '#/components/schemas/type_inboxes:ClientId'
        metadata:
          $ref: '#/components/schemas/type_inboxes:Metadata'
          description: Custom metadata to attach to the inbox.
      title: CreateInboxRequest
    type_inboxes:InboxId:
      type: string
      description: The ID of the inbox.
      title: InboxId
    type_inboxes:Email:
      type: string
      description: Email address of the inbox.
      title: Email
    type_inboxes:Inbox:
      type: object
      properties:
        pod_id:
          $ref: '#/components/schemas/type_pods:PodId'
        inbox_id:
          $ref: '#/components/schemas/type_inboxes:InboxId'
        email:
          $ref: '#/components/schemas/type_inboxes:Email'
        display_name:
          $ref: '#/components/schemas/type_inboxes:DisplayName'
        client_id:
          $ref: '#/components/schemas/type_inboxes:ClientId'
        metadata:
          $ref: '#/components/schemas/type_inboxes:Metadata'
          description: Custom metadata attached to the inbox.
        updated_at:
          type: string
          format: date-time
          description: Time at which inbox was last updated.
        created_at:
          type: string
          format: date-time
          description: Time at which inbox was created.
      required:
        - pod_id
        - inbox_id
        - email
        - updated_at
        - created_at
      title: Inbox
    type_:ErrorName:
      type: string
      description: Name of error.
      title: ErrorName
    type_:ValidationErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        errors:
          description: Validation errors.
      required:
        - name
        - errors
      title: ValidationErrorResponse
    type_:ErrorMessage:
      type: string
      description: Error message.
      title: ErrorMessage
    type_:ErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        message:
          $ref: '#/components/schemas/type_:ErrorMessage'
      required:
        - name
        - message
      title: ErrorResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

Request

json
{}

Response

json
{
  "pod_id": "pod_id",
  "inbox_id": "inbox_id",
  "email": "email",
  "updated_at": "2024-01-15T09:30:00Z",
  "created_at": "2024-01-15T09:30:00Z",
  "display_name": "display_name",
  "client_id": "client_id",
  "metadata": {
    "metadata": "metadata"
  }
}

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.pods.inboxes.create("pod_id", {});
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.pods.inboxes.create(
    pod_id="pod_id",
)
go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/pods/pod_id/inboxes"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <api_key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/pods/pod_id/inboxes")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <api_key>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.agentmail.to/v0/pods/pod_id/inboxes")
  .header("Authorization", "Bearer <api_key>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.agentmail.to/v0/pods/pod_id/inboxes', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/inboxes");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <api_key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = [
  "Authorization": "Bearer <api_key>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/inboxes")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()

Pod Inboxes: Get

GET https://api.agentmail.to/v0/pods/{pod_id}/inboxes/{inbox_id}

CLI:

bash
agentmail pods:inboxes get --pod-id <pod_id> --inbox-id <inbox_id>

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/pods/{pod_id}/inboxes/{inbox_id}:
    get:
      operationId: get
      summary: Get Inbox
      description: |-
        **CLI:**
        ```bash
        agentmail pods:inboxes get --pod-id <pod_id> --inbox-id <inbox_id>
        ```
      tags:
        - subpackage_pods.subpackage_pods/inboxes
      parameters:
        - name: pod_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_pods:PodId'
        - name: inbox_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_inboxes:InboxId'
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Response with status 200
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_inboxes:Inbox'
        '404':
          description: Error response with status 404
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ErrorResponse'
servers:
  - url: https://api.agentmail.to
    description: prod
  - url: https://x402.api.agentmail.to
    description: prod-x402
  - url: https://mpp.api.agentmail.to
    description: prod-mpp
  - url: https://api.agentmail.eu
    description: eu-prod
components:
  schemas:
    type_pods:PodId:
      type: string
      description: ID of pod.
      title: PodId
    type_inboxes:InboxId:
      type: string
      description: The ID of the inbox.
      title: InboxId
    type_inboxes:Email:
      type: string
      description: Email address of the inbox.
      title: Email
    type_inboxes:DisplayName:
      type: string
      description: 'Display name: `Display Name <username@domain.com>`.'
      title: DisplayName
    type_inboxes:ClientId:
      type: string
      description: Client ID of inbox.
      title: ClientId
    type_inboxes:MetadataValue:
      oneOf:
        - type: string
        - type: number
          format: double
        - type: boolean
      description: A metadata value. May be a string, number, or boolean.
      title: MetadataValue
    type_inboxes:Metadata:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/type_inboxes:MetadataValue'
      description: >-
        Custom key-value pairs attached to the inbox. Up to 256 keys. Keys and

        string values are each limited to 256 characters. When updating
        metadata,

        send a key with a null value to remove that key.
      title: Metadata
    type_inboxes:Inbox:
      type: object
      properties:
        pod_id:
          $ref: '#/components/schemas/type_pods:PodId'
        inbox_id:
          $ref: '#/components/schemas/type_inboxes:InboxId'
        email:
          $ref: '#/components/schemas/type_inboxes:Email'
        display_name:
          $ref: '#/components/schemas/type_inboxes:DisplayName'
        client_id:
          $ref: '#/components/schemas/type_inboxes:ClientId'
        metadata:
          $ref: '#/components/schemas/type_inboxes:Metadata'
          description: Custom metadata attached to the inbox.
        updated_at:
          type: string
          format: date-time
          description: Time at which inbox was last updated.
        created_at:
          type: string
          format: date-time
          description: Time at which inbox was created.
      required:
        - pod_id
        - inbox_id
        - email
        - updated_at
        - created_at
      title: Inbox
    type_:ErrorName:
      type: string
      description: Name of error.
      title: ErrorName
    type_:ErrorMessage:
      type: string
      description: Error message.
      title: ErrorMessage
    type_:ErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        message:
          $ref: '#/components/schemas/type_:ErrorMessage'
      required:
        - name
        - message
      title: ErrorResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

Response

json
{
  "pod_id": "pod_id",
  "inbox_id": "inbox_id",
  "email": "email",
  "updated_at": "2024-01-15T09:30:00Z",
  "created_at": "2024-01-15T09:30:00Z",
  "display_name": "display_name",
  "client_id": "client_id",
  "metadata": {
    "metadata": "metadata"
  }
}

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.pods.inboxes.get("pod_id", "inbox_id");
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.pods.inboxes.get(
    pod_id="pod_id",
    inbox_id="inbox_id",
)
go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <api_key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <api_key>'

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id")
  .header("Authorization", "Bearer <api_key>")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id', [
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <api_key>");
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = ["Authorization": "Bearer <api_key>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()

Pod Inboxes: List

GET https://api.agentmail.to/v0/pods/{pod_id}/inboxes

CLI:

bash
agentmail pods:inboxes list --pod-id <pod_id>

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/pods/{pod_id}/inboxes:
    get:
      operationId: list
      summary: List Inboxes
      description: |-
        **CLI:**
        ```bash
        agentmail pods:inboxes list --pod-id <pod_id>
        ```
      tags:
        - subpackage_pods.subpackage_pods/inboxes
      parameters:
        - name: pod_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_pods:PodId'
        - name: limit
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:Limit'
        - name: page_token
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:PageToken'
        - name: ascending
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:Ascending'
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Response with status 200
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_inboxes:ListInboxesResponse'
        '404':
          description: Error response with status 404
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ErrorResponse'
servers:
  - url: https://api.agentmail.to
    description: prod
  - url: https://x402.api.agentmail.to
    description: prod-x402
  - url: https://mpp.api.agentmail.to
    description: prod-mpp
  - url: https://api.agentmail.eu
    description: eu-prod
components:
  schemas:
    type_pods:PodId:
      type: string
      description: ID of pod.
      title: PodId
    type_:Limit:
      type: integer
      description: Limit of number of items returned.
      title: Limit
    type_:PageToken:
      type: string
      description: Page token for pagination.
      title: PageToken
    type_:Ascending:
      type: boolean
      description: Sort in ascending temporal order.
      title: Ascending
    type_:Count:
      type: integer
      description: Number of items returned.
      title: Count
    type_inboxes:InboxId:
      type: string
      description: The ID of the inbox.
      title: InboxId
    type_inboxes:Email:
      type: string
      description: Email address of the inbox.
      title: Email
    type_inboxes:DisplayName:
      type: string
      description: 'Display name: `Display Name <username@domain.com>`.'
      title: DisplayName
    type_inboxes:ClientId:
      type: string
      description: Client ID of inbox.
      title: ClientId
    type_inboxes:MetadataValue:
      oneOf:
        - type: string
        - type: number
          format: double
        - type: boolean
      description: A metadata value. May be a string, number, or boolean.
      title: MetadataValue
    type_inboxes:Metadata:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/type_inboxes:MetadataValue'
      description: >-
        Custom key-value pairs attached to the inbox. Up to 256 keys. Keys and

        string values are each limited to 256 characters. When updating
        metadata,

        send a key with a null value to remove that key.
      title: Metadata
    type_inboxes:Inbox:
      type: object
      properties:
        pod_id:
          $ref: '#/components/schemas/type_pods:PodId'
        inbox_id:
          $ref: '#/components/schemas/type_inboxes:InboxId'
        email:
          $ref: '#/components/schemas/type_inboxes:Email'
        display_name:
          $ref: '#/components/schemas/type_inboxes:DisplayName'
        client_id:
          $ref: '#/components/schemas/type_inboxes:ClientId'
        metadata:
          $ref: '#/components/schemas/type_inboxes:Metadata'
          description: Custom metadata attached to the inbox.
        updated_at:
          type: string
          format: date-time
          description: Time at which inbox was last updated.
        created_at:
          type: string
          format: date-time
          description: Time at which inbox was created.
      required:
        - pod_id
        - inbox_id
        - email
        - updated_at
        - created_at
      title: Inbox
    type_inboxes:ListInboxesResponse:
      type: object
      properties:
        count:
          $ref: '#/components/schemas/type_:Count'
        limit:
          $ref: '#/components/schemas/type_:Limit'
        next_page_token:
          $ref: '#/components/schemas/type_:PageToken'
        inboxes:
          type: array
          items:
            $ref: '#/components/schemas/type_inboxes:Inbox'
          description: Ordered by `created_at` descending.
      required:
        - count
        - inboxes
      title: ListInboxesResponse
    type_:ErrorName:
      type: string
      description: Name of error.
      title: ErrorName
    type_:ErrorMessage:
      type: string
      description: Error message.
      title: ErrorMessage
    type_:ErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        message:
          $ref: '#/components/schemas/type_:ErrorMessage'
      required:
        - name
        - message
      title: ErrorResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

Response

json
{
  "count": 1,
  "inboxes": [
    {
      "pod_id": "pod_id",
      "inbox_id": "inbox_id",
      "email": "email",
      "updated_at": "2024-01-15T09:30:00Z",
      "created_at": "2024-01-15T09:30:00Z",
      "display_name": "display_name",
      "client_id": "client_id",
      "metadata": {
        "metadata": "metadata"
      }
    },
    {
      "pod_id": "pod_id",
      "inbox_id": "inbox_id",
      "email": "email",
      "updated_at": "2024-01-15T09:30:00Z",
      "created_at": "2024-01-15T09:30:00Z",
      "display_name": "display_name",
      "client_id": "client_id",
      "metadata": {
        "metadata": "metadata"
      }
    }
  ],
  "limit": 1,
  "next_page_token": "next_page_token"
}

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.pods.inboxes.list("pod_id", {});
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.pods.inboxes.list(
    pod_id="pod_id",
)
go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/pods/pod_id/inboxes"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <api_key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/pods/pod_id/inboxes")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <api_key>'

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/pod_id/inboxes")
  .header("Authorization", "Bearer <api_key>")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.agentmail.to/v0/pods/pod_id/inboxes', [
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/inboxes");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <api_key>");
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = ["Authorization": "Bearer <api_key>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/inboxes")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()

Pod Inboxes: Update

PATCH https://api.agentmail.to/v0/pods/{pod_id}/inboxes/{inbox_id} Content-Type: application/json

CLI:

bash
agentmail pods:inboxes update --pod-id <pod_id> --inbox-id <inbox_id>

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/pods/{pod_id}/inboxes/{inbox_id}:
    patch:
      operationId: update
      summary: Update Inbox
      description: |-
        **CLI:**
        ```bash
        agentmail pods:inboxes update --pod-id <pod_id> --inbox-id <inbox_id>
        ```
      tags:
        - subpackage_pods.subpackage_pods/inboxes
      parameters:
        - name: pod_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_pods:PodId'
        - name: inbox_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_inboxes:InboxId'
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Response with status 200
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_inboxes:Inbox'
        '404':
          description: Error response with status 404
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ErrorResponse'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/type_inboxes:UpdateInboxRequest'
servers:
  - url: https://api.agentmail.to
    description: prod
  - url: https://x402.api.agentmail.to
    description: prod-x402
  - url: https://mpp.api.agentmail.to
    description: prod-mpp
  - url: https://api.agentmail.eu
    description: eu-prod
components:
  schemas:
    type_pods:PodId:
      type: string
      description: ID of pod.
      title: PodId
    type_inboxes:InboxId:
      type: string
      description: The ID of the inbox.
      title: InboxId
    type_inboxes:DisplayName:
      type: string
      description: 'Display name: `Display Name <username@domain.com>`.'
      title: DisplayName
    type_inboxes:MetadataValue:
      oneOf:
        - type: string
        - type: number
          format: double
        - type: boolean
      description: A metadata value. May be a string, number, or boolean.
      title: MetadataValue
    type_inboxes:UpdateMetadata:
      type: object
      additionalProperties:
        oneOf:
          - $ref: '#/components/schemas/type_inboxes:MetadataValue'
          - type: 'null'
      description: |-
        Custom key-value pairs to merge into the inbox's existing metadata. A
        value may be a string, number, boolean, or null. Setting a key to null
        removes it. Up to 256 keys; keys and string values are each limited to
        256 characters.
      title: UpdateMetadata
    type_inboxes:UpdateInboxRequest:
      type: object
      properties:
        display_name:
          $ref: '#/components/schemas/type_inboxes:DisplayName'
        metadata:
          oneOf:
            - $ref: '#/components/schemas/type_inboxes:UpdateMetadata'
            - type: 'null'
          description: >-
            Metadata to merge into the inbox's existing metadata. Keys you
            include

            are added or overwritten; keys you omit are left unchanged. To
            remove a

            single key, send it with a null value. To clear all metadata, send

            `metadata` as null. Sending an empty object is rejected; use null to

            clear. Each update must include at least one of `display_name` or

            `metadata`.
      title: UpdateInboxRequest
    type_inboxes:Email:
      type: string
      description: Email address of the inbox.
      title: Email
    type_inboxes:ClientId:
      type: string
      description: Client ID of inbox.
      title: ClientId
    type_inboxes:Metadata:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/type_inboxes:MetadataValue'
      description: >-
        Custom key-value pairs attached to the inbox. Up to 256 keys. Keys and

        string values are each limited to 256 characters. When updating
        metadata,

        send a key with a null value to remove that key.
      title: Metadata
    type_inboxes:Inbox:
      type: object
      properties:
        pod_id:
          $ref: '#/components/schemas/type_pods:PodId'
        inbox_id:
          $ref: '#/components/schemas/type_inboxes:InboxId'
        email:
          $ref: '#/components/schemas/type_inboxes:Email'
        display_name:
          $ref: '#/components/schemas/type_inboxes:DisplayName'
        client_id:
          $ref: '#/components/schemas/type_inboxes:ClientId'
        metadata:
          $ref: '#/components/schemas/type_inboxes:Metadata'
          description: Custom metadata attached to the inbox.
        updated_at:
          type: string
          format: date-time
          description: Time at which inbox was last updated.
        created_at:
          type: string
          format: date-time
          description: Time at which inbox was created.
      required:
        - pod_id
        - inbox_id
        - email
        - updated_at
        - created_at
      title: Inbox
    type_:ErrorName:
      type: string
      description: Name of error.
      title: ErrorName
    type_:ErrorMessage:
      type: string
      description: Error message.
      title: ErrorMessage
    type_:ErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        message:
          $ref: '#/components/schemas/type_:ErrorMessage'
      required:
        - name
        - message
      title: ErrorResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

Request

json
{}

Response

json
{
  "pod_id": "pod_id",
  "inbox_id": "inbox_id",
  "email": "email",
  "updated_at": "2024-01-15T09:30:00Z",
  "created_at": "2024-01-15T09:30:00Z",
  "display_name": "display_name",
  "client_id": "client_id",
  "metadata": {
    "metadata": "metadata"
  }
}

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.pods.inboxes.update("pod_id", "inbox_id", {});
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.pods.inboxes.update(
    pod_id="pod_id",
    inbox_id="inbox_id",
)
go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <api_key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <api_key>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id")
  .header("Authorization", "Bearer <api_key>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <api_key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = [
  "Authorization": "Bearer <api_key>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()

Pod Inboxes: Delete

DELETE https://api.agentmail.to/v0/pods/{pod_id}/inboxes/{inbox_id}

CLI:

bash
agentmail pods:inboxes delete --pod-id <pod_id> --inbox-id <inbox_id>

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/pods/{pod_id}/inboxes/{inbox_id}:
    delete:
      operationId: delete
      summary: Delete Inbox
      description: |-
        **CLI:**
        ```bash
        agentmail pods:inboxes delete --pod-id <pod_id> --inbox-id <inbox_id>
        ```
      tags:
        - subpackage_pods.subpackage_pods/inboxes
      parameters:
        - name: pod_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_pods:PodId'
        - name: inbox_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_inboxes:InboxId'
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
        '404':
          description: Error response with status 404
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ErrorResponse'
servers:
  - url: https://api.agentmail.to
    description: prod
  - url: https://x402.api.agentmail.to
    description: prod-x402
  - url: https://mpp.api.agentmail.to
    description: prod-mpp
  - url: https://api.agentmail.eu
    description: eu-prod
components:
  schemas:
    type_pods:PodId:
      type: string
      description: ID of pod.
      title: PodId
    type_inboxes:InboxId:
      type: string
      description: The ID of the inbox.
      title: InboxId
    type_:ErrorName:
      type: string
      description: Name of error.
      title: ErrorName
    type_:ErrorMessage:
      type: string
      description: Error message.
      title: ErrorMessage
    type_:ErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        message:
          $ref: '#/components/schemas/type_:ErrorMessage'
      required:
        - name
        - message
      title: ErrorResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.pods.inboxes.delete("pod_id", "inbox_id");
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.pods.inboxes.delete(
    pod_id="pod_id",
    inbox_id="inbox_id",
)
go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("Authorization", "Bearer <api_key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <api_key>'

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id")
  .header("Authorization", "Bearer <api_key>")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id', [
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer <api_key>");
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = ["Authorization": "Bearer <api_key>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/inboxes/inbox_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()

Pod Domains: Create

POST https://api.agentmail.to/v0/pods/{pod_id}/domains Content-Type: application/json

CLI:

bash
agentmail pods:domains create --pod-id <pod_id> --domain example.com

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/pods/{pod_id}/domains:
    post:
      operationId: create
      summary: Create Domain
      description: |-
        **CLI:**
        ```bash
        agentmail pods:domains create --pod-id <pod_id> --domain example.com
        ```
      tags:
        - subpackage_pods.subpackage_pods/domains
      parameters:
        - name: pod_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_pods:PodId'
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Response with status 200
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_domains:Domain'
        '400':
          description: Error response with status 400
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ValidationErrorResponse'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/type_domains:CreateDomainRequest'
servers:
  - url: https://api.agentmail.to
    description: prod
  - url: https://x402.api.agentmail.to
    description: prod-x402
  - url: https://mpp.api.agentmail.to
    description: prod-mpp
  - url: https://api.agentmail.eu
    description: eu-prod
components:
  schemas:
    type_pods:PodId:
      type: string
      description: ID of pod.
      title: PodId
    type_domains:DomainName:
      type: string
      description: The name of the domain (e.g., `example.com`).
      title: DomainName
    type_domains:FeedbackEnabled:
      type: boolean
      description: Bounce and complaint notifications are sent to your inboxes.
      title: FeedbackEnabled
    type_domains:SubdomainsEnabled:
      type: boolean
      description: >-
        Allow inboxes on any subdomain of this domain. Adds a required wildcard
        MX

        record (`*.<domain>`) to `records`.
      title: SubdomainsEnabled
    type_domains:CreateDomainRequest:
      type: object
      properties:
        domain:
          $ref: '#/components/schemas/type_domains:DomainName'
        feedback_enabled:
          $ref: '#/components/schemas/type_domains:FeedbackEnabled'
        subdomains_enabled:
          $ref: '#/components/schemas/type_domains:SubdomainsEnabled'
      required:
        - domain
      title: CreateDomainRequest
    type_domains:DomainId:
      type: string
      description: The ID of the domain.
      title: DomainId
    type_domains:VerificationStatus:
      type: string
      enum:
        - NOT_STARTED
        - PENDING
        - INVALID
        - FAILED
        - VERIFYING
        - VERIFIED
      title: VerificationStatus
    type_domains:Status:
      $ref: '#/components/schemas/type_domains:VerificationStatus'
      description: The verification status of the domain.
      title: Status
    type_domains:RecordType:
      type: string
      enum:
        - TXT
        - CNAME
        - MX
      title: RecordType
    type_domains:RecordStatus:
      type: string
      enum:
        - MISSING
        - INVALID
        - VALID
      title: RecordStatus
    type_domains:VerificationRecord:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/type_domains:RecordType'
          description: The type of the DNS record.
        name:
          type: string
          description: The name or host of the record.
        value:
          type: string
          description: The value of the record.
        status:
          $ref: '#/components/schemas/type_domains:RecordStatus'
          description: The verification status of this specific record.
        priority:
          type: integer
          description: The priority of the MX record.
      required:
        - type
        - name
        - value
        - status
      title: VerificationRecord
    type_domains:ClientId:
      type: string
      description: Client ID of domain.
      title: ClientId
    type_domains:Domain:
      type: object
      properties:
        pod_id:
          $ref: '#/components/schemas/type_pods:PodId'
        domain_id:
          $ref: '#/components/schemas/type_domains:DomainId'
        domain:
          $ref: '#/components/schemas/type_domains:DomainName'
        status:
          $ref: '#/components/schemas/type_domains:Status'
        feedback_enabled:
          $ref: '#/components/schemas/type_domains:FeedbackEnabled'
        subdomains_enabled:
          $ref: '#/components/schemas/type_domains:SubdomainsEnabled'
        records:
          type: array
          items:
            $ref: '#/components/schemas/type_domains:VerificationRecord'
          description: |-
            A list of DNS records required to verify the domain. Includes a
            wildcard MX record (`*.<domain>`) when `subdomains_enabled` is true.
        client_id:
          $ref: '#/components/schemas/type_domains:ClientId'
        updated_at:
          type: string
          format: date-time
          description: Time at which the domain was last updated.
        created_at:
          type: string
          format: date-time
          description: Time at which the domain was created.
      required:
        - domain_id
        - domain
        - status
        - feedback_enabled
        - subdomains_enabled
        - records
        - updated_at
        - created_at
      title: Domain
    type_:ErrorName:
      type: string
      description: Name of error.
      title: ErrorName
    type_:ValidationErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        errors:
          description: Validation errors.
      required:
        - name
        - errors
      title: ValidationErrorResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

Request

json
{
  "domain": "domain"
}

Response

json
{
  "domain_id": "domain_id",
  "domain": "domain",
  "status": "NOT_STARTED",
  "feedback_enabled": true,
  "subdomains_enabled": true,
  "records": [
    {
      "type": "TXT",
      "name": "name",
      "value": "value",
      "status": "MISSING",
      "priority": 1
    },
    {
      "type": "TXT",
      "name": "name",
      "value": "value",
      "status": "MISSING",
      "priority": 1
    }
  ],
  "updated_at": "2024-01-15T09:30:00Z",
  "created_at": "2024-01-15T09:30:00Z",
  "pod_id": "pod_id",
  "client_id": "client_id"
}

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.pods.domains.create("pod_id", {
        domain: "domain",
    });
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.pods.domains.create(
    pod_id="pod_id",
    domain="domain",
)
go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/pods/pod_id/domains"

	payload := strings.NewReader("{\n  \"domain\": \"domain\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <api_key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/pods/pod_id/domains")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <api_key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"domain\": \"domain\"\n}"

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.agentmail.to/v0/pods/pod_id/domains")
  .header("Authorization", "Bearer <api_key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"domain\": \"domain\"\n}")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.agentmail.to/v0/pods/pod_id/domains', [
  'body' => '{
  "domain": "domain"
}',
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/domains");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <api_key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"domain\": \"domain\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = [
  "Authorization": "Bearer <api_key>",
  "Content-Type": "application/json"
]
let parameters = ["domain": "domain"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/domains")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()

Pod Domains: Verify

POST https://api.agentmail.to/v0/pods/{pod_id}/domains/{domain_id}/verify

CLI:

bash
agentmail pods:domains verify --pod-id <pod_id> --domain-id <domain_id>

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/pods/{pod_id}/domains/{domain_id}/verify:
    post:
      operationId: verify
      summary: Verify Domain
      description: |-
        **CLI:**
        ```bash
        agentmail pods:domains verify --pod-id <pod_id> --domain-id <domain_id>
        ```
      tags:
        - subpackage_pods.subpackage_pods/domains
      parameters:
        - name: pod_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_pods:PodId'
        - name: domain_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_domains:DomainId'
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
        '404':
          description: Error response with status 404
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ErrorResponse'
servers:
  - url: https://api.agentmail.to
    description: prod
  - url: https://x402.api.agentmail.to
    description: prod-x402
  - url: https://mpp.api.agentmail.to
    description: prod-mpp
  - url: https://api.agentmail.eu
    description: eu-prod
components:
  schemas:
    type_pods:PodId:
      type: string
      description: ID of pod.
      title: PodId
    type_domains:DomainId:
      type: string
      description: The ID of the domain.
      title: DomainId
    type_:ErrorName:
      type: string
      description: Name of error.
      title: ErrorName
    type_:ErrorMessage:
      type: string
      description: Error message.
      title: ErrorMessage
    type_:ErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        message:
          $ref: '#/components/schemas/type_:ErrorMessage'
      required:
        - name
        - message
      title: ErrorResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.pods.domains.verify("pod_id", "domain_id");
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.pods.domains.verify(
    pod_id="pod_id",
    domain_id="domain_id",
)
go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/pods/pod_id/domains/domain_id/verify"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Bearer <api_key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/pods/pod_id/domains/domain_id/verify")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <api_key>'

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.agentmail.to/v0/pods/pod_id/domains/domain_id/verify")
  .header("Authorization", "Bearer <api_key>")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.agentmail.to/v0/pods/pod_id/domains/domain_id/verify', [
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/domains/domain_id/verify");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <api_key>");
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = ["Authorization": "Bearer <api_key>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/domains/domain_id/verify")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()

Pod Threads: Get

GET https://api.agentmail.to/v0/pods/{pod_id}/threads/{thread_id}

CLI:

bash
agentmail pods:threads get --pod-id <pod_id> --thread-id <thread_id>

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/pods/{pod_id}/threads/{thread_id}:
    get:
      operationId: get
      summary: Get Thread
      description: |-
        **CLI:**
        ```bash
        agentmail pods:threads get --pod-id <pod_id> --thread-id <thread_id>
        ```
      tags:
        - subpackage_pods.subpackage_pods/threads
      parameters:
        - name: pod_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_pods:PodId'
        - name: thread_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_threads:ThreadId'
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Response with status 200
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_threads:Thread'
        '404':
          description: Error response with status 404
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ErrorResponse'
servers:
  - url: https://api.agentmail.to
    description: prod
  - url: https://x402.api.agentmail.to
    description: prod-x402
  - url: https://mpp.api.agentmail.to
    description: prod-mpp
  - url: https://api.agentmail.eu
    description: eu-prod
components:
  schemas:
    type_pods:PodId:
      type: string
      description: ID of pod.
      title: PodId
    type_threads:ThreadId:
      type: string
      description: ID of thread.
      title: ThreadId
    type_inboxes:InboxId:
      type: string
      description: The ID of the inbox.
      title: InboxId
    type_threads:ThreadLabels:
      type: array
      items:
        type: string
      description: Labels of thread.
      title: ThreadLabels
    type_threads:ThreadTimestamp:
      type: string
      format: date-time
      description: Timestamp of last sent or received message.
      title: ThreadTimestamp
    type_threads:ThreadReceivedTimestamp:
      type: string
      format: date-time
      description: Timestamp of last received message.
      title: ThreadReceivedTimestamp
    type_threads:ThreadSentTimestamp:
      type: string
      format: date-time
      description: Timestamp of last sent message.
      title: ThreadSentTimestamp
    type_threads:ThreadSenders:
      type: array
      items:
        type: string
      description: >-
        Senders in thread. In format `username@domain.com` or `Display Name
        <username@domain.com>`.
      title: ThreadSenders
    type_threads:ThreadRecipients:
      type: array
      items:
        type: string
      description: >-
        Recipients in thread. In format `username@domain.com` or `Display Name
        <username@domain.com>`.
      title: ThreadRecipients
    type_threads:ThreadSubject:
      type: string
      description: Subject of thread.
      title: ThreadSubject
    type_threads:ThreadPreview:
      type: string
      description: Text preview of last message in thread.
      title: ThreadPreview
    type_attachments:AttachmentId:
      type: string
      description: ID of attachment.
      title: AttachmentId
    type_attachments:AttachmentFilename:
      type: string
      description: Filename of attachment.
      title: AttachmentFilename
    type_attachments:AttachmentSize:
      type: integer
      description: Size of attachment in bytes.
      title: AttachmentSize
    type_attachments:AttachmentContentType:
      type: string
      description: Content type of attachment.
      title: AttachmentContentType
    type_attachments:AttachmentContentDisposition:
      type: string
      enum:
        - inline
        - attachment
      description: Content disposition of attachment.
      title: AttachmentContentDisposition
    type_attachments:AttachmentContentId:
      type: string
      description: Content ID of attachment.
      title: AttachmentContentId
    type_attachments:Attachment:
      type: object
      properties:
        attachment_id:
          $ref: '#/components/schemas/type_attachments:AttachmentId'
        filename:
          $ref: '#/components/schemas/type_attachments:AttachmentFilename'
        size:
          $ref: '#/components/schemas/type_attachments:AttachmentSize'
        content_type:
          $ref: '#/components/schemas/type_attachments:AttachmentContentType'
        content_disposition:
          $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
        content_id:
          $ref: '#/components/schemas/type_attachments:AttachmentContentId'
      required:
        - attachment_id
        - size
      title: Attachment
    type_threads:ThreadAttachments:
      type: array
      items:
        $ref: '#/components/schemas/type_attachments:Attachment'
      description: Attachments in thread.
      title: ThreadAttachments
    type_threads:ThreadLastMessageId:
      type: string
      description: ID of last message in thread.
      title: ThreadLastMessageId
    type_threads:ThreadMessageCount:
      type: integer
      description: Number of messages in thread.
      title: ThreadMessageCount
    type_threads:ThreadSize:
      type: integer
      description: Size of thread in bytes.
      title: ThreadSize
    type_threads:ThreadUpdatedAt:
      type: string
      format: date-time
      description: Time at which thread was last updated.
      title: ThreadUpdatedAt
    type_threads:ThreadCreatedAt:
      type: string
      format: date-time
      description: Time at which thread was created.
      title: ThreadCreatedAt
    type_messages:MessageId:
      type: string
      description: ID of message.
      title: MessageId
    type_messages:MessageLabels:
      type: array
      items:
        type: string
      description: Labels of message.
      title: MessageLabels
    type_messages:MessageTimestamp:
      type: string
      format: date-time
      description: Time at which message was sent or drafted.
      title: MessageTimestamp
    type_messages:MessageFrom:
      type: string
      description: >-
        Address of sender. In format `username@domain.com` or `Display Name
        <username@domain.com>`.
      title: MessageFrom
    type_messages:MessageTo:
      type: array
      items:
        type: string
      description: >-
        Addresses of recipients. In format `username@domain.com` or `Display
        Name <username@domain.com>`.
      title: MessageTo
    type_messages:MessageCc:
      type: array
      items:
        type: string
      description: >-
        Addresses of CC recipients. In format `username@domain.com` or `Display
        Name <username@domain.com>`.
      title: MessageCc
    type_messages:MessageBcc:
      type: array
      items:
        type: string
      description: >-
        Addresses of BCC recipients. In format `username@domain.com` or `Display
        Name <username@domain.com>`.
      title: MessageBcc
    type_messages:MessageSubject:
      type: string
      description: Subject of message.
      title: MessageSubject
    type_messages:MessagePreview:
      type: string
      description: Text preview of message.
      title: MessagePreview
    type_messages:MessageText:
      type: string
      description: Plain text body of message.
      title: MessageText
    type_messages:MessageHtml:
      type: string
      description: HTML body of message.
      title: MessageHtml
    type_messages:MessageAttachments:
      type: array
      items:
        $ref: '#/components/schemas/type_attachments:Attachment'
      description: Attachments in message.
      title: MessageAttachments
    type_messages:MessageInReplyTo:
      type: string
      description: ID of message being replied to.
      title: MessageInReplyTo
    type_messages:MessageReferences:
      type: array
      items:
        type: string
      description: IDs of previous messages in thread.
      title: MessageReferences
    type_messages:MessageHeaders:
      type: object
      additionalProperties:
        type: string
      description: Headers in message.
      title: MessageHeaders
    type_messages:MessageSize:
      type: integer
      description: Size of message in bytes.
      title: MessageSize
    type_messages:MessageUpdatedAt:
      type: string
      format: date-time
      description: Time at which message was last updated.
      title: MessageUpdatedAt
    type_messages:MessageCreatedAt:
      type: string
      format: date-time
      description: Time at which message was created.
      title: MessageCreatedAt
    type_messages:Message:
      type: object
      properties:
        inbox_id:
          $ref: '#/components/schemas/type_inboxes:InboxId'
        thread_id:
          $ref: '#/components/schemas/type_threads:ThreadId'
        message_id:
          $ref: '#/components/schemas/type_messages:MessageId'
        labels:
          $ref: '#/components/schemas/type_messages:MessageLabels'
        timestamp:
          $ref: '#/components/schemas/type_messages:MessageTimestamp'
        from:
          $ref: '#/components/schemas/type_messages:MessageFrom'
        reply_to:
          type: array
          items:
            type: string
          description: >-
            Reply-to addresses. In format `username@domain.com` or `Display Name
            <username@domain.com>`.
        to:
          $ref: '#/components/schemas/type_messages:MessageTo'
        cc:
          $ref: '#/components/schemas/type_messages:MessageCc'
        bcc:
          $ref: '#/components/schemas/type_messages:MessageBcc'
        subject:
          $ref: '#/components/schemas/type_messages:MessageSubject'
        preview:
          $ref: '#/components/schemas/type_messages:MessagePreview'
        text:
          $ref: '#/components/schemas/type_messages:MessageText'
        html:
          $ref: '#/components/schemas/type_messages:MessageHtml'
        extracted_text:
          type: string
          description: Extracted new text content.
        extracted_html:
          type: string
          description: Extracted new HTML content.
        attachments:
          $ref: '#/components/schemas/type_messages:MessageAttachments'
        in_reply_to:
          $ref: '#/components/schemas/type_messages:MessageInReplyTo'
        references:
          $ref: '#/components/schemas/type_messages:MessageReferences'
        headers:
          $ref: '#/components/schemas/type_messages:MessageHeaders'
        size:
          $ref: '#/components/schemas/type_messages:MessageSize'
        updated_at:
          $ref: '#/components/schemas/type_messages:MessageUpdatedAt'
        created_at:
          $ref: '#/components/schemas/type_messages:MessageCreatedAt'
      required:
        - inbox_id
        - thread_id
        - message_id
        - labels
        - timestamp
        - from
        - to
        - size
        - updated_at
        - created_at
      title: Message
    type_threads:Thread:
      type: object
      properties:
        inbox_id:
          $ref: '#/components/schemas/type_inboxes:InboxId'
        thread_id:
          $ref: '#/components/schemas/type_threads:ThreadId'
        labels:
          $ref: '#/components/schemas/type_threads:ThreadLabels'
        timestamp:
          $ref: '#/components/schemas/type_threads:ThreadTimestamp'
        received_timestamp:
          $ref: '#/components/schemas/type_threads:ThreadReceivedTimestamp'
        sent_timestamp:
          $ref: '#/components/schemas/type_threads:ThreadSentTimestamp'
        senders:
          $ref: '#/components/schemas/type_threads:ThreadSenders'
        recipients:
          $ref: '#/components/schemas/type_threads:ThreadRecipients'
        subject:
          $ref: '#/components/schemas/type_threads:ThreadSubject'
        preview:
          $ref: '#/components/schemas/type_threads:ThreadPreview'
        attachments:
          $ref: '#/components/schemas/type_threads:ThreadAttachments'
        last_message_id:
          $ref: '#/components/schemas/type_threads:ThreadLastMessageId'
        message_count:
          $ref: '#/components/schemas/type_threads:ThreadMessageCount'
        size:
          $ref: '#/components/schemas/type_threads:ThreadSize'
        updated_at:
          $ref: '#/components/schemas/type_threads:ThreadUpdatedAt'
        created_at:
          $ref: '#/components/schemas/type_threads:ThreadCreatedAt'
        messages:
          type: array
          items:
            $ref: '#/components/schemas/type_messages:Message'
          description: Messages in thread. Ordered by `timestamp` ascending.
      required:
        - inbox_id
        - thread_id
        - labels
        - timestamp
        - senders
        - recipients
        - last_message_id
        - message_count
        - size
        - updated_at
        - created_at
        - messages
      title: Thread
    type_:ErrorName:
      type: string
      description: Name of error.
      title: ErrorName
    type_:ErrorMessage:
      type: string
      description: Error message.
      title: ErrorMessage
    type_:ErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        message:
          $ref: '#/components/schemas/type_:ErrorMessage'
      required:
        - name
        - message
      title: ErrorResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

Response

json
{
  "inbox_id": "inbox_id",
  "thread_id": "thread_id",
  "labels": [
    "labels",
    "labels"
  ],
  "timestamp": "2024-01-15T09:30:00Z",
  "senders": [
    "senders",
    "senders"
  ],
  "recipients": [
    "recipients",
    "recipients"
  ],
  "last_message_id": "last_message_id",
  "message_count": 1,
  "size": 1,
  "updated_at": "2024-01-15T09:30:00Z",
  "created_at": "2024-01-15T09:30:00Z",
  "messages": [
    {
      "inbox_id": "inbox_id",
      "thread_id": "thread_id",
      "message_id": "message_id",
      "labels": [
        "labels",
        "labels"
      ],
      "timestamp": "2024-01-15T09:30:00Z",
      "from": "from",
      "to": [
        "to",
        "to"
      ],
      "size": 1,
      "updated_at": "2024-01-15T09:30:00Z",
      "created_at": "2024-01-15T09:30:00Z",
      "reply_to": [
        "reply_to",
        "reply_to"
      ],
      "cc": [
        "cc",
        "cc"
      ],
      "bcc": [
        "bcc",
        "bcc"
      ],
      "subject": "subject",
      "preview": "preview",
      "text": "text",
      "html": "html",
      "extracted_text": "extracted_text",
      "extracted_html": "extracted_html",
      "attachments": [
        {
          "attachment_id": "attachment_id",
          "size": 1,
          "filename": "filename",
          "content_type": "content_type",
          "content_disposition": "inline",
          "content_id": "content_id"
        },
        {
          "attachment_id": "attachment_id",
          "size": 1,
          "filename": "filename",
          "content_type": "content_type",
          "content_disposition": "inline",
          "content_id": "content_id"
        }
      ],
      "in_reply_to": "in_reply_to",
      "references": [
        "references",
        "references"
      ],
      "headers": {
        "headers": "headers"
      }
    },
    {
      "inbox_id": "inbox_id",
      "thread_id": "thread_id",
      "message_id": "message_id",
      "labels": [
        "labels",
        "labels"
      ],
      "timestamp": "2024-01-15T09:30:00Z",
      "from": "from",
      "to": [
        "to",
        "to"
      ],
      "size": 1,
      "updated_at": "2024-01-15T09:30:00Z",
      "created_at": "2024-01-15T09:30:00Z",
      "reply_to": [
        "reply_to",
        "reply_to"
      ],
      "cc": [
        "cc",
        "cc"
      ],
      "bcc": [
        "bcc",
        "bcc"
      ],
      "subject": "subject",
      "preview": "preview",
      "text": "text",
      "html": "html",
      "extracted_text": "extracted_text",
      "extracted_html": "extracted_html",
      "attachments": [
        {
          "attachment_id": "attachment_id",
          "size": 1,
          "filename": "filename",
          "content_type": "content_type",
          "content_disposition": "inline",
          "content_id": "content_id"
        },
        {
          "attachment_id": "attachment_id",
          "size": 1,
          "filename": "filename",
          "content_type": "content_type",
          "content_disposition": "inline",
          "content_id": "content_id"
        }
      ],
      "in_reply_to": "in_reply_to",
      "references": [
        "references",
        "references"
      ],
      "headers": {
        "headers": "headers"
      }
    }
  ],
  "received_timestamp": "2024-01-15T09:30:00Z",
  "sent_timestamp": "2024-01-15T09:30:00Z",
  "subject": "subject",
  "preview": "preview",
  "attachments": [
    {
      "attachment_id": "attachment_id",
      "size": 1,
      "filename": "filename",
      "content_type": "content_type",
      "content_disposition": "inline",
      "content_id": "content_id"
    },
    {
      "attachment_id": "attachment_id",
      "size": 1,
      "filename": "filename",
      "content_type": "content_type",
      "content_disposition": "inline",
      "content_id": "content_id"
    }
  ]
}

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.pods.threads.get("pod_id", "thread_id");
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.pods.threads.get(
    pod_id="pod_id",
    thread_id="thread_id",
)
go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/pods/pod_id/threads/thread_id"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <api_key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/pods/pod_id/threads/thread_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <api_key>'

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/pod_id/threads/thread_id")
  .header("Authorization", "Bearer <api_key>")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.agentmail.to/v0/pods/pod_id/threads/thread_id', [
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/threads/thread_id");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <api_key>");
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = ["Authorization": "Bearer <api_key>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/threads/thread_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()

Pod Threads: List

GET https://api.agentmail.to/v0/pods/{pod_id}/threads

Lists threads in the pod, most recent first. Pass senders, recipients, or subject to filter by substring. Filtered requests are served by search, which caps limit at 100. For relevance-ranked full-text search, use Search Threads.

CLI:

bash
agentmail pods:threads list --pod-id <pod_id>

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/pods/{pod_id}/threads:
    get:
      operationId: list
      summary: List Threads
      description: |-
        Lists threads in the pod, most recent first. Pass `senders`,
        `recipients`, or `subject` to filter by substring. Filtered requests are
        served by search, which caps `limit` at 100. For relevance-ranked
        full-text search, use `Search Threads`.

        **CLI:**
        ```bash
        agentmail pods:threads list --pod-id <pod_id>
        ```
      tags:
        - subpackage_pods.subpackage_pods/threads
      parameters:
        - name: pod_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_pods:PodId'
        - name: limit
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:Limit'
        - name: page_token
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:PageToken'
        - name: labels
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:Labels'
        - name: before
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:Before'
        - name: after
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:After'
        - name: ascending
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:Ascending'
        - name: include_spam
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:IncludeSpam'
        - name: include_blocked
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:IncludeBlocked'
        - name: include_unauthenticated
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:IncludeUnauthenticated'
        - name: include_trash
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_:IncludeTrash'
        - name: senders
          in: query
          description: >-
            Filter to threads whose senders contain this value (substring
            match). Repeatable; all values must match.
          required: false
          schema:
            type: array
            items:
              type: string
        - name: recipients
          in: query
          description: >-
            Filter to threads whose recipients contain this value (substring
            match). Repeatable; all values must match.
          required: false
          schema:
            type: array
            items:
              type: string
        - name: subject
          in: query
          description: >-
            Filter to threads whose subject contains this value (substring
            match). Repeatable; all values must match.
          required: false
          schema:
            type: array
            items:
              type: string
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Response with status 200
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_threads:ListThreadsResponse'
        '404':
          description: Error response with status 404
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ErrorResponse'
servers:
  - url: https://api.agentmail.to
    description: prod
  - url: https://x402.api.agentmail.to
    description: prod-x402
  - url: https://mpp.api.agentmail.to
    description: prod-mpp
  - url: https://api.agentmail.eu
    description: eu-prod
components:
  schemas:
    type_pods:PodId:
      type: string
      description: ID of pod.
      title: PodId
    type_:Limit:
      type: integer
      description: Limit of number of items returned.
      title: Limit
    type_:PageToken:
      type: string
      description: Page token for pagination.
      title: PageToken
    type_:Labels:
      type: array
      items:
        type: string
      description: Labels to filter by.
      title: Labels
    type_:Before:
      type: string
      format: date-time
      description: Timestamp before which to filter by.
      title: Before
    type_:After:
      type: string
      format: date-time
      description: Timestamp after which to filter by.
      title: After
    type_:Ascending:
      type: boolean
      description: Sort in ascending temporal order.
      title: Ascending
    type_:IncludeSpam:
      type: boolean
      description: Include spam in results.
      title: IncludeSpam
    type_:IncludeBlocked:
      type: boolean
      description: Include blocked in results.
      title: IncludeBlocked
    type_:IncludeUnauthenticated:
      type: boolean
      description: Include unauthenticated in results.
      title: IncludeUnauthenticated
    type_:IncludeTrash:
      type: boolean
      description: Include trash in results.
      title: IncludeTrash
    type_:Count:
      type: integer
      description: Number of items returned.
      title: Count
    type_inboxes:InboxId:
      type: string
      description: The ID of the inbox.
      title: InboxId
    type_threads:ThreadId:
      type: string
      description: ID of thread.
      title: ThreadId
    type_threads:ThreadLabels:
      type: array
      items:
        type: string
      description: Labels of thread.
      title: ThreadLabels
    type_threads:ThreadTimestamp:
      type: string
      format: date-time
      description: Timestamp of last sent or received message.
      title: ThreadTimestamp
    type_threads:ThreadReceivedTimestamp:
      type: string
      format: date-time
      description: Timestamp of last received message.
      title: ThreadReceivedTimestamp
    type_threads:ThreadSentTimestamp:
      type: string
      format: date-time
      description: Timestamp of last sent message.
      title: ThreadSentTimestamp
    type_threads:ThreadSenders:
      type: array
      items:
        type: string
      description: >-
        Senders in thread. In format `username@domain.com` or `Display Name
        <username@domain.com>`.
      title: ThreadSenders
    type_threads:ThreadRecipients:
      type: array
      items:
        type: string
      description: >-
        Recipients in thread. In format `username@domain.com` or `Display Name
        <username@domain.com>`.
      title: ThreadRecipients
    type_threads:ThreadSubject:
      type: string
      description: Subject of thread.
      title: ThreadSubject
    type_threads:ThreadPreview:
      type: string
      description: Text preview of last message in thread.
      title: ThreadPreview
    type_attachments:AttachmentId:
      type: string
      description: ID of attachment.
      title: AttachmentId
    type_attachments:AttachmentFilename:
      type: string
      description: Filename of attachment.
      title: AttachmentFilename
    type_attachments:AttachmentSize:
      type: integer
      description: Size of attachment in bytes.
      title: AttachmentSize
    type_attachments:AttachmentContentType:
      type: string
      description: Content type of attachment.
      title: AttachmentContentType
    type_attachments:AttachmentContentDisposition:
      type: string
      enum:
        - inline
        - attachment
      description: Content disposition of attachment.
      title: AttachmentContentDisposition
    type_attachments:AttachmentContentId:
      type: string
      description: Content ID of attachment.
      title: AttachmentContentId
    type_attachments:Attachment:
      type: object
      properties:
        attachment_id:
          $ref: '#/components/schemas/type_attachments:AttachmentId'
        filename:
          $ref: '#/components/schemas/type_attachments:AttachmentFilename'
        size:
          $ref: '#/components/schemas/type_attachments:AttachmentSize'
        content_type:
          $ref: '#/components/schemas/type_attachments:AttachmentContentType'
        content_disposition:
          $ref: '#/components/schemas/type_attachments:AttachmentContentDisposition'
        content_id:
          $ref: '#/components/schemas/type_attachments:AttachmentContentId'
      required:
        - attachment_id
        - size
      title: Attachment
    type_threads:ThreadAttachments:
      type: array
      items:
        $ref: '#/components/schemas/type_attachments:Attachment'
      description: Attachments in thread.
      title: ThreadAttachments
    type_threads:ThreadLastMessageId:
      type: string
      description: ID of last message in thread.
      title: ThreadLastMessageId
    type_threads:ThreadMessageCount:
      type: integer
      description: Number of messages in thread.
      title: ThreadMessageCount
    type_threads:ThreadSize:
      type: integer
      description: Size of thread in bytes.
      title: ThreadSize
    type_threads:ThreadUpdatedAt:
      type: string
      format: date-time
      description: Time at which thread was last updated.
      title: ThreadUpdatedAt
    type_threads:ThreadCreatedAt:
      type: string
      format: date-time
      description: Time at which thread was created.
      title: ThreadCreatedAt
    type_threads:ThreadItem:
      type: object
      properties:
        inbox_id:
          $ref: '#/components/schemas/type_inboxes:InboxId'
        thread_id:
          $ref: '#/components/schemas/type_threads:ThreadId'
        labels:
          $ref: '#/components/schemas/type_threads:ThreadLabels'
        timestamp:
          $ref: '#/components/schemas/type_threads:ThreadTimestamp'
        received_timestamp:
          $ref: '#/components/schemas/type_threads:ThreadReceivedTimestamp'
        sent_timestamp:
          $ref: '#/components/schemas/type_threads:ThreadSentTimestamp'
        senders:
          $ref: '#/components/schemas/type_threads:ThreadSenders'
        recipients:
          $ref: '#/components/schemas/type_threads:ThreadRecipients'
        subject:
          $ref: '#/components/schemas/type_threads:ThreadSubject'
        preview:
          $ref: '#/components/schemas/type_threads:ThreadPreview'
        attachments:
          $ref: '#/components/schemas/type_threads:ThreadAttachments'
        last_message_id:
          $ref: '#/components/schemas/type_threads:ThreadLastMessageId'
        message_count:
          $ref: '#/components/schemas/type_threads:ThreadMessageCount'
        size:
          $ref: '#/components/schemas/type_threads:ThreadSize'
        updated_at:
          $ref: '#/components/schemas/type_threads:ThreadUpdatedAt'
        created_at:
          $ref: '#/components/schemas/type_threads:ThreadCreatedAt'
      required:
        - inbox_id
        - thread_id
        - labels
        - timestamp
        - senders
        - recipients
        - last_message_id
        - message_count
        - size
        - updated_at
        - created_at
      title: ThreadItem
    type_threads:ListThreadsResponse:
      type: object
      properties:
        count:
          $ref: '#/components/schemas/type_:Count'
        limit:
          $ref: '#/components/schemas/type_:Limit'
        next_page_token:
          $ref: '#/components/schemas/type_:PageToken'
        threads:
          type: array
          items:
            $ref: '#/components/schemas/type_threads:ThreadItem'
          description: Ordered by `timestamp` descending.
      required:
        - count
        - threads
      title: ListThreadsResponse
    type_:ErrorName:
      type: string
      description: Name of error.
      title: ErrorName
    type_:ErrorMessage:
      type: string
      description: Error message.
      title: ErrorMessage
    type_:ErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        message:
          $ref: '#/components/schemas/type_:ErrorMessage'
      required:
        - name
        - message
      title: ErrorResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

Response

json
{
  "count": 1,
  "threads": [
    {
      "inbox_id": "inbox_id",
      "thread_id": "thread_id",
      "labels": [
        "labels",
        "labels"
      ],
      "timestamp": "2024-01-15T09:30:00Z",
      "senders": [
        "senders",
        "senders"
      ],
      "recipients": [
        "recipients",
        "recipients"
      ],
      "last_message_id": "last_message_id",
      "message_count": 1,
      "size": 1,
      "updated_at": "2024-01-15T09:30:00Z",
      "created_at": "2024-01-15T09:30:00Z",
      "received_timestamp": "2024-01-15T09:30:00Z",
      "sent_timestamp": "2024-01-15T09:30:00Z",
      "subject": "subject",
      "preview": "preview",
      "attachments": [
        {
          "attachment_id": "attachment_id",
          "size": 1,
          "filename": "filename",
          "content_type": "content_type",
          "content_disposition": "inline",
          "content_id": "content_id"
        },
        {
          "attachment_id": "attachment_id",
          "size": 1,
          "filename": "filename",
          "content_type": "content_type",
          "content_disposition": "inline",
          "content_id": "content_id"
        }
      ]
    },
    {
      "inbox_id": "inbox_id",
      "thread_id": "thread_id",
      "labels": [
        "labels",
        "labels"
      ],
      "timestamp": "2024-01-15T09:30:00Z",
      "senders": [
        "senders",
        "senders"
      ],
      "recipients": [
        "recipients",
        "recipients"
      ],
      "last_message_id": "last_message_id",
      "message_count": 1,
      "size": 1,
      "updated_at": "2024-01-15T09:30:00Z",
      "created_at": "2024-01-15T09:30:00Z",
      "received_timestamp": "2024-01-15T09:30:00Z",
      "sent_timestamp": "2024-01-15T09:30:00Z",
      "subject": "subject",
      "preview": "preview",
      "attachments": [
        {
          "attachment_id": "attachment_id",
          "size": 1,
          "filename": "filename",
          "content_type": "content_type",
          "content_disposition": "inline",
          "content_id": "content_id"
        },
        {
          "attachment_id": "attachment_id",
          "size": 1,
          "filename": "filename",
          "content_type": "content_type",
          "content_disposition": "inline",
          "content_id": "content_id"
        }
      ]
    }
  ],
  "limit": 1,
  "next_page_token": "next_page_token"
}

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.pods.threads.list("pod_id", {});
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.pods.threads.list(
    pod_id="pod_id",
)
go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/pods/pod_id/threads"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <api_key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/pods/pod_id/threads")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <api_key>'

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/pod_id/threads")
  .header("Authorization", "Bearer <api_key>")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.agentmail.to/v0/pods/pod_id/threads', [
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/threads");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <api_key>");
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = ["Authorization": "Bearer <api_key>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/threads")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()

Pod API Keys: Create

POST https://api.agentmail.to/v0/pods/{pod_id}/api-keys Content-Type: application/json

CLI:

bash
agentmail pods:api-keys create --pod-id <pod_id> --name "My Key"

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/pods/{pod_id}/api-keys:
    post:
      operationId: create
      summary: Create API Key
      description: |-
        **CLI:**
        ```bash
        agentmail pods:api-keys create --pod-id <pod_id> --name "My Key"
        ```
      tags:
        - subpackage_pods.subpackage_pods/api-keys
      parameters:
        - name: pod_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_pods:PodId'
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Response with status 200
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_api-keys:CreateApiKeyResponse'
        '400':
          description: Error response with status 400
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ValidationErrorResponse'
        '404':
          description: Error response with status 404
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ErrorResponse'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/type_api-keys:CreateApiKeyRequest'
servers:
  - url: https://api.agentmail.to
    description: prod
  - url: https://x402.api.agentmail.to
    description: prod-x402
  - url: https://mpp.api.agentmail.to
    description: prod-mpp
  - url: https://api.agentmail.eu
    description: eu-prod
components:
  schemas:
    type_pods:PodId:
      type: string
      description: ID of pod.
      title: PodId
    type_api-keys:Name:
      type: string
      description: Name of api key.
      title: Name
    type_api-keys:ApiKeyPermissions:
      type: object
      properties:
        inbox_read:
          type: boolean
          description: Read inbox details.
        inbox_create:
          type: boolean
          description: Create new inboxes.
        inbox_update:
          type: boolean
          description: Update inbox settings.
        inbox_delete:
          type: boolean
          description: Delete inboxes.
        thread_read:
          type: boolean
          description: Read threads.
        thread_delete:
          type: boolean
          description: Delete threads.
        message_read:
          type: boolean
          description: Read messages.
        message_send:
          type: boolean
          description: Send messages.
        message_update:
          type: boolean
          description: Update message labels.
        label_spam_read:
          type: boolean
          description: Access messages labeled spam.
        label_blocked_read:
          type: boolean
          description: Access messages labeled blocked.
        label_trash_read:
          type: boolean
          description: Access messages labeled trash.
        draft_read:
          type: boolean
          description: Read drafts.
        draft_create:
          type: boolean
          description: Create drafts.
        draft_update:
          type: boolean
          description: Update drafts.
        draft_delete:
          type: boolean
          description: Delete drafts.
        draft_send:
          type: boolean
          description: Send drafts.
        webhook_read:
          type: boolean
          description: Read webhook configurations.
        webhook_create:
          type: boolean
          description: Create webhooks.
        webhook_update:
          type: boolean
          description: Update webhooks.
        webhook_delete:
          type: boolean
          description: Delete webhooks.
        domain_read:
          type: boolean
          description: Read domain details.
        domain_create:
          type: boolean
          description: Create domains.
        domain_update:
          type: boolean
          description: Update domains.
        domain_delete:
          type: boolean
          description: Delete domains.
        list_entry_read:
          type: boolean
          description: Read list entries.
        list_entry_create:
          type: boolean
          description: Create list entries.
        list_entry_delete:
          type: boolean
          description: Delete list entries.
        metrics_read:
          type: boolean
          description: Read metrics.
        api_key_read:
          type: boolean
          description: Read API keys.
        api_key_create:
          type: boolean
          description: Create API keys.
        api_key_delete:
          type: boolean
          description: Delete API keys.
        pod_read:
          type: boolean
          description: Read pods.
        pod_create:
          type: boolean
          description: Create pods.
        pod_delete:
          type: boolean
          description: Delete pods.
      description: >-
        Granular permissions for the API key. When ommitted all permissions are
        granted. Otherwise, only permissions set to true are granted.
      title: ApiKeyPermissions
    type_api-keys:CreateApiKeyRequest:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_api-keys:Name'
        permissions:
          $ref: '#/components/schemas/type_api-keys:ApiKeyPermissions'
      title: CreateApiKeyRequest
    type_api-keys:ApiKeyId:
      type: string
      description: ID of api key.
      title: ApiKeyId
    type_api-keys:Prefix:
      type: string
      description: Prefix of api key.
      title: Prefix
    type_api-keys:CreatedAt:
      type: string
      format: date-time
      description: Time at which api key was created.
      title: CreatedAt
    type_api-keys:CreateApiKeyResponse:
      type: object
      properties:
        api_key_id:
          $ref: '#/components/schemas/type_api-keys:ApiKeyId'
        api_key:
          type: string
          description: API key.
        prefix:
          $ref: '#/components/schemas/type_api-keys:Prefix'
        name:
          $ref: '#/components/schemas/type_api-keys:Name'
        pod_id:
          type: string
          description: Pod ID the api key is scoped to.
        inbox_id:
          type: string
          description: Inbox ID the api key is scoped to.
        permissions:
          $ref: '#/components/schemas/type_api-keys:ApiKeyPermissions'
        created_at:
          $ref: '#/components/schemas/type_api-keys:CreatedAt'
      required:
        - api_key_id
        - api_key
        - prefix
        - name
        - created_at
      title: CreateApiKeyResponse
    type_:ErrorName:
      type: string
      description: Name of error.
      title: ErrorName
    type_:ErrorMessage:
      type: string
      description: Error message.
      title: ErrorMessage
    type_:ErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        message:
          $ref: '#/components/schemas/type_:ErrorMessage'
      required:
        - name
        - message
      title: ErrorResponse
    type_:ValidationErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        errors:
          description: Validation errors.
      required:
        - name
        - errors
      title: ValidationErrorResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

Request

json
{}

Response

json
{
  "api_key_id": "api_key_id",
  "api_key": "api_key",
  "prefix": "prefix",
  "name": "name",
  "created_at": "2024-01-15T09:30:00Z",
  "pod_id": "pod_id",
  "inbox_id": "inbox_id",
  "permissions": {
    "inbox_read": true,
    "inbox_create": true,
    "inbox_update": true,
    "inbox_delete": true,
    "thread_read": true,
    "thread_delete": true,
    "message_read": true,
    "message_send": true,
    "message_update": true,
    "label_spam_read": true,
    "label_blocked_read": true,
    "label_trash_read": true,
    "draft_read": true,
    "draft_create": true,
    "draft_update": true,
    "draft_delete": true,
    "draft_send": true,
    "webhook_read": true,
    "webhook_create": true,
    "webhook_update": true,
    "webhook_delete": true,
    "domain_read": true,
    "domain_create": true,
    "domain_update": true,
    "domain_delete": true,
    "list_entry_read": true,
    "list_entry_create": true,
    "list_entry_delete": true,
    "metrics_read": true,
    "api_key_read": true,
    "api_key_create": true,
    "api_key_delete": true,
    "pod_read": true,
    "pod_create": true,
    "pod_delete": true
  }
}

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.pods.apiKeys.create("pod_id", {});
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.pods.api_keys.create(
    pod_id="pod_id",
)
go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/pods/pod_id/api-keys"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <api_key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/pods/pod_id/api-keys")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <api_key>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.agentmail.to/v0/pods/pod_id/api-keys")
  .header("Authorization", "Bearer <api_key>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.agentmail.to/v0/pods/pod_id/api-keys', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/api-keys");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <api_key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = [
  "Authorization": "Bearer <api_key>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/api-keys")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()

Pod Metrics: Query

GET https://api.agentmail.to/v0/pods/{pod_id}/metrics

CLI:

bash
agentmail pods:metrics query --pod-id <pod_id>

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/pods/{pod_id}/metrics:
    get:
      operationId: query
      summary: Query Metrics
      description: |-
        **CLI:**
        ```bash
        agentmail pods:metrics query --pod-id <pod_id>
        ```
      tags:
        - subpackage_pods.subpackage_pods/metrics
      parameters:
        - name: pod_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_pods:PodId'
        - name: event_types
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_metrics:MetricEventTypes'
        - name: start
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_metrics:Start'
        - name: end
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_metrics:End'
        - name: period
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_metrics:Period'
        - name: limit
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_metrics:MetricLimit'
        - name: descending
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/type_metrics:Descending'
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Response with status 200
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_metrics:QueryMetricsResponse'
        '400':
          description: Error response with status 400
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:ValidationErrorResponse'
servers:
  - url: https://api.agentmail.to
    description: prod
  - url: https://x402.api.agentmail.to
    description: prod-x402
  - url: https://mpp.api.agentmail.to
    description: prod-mpp
  - url: https://api.agentmail.eu
    description: eu-prod
components:
  schemas:
    type_pods:PodId:
      type: string
      description: ID of pod.
      title: PodId
    type_metrics:MetricEventType:
      type: string
      enum:
        - message.sent
        - message.delivered
        - message.bounced
        - message.delayed
        - message.rejected
        - message.complained
        - message.received
      description: Type of metric event.
      title: MetricEventType
    type_metrics:MetricEventTypes:
      type: array
      items:
        $ref: '#/components/schemas/type_metrics:MetricEventType'
      description: List of metric event types to query.
      title: MetricEventTypes
    type_metrics:Start:
      type: string
      format: date-time
      description: Start timestamp for the query.
      title: Start
    type_metrics:End:
      type: string
      format: date-time
      description: End timestamp for the query.
      title: End
    type_metrics:Period:
      type: string
      description: Period in number of seconds for the query.
      title: Period
    type_metrics:MetricLimit:
      type: integer
      description: Limit on number of buckets to return.
      title: MetricLimit
    type_metrics:Descending:
      type: boolean
      description: Sort in descending order.
      title: Descending
    type_metrics:MetricBucket:
      type: object
      properties:
        timestamp:
          type: string
          format: date-time
          description: Timestamp of the bucket.
        count:
          type: integer
          description: Count of events in the bucket.
      required:
        - timestamp
        - count
      title: MetricBucket
    type_metrics:QueryMetricsResponse:
      type: object
      additionalProperties:
        type: array
        items:
          $ref: '#/components/schemas/type_metrics:MetricBucket'
      description: Metrics grouped by event type.
      title: QueryMetricsResponse
    type_:ErrorName:
      type: string
      description: Name of error.
      title: ErrorName
    type_:ValidationErrorResponse:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/type_:ErrorName'
        errors:
          description: Validation errors.
      required:
        - name
        - errors
      title: ValidationErrorResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

Response

json
{
  "message.sent": [
    {
      "timestamp": "2024-01-15T09:30:00Z",
      "count": 1
    },
    {
      "timestamp": "2024-01-15T09:30:00Z",
      "count": 1
    }
  ]
}

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.pods.metrics.query("pod_id", {});
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.pods.metrics.query(
    pod_id="pod_id",
)
go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.agentmail.to/v0/pods/pod_id/metrics"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <api_key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
ruby
require 'uri'
require 'net/http'

url = URI("https://api.agentmail.to/v0/pods/pod_id/metrics")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <api_key>'

response = http.request(request)
puts response.read_body
java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/pods/pod_id/metrics")
  .header("Authorization", "Bearer <api_key>")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.agentmail.to/v0/pods/pod_id/metrics', [
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
  ],
]);

echo $response->getBody();
csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/pods/pod_id/metrics");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <api_key>");
IRestResponse response = client.Execute(request);
swift
import Foundation

let headers = ["Authorization": "Bearer <api_key>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/pods/pod_id/metrics")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()