This method returns a list of recent events across all your projects. By default it returns events from the last 7 days, and you can choose a different window with the `range` parameter. Optionally include deployment statistics.

**Tip**: You can explore and test this endpoint interactively using our [OpenAPI documentation](https://api.deployhq.com/docs).

## URL

```text
/activity
```

## HTTP Method

```text
GET
```

## Supported Parameters

- **range** (optional) - The window of events to return. One of `today`, `last_7_days`, `last_30_days`, or `this_week`. Defaults to `last_7_days`. Unrecognised values fall back to the default.
- **include** (optional) - Set to `stats` to include deployment statistics alongside the events

## Example cURL Request

```shell
curl -H "Content-type: application/json" \
-H "Accept: application/json" \
--user your-email@example.com:your-api-key \
https://test.deployhq.com/activity
```

## Example Response

```json
[
    {
        "event": "deploy_completed",
        "properties": {
            "end_ref": "abc123def456",
            "servers": ["production"]
        },
        "project": {
            "name": "My App",
            "permalink": "my-app",
            "identifier": "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
        },
        "user": "Jane Doe",
        "created_at": "2026-03-30T14:22:00Z"
    }
]
```

## Including Deployment Statistics

Add `?include=stats` to also receive deployment statistics. The statistics always cover the current week, regardless of the `range` you choose for the event list:

```shell
curl -H "Content-type: application/json" \
-H "Accept: application/json" \
--user your-email@example.com:your-api-key \
https://test.deployhq.com/activity?include=stats
```

When stats are included, the response wraps events in an object:

```json
{
    "events": [
        {
            "event": "deploy_completed",
            "properties": {
                "end_ref": "abc123def456",
                "servers": ["production"]
            },
            "project": {
                "name": "My App",
                "permalink": "my-app",
                "identifier": "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
            },
            "user": "Jane Doe",
            "created_at": "2026-03-30T14:22:00Z"
        }
    ],
    "stats": {
        "total_deployments": 12,
        "total_deployments_delta": 3,
        "success_rate": 91.7,
        "success_rate_delta": -2.1,
        "avg_duration": "2m 34s",
        "active_servers": 8
    }
}
```

## Response Fields

### Event fields

- **event** - The event type (e.g. `deploy_completed`, `deploy_failed`)
- **properties** - Event-specific metadata (e.g. `end_ref`, `servers`)
- **project** - The associated project with `name`, `permalink`, and `identifier`
- **user** - Name of the user who triggered the event
- **created_at** - ISO 8601 timestamp of when the event occurred

### Stats fields (when `?include=stats` is used)

- **total_deployments** - Number of deployments this week
- **total_deployments_delta** - Change compared to last week
- **success_rate** - Percentage of successful deployments (null if no deployments)
- **success_rate_delta** - Change in success rate compared to last week
- **avg_duration** - Average deployment duration as a human-readable string
- **active_servers** - Number of currently enabled servers

Events are ordered by most recent first. The response is limited to the latest 100 events within the selected range, so a wider range such as `last_30_days` returns the 100 most recent events from that window.
