> ## Documentation index
> Fetch the complete documentation index at: https://docs.prescientai.com/llms.txt
> Use this file to discover all available pages before exploring further. Add `.md` to any page URL to get that page as Markdown.

# modeledMetrics

> Reference for the modeledMetrics query of the Prescient GraphQL API, with its arguments, its return type, and an example request.

```graphql
# Query
modeledMetrics(after: BigInt, campaignIds: [String!], endDate: ISO8601Date, processDate: ISO8601Date, salesChannel: [SalesChannelEnum!], startDate: ISO8601Date): ModeledMetricQuery!
```

Get modeled metrics for a given date range. We recommend pulling data updates once per day. Results will be paginated, so implementations should handle making multiple calls using the `after` argument.

## Arguments

Each argument is optional unless the list marks it as required.

| Argument       | Type                  | Required | Description                                                                                                                                                                      |
| -------------- | --------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `after`        | `BigInt`              | Optional | The cursor to indicate where the pagination should begin. Value comes from the `pageInfo>endCursor` field in the previous response.                                              |
| `campaignIds`  | `[String!]`           | Optional | Filter by campaign ids. These correspond to the ids of your campaigns in their respective source channels.                                                                       |
| `endDate`      | `ISO8601Date`         | Optional | End date for the reporting records. Defaults to today.                                                                                                                           |
| `processDate`  | `ISO8601Date`         | Optional | Filters out any records that have not been created or updated since this date. We recommend using this field in all implementations to avoid pulling large, unchanged data sets. |
| `salesChannel` | `[SalesChannelEnum!]` | Optional | Sales channels to filter modeled output by. When omitted, returns both ECOMMERCE and RETAIL.                                                                                     |
| `startDate`    | `ISO8601Date`         | Optional | Start date for the reporting records. Defaults to 30 days ago.                                                                                                                   |

## Returns

The query returns [`ModeledMetricQuery`](https://docs.prescientai.com/api/types#modeledmetricquery), written as `ModeledMetricQuery!` in the schema. The type has these fields.

| Field      | Type                   | Nullable | Description                                  |
| ---------- | ---------------------- | -------- | -------------------------------------------- |
| `data`     | `[ModeledMetricRow!]!` | No       | The array containing the modeled metric rows |
| `pageInfo` | `PageInfo!`            | No       | Pagination info for the query                |

## Example request

Send the query in the `query` field of the request body, and the variables in the `variables` field.

```graphql title="Query"
query modeledMetrics(
  $after: BigInt
  $campaignIds: [String!]
  $endDate: ISO8601Date
  $processDate: ISO8601Date
  $salesChannel: [SalesChannelEnum!]
  $startDate: ISO8601Date
) {
  modeledMetrics(
    after: $after
    campaignIds: $campaignIds
    endDate: $endDate
    processDate: $processDate
    salesChannel: $salesChannel
    startDate: $startDate
  ) {
    data {
      metricName
      metricValue
      processDate
      reportedDate
      sourceCampaignId
      sourceCampaignName
      sourceCampaignTactic
      sourceChannelName
      target
      targetChannelName
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
}
```

```json title="Variables"
{
  "after": null,
  "campaignIds": [
    "1234567890"
  ],
  "endDate": "2026-01-31",
  "processDate": "2026-01-15",
  "salesChannel": [
    "ECOMMERCE"
  ],
  "startDate": "2026-01-01"
}
```

## Example response

The values in this response are examples. They are not real data.

```json title="Response"
{
  "data": {
    "modeledMetrics": {
      "data": [
        {
          "metricName": "FIRST_ORDER_REVENUE",
          "metricValue": 1250.5,
          "processDate": "2026-01-15T06:00:00Z",
          "reportedDate": "2026-01-14",
          "sourceCampaignId": "1234567890",
          "sourceCampaignName": "Example campaign",
          "sourceCampaignTactic": "Example tactic",
          "sourceChannelName": "EXAMPLE_CHANNEL",
          "target": "example_revenue",
          "targetChannelName": null
        }
      ],
      "pageInfo": {
        "endCursor": "5000",
        "hasNextPage": true
      }
    }
  }
}
```
