/api/v1_2/emails/:email_idRetrieves all the information associated with the email. Including basic data about attachments.
One email can have multiple attachments which are processed to uploads. In case the attachment file is compressed archive or mail message (*.eml) we unpack it and create uploads from it which become children of the initial upload.
Parent uploads json objects in response have children listed under “uploads” key. In case the upload has no children they have “documents” key instead containing data about documents created from uploads.
Multiple documents can be created from single upload because of file split feature.
Upload states
| State | State Description Options | Note |
|---|---|---|
uploaded |
Waiting for processing | |
infected |
Flagged by antivirus | |
file_duplicate |
File with same MD5 hash already exists in folder | |
processing |
Being processed right now | |
failed |
Processing failed unexpectedly - will be checked by support soon | |
processed |
Finalized upload | |
skipped |
ignored_file excess_email_file unknown_file invalid_file_size embedded_archive archive_extraction_failed |
These uploads were not processed to document because of various reason stated in state description |
Skipping reasons
-
ignored_file -> following file extension/conten-types are ignored:
xml ics css js bin exe sh bat dmg rtf csv odt ods pptx vcard aba step igs kbb pmi webarchive dwg jp2 -
excess_email_file -> if email contains one of preffered extension
pdf zip rar 7z xls xlsx doc docxall other present files are skipped -> this feature can be disabled on request (contact our support to get more info) -
unknown_file -> unrecognized file
-
invalid_file_size -> any image which has at least one dimension lower than 160px or bigger than 10000px is skipped
-
embedded_archive -> compressed archives present inside of compressed archives are not supported
-
archive_extraction_failed -> malformed compressed archive
Path parameters
| Name | Example | Description |
|---|---|---|
email_id |
- | - |
Code examples
cURL
curl --request GET 'https://app.datamolino.com/api/v1_2/emails/13579' \
--header 'Authorization: Bearer demo_access_token'HTTP
GET /api/v1_2/emails/13579 HTTP/1.1
Host: app.datamolino.com
Authorization: Bearer demo_access_tokenJavaScript Fetch
const response = await fetch("https://app.datamolino.com/api/v1_2/emails/13579", {
method: "GET",
headers: {
"Authorization": "Bearer demo_access_token"
},
});
const data = await response.json();Node.js Axios
import axios from "axios";
const response = await axios({
method: "get",
url: "https://app.datamolino.com/api/v1_2/emails/13579",
headers: {
"Authorization": "Bearer demo_access_token"
}
});
console.log(response.data);Python Requests
import requests
url = "https://app.datamolino.com/api/v1_2/emails/13579"
headers = {
"Authorization": "Bearer demo_access_token"
}
response = requests.request("GET", url, headers=headers)
response.raise_for_status()
print(response.json())Ruby Net::HTTP
require 'json'
require 'net/http'
uri = URI("https://app.datamolino.com/api/v1_2/emails/13579")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer demo_access_token"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
puts JSON.parse(response.body)Ruby on Rails
# app/services/datamolino_client.rb
require 'json'
require 'net/http'
class DatamolinoClient
BASE_URL = "https://app.datamolino.com"
def initialize(access_token: Rails.application.credentials.dig(:datamolino, :access_token))
@access_token = access_token
end
def request_fetch_email
uri = URI("#{BASE_URL}/api/v1_2/emails/13579")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer #{@access_token}"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
JSON.parse(response.body)
end
endPHP Guzzle
<?php
use GuzzleHttp\Client;
$client = new Client();
$response = $client->request('GET', 'https://app.datamolino.com/api/v1_2/emails/13579', [
'headers' => json_decode('{"Authorization":"Bearer demo_access_token"}', true)
]);
echo $response->getBody();Java OkHttp
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://app.datamolino.com/api/v1_2/emails/13579")
.addHeader("Authorization", "Bearer demo_access_token")
.method("GET", null)
.build();
Response response = client.newCall(request).execute();C# HttpClient
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Get, "https://app.datamolino.com/api/v1_2/emails/13579");
request.Headers.Add("Authorization", "Bearer demo_access_token");
using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());Go Native
client := &http.Client{}
req, err := http.NewRequest("GET", "https://app.datamolino.com/api/v1_2/emails/13579", nil)
if err != nil { panic(err) }
req.Header.Add("Authorization", "Bearer demo_access_token")
res, err := client.Do(req)
if err != nil { panic(err) }
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil { panic(err) }
fmt.Println(string(body))Swift URLSession
import Foundation
var request = URLRequest(url: URL(string: "https://app.datamolino.com/api/v1_2/emails/13579")!)
request.httpMethod = "GET"
request.setValue("Bearer demo_access_token", forHTTPHeaderField: "Authorization")
let (data, _) = try await URLSession.shared.data(for: request)
print(String(data: data, encoding: .utf8)!)Responses
200 OK
Content type: application/json; charset=utf-8
Synthetic example of a processed email with one upload and one document:
{
"emails": [
{
"id": 13579,
"state": "processed",
"folder_id": 143,
"sender": "supplier@example.com",
"recipients": [
"invoices@example.com"
],
"subject": "Demo invoice",
"text_body": "Please find the invoice attached.",
"html_body": "<p>Please find the invoice attached.</p>",
"date": "2026-01-15T10:00:00Z",
"attachments": [
"demo-invoice.pdf"
],
"uploads": [
{
"uuid": "00000000-0000-4000-8000-000000000001",
"state": "processed",
"state_description": null,
"original_file_name": "demo-invoice.pdf",
"original_content_type": "application/pdf",
"original": "https://files.example.com/demo-upload.pdf",
"documents": [
{
"id": 24680,
"state": "ready",
"original_file_name": "demo-invoice.pdf",
"original_content_type": "application/pdf",
"original": "https://files.example.com/demo-invoice.pdf"
}
]
}
]
}
]
}
404 Not Found
Content type: application/json; charset=utf-8
{
"message": "Email not found"
}