Appearance
Authentication
Fresh 🌱AgentMail REST API reference for Authentication. Base URL
https://api.agentmail.to/v0. Authenticate withAuthorization: Bearer <API_KEY>.
Auth Overview
GET https://api.agentmail.to/v0/auth/me
Returns the identity and scope of the authenticated credential. Useful when a client holds a pod-scoped or inbox-scoped API key and needs to discover the parent organization, pod, or inbox without prior knowledge.
CLI:
bash
agentmail auth meOpenAPI Specification
yaml
openapi: 3.1.0
info:
title: api
version: 1.0.0
paths:
/v0/auth/me:
get:
operationId: me
summary: Who Am I
description: >-
Returns the identity and scope of the authenticated credential. Useful
when a client holds a pod-scoped or inbox-scoped API key and needs to
discover the parent organization, pod, or inbox without prior knowledge.
**CLI:**
```bash
agentmail auth me
```
tags:
- subpackage_auth
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_auth:Identity'
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_auth:ScopeType:
type: string
enum:
- organization
- pod
- inbox
description: The scope tier the authenticated credential is bound to.
title: ScopeType
type_:OrganizationId:
type: string
description: ID of organization.
title: OrganizationId
type_auth:Identity:
type: object
properties:
scope_type:
$ref: '#/components/schemas/type_auth:ScopeType'
scope_id:
type: string
description: >-
ID of the most specific scope the credential is bound to.
Equals inbox_id when scope_type is inbox, pod_id when pod,
organization_id when organization.
organization_id:
$ref: '#/components/schemas/type_:OrganizationId'
pod_id:
type: string
description: >-
ID of the pod the credential is scoped to. Present when scope_type
is pod or inbox.
inbox_id:
type: string
description: >-
ID of the inbox the credential is scoped to. Present when scope_type
is inbox.
api_key_id:
type: string
description: >-
ID of the API key used to authenticate. Absent for JWT and proxy
credentials.
required:
- scope_type
- scope_id
- organization_id
description: Identity and scope of the authenticated credential.
title: Identity
securitySchemes:
Bearer:
type: http
scheme: bearerExamples
Response
json
{
"scope_type": "organization",
"scope_id": "scope_id",
"organization_id": "organization_id",
"pod_id": "pod_id",
"inbox_id": "inbox_id",
"api_key_id": "api_key_id"
}SDK Code
typescript
import { AgentMailClient } from "agentmail";
async function main() {
const client = new AgentMailClient({
apiKey: "YOUR_TOKEN_HERE",
});
await client.auth.me();
}
main();python
from agentmail import AgentMail
client = AgentMail(
api_key="YOUR_TOKEN_HERE",
)
client.auth.me()go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.agentmail.to/v0/auth/me"
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/auth/me")
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_bodyjava
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/auth/me")
.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/auth/me', [
'headers' => [
'Authorization' => 'Bearer <api_key>',
],
]);
echo $response->getBody();csharp
using RestSharp;
var client = new RestClient("https://api.agentmail.to/v0/auth/me");
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/auth/me")! 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()Get Current Identity (me)
GET https://api.agentmail.to/v0/auth/me
Returns the identity and scope of the authenticated credential. Useful when a client holds a pod-scoped or inbox-scoped API key and needs to discover the parent organization, pod, or inbox without prior knowledge.
CLI:
bash
agentmail auth meOpenAPI Specification
yaml
openapi: 3.1.0
info:
title: api
version: 1.0.0
paths:
/v0/auth/me:
get:
operationId: me
summary: Who Am I
description: >-
Returns the identity and scope of the authenticated credential. Useful
when a client holds a pod-scoped or inbox-scoped API key and needs to
discover the parent organization, pod, or inbox without prior knowledge.
**CLI:**
```bash
agentmail auth me
```
tags:
- subpackage_auth
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_auth:Identity'
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_auth:ScopeType:
type: string
enum:
- organization
- pod
- inbox
description: The scope tier the authenticated credential is bound to.
title: ScopeType
type_:OrganizationId:
type: string
description: ID of organization.
title: OrganizationId
type_auth:Identity:
type: object
properties:
scope_type:
$ref: '#/components/schemas/type_auth:ScopeType'
scope_id:
type: string
description: >-
ID of the most specific scope the credential is bound to.
Equals inbox_id when scope_type is inbox, pod_id when pod,
organization_id when organization.
organization_id:
$ref: '#/components/schemas/type_:OrganizationId'
pod_id:
type: string
description: >-
ID of the pod the credential is scoped to. Present when scope_type
is pod or inbox.
inbox_id:
type: string
description: >-
ID of the inbox the credential is scoped to. Present when scope_type
is inbox.
api_key_id:
type: string
description: >-
ID of the API key used to authenticate. Absent for JWT and proxy
credentials.
required:
- scope_type
- scope_id
- organization_id
description: Identity and scope of the authenticated credential.
title: Identity
securitySchemes:
Bearer:
type: http
scheme: bearerExamples
Response
json
{
"scope_type": "organization",
"scope_id": "scope_id",
"organization_id": "organization_id",
"pod_id": "pod_id",
"inbox_id": "inbox_id",
"api_key_id": "api_key_id"
}SDK Code
typescript
import { AgentMailClient } from "agentmail";
async function main() {
const client = new AgentMailClient({
apiKey: "YOUR_TOKEN_HERE",
});
await client.auth.me();
}
main();python
from agentmail import AgentMail
client = AgentMail(
api_key="YOUR_TOKEN_HERE",
)
client.auth.me()go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.agentmail.to/v0/auth/me"
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/auth/me")
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_bodyjava
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
HttpResponse<String> response = Unirest.get("https://api.agentmail.to/v0/auth/me")
.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/auth/me', [
'headers' => [
'Authorization' => 'Bearer <api_key>',
],
]);
echo $response->getBody();csharp
using RestSharp;
var client = new RestClient("https://api.agentmail.to/v0/auth/me");
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/auth/me")! 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()