Data Consolidation

Control how a user's connected providers are combined into canonical daily metrics.

7 min read Updated Sep 18, 2026

When two or more providers report the same metric for the same calendar day, Sonar consolidates their values into one result. Every configurable metric has a catalog default, and each user can override that method or exclude selected providers.

MethodBehavior
maxUses the largest value reported by an enabled provider
avgUses the arithmetic mean of values reported by enabled providers
sumAdds the values reported by enabled providers

The catalog is authoritative. Do not hard-code configurable metric keys or default methods in your application.

Consolidation Catalog

GET /v1/consolidation/catalog

Returns every configurable daily metric and metric group, its default method, and the methods it accepts.

json
{
  "category_order": ["Activity", "Energy", "Body Composition", "Sleep", "Vitals", "Nutrition"],
  "metrics": [
    {
      "key": "steps",
      "display_name": "Steps",
      "category": "Activity",
      "kind": "metric",
      "default_method": "max",
      "allowed_methods": ["avg", "max", "sum"]
    },
    {
      "key": "global_sleep",
      "display_name": "Sleep",
      "category": "Sleep",
      "kind": "group",
      "default_method": "max",
      "allowed_methods": ["avg", "max", "sum"]
    }
  ]
}

A group applies one setting to its related daily metrics. Workout selection is session-based rather than numeric consolidation and is not part of this API.

Retrieve User Configuration

GET /v1/users/{id}/consolidation

Returns the effective configuration after applying catalog defaults and the user’s overrides.

json
{
  "providers": [
    { "provider": "garmin", "enabled": true },
    { "provider": "oura", "enabled": true }
  ],
  "metrics": [
    {
      "key": "steps",
      "category": "Activity",
      "default_method": "max",
      "method": "sum",
      "overridden": true,
      "providers": [
        { "provider": "garmin", "enabled": true },
        { "provider": "oura", "enabled": false }
      ]
    }
  ]
}

The top-level provider state applies to every metric. A provider can also be excluded only for an individual metric. Metric provider state is effective state, so it is false when the provider is disabled either globally or for that metric.

Update User Configuration

PATCH /v1/users/{id}/consolidation

Atomically updates only the supplied settings and returns 202 Accepted.

python
response = requests.patch(
    f"{BASE}/users/{user_id}/consolidation",
    headers=HEADERS,
    json={
        "metrics": {
            "steps": {
                "method": "sum",
                "providers": {"oura": False},
            }
        },
        "providers": {"garmin": True},
    },
)
response.raise_for_status()
typescript
const response = await fetch(`${base}/users/${userId}/consolidation`, {
  method: "PATCH",
  headers,
  body: JSON.stringify({
    metrics: {
      steps: {
        method: "sum",
        providers: { oura: false },
      },
    },
    providers: { garmin: true },
  }),
});
if (!response.ok) throw new Error(await response.text());

Set a metric’s method to null to remove its override and restore the current catalog default. Provider keys must identify providers currently connected to that user.

json
{
  "status": "reconsolidating",
  "configuration": {
    "providers": [],
    "metrics": []
  }
}

status is unchanged when the submitted state already matches the stored configuration.

Updates rebuild historical data

The setting is stored before the response, but existing historical outputs are reconsolidated asynchronously. When the rebuild changes available data, a subsequent subject.synced webhook indicates that refreshed data is available. Multiple changes made close together are coalesced into one rebuild.

Reset to Defaults

DELETE /v1/users/{id}/consolidation

Removes method overrides and provider exclusions and returns 202 Accepted. It does not change connected providers, workout ordering, or unrelated user settings.

Errors

CodeStatusMeaning
invalid_body400The request shape or method is invalid
user_not_found404The user does not exist in the API key’s environment
invalid_metric422The metric key is not present in the consolidation catalog
invalid_method422The method is not allowed for that metric
invalid_provider422The provider is not currently connected to the user