curl --request GET \
--url https://{dsn}/api/v1/emails \
--header 'X-API-KEY: <api-key>'import requests
url = "https://{dsn}/api/v1/emails"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://{dsn}/api/v1/emails', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{dsn}/api/v1/emails",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{dsn}/api/v1/emails"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{dsn}/api/v1/emails")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{dsn}/api/v1/emails")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"object": "Emails",
"data": [
{
"$ref": "#/components/examples/Email/value"
}
],
"has_more": true,
"cursor": "eyJkIjoiMjAyNi0xMC0wNlQwOToxMjowMFoiLCJpIjoiOTRhMGQ3N2QifQ"
}{
"status": 400,
"type": "errors/invalid_parameters",
"title": "Invalid parameters",
"detail": "limit must be between 1 and 250"
}{
"status": 401,
"type": "errors/unauthorized",
"title": "Unauthorized",
"detail": "missing or invalid API key"
}List emails
Returns emails, newest first (by the email’s date), with optional filters. All
filters can be combined: account_id=…&folder=INBOX&unread=true returns the unread emails
of one account’s inbox.
Paging: up to limit emails per page. When has_more is true, pass cursor back,
with the same filters, for the next page.
Only emails received after the account connected are available.
curl --request GET \
--url https://{dsn}/api/v1/emails \
--header 'X-API-KEY: <api-key>'import requests
url = "https://{dsn}/api/v1/emails"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://{dsn}/api/v1/emails', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{dsn}/api/v1/emails",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{dsn}/api/v1/emails"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{dsn}/api/v1/emails")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{dsn}/api/v1/emails")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"object": "Emails",
"data": [
{
"$ref": "#/components/examples/Email/value"
}
],
"has_more": true,
"cursor": "eyJkIjoiMjAyNi0xMC0wNlQwOToxMjowMFoiLCJpIjoiOTRhMGQ3N2QifQ"
}{
"status": 400,
"type": "errors/invalid_parameters",
"title": "Invalid parameters",
"detail": "limit must be between 1 and 250"
}{
"status": 401,
"type": "errors/unauthorized",
"title": "Unauthorized",
"detail": "missing or invalid API key"
}Authorizations
Your access token, from your dashboard under API keys.
Query Parameters
Emails of this account only. Without it, emails of all accounts.
Emails in this folder: a fld_… id, the provider's folder id, or a role (INBOX, SENT, DRAFTS, TRASH, SPAM, ARCHIVE).
Emails whose main role is this one. An email you sent yourself (in Inbox and Sent) matches only its main role.
INBOX, SENT, DRAFTS, TRASH, SPAM, ARCHIVE, ALL, IMPORTANT, STARRED, UNKNOWN Sender's email address (exact, case-insensitive).
A recipient's address, in to, cc or bcc.
The sender or any recipient: every email exchanged with one person.
All emails of one conversation.
true: unread only. false: read only.
true: flagged (IMAP) or starred (Gmail) only.
true: emails with at least one attachment (inline images count).
Subject contains this text (case-insensitive).
Emails dated after this time (ISO 8601).
Emails dated before this time (ISO 8601).
Add every header (headers) to each email.
How many items per page, 1 to 250.
1 <= x <= 250The cursor from the previous page. Leave it out for the first page.