---
title: "Fetch Email"
description: "Retrieves all the information associated with the email. Including basic data about attachments."
---

> Documentation Index
> Fetch the complete documentation index at: /api-docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch Email

<div class="endpoint-signature"><span data-method="GET">GET</span><code>/api/v1_2/emails/:email_id</code></div>

Retrieves 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 -&gt; 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 -&gt; if email contains one of preffered extension pdf zip rar 7z xls xlsx doc docx all other present files are skipped -&gt; this feature can be disabled on request (contact our support to get more info)

- unknown_file -&gt; unrecognized file

- invalid_file_size -&gt; any image which has at least one dimension lower than 160px or bigger than 10000px is skipped

- embedded_archive -&gt; compressed archives present inside of compressed archives are not supported

- demo_identifier -&gt; malformed compressed archive

## Path parameters

| Name | Example | Description |
|---|---|---|
| `email_id` | — | — |

## Code examples

### cURL

```curl
curl --request GET 'https://app.datamolino.com/api/v1_2/emails/13579' \
  --header 'Authorization: Bearer demo_access_token'
```
### HTTP

```http
GET /api/v1_2/emails/13579 HTTP/1.1
Host: app.datamolino.com
Authorization: Bearer demo_access_token
```
### JavaScript Fetch

```javascript
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

```javascript
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

```python
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

```ruby
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

```ruby
# 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 Guzzle

```php
<?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

```java
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

```csharp
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

```go
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

```swift
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`

```text
https://files.example.com/datamolino-demo/original/demo-supplier-invoice.pdf?expires=3600&signature=demo_signature
```

### 404 Forbidden

Content type: `application/json; charset=utf-8`

```json
{
  "message": "Email not found"
}
```

Source: /api-docs/reference/emails/fetch-email/index.md
