# Return a message's opens and clicks

> **GET** `https://api.us.nylas.com/v3/activity/tracking/messages/{message_id}`

Source: https://developer.nylas.com/docs/reference/api/tracking-events/get-message-tracking-events/

Returns engagement for one message: how many times it was opened, when it was first and last
opened, and how many clicks each link got. Opens and clicks are counted per message, not per
recipient. Covers messages sent in the last 90 days.

**Authentication:** NYLAS_API_KEY

## Parameters

### Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `message_id` | string, maxLength: 512 | Yes | The ID of the message. For an Agent Account send, this is the message ID the send returned. For a transactional send, it's the message's `Message-ID` header, such as `<0100019a1b2c3d4e@mail.example.com>`. Percent-encode it in the path: `%3C0100019a1b2c3d4e%40mail.example.com%3E`. |

## Responses

### 200 - Success. Returns the message's opens and clicks.

- `request_id` (string) - The request ID.
- `data` (object) - Opens and link clicks for one message.
  - `message_id` (string) - The ID of the message.
  - `thread_id` (string) - The Agent Account thread the message belongs to. Empty for a transactional send.
  - `grant_id` (string) - The Agent Account grant that sent the message. Empty for a transactional send.
  - `from` (string) - The email address the message was sent from.
  - `sending_domain` (string) - The domain the message was sent from.
  - `label` (string) - The `tracking_options.label` you set when you sent the message.
  - `tracking` (object) - Which kinds of tracking were turned on when the message was sent.
    - `opens` (boolean) - Whether open tracking was on.
    - `links` (boolean) - Whether link click tracking was on.
  - `opens` (object) - Opens of the message. Opens are counted per message, not per recipient.
    - `total` (integer) - The number of opens, including repeat opens.
    - `first_at` (integer, nullable, format: int64) - When the message was first opened, as a Unix timestamp in seconds. `null` if it hasn't been opened.
    - `last_at` (integer, nullable, format: int64) - When the message was last opened, as a Unix timestamp in seconds. `null` if it hasn't been opened.
  - `clicks` (object) - Link clicks in the message.
    - `total` (integer) - The number of clicks on any link, including repeat clicks.
    - `first_at` (integer, nullable, format: int64) - When a link was first clicked, as a Unix timestamp in seconds. `null` if no link has been clicked.
    - `last_at` (integer, nullable, format: int64) - When a link was last clicked, as a Unix timestamp in seconds. `null` if no link has been clicked.
    - `links` (array) - Clicks per link, in the order the links appear in the message.
      - `link_index` (integer) - The position of the link in the message, starting at 0.
      - `url` (string) - The link.
      - `clicks` (integer) - The number of clicks on the link.
  - `events` (array) - The 100 most recent opens and clicks, newest first. The totals count every open and click.
    - `id` (string) - The ID of the event.
    - `event_type` (string, one of: `opened`, `link_clicked`) - Whether the message was opened or a link was clicked.
    - `timestamp` (integer, format: int64) - When the open or click happened, as a Unix timestamp in seconds.
    - `is_first` (boolean) - `true` for the first open, or the first click, recorded for the message.
    - `url` (string) - For a click, the link that was clicked.
    - `link_index` (integer) - For a click, the position of the link in the message, starting at 0.
    - `ip` (string) - The IP address the open or click came from. Can be a comma-separated list when the request passed through proxies.
    - `user_agent` (string) - The user agent of the client.

### 401 - Unauthorized

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 403 - Forbidden. These endpoints need your application's API key, not a grant access token.

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

### 404 - Not found. Nylas has no tracking activity for this ID in the last 90 days.

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

## Code samples

### cURL

```bash
curl --request GET \
  --url "https://api.us.nylas.com/v3/activity/tracking/messages/<MESSAGE_ID>" \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <NYLAS_API_KEY>'
```
