Skip to content

Labels & Lists

Fresh 🌱

AgentMail REST API reference for Labels & Lists. Base URL https://api.agentmail.to/v0. Authenticate with Authorization: Bearer <API_KEY>.

Create List

POST https://api.agentmail.to/v0/inboxes/{inbox_id}/lists/{direction}/{type} Content-Type: application/json

CLI:

bash
agentmail inboxes:lists create --inbox-id <inbox_id> --direction <direction> --type <type> --entry user@example.com

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/inboxes/{inbox_id}/lists/{direction}/{type}:
    post:
      operationId: create
      summary: Create List Entry
      description: >-
        **CLI:**

        ```bash

        agentmail inboxes:lists create --inbox-id <inbox_id> --direction
        <direction> --type <type> --entry user@example.com

        ```
      tags:
        - subpackage_inboxes.subpackage_inboxes/lists
      parameters:
        - name: inbox_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_inboxes:InboxId'
        - name: direction
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_lists:Direction'
        - name: type
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_lists:ListType'
        - 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_lists:PodListEntry'
        '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_lists:CreateListEntryRequest'
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_inboxes:InboxId:
      type: string
      description: The ID of the inbox.
      title: InboxId
    type_lists:Direction:
      type: string
      enum:
        - send
        - receive
        - reply
      description: Direction of list entry.
      title: Direction
    type_lists:ListType:
      type: string
      enum:
        - allow
        - block
      description: Type of list entry.
      title: ListType
    type_lists:CreateListEntryRequest:
      type: object
      properties:
        entry:
          type: string
          description: Email address or domain to add.
        reason:
          type: string
          description: Reason for adding the entry.
      required:
        - entry
      title: CreateListEntryRequest
    type_:OrganizationId:
      type: string
      description: ID of organization.
      title: OrganizationId
    type_lists:EntryType:
      type: string
      enum:
        - email
        - domain
      description: Whether the entry is an email address or domain.
      title: EntryType
    type_lists:PodListEntry:
      type: object
      properties:
        entry:
          type: string
          description: Email address or domain of list entry.
        organization_id:
          $ref: '#/components/schemas/type_:OrganizationId'
        reason:
          type: string
          description: Reason for adding the entry.
        direction:
          $ref: '#/components/schemas/type_lists:Direction'
        list_type:
          $ref: '#/components/schemas/type_lists:ListType'
        entry_type:
          $ref: '#/components/schemas/type_lists:EntryType'
        created_at:
          type: string
          format: date-time
          description: Time at which entry was created.
        read_only:
          type: boolean
          description: Whether the entry is read-only and cannot be deleted via the API.
        pod_id:
          type: string
          description: ID of pod.
        inbox_id:
          type: string
          description: ID of inbox, if entry is inbox-scoped.
      required:
        - entry
        - organization_id
        - direction
        - list_type
        - entry_type
        - created_at
        - pod_id
      title: PodListEntry
    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
{
  "entry": "entry"
}

Response

json
{
  "created_at": "2024-01-15T09:30:00Z",
  "direction": "send",
  "entry": "entry",
  "entry_type": "email",
  "list_type": "allow",
  "organization_id": "organization_id",
  "pod_id": "pod_id",
  "inbox_id": "inbox_id",
  "read_only": true,
  "reason": "reason"
}

SDK Code

typescript
import { AgentMailClient } from "agentmail";

