Récupérer les métadonnées d'un email
Retourne les métadonnées d'un email avec les informations des pièces jointes, mais sans le contenu des pièces jointes. Utile pour examiner un email sans télécharger des données de pièces jointes potentiellement volumineuses.
GET
/emails/{id}/metaCopy
Paramètres de chemin
idstring Required Link
L'identifiant de l'email au format em_xxx.
const response = await fetch('https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta', {
method: 'GET',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
});
const result = await response.json();
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type: application/json'
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "Erreur cURL #:" . $err;
} else {
$result = json_decode($response, true);
print_r($result);
}
import requests
response = requests.get(
'https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta',
headers={
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
)
result = response.json()
print(result)
require 'net/http'
require 'json'
uri = URI('https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer em_test_51RxCWJ...vS00p61e0qRE'
request['Content-Type'] = 'application/json'
response = http.request(request)
result = JSON.parse(response.body)
puts result
package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
}
use reqwest;
use serde_json::Value;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.get("https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta")
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.send()
.await?;
let result: Value = response.json().await?;
println!("{:?}", result);
Ok(())
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class GetEmailMeta {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta"))
.header("Authorization", "Bearer em_test_51RxCWJ...vS00p61e0qRE")
.header("Content-Type", "application/json")
.GET()
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
public class GetEmailMeta
{
public static async Task Main()
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization",
"Bearer em_test_51RxCWJ...vS00p61e0qRE");
var response = await client.GetAsync(
"https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta");
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
}
curl -X GET https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta \
-H "Authorization: Bearer em_test_51RxCWJ...vS00p61e0qRE" \
-H "Content-Type: application/json"
Récupérer les métadonnées d'un email
const response = await fetch('https://api.emailit.com/v2/emails/em_abc123xyz789def456/meta', {
method: 'GET',
headers: {
'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
'Content-Type': 'application/json'
}
});
const result = await response.json();
Champs de réponse
La réponse inclut tous les champs de métadonnées de l'email plus un tableau attachments avec les informations des pièces jointes (sans le champ content).
Objet Pièce jointe (Métadonnées)
| Champ | Type | Description |
|---|---|---|
filename | string | Nom du fichier de la pièce jointe |
content_type | string | Type MIME |
size | integer | Taille de la pièce jointe en octets |
content_id | string | null | Content-ID pour les pièces jointes intégrées |
content_disposition | string | "attachment" ou "inline" |
{
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "outbound",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@yourdomain.com>",
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Hello World",
"status": "delivered",
"size": 4523,
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:05:00.123456Z",
"tracking": {
"loads": true,
"clicks": false
},
"meta": null,
"headers": {
"From": "sender@yourdomain.com",
"To": "recipient@example.com",
"Subject": "Hello World",
"Content-Type": "multipart/mixed; boundary=----boundary123"
},
"attachments": [
{
"filename": "doc.pdf",
"content_type": "application/pdf",
"size": 12345,
"content_id": null,
"content_disposition": "attachment"
}
]
}
{
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "outbound",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@yourdomain.com>",
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Hello World",
"status": "delivered",
"size": 4523,
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:05:00.123456Z",
"tracking": {
"loads": true,
"clicks": false
},
"meta": null,
"headers": {
"From": "sender@yourdomain.com",
"To": "recipient@example.com",
"Subject": "Hello World",
"Content-Type": "text/html; charset=utf-8"
},
"attachments": []
}
{
"error": "Email introuvable",
"message": "L'email avec l'ID 'em_abc123' n'a pas été trouvé dans votre espace de travail"
}
Réponses
{
"object": "email",
"id": "em_abc123xyz789def456ghi012jkl345",
"type": "outbound",
"token": "abc123xyz789",
"message_id": "<abc123xyz789@yourdomain.com>",
"from": "sender@yourdomain.com",
"to": "recipient@example.com",
"subject": "Hello World",
"status": "delivered",
"size": 4523,
"scheduled_at": null,
"created_at": "2026-01-08T12:00:00.123456Z",
"updated_at": "2026-01-08T12:05:00.123456Z",
"tracking": {
"loads": true,
"clicks": false
},
"meta": null,
"headers": {
"From": "sender@yourdomain.com",
"To": "recipient@example.com",
"Subject": "Hello World",
"Content-Type": "multipart/mixed; boundary=----boundary123"
},
"attachments": [
{
"filename": "doc.pdf",
"content_type": "application/pdf",
"size": 12345,
"content_id": null,
"content_disposition": "attachment"
}
]
}