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

# List Dataset Values

> Paginated cross-campaign view of all submitted values in a dataset

# List Dataset Values

Retrieve a paginated, cross-campaign view of all submitted KPI values in a dataset. Each row is enriched with campaign context, KPI metadata, data owner, organization, and facility names — useful for building aggregate dashboards.

## 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="dataset_id" type="string" required>
  UUID of the dataset
</ParamField>

### Query Parameters

<ParamField query="page" type="integer" default="1">
  Page number (1-based)
</ParamField>

<ParamField query="size" type="integer" default="20">
  Page size (1–100)
</ParamField>

<ParamField query="sort" type="string" default="-submitted_at">
  Sort field. Prefix with `-` for descending.
</ParamField>

## Response

<ResponseField name="items" type="array[object]">
  Value rows enriched with campaign and display context:

  | Field                    | Type   | Description                                         |
  | ------------------------ | ------ | --------------------------------------------------- |
  | `id`                     | string | Value UUID                                          |
  | `campaign_id`            | string | Campaign UUID                                       |
  | `campaign_name`          | string | Campaign display name                               |
  | `campaign_period_start`  | string | Campaign period start (ISO date)                    |
  | `campaign_period_end`    | string | Campaign period end (ISO date)                      |
  | `campaign_assignment_id` | string | Campaign-assignment UUID                            |
  | `assignment_id`          | string | Dataset assignment UUID                             |
  | `kpi_id`                 | string | KPI definition UUID                                 |
  | `kpi_name`               | string | KPI display name                                    |
  | `kpi_unit`               | string | Measurement unit (nullable)                         |
  | `value_numeric`          | number | Numeric answer (nullable)                           |
  | `value_text`             | string | Text answer (nullable)                              |
  | `value_date`             | string | Date answer (nullable)                              |
  | `option_id`              | string | Selected option UUID (nullable)                     |
  | `submitted_at`           | string | ISO 8601 timestamp                                  |
  | `submitter_email`        | string | Who submitted (nullable)                            |
  | `data_owner_email`       | string | Assigned data owner                                 |
  | `organization_name`      | string | Organization name                                   |
  | `facility_name`          | string | Facility name (nullable)                            |
  | `attachments`            | array  | Evidence files (`file_id`, `file_name`, `file_url`) |
</ResponseField>

<ResponseField name="total" type="integer">
  Total number of value rows across all pages
</ResponseField>

<ResponseField name="response_count" type="integer">
  Total number of distinct response submissions
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X GET "https://api.dcycle.io/v1/custom-kpi-datasets/${DATASET_ID}/values?page=1&size=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

  headers = {
      "x-api-key": os.getenv("DCYCLE_API_KEY"),
      "x-organization-id": os.getenv("DCYCLE_ORG_ID"),
  }

  dataset_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"

  response = requests.get(
      f"https://api.dcycle.io/v1/custom-kpi-datasets/{dataset_id}/values",
      headers=headers,
      params={"page": 1, "size": 10, "sort": "-submitted_at"},
  )

  data = response.json()
  print(f"Showing {len(data['items'])}/{data['total']} values ({data['response_count']} submissions)")
  for v in data["items"]:
      print(f"  [{v['campaign_name']}] {v['kpi_name']}: {v['value_numeric']} — {v['data_owner_email']}")
  ```

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

  const headers = {
    'x-api-key': process.env.DCYCLE_API_KEY,
    'x-organization-id': process.env.DCYCLE_ORG_ID,
  };

  const datasetId = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';

  axios.get(`https://api.dcycle.io/v1/custom-kpi-datasets/${datasetId}/values`, {
    headers,
    params: { page: 1, size: 10 },
  })
  .then(response => {
    const { items, total, response_count } = response.data;
    console.log(`${items.length}/${total} values (${response_count} submissions)`);
    items.forEach(v => console.log(`[${v.campaign_name}] ${v.kpi_name}: ${v.value_numeric}`));
  });
  ```
</CodeGroup>

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "items": [
    {
      "id": "e1f2a3b4-c5d6-7890-abcd-ef1234567890",
      "campaign_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "campaign_name": "Q1 2025 Water Survey",
      "campaign_period_start": "2025-01-01",
      "campaign_period_end": "2025-03-31",
      "campaign_assignment_id": "f1a2b3c4-d5e6-7890-abcd-ef1234567890",
      "assignment_id": "d4e5f6a7-b8c9-0123-defa-234567890123",
      "kpi_id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
      "value_numeric": 1250.5,
      "value_text": null,
      "value_date": null,
      "option_id": null,
      "submitted_at": "2025-06-20T14:30:00Z",
      "submitter_email": "supplier@example.com",
      "submitter_user_id": null,
      "kpi_name": "Total water consumption",
      "kpi_unit": "m³",
      "data_owner_email": "supplier@example.com",
      "organization_name": "Acme Corp",
      "facility_name": "Madrid Office",
      "attachments": [
        {
          "file_id": "a1b2c3d4-0000-0000-0000-000000000001",
          "file_name": "water-bill-q1.pdf",
          "file_url": "https://storage.dcycle.io/..."
        }
      ]
    }
  ],
  "total": 24,
  "response_count": 8
}
```

## 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 dataset 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="Campaign Values" icon="filter" href="/api-reference/custom-kpi/list-campaign-values">
    View values scoped to a single campaign
  </Card>

  <Card title="Submit Response" icon="paper-plane" href="/api-reference/custom-kpi/submit-response">
    Submit new KPI values
  </Card>
</CardGroup>
