/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
demo_identifier
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 docx all 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
-
demo_identifier -> malformed compressed archive
Path parameters
| Name | Example | Description |
|---|---|---|
email_id |
— | — |
Code examples
curl --request GET 'https://app.datamolino.com/api/v1_2/emails/13579' \
--header 'Authorization: Bearer demo_access_token'GET /api/v1_2/emails/13579 HTTP/1.1
Host: app.datamolino.com
Authorization: Bearer demo_access_tokenconst 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();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);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())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)# 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
end<?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();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();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());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))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
https://files.example.com/datamolino-demo/original/demo-supplier-invoice.pdf?expires=3600&signature=demo_signature404 Forbidden
Content type: application/json; charset=utf-8
{
"message": "Email not found"
}