> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.mercoa.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mercoa.com/_mcp/server.

# Email Log

GET https://api.mercoa.com/organization/emailLog

Get log of all emails sent to this organization. Content format subject to change.

Reference: https://docs.mercoa.com/embedded-ap-ar/api-reference/organization/email-log

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `startDate` (datetime, optional)
- `endDate` (datetime, optional)
- `from` (string, optional) — Filter by sender email address
- `to` (string, optional) — Filter by recipient email address
- `limit` (integer, optional) — Number of logs to return. Limit can range between 1 and 100, and the default is 10.
- `startingAfter` (string, optional) — The ID of the log to start after. If not provided, the first page of logs will be returned.

## Response

### 200

- `count` (integer, required) — Total number of logs for the given filters. This value is not limited by the limit parameter. It is provided so that you can determine how many pages of results are available.
- `hasMore` (boolean, required) — True if there are more logs available for the given filters.
- `data` (list of object, required)
  - `id` (string, required)
  - `status` (enum, required) — The status of the email log. If the status is PENDING, the email has not been processed yet. If the status is PROCESSED, the email has been processed and the invoice has been created. If the status is FAILED, the email was not processed due to an error.
    - Allowed values: `PENDING`, `PROCESSED`, `FAILED`
  - `subject` (string, required)
  - `from` (string, required)
  - `to` (string, required)
  - `htmlBody` (string, required)
  - `textBody` (string, required)
  - `createdAt` (datetime, required)
  - `attachment` (object, optional)
    - `filename` (string, required)
    - `contentType` (string, required)
  - `invoiceId` (string, optional)

## Errors

### 400 Bad Request

- `errorName` ("BadRequest", required)
- `content` (string, required)

### 401 Unauthorized

- `errorName` ("Unauthorized", required)
- `content` (string, required)

### 403 Forbidden

- `errorName` ("Forbidden", required)
- `content` (string, required)

### 404 Not Found

- `errorName` ("NotFound", required)
- `content` (string, required)

### 409 Conflict

- `errorName` ("Conflict", required)
- `content` (string, required)

### 500 Internal Server Error

- `errorName` ("InternalServerError", required)
- `content` (string, required)

### 501 Unimplemented

- `errorName` ("Unimplemented", required)
- `content` (string, required)

## Examples

**Response**

```json
{
  "count": 1,
  "hasMore": true,
  "data": [
    {
      "id": "id",
      "status": "PENDING",
      "subject": "subject",
      "from": "from",
      "to": "to",
      "htmlBody": "htmlBody",
      "textBody": "textBody",
      "createdAt": "2024-01-15T09:30:00Z",
      "attachment": {
        "filename": "filename",
        "contentType": "contentType"
      },
      "invoiceId": "invoiceId"
    },
    {
      "id": "id",
      "status": "PENDING",
      "subject": "subject",
      "from": "from",
      "to": "to",
      "htmlBody": "htmlBody",
      "textBody": "textBody",
      "createdAt": "2024-01-15T09:30:00Z",
      "attachment": {
        "filename": "filename",
        "contentType": "contentType"
      },
      "invoiceId": "invoiceId"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.mercoa.com/organization/emailLog"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```typescript
import { MercoaClient } from "@mercoa/javascript";

const client = new MercoaClient({ token: "YOUR_TOKEN" });
await client.organization.emailLog();

```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.mercoa.com/organization/emailLog"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.mercoa.com/organization/emailLog")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.mercoa.com/organization/emailLog")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.mercoa.com/organization/emailLog', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.mercoa.com/organization/emailLog");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercoa.com/organization/emailLog")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```