Skip to content

Organizations

Fresh 🌱

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

Get Organization

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

Returns the organization for the authenticated API key (usage limits, counts, and billing metadata).

CLI:

bash
agentmail organizations get

OpenAPI Specification

yaml
openapi: 3.1.0
info:
  title: api
  version: 1.0.0
paths:
  /v0/organizations:
    get:
      operationId: get
      summary: Get Organization
      description: >-
        Returns the organization for the authenticated API key (usage limits,
        counts, and billing metadata).

        **CLI:**

        ```bash

        agentmail organizations get

        ```
      tags:
        - subpackage_organizations
      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_organizations:Organization'
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_:OrganizationId:
      type: string
      description: ID of organization.
      title: OrganizationId
    type_organizations:Organization:
      type: object
      properties:
        organization_id:
          $ref: '#/components/schemas/type_:OrganizationId'
        inbox_count:
          type: integer
          description: Current number of inboxes.
        domain_count:
          type: integer
          description: Current number of domains.
        inbox_limit:
          type: integer
          description: Maximum number of inboxes allowed.
        domain_limit:
          type: integer
          description: Maximum number of domains allowed.
        billing_id:
          type: string
          description: Provider-agnostic billing customer ID.
        billing_type:
          type: string
          description: Billing provider type (e.g. "stripe").
        billing_subscription_id:
          type: string
          description: Active billing subscription ID.
        authentication_id:
          type: string
          description: Provider-agnostic authentication ID.
        authentication_type:
          type: string
          description: Authentication provider type.
        updated_at:
          type: string
          format: date-time
          description: Time at which organization was last updated.
        created_at:
          type: string
          format: date-time
          description: Time at which organization was created.
      required:
        - organization_id
        - inbox_count
        - domain_count
        - updated_at
        - created_at
      description: Organization details with usage limits and counts.
      title: Organization
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

Examples

Response

json
{
  "organization_id": "organization_id",
  "inbox_count": 1,
  "domain_count": 1,
  "updated_at": "2024-01-15T09:30:00Z",
  "created_at": "2024-01-15T09:30:00Z",
  "inbox_limit": 1,
  "domain_limit": 1,
  "billing_id": "billing_id",
  "billing_type": "billing_type",
  "billing_subscription_id": "billing_subscription_id",
  "authentication_id": "authentication_id",
  "authentication_type": "authentication_type"
}

SDK Code

typescript
import { AgentMailClient } from "agentmail";

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

client = AgentMail(
    api_key="YOUR_TOKEN_HERE",
)

client.organizations.get()
go
package main

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

func main() {

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

	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/organizations")

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/organizations")
  .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/organizations', [
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
  ],
]);

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

var client = new RestClient("https://api.agentmail.to/v0/organizations");
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/organizations")! 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()