> ## Documentation Index
> Fetch the complete documentation index at: https://api.docs.dealmachine.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Activity

Retrieve the full details of a specific activity record, including the complete original request parameters and the entity IDs that were returned. Use the `activity_id` from [Search Activity](/api-reference/activity/search-activity) results.

## Path Parameters

<ParamField path="activity_id" type="string" required>
  The activity ID to retrieve (e.g., `act_r7s8t9u0`).
</ParamField>

## Query Parameters

<ParamField query="entity_page" type="integer" default={1}>
  Page number for the `entity_ids` array. Since a single search can return thousands of entities,
  the IDs are paginated separately.
</ParamField>

<ParamField query="entity_per_page" type="integer" default={250}>
  Entity IDs per page (min: `1`, max: `250`).
</ParamField>

***

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.v2.dealmachine.com/v1/activity/act_r7s8t9u0" \
    -H "Authorization: Bearer dm_sk_live_xxx"
  ```

  ```bash cURL (with entity pagination) theme={null}
  curl "https://api.v2.dealmachine.com/v1/activity/act_r7s8t9u0?entity_page=2&entity_per_page=250" \
    -H "Authorization: Bearer dm_sk_live_xxx"
  ```

  ```typescript Node.js theme={null}
  const activityId = 'act_r7s8t9u0';
  const response = await fetch(`https://api.v2.dealmachine.com/v1/activity/${activityId}`, {
    headers: {
      Authorization: `Bearer ${apiKey}`,
    },
  });

  const { data } = await response.json();

  console.log(`Activity: ${data.type} on ${data.created_at}`);
  console.log(`Total results: ${data.result_summary.total_results}`);
  console.log(`Credits used: ${data.result_summary.credits_used}`);

  // Entity IDs returned
  for (const id of data.entity_ids.people) {
    console.log(`Person: ${id}`);
  }
  for (const id of data.entity_ids.properties) {
    console.log(`Property: ${id}`);
  }
  ```

  ```python Python theme={null}
  import requests

  activity_id = "act_r7s8t9u0"
  response = requests.get(
      f"https://api.v2.dealmachine.com/v1/activity/{activity_id}",
      headers={"Authorization": f"Bearer {api_key}"},
  )

  data = response.json()["data"]
  print(f"Activity: {data['type']} on {data['created_at']}")
  print(f"Credits used: {data['result_summary']['credits_used']}")

  for person_id in data["entity_ids"]["people"]:
      print(f"Person: {person_id}")
  for property_id in data["entity_ids"]["properties"]:
      print(f"Property: {property_id}")
  ```
</RequestExample>

<ResponseExample>
  ```json 200 Success — Search Activity theme={null}
  {
    "data": {
      "activity_id": "act_r7s8t9u0",
      "type": "search_people",
      "created_at": "2025-06-28T14:22:00Z",
      "api_key_id": "key_def456",
      "api_key_name": "Data warehouse",
      "request": {
        "locations": [{ "type": "state", "code": "TX" }],
        "filters": [
          {
            "filter_id": "estimated_value",
            "operator": "greater_than",
            "value": 500000
          },
          {
            "filter_id": "has_phone",
            "value": true
          }
        ],
        "fields": ["full_name", "phones", "estimated_value"],
        "property_match": "owner",
        "page": 1,
        "per_page": 25,
        "sort": [{ "field_id": "full_name", "direction": "asc" }]
      },
      "result_summary": {
        "total_results": 1250,
        "total_pages": 50,
        "pages_retrieved": 3,
        "credits_used": 75,
        "credits_breakdown": {
          "new_people": 45,
          "new_properties": 22,
          "repeat": 8
        },
        "entity_count": {
          "people": 75,
          "properties": 68
        }
      },
      "entity_ids": {
        "people": ["per_x1y2z3", "per_a4b5c6", "per_d7e8f9", "per_g0h1i2"],
        "properties": ["prop_a1b2c3", "prop_d4e5f6", "prop_g7h8i9"],
        "pagination": {
          "page": 1,
          "per_page": 250,
          "total_people": 75,
          "total_properties": 68,
          "has_next_page": false
        }
      }
    }
  }
  ```

  ```json 200 Success — Enrichment Activity theme={null}
  {
    "data": {
      "activity_id": "act_a1b2c3d4",
      "type": "enrich_email",
      "created_at": "2025-06-25T09:15:00Z",
      "api_key_id": "key_abc123",
      "api_key_name": "Production integration",
      "request": {
        "enrichment_type": "email",
        "items": [
          { "email": "john.smith@example.com" },
          { "email": "sarah.johnson@example.com" },
          { "email": "mike.williams@example.com" }
        ],
        "fields": ["full_name", "phones"],
        "include_properties": true
      },
      "result_summary": {
        "total_results": 42,
        "items_submitted": 50,
        "items_matched": 42,
        "items_unmatched": 8,
        "credits_used": 38,
        "credits_breakdown": {
          "new_people": 35,
          "new_properties": 0,
          "repeat": 7
        },
        "entity_count": {
          "people": 42,
          "properties": 0
        }
      },
      "entity_ids": {
        "people": ["per_x1y2z3", "per_j3k4l5", "per_m6n7o8"],
        "properties": [],
        "pagination": {
          "page": 1,
          "per_page": 250,
          "total_people": 42,
          "total_properties": 0,
          "has_next_page": false
        }
      }
    }
  }
  ```

  ```json 404 Not Found theme={null}
  {
    "error": {
      "code": "not_found",
      "message": "Activity record not found",
      "request_id": "req_abc123def456"
    }
  }
  ```

  ```json 401 Unauthorized theme={null}
  {
    "error": {
      "code": "invalid_api_key",
      "message": "The provided API key is invalid",
      "request_id": "req_def456ghi789"
    }
  }
  ```
</ResponseExample>

## Response Fields

### `data`

The full activity record.

| Field            | Type           | Description                                                             |
| ---------------- | -------------- | ----------------------------------------------------------------------- |
| `activity_id`    | string         | Unique activity identifier                                              |
| `type`           | string         | Activity type. See [Activity Types](/concepts/activity#activity-types). |
| `created_at`     | string         | ISO 8601 timestamp of when the request was made                         |
| `api_key_id`     | string         | Stable identifier for the API key or OAuth token that made the request  |
| `api_key_name`   | string or null | Current API key name. `null` when the key record is unavailable         |
| `request`        | object         | The **complete** original request parameters (see below)                |
| `result_summary` | object         | Full result and credit breakdown (see below)                            |
| `entity_ids`     | object         | Paginated entity IDs returned by this activity (see below)              |

### `request`

The full, unmodified request body that was sent to the original endpoint. This is the complete version of what `request_summary` shows in [Search Activity](/api-reference/activity/search-activity).

**For search types**, this is the exact search request body:

| Field            | Type      | Description                                          |
| ---------------- | --------- | ---------------------------------------------------- |
| `locations`      | array     | Location objects used                                |
| `filters`        | array     | Filter objects with `filter_id`, `operator`, `value` |
| `fields`         | string\[] | Requested field IDs                                  |
| `property_match` | string    | Person-to-property relationship (if set)             |
| `page`           | integer   | Page number requested                                |
| `per_page`       | integer   | Results per page                                     |
| `sort`           | array     | Sort configuration                                   |

**For enrichment types**, this is the enrichment request:

| Field                | Type      | Description                                                                 |
| -------------------- | --------- | --------------------------------------------------------------------------- |
| `enrichment_type`    | string    | The enrichment method                                                       |
| `items`              | array     | The input items submitted (email addresses, phone numbers, addresses, etc.) |
| `fields`             | string\[] | Requested field IDs                                                         |
| `include_properties` | boolean   | Whether properties were included                                            |

<Note>
  The `request` object contains the exact parameters you can copy-paste to re-run the same query.
  For search types, pass it directly to the corresponding search endpoint. For enrichment types,
  wrap the `items` array back into a `data` field.
</Note>

### `result_summary`

| Field                              | Type    | Description                                     |
| ---------------------------------- | ------- | ----------------------------------------------- |
| `total_results`                    | integer | Total matching records                          |
| `total_pages`                      | integer | Total pages available (search types only)       |
| `pages_retrieved`                  | integer | Pages you actually fetched (search types only)  |
| `items_submitted`                  | integer | Items in the request (enrichment types only)    |
| `items_matched`                    | integer | Items that matched (enrichment types only)      |
| `items_unmatched`                  | integer | Items that didn't match (enrichment types only) |
| `credits_used`                     | integer | Total credits consumed                          |
| `credits_breakdown`                | object  | Breakdown of credit charges                     |
| `credits_breakdown.new_people`     | integer | New people accessed (charged)                   |
| `credits_breakdown.new_properties` | integer | New properties accessed (charged)               |
| `credits_breakdown.repeat`         | integer | Previously accessed entities (free)             |
| `entity_count.people`              | integer | Unique people returned                          |
| `entity_count.properties`          | integer | Unique properties returned                      |

### `entity_ids`

The entity IDs that were captured for this activity response. Search activities only include the IDs returned by that specific API response page, so a search originally requested with `per_page: 25` will only have up to 25 entity IDs in its activity detail. When an activity captured more IDs, they are paginated with the `entity_page` and `entity_per_page` query parameters.

| Field                         | Type      | Description                                              |
| ----------------------------- | --------- | -------------------------------------------------------- |
| `people`                      | string\[] | Array of `dm_person_id` values (e.g., `"per_x1y2z3"`)    |
| `properties`                  | string\[] | Array of `dm_property_id` values (e.g., `"prop_a1b2c3"`) |
| `pagination.page`             | integer   | Current entity page                                      |
| `pagination.per_page`         | integer   | Entity IDs per page                                      |
| `pagination.total_people`     | integer   | Total unique people across all pages                     |
| `pagination.total_properties` | integer   | Total unique properties across all pages                 |
| `pagination.has_next_page`    | boolean   | Whether more entity IDs exist                            |

***

## Paginating Entity IDs

A single activity can capture up to the number of records returned by the original request. The `entity_ids` section paginates those captured IDs separately so the activity detail response stays fast.

To retrieve all entity IDs from a large search:

```typescript theme={null}
const activityId = 'act_r7s8t9u0';
const allPeople: string[] = [];
const allProperties: string[] = [];
let page = 1;
let hasMore = true;

