> 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.

# Events

GET https://api.mercoa.com/entity/{entityId}/events

Get all events for an entity

Reference: https://docs.mercoa.com/embedded-ap-ar/api-reference/entity/events

## Authentication

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

## Request

### Path parameters

- `entityId` (string, required) — Entity ID or Entity ForeignID

### Query parameters

- `startDate` (datetime, optional) — Start date filter. If not provided, events from the start of time will be returned.
- `endDate` (datetime, optional) — End date filter. If not provided, events to the end of time will be returned.
- `limit` (integer, optional) — Number of events to return. Limit can range between 1 and 100, and the default is 50.
- `startingAfter` (string, optional) — The ID of the event to start after. If not provided, the first page of events will be returned.

## Response

### 200

- `data` (list of object, required)
  - `id` (string, required) — The ID of the event
  - `data` (object, required) — The payment method data at the time of the event
    - `id` (string, required)
    - `name` (string, required)
    - `email` (string, required)
    - `isCustomer` (boolean, required) — True if this entity has a direct relationship with your organization.
    - `accountType` (enum, required)
      - Allowed values: `business`, `individual`
    - `profile` (object, required)
      - `business` (object, optional) — Will be set if the entity is a business
        - `legalBusinessName` (string, required)
        - `taxIDProvided` (boolean, required)
        - `email` (string, optional)
        - `businessType` (enum, optional)
          - Allowed values: `soleProprietorship`, `unincorporatedAssociation`, `trust`, `publicCorporation`, `privateCorporation`, `llc`, `partnership`, `unincorporatedNonProfit`, `incorporatedNonProfit`
        - `phone` (object, optional)
          - `countryCode` (string, required)
          - `number` (string, required)
        - `doingBusinessAs` (string, optional)
        - `website` (string, optional)
        - `description` (string, optional)
        - `address` (object, optional)
          - `addressLine1` (string, required)
          - `city` (string, required)
          - `stateOrProvince` (string, required) — State or province code. Must be in the format XX.
          - `postalCode` (string, required) — Postal code. Must be in the format XXXXX or XXXXX-XXXX.
          - `addressLine2` (string, optional)
          - `country` (string, optional)
        - `ownersProvided` (boolean, optional) — True if all representatives have been provided for this business.
        - `taxId` (object, optional)
          - `ein` (object, required)
            - `number` (string, required) — Must be in the format XX-XXXXXXX.
        - `formationDate` (datetime, optional)
        - `industryCodes` (object, optional)
          - `mcc` (string, optional)
        - `averageMonthlyTransactionVolume` (double, optional)
        - `averageTransactionSize` (double, optional)
        - `maxTransactionSize` (double, optional)
      - `individual` (object, optional) — Will be set if the entity is a individual
        - `name` (object, required)
          - `firstName` (string, required)
          - `lastName` (string, required)
          - `middleName` (string, optional)
          - `suffix` (string, optional)
        - `birthDateProvided` (boolean, required)
        - `governmentIDProvided` (boolean, required)
        - `email` (string, optional)
        - `phone` (object, optional)
          - `countryCode` (string, required)
          - `number` (string, required)
        - `address` (object, optional)
          - `addressLine1` (string, required)
          - `city` (string, required)
          - `stateOrProvince` (string, required) — State or province code. Must be in the format XX.
          - `postalCode` (string, required) — Postal code. Must be in the format XXXXX or XXXXX-XXXX.
          - `addressLine2` (string, optional)
          - `country` (string, optional)
    - `status` (enum, required)
      - Allowed values: `unverified`, `pending`, `resubmit`, `review`, `verified`, `failed`
    - `acceptedTos` (boolean, required) — True if this entity has accepted the terms of service.
    - `isPayor` (boolean, required) — True if this entity can pay invoices.
    - `isPayee` (boolean, required) — True if this entity can receive payments.
    - `isNetworkPayor` (boolean, required) — True if this entity is available as a payor to any entity on your platform. Otherwise this entity will only be available as a payor to entities that have a direct relationship with this entity.
    - `isNetworkPayee` (boolean, required) — True if this entity is available as a payee to any entity on your platform. Otherwise this entity will only be available as a payee to entities that have a direct relationship with this entity.
    - `createdAt` (datetime, required)
    - `updatedAt` (datetime, required)
    - `foreignId` (string, optional) — The ID used to identify this entity in your system
    - `emailTo` (string, optional) — Local-part/username of the email address to which to send invoices to be added to the Invoice Inbox.
    - `emailToAlias` (list of string, optional) — Email inbox alias addresses. Used when forwarding emails to the emailTo address from an alias.
    - `logo` (string, optional) — URL for the entity logo
    - `oatfiStatus` (string, optional) — The OatFi status of this entity
    - `oatfiUnderwritingResponse` (map from string to string, optional) — The OatFi underwriting response of this entity
    - `metadata` (map from string to string, optional) — Simple key/value metadata associated with this entity. For more complex metadata, use the Metadata API.
  - `webhookIds` (list of string, required) — The list of webhook IDs associated with this event
  - `createdAt` (datetime, required) — The timestamp when the event was created
  - `userId` (string, optional) — The ID of the user who triggered the event
  - `updatedByEntityId` (string, optional) — The ID of the entity that updated the payment method
- `count` (integer, required)
- `hasMore` (boolean, required)

## 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
{
  "data": [
    {
      "id": "evt_a0f6ea94-0761-4a5e-a416-3c453cb7eced",
      "data": {
        "id": "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
        "name": "Acme Inc.",
        "email": "customer@acme.com",
        "isCustomer": true,
        "accountType": "business",
        "profile": {
          "business": {
            "legalBusinessName": "Acme Inc.",
            "taxIDProvided": true,
            "email": "customer@acme.com",
            "businessType": "llc",
            "phone": {
              "countryCode": "1",
              "number": "4155551234"
            },
            "address": {
              "addressLine1": "123 Main St",
              "city": "San Francisco",
              "stateOrProvince": "CA",
              "postalCode": "94105",
              "addressLine2": "Unit 1",
              "country": "US"
            },
            "ownersProvided": true,
            "taxId": {
              "ein": {
                "number": "12-3456789"
              }
            }
          }
        },
        "status": "verified",
        "acceptedTos": true,
        "isPayor": true,
        "isPayee": false,
        "isNetworkPayor": false,
        "isNetworkPayee": false,
        "createdAt": "2024-01-01T00:00:00Z",
        "updatedAt": "2024-01-02T00:00:00Z",
        "foreignId": "MY-DB-ID-12345"
      },
      "webhookIds": [
        "webhook_12345"
      ],
      "createdAt": "2024-01-01T00:00:00.000Z",
      "userId": "user_e24fc81c-c5ee-47e8-af42-4fe29d895506"
    }
  ],
  "count": 1,
  "hasMore": false
}
```

**SDK Code**

```python Default
import requests

url = "https://api.mercoa.com/entity/ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced/events"

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

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

print(response.json())
```

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

const client = new MercoaClient({ token: "YOUR_TOKEN" });
await client.entity.events("ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced");

```

```go Default
package main

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

func main() {

	url := "https://api.mercoa.com/entity/ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced/events"

	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 Default
require 'uri'
require 'net/http'

url = URI("https://api.mercoa.com/entity/ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced/events")

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 Default
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.mercoa.com/entity/ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced/events")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.mercoa.com/entity/ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced/events', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Default
using RestSharp;

var client = new RestClient("https://api.mercoa.com/entity/ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced/events");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Default
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercoa.com/entity/ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced/events")! 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()
```