> ## 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 Campaign Values

> Paginated view of all submitted values across every recipient in a campaign

# List Campaign Values

Retrieve a paginated, cross-recipient view of all submitted KPI values in a campaign. Each row is enriched with the KPI name, data owner email, organization, and facility.

## 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 parent dataset
</ParamField>

<ParamField path="campaign_id" type="string" required>
  UUID of the campaign
</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 display context:

  | Field               | Type   | Description                 |
  | ------------------- | ------ | --------------------------- |
  | `id`                | string | Value 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)   |
  | `submitted_at`      | string | ISO 8601 timestamp          |
  | `submitter_email`   | string | Who submitted               |
  | `data_owner_email`  | string | Assigned data owner         |
  | `organization_name` | string | Organization name           |
  | `facility_name`     | string | Facility name (nullable)    |
</ResponseField>

<ResponseField name="total" type="integer">
  Total number of value rows across all pages
</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}/campaigns/${CAMPAIGN_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"
  campaign_id = "b2c3d4e5-f6a7-8901-bcde-f12345678901"

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

  data = response.json()
  print(f"Showing {len(data['items'])}/{data['total']} values")
  for v in data["items"]:
      print(f"  {v['kpi_name']}: {v['value_numeric']} {v.get('kpi_unit', '')} — {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';
  const campaignId = 'b2c3d4e5-f6a7-8901-bcde-f12345678901';

  axios.get(`https://api.dcycle.io/v1/custom-kpi-datasets/${datasetId}/campaigns/${campaignId}/values`, {
    headers,
    params: { page: 1, size: 10 },
  })
  .then(response => {
    console.log(`Total: ${response.data.total}`);
    response.data.items.forEach(v => console.log(`${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_assignment_id": "f1a2b3c4-d5e6-7890-abcd-ef1234567890",
      "assignment_id": "d4e5f6a7-b8c9-0123-defa-234567890123",
      "response_set_id": null,
      "kpi_id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
      "value_numeric": 1250.5,
      "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"
    },
    {
      "id": "a2b3c4d5-e6f7-8901-bcde-f23456789012",
      "campaign_assignment_id": "f1a2b3c4-d5e6-7890-abcd-ef1234567890",
      "assignment_id": "d4e5f6a7-b8c9-0123-defa-234567890123",
      "response_set_id": null,
      "kpi_id": "d4e5f6a7-b8c9-0123-defa-234567890124",
      "value_numeric": 85.0,
      "submitted_at": "2025-06-20T14:30:00Z",
      "submitter_email": "supplier@example.com",
      "submitter_user_id": null,
      "kpi_name": "Recycled water percentage",
      "kpi_unit": "%",
      "data_owner_email": "supplier@example.com",
      "organization_name": "Acme Corp",
      "facility_name": "Madrid Office"
    }
  ],
  "total": 12
}
```

## 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 or campaign 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="Get Assignment Values" icon="user" href="/api-reference/custom-kpi/get-assignment-values">
    View one recipient's values
  </Card>

  <Card title="Edit Values" icon="pencil" href="/api-reference/custom-kpi/edit-assignment-values">
    Submit or update values
  </Card>
</CardGroup>