while (hasMore) {
  const res = await fetch(
    `https://api.v2.dealmachine.com/v1/activity/${activityId}?entity_page=${page}&entity_per_page=250`,
    { headers: { Authorization: `Bearer ${apiKey}` } }
  );

  const { data } = await res.json();
  allPeople.push(...data.entity_ids.people);
  allProperties.push(...data.entity_ids.properties);
  hasMore = data.entity_ids.pagination.has_next_page;
  page++;
}

console.log(`Total people: ${allPeople.length}`);
console.log(`Total properties: ${allProperties.length}`);
```

***

## Re-Running a Past Search

The `request` object contains everything you need to replay a search:

```typescript theme={null}
// 1. Get the activity detail
const activityRes = await fetch(`https://api.v2.dealmachine.com/v1/activity/${activityId}`, {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const { data: activity } = await activityRes.json();

// 2. Re-run the same search
const searchRes = await fetch('https://api.v2.dealmachine.com/v1/people/search', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(activity.request),
});
```

<Note>
  Re-running a search within the same billing period will not charge credits for entities you've
  already accessed. Check `credits.breakdown.repeat` in the search response to see how many were
  free.
</Note>

***

## Notes

* This endpoint does **not** consume credits.
* Activity is scoped to your organization — you can access activity created by any API key under your account.
* Count activities (`count_people`, `count_properties`) will have empty `entity_ids` since no entity data is returned.
* For enrichment activities, `entity_ids` includes only the entities from matched items.
* The `request.items` array in enrichment activities is capped at the first 100 items in the response. For enrichments with more than 100 items, the full list is available but truncated in this view.
* Activity records are retained for 12 months.
