> ## Documentation Index
> Fetch the complete documentation index at: https://code.dcycle.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Recent Activities

> Get the most recent activity feed for a project

# Recent Activities

Get the most recent activities for a project. Aggregates task changes, task comments, output-data value updates, and output-data comments — sorted by most recent first.

## Request

### Headers

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication

  **Example:** `sk_live_1234567890abcdef`
</ParamField>

<ParamField header="x-organization-id" type="string" required>
  Your organization UUID

  **Example:** `a8315ef3-dd50-43f8-b7ce-d839e68d51fa`
</ParamField>

### Path Parameters

<ParamField path="project_id" type="string" required>
  UUID of the project
</ParamField>

### Query Parameters

<ParamField query="limit" type="integer" default="4">
  Maximum number of activities to return (1–50)
</ParamField>

## Response

Returns an array of activity objects.

<ResponseField name="activity_type" type="string">
  Type of activity: `task`, `task_comment`, `output_data`, `output_data_comment`
</ResponseField>

<ResponseField name="entity_id" type="string">
  UUID of the entity that was changed
</ResponseField>

<ResponseField name="parent_entity_id" type="string | null">
  UUID of the parent entity (e.g., task ID for a task comment)
</ResponseField>

<ResponseField name="subject" type="string | null">
  Short description of what changed
</ResponseField>

<ResponseField name="context" type="string | null">
  Additional context (e.g., comment text, field value)
</ResponseField>

<ResponseField name="created_at" type="datetime">
  When the activity occurred (ISO 8601)
</ResponseField>

<ResponseField name="actor" type="object | null">
  User who performed the action, with `id`, `first_name`, `last_name`, `profile_img_url`
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl "https://api.dcycle.io/v1/projects/${PROJECT_ID}/recent-activities?limit=10" \
    -H "x-api-key: ${DCYCLE_API_KEY}" \
    -H "x-organization-id: ${DCYCLE_ORG_ID}"
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests
  import os

  response = requests.get(
      f"https://api.dcycle.io/v1/projects/{os.getenv('PROJECT_ID')}/recent-activities",
      headers={
          "x-api-key": os.getenv("DCYCLE_API_KEY"),
          "x-organization-id": os.getenv("DCYCLE_ORG_ID"),
      },
      params={"limit": 10},
  )

  for activity in response.json():
      actor = activity.get("actor") or {}
      name = f"{actor.get('first_name', '')} {actor.get('last_name', '')}".strip() or "System"
      print(f"[{activity['activity_type']}] {name}: {activity.get('subject', '')}")
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const axios = require('axios');

  const { data: activities } = await axios.get(
    `https://api.dcycle.io/v1/projects/${process.env.PROJECT_ID}/recent-activities`,
    {
      headers: {
        'x-api-key': process.env.DCYCLE_API_KEY,
        'x-organization-id': process.env.DCYCLE_ORG_ID,
      },
      params: { limit: 10 },
    }
  );

  activities.forEach(a => {
    const name = a.actor ? `${a.actor.first_name} ${a.actor.last_name}` : 'System';
    console.log(`[${a.activity_type}] ${name}: ${a.subject}`);
  });
  ```
</CodeGroup>

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
[
  {
    "activity_type": "task",
    "entity_id": "task-uuid",
    "parent_entity_id": null,
    "subject": "Upload fleet data",
    "context": "Stage changed to completed",
    "created_at": "2025-06-15T14:30:00Z",
    "actor": {
      "id": "user-uuid",
      "first_name": "Ana",
      "last_name": "García",
      "profile_img_url": "https://..."
    }
  },
  {
    "activity_type": "task_comment",
    "entity_id": "comment-uuid",
    "parent_entity_id": "task-uuid",
    "subject": "Upload fleet data",
    "context": "All vehicle records uploaded for Q1",
    "created_at": "2025-06-15T14:25:00Z",
    "actor": {
      "id": "user-uuid",
      "first_name": "Ana",
      "last_name": "García",
      "profile_img_url": null
    }
  }
]
```

## Common Errors

### 401 Unauthorized

**Cause:** Missing or invalid API key

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}
```

### 403 Forbidden

**Cause:** The authenticated user is not a member of the organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}
```

### 404 Not Found

**Cause:** The project does not exist or belongs to another organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Not Found"}
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="List Project Tasks" icon="list-check" href="/api-reference/projects/project-tasks">
    List all tasks in a project
  </Card>

  <Card title="Get Project" icon="folder" href="/api-reference/projects/get">
    Get project details
  </Card>
</CardGroup>
