# API Email - History

## Search Emails History

<mark style="color:green;">`POST`</mark> `/v2/email/search`

**Body**

<table><thead><tr><th width="225">Param</th><th width="121">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>api_key</code></td><td>string</td><td><mark style="color:red;">required</mark></td></tr><tr><td><code>email_address</code></td><td>string</td><td>Email Address lookup <mark style="color:red;">required</mark></td></tr><tr><td><code>page</code></td><td>int</td><td></td></tr><tr><td><code>uuid</code></td><td>string</td><td>Return Single Email From UUID</td></tr><tr><td><code>eid</code></td><td>string</td><td>Return Emails from eid [Chain]</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "current_page": 1,
    "from": 1,
    "to": 1,
    "total": 4,
    "data": [
        {
            "id": 1,
            "uuid": "14e60762992ef2aeb13038a8fb08ffd5",
            "user_id": 1,
            "agent_id": 1000,
            "hidden": 0,
            "provider": "outlook", // outlook, gmail or smtp
            "folder": "Inbox",
            "type": "inbound", // inbound or outbound
            "eid": "EMAIL_CHAIN_ID_HERE",
            "uid": "UNIWUE_EMAIL_ID_HERE",
            "from_email": "from@email.com",
            "to_email": [
                {
                    "name": "John Doe",
                    "email_address": "to@email.com"
                }
            ],
            "subject": "Sending Email Eample",
            "text_body": "BASE_64_ENCODED_STRING",
            "html_body": "BASE_64_ENCODED_STRING",
            "headers": [
                { // Possible outputs, custom to whats sent.
                    "sense_customer_id": 123456,
                    "sense_order_id": 123456
                    // ...
                }
            ],
            "cc": [
                {
                    "name": "Another Person",
                    "email_address": "cc1@email.com"
                }
            ],
            "bcc": [], // Same pattern as CC
            "is_draft": 0, // True/False
            "is_read": 1, // True/False
            "summary": "Summary of the Email Chain here",
            "actions": [
                {
                    "type": "email",
                    "task": "Example task here",
                    "period": "ASAP" // TODAY, ASAP, THIS_WEEK, NEXT_WEEK or Specific Date [YYYY-MM-DD H:i:s]
                }
            ],
            "spam": 0, // 0-100
            "scam": 0, // 0-100
            "junk": 0, // 0-100
            "tags": [
                "technical",
                "b2b",
                "internal",
                "follow_up",
                "product_update"
            ],
            "priority": "medium", // low, medium, high
            "date": "2024-11-21 18:51:03", // Date the email landed
            "created_at": "2024-11-21T23:15:33.000000Z",
            "updated_at": "2024-11-21T23:15:48.000000Z"
        },
    ],
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.systemsx.co.uk/sense/api-email-history.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