async function main() {
    const client = new AgentMailClient({
        apiKey: "YOUR_TOKEN_HERE",
    });
    await client.inboxes.lists.create("inbox_id", "send", "allow", {
        entry: "entry",
    });
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.inboxes.lists.create(
    inbox_id="inbox_id",
    direction="send",
    type="allow",
    entry="entry",
)
go
package main

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

func main() {

	url := "https://api.agentmail.to/v0/inboxes/inbox_id/lists/send/allow"

	payload := strings.NewReader("{\n  \"entry\": \"entry\"\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/inboxes/inbox_id/lists/send/allow")

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  \"entry\": \"entry\"\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/inboxes/inbox_id/lists/send/allow")
  .header("Authorization", "Bearer <api_key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"entry\": \"entry\"\n}")
  .asString();
php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

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

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/inboxes/inbox_id/lists/send/allow")! 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 List

GET https://api.agentmail.to/v0/inboxes/{inbox_id}/lists/{direction}/{type}/{entry}

CLI:

bash
agentmail inboxes:lists get --inbox-id <inbox_id> --direction <direction> --type <type> --entry <entry>

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/inboxes/{inbox_id}/lists/{direction}/{type}/{entry}:
    get:
      operationId: get
      summary: Get List Entry
      description: >-
        **CLI:**

        ```bash

        agentmail inboxes:lists get --inbox-id <inbox_id> --direction
        <direction> --type <type> --entry <entry>

        ```
      tags:
        - subpackage_inboxes.subpackage_inboxes/lists
      parameters:
        - name: inbox_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_inboxes:InboxId'
        - name: direction
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_lists:Direction'
        - name: type
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_lists:ListType'
        - name: entry
          in: path
          description: Email address or domain.
          required: true
          schema:
            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_lists:PodListEntry'
        '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_inboxes:InboxId:
      type: string
      description: The ID of the inbox.
      title: InboxId
    type_lists:Direction:
      type: string
      enum:
        - send
        - receive
        - reply
      description: Direction of list entry.
      title: Direction
    type_lists:ListType:
      type: string
      enum:
        - allow
        - block
      description: Type of list entry.
      title: ListType
    type_:OrganizationId:
      type: string
      description: ID of organization.
      title: OrganizationId
    type_lists:EntryType:
      type: string
      enum:
        - email
        - domain
      description: Whether the entry is an email address or domain.
      title: EntryType
    type_lists:PodListEntry:
      type: object
      properties:
        entry:
          type: string
          description: Email address or domain of list entry.
        organization_id:
          $ref: '#/components/schemas/type_:OrganizationId'
        reason:
          type: string
          description: Reason for adding the entry.
        direction:
          $ref: '#/components/schemas/type_lists:Direction'
        list_type:
          $ref: '#/components/schemas/type_lists:ListType'
        entry_type:
          $ref: '#/components/schemas/type_lists:EntryType'
        created_at:
          type: string
          format: date-time
          description: Time at which entry was created.
        read_only:
          type: boolean
          description: Whether the entry is read-only and cannot be deleted via the API.
        pod_id:
          type: string
          description: ID of pod.
        inbox_id:
          type: string
          description: ID of inbox, if entry is inbox-scoped.
      required:
        - entry
        - organization_id
        - direction
        - list_type
        - entry_type
        - created_at
        - pod_id
      title: PodListEntry
    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
{
  "created_at": "2024-01-15T09:30:00Z",
  "direction": "send",
  "entry": "entry",
  "entry_type": "email",
  "list_type": "allow",
  "organization_id": "organization_id",
  "pod_id": "pod_id",
  "inbox_id": "inbox_id",
  "read_only": true,
  "reason": "reason"
}

SDK Code

typescript
import { AgentMailClient } from "agentmail";

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

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.inboxes.lists.get(
    inbox_id="inbox_id",
    direction="send",
    type="allow",
    entry="entry",
)
go
package main

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

func main() {

	url := "https://api.agentmail.to/v0/inboxes/inbox_id/lists/send/allow/entry"

	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/inboxes/inbox_id/lists/send/allow/entry")

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/inboxes/inbox_id/lists/send/allow/entry")
  .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/inboxes/inbox_id/lists/send/allow/entry', [
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
  ],
]);

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

var client = new RestClient("https://api.agentmail.to/v0/inboxes/inbox_id/lists/send/allow/entry");
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/inboxes/inbox_id/lists/send/allow/entry")! 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 Lists

GET https://api.agentmail.to/v0/inboxes/{inbox_id}/lists/{direction}/{type}

CLI:

bash
agentmail inboxes:lists list --inbox-id <inbox_id> --direction <direction> --type <type>

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/inboxes/{inbox_id}/lists/{direction}/{type}:
    get:
      operationId: list
      summary: List Entries
      description: >-
        **CLI:**

        ```bash

        agentmail inboxes:lists list --inbox-id <inbox_id> --direction
        <direction> --type <type>

        ```
      tags:
        - subpackage_inboxes.subpackage_inboxes/lists
      parameters:
        - name: inbox_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_inboxes:InboxId'
        - name: direction
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_lists:Direction'
        - name: type
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_lists:ListType'
        - 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: 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_lists:PodListListEntriesResponse'
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_inboxes:InboxId:
      type: string
      description: The ID of the inbox.
      title: InboxId
    type_lists:Direction:
      type: string
      enum:
        - send
        - receive
        - reply
      description: Direction of list entry.
      title: Direction
    type_lists:ListType:
      type: string
      enum:
        - allow
        - block
      description: Type of list entry.
      title: ListType
    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_:Count:
      type: integer
      description: Number of items returned.
      title: Count
    type_:OrganizationId:
      type: string
      description: ID of organization.
      title: OrganizationId
    type_lists:EntryType:
      type: string
      enum:
        - email
        - domain
      description: Whether the entry is an email address or domain.
      title: EntryType
    type_lists:PodListEntry:
      type: object
      properties:
        entry:
          type: string
          description: Email address or domain of list entry.
        organization_id:
          $ref: '#/components/schemas/type_:OrganizationId'
        reason:
          type: string
          description: Reason for adding the entry.
        direction:
          $ref: '#/components/schemas/type_lists:Direction'
        list_type:
          $ref: '#/components/schemas/type_lists:ListType'
        entry_type:
          $ref: '#/components/schemas/type_lists:EntryType'
        created_at:
          type: string
          format: date-time
          description: Time at which entry was created.
        read_only:
          type: boolean
          description: Whether the entry is read-only and cannot be deleted via the API.
        pod_id:
          type: string
          description: ID of pod.
        inbox_id:
          type: string
          description: ID of inbox, if entry is inbox-scoped.
      required:
        - entry
        - organization_id
        - direction
        - list_type
        - entry_type
        - created_at
        - pod_id
      title: PodListEntry
    type_lists:PodListListEntriesResponse:
      type: object
      properties:
        count:
          $ref: '#/components/schemas/type_:Count'
        limit:
          $ref: '#/components/schemas/type_:Limit'
        next_page_token:
          $ref: '#/components/schemas/type_:PageToken'
        entries:
          type: array
          items:
            $ref: '#/components/schemas/type_lists:PodListEntry'
          description: Ordered by entry ascending.
      required:
        - count
        - entries
      title: PodListListEntriesResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

Response

json
{
  "count": 1,
  "entries": [
    {
      "created_at": "2024-01-15T09:30:00Z",
      "direction": "send",
      "entry": "entry",
      "entry_type": "email",
      "list_type": "allow",
      "organization_id": "organization_id",
      "pod_id": "pod_id",
      "inbox_id": "inbox_id",
      "read_only": true,
      "reason": "reason"
    },
    {
      "created_at": "2024-01-15T09:30:00Z",
      "direction": "send",
      "entry": "entry",
      "entry_type": "email",
      "list_type": "allow",
      "organization_id": "organization_id",
      "pod_id": "pod_id",
      "inbox_id": "inbox_id",
      "read_only": true,
      "reason": "reason"
    }
  ],
  "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.inboxes.lists.list("inbox_id", "send", "allow", {});
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.inboxes.lists.list(
    inbox_id="inbox_id",
    direction="send",
    type="allow",
)
go
package main

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

func main() {

	url := "https://api.agentmail.to/v0/inboxes/inbox_id/lists/send/allow"

	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/inboxes/inbox_id/lists/send/allow")

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/inboxes/inbox_id/lists/send/allow")
  .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/inboxes/inbox_id/lists/send/allow', [
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
  ],
]);

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

var client = new RestClient("https://api.agentmail.to/v0/inboxes/inbox_id/lists/send/allow");
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/inboxes/inbox_id/lists/send/allow")! 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 List

DELETE https://api.agentmail.to/v0/inboxes/{inbox_id}/lists/{direction}/{type}/{entry}

CLI:

bash
agentmail inboxes:lists delete --inbox-id <inbox_id> --direction <direction> --type <type> --entry <entry>

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/inboxes/{inbox_id}/lists/{direction}/{type}/{entry}:
    delete:
      operationId: delete
      summary: Delete List Entry
      description: >-
        **CLI:**

        ```bash

        agentmail inboxes:lists delete --inbox-id <inbox_id> --direction
        <direction> --type <type> --entry <entry>

        ```
      tags:
        - subpackage_inboxes.subpackage_inboxes/lists
      parameters:
        - name: inbox_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_inboxes:InboxId'
        - name: direction
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_lists:Direction'
        - name: type
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/type_lists:ListType'
        - name: entry
          in: path
          description: Email address or domain.
          required: true
          schema:
            type: string
        - 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_inboxes:InboxId:
      type: string
      description: The ID of the inbox.
      title: InboxId
    type_lists:Direction:
      type: string
      enum:
        - send
        - receive
        - reply
      description: Direction of list entry.
      title: Direction
    type_lists:ListType:
      type: string
      enum:
        - allow
        - block
      description: Type of list entry.
      title: ListType
    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.inboxes.lists.delete("inbox_id", "send", "allow", "entry");
}
main();
python
from agentmail import AgentMail

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.inboxes.lists.delete(
    inbox_id="inbox_id",
    direction="send",
    type="allow",
    entry="entry",
)
go
package main

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

func main() {

	url := "https://api.agentmail.to/v0/inboxes/inbox_id/lists/send/allow/entry"

	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/inboxes/inbox_id/lists/send/allow/entry")

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/inboxes/inbox_id/lists/send/allow/entry")
  .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/inboxes/inbox_id/lists/send/allow/entry', [
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
  ],
]);

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

var client = new RestClient("https://api.agentmail.to/v0/inboxes/inbox_id/lists/send/allow/entry");
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/inboxes/inbox_id/lists/send/allow/entry")! 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()