---
title: "Replace resource results for an insight"
method: POST
path: "/insights/v1/results/source/{sourceID}/insight/{insightKey}/resource-results"
tags: ["Insights"]
---

# Replace resource results for an insight

`POST /insights/v1/results/source/{sourceID}/insight/{insightKey}/resource-results`

Replaces all resource results for the specified insight. Any existing unresolved resource results not present in the new set will be removed. The response includes server-computed fields (severity, resolved, enhancement) for each resource result. To delete all resource results, send an empty array.

## Path parameters

- `sourceID` 'public-api', required
- `insightKey` string, required

## Query parameters

- `maxResults` integer

## Request body

- CreateResourceResultsBody — Request body for creating or replacing resource results for an insight.
  - `resourceResults` ResourceResultRequest[], required — A list of resource-level results for creating or updating an insight.
    - `resourceId` string, required — The cloud resource identifier.
    - `resourceType` string — What the resource actually is, e.g. for an EC2 resource ID, this field would be `instance`. Immutable after creation — updates to this field are silently ignored.
    - `cloudProvider` string, required — The cloud provider associated with the resource.
    - `account` string, required — The cloud account or project ID containing this resource. Immutable after creation — updates to this field are silently ignored.
    - `location` string — Represents the region/zone of the resource in AWS, or equivalent for other providers. Immutable after creation — updates to this field are silently ignored.
    - `externalId` string — the external ID of the resource in the provider's system for the resource
    - `externalUrl` string — the URL to the resource-level issue in the provider's system
    - `metadata` object — contains any additional information for the resource results
    - `resultType` 'security_risk' | 'potential_daily_savings' | 'potential_daily_savings_with_recommendation' | 'potential_daily_savings_with_cluster_agent', required — The discriminator property that determines which fields are populated in the 'result' object.
    - `result` object — The result data for this resource. Which fields are populated depends on the resultType. For security_risk: critical, high, medium, low. For potential_daily_savings: value. For potential_daily_savings_with_recommendation: value, current, recommendation. For potential_daily_savings_with_cluster_agent: value, agentInstalled.
      - `value` number, double — the daily saving amount for this result
      - `critical` integer — number of critical security risks
      - `high` integer — number of high security risks
      - `medium` integer — number of medium security risks
      - `low` integer — number of low security risks
      - `current` string — the current state (i.e. current instance type)
      - `recommendation` string — the recommended state (i.e. recommended instance type)
      - `agentInstalled` boolean — true if the agent is installed

## Response `200`

Resource results created/replaced successfully

- ResourceResultsResponse
  - `resourceResults` ResourceResult[], required
    - `resourceId` string, required — The cloud resource identifier.
    - `resourceType` string — What the resource actually is, eg. for an EC2 resource ID, this field would be `instance`
    - `cloudProvider` string, required — The cloud provider associated with the resource.
    - `account` string, required — The cloud account or project ID containing this resource.
    - `location` string — represents the region/zone of the resource in AWS, or equivalent for other providers
    - `resolved` boolean — Whether this resource-level issue has been resolved. Computed server-side.
    - `severity` 'critical' | 'high' | 'medium' | 'low' — The severity level of the finding. Computed server-side from the security risk counts.
    - `externalId` string — the external ID of the resource in the provider's system for the resource
    - `externalUrl` string — the URL to the resource-level issue in the provider's system
    - `metadata` object — contains any additional information for the resource results
    - `enhancement` ResourceResultEnhancement — DoiT-managed metadata associated with a resource result.
      - `tags` string[] — Tags assigned to this resource result.
      - `priority` object — Priority information for this resource result.
        - `value` string — The priority level (e.g. Low, Medium, High).
        - `priorityScore` number, double — Numeric priority score.
      - `lastUpdatedBy` string — The user who last updated this enhancement.
      - `lastUpdatedAt` string, date-time — Timestamp of the last update.
    - `resultType` 'security_risk' | 'potential_daily_savings' | 'potential_daily_savings_with_recommendation' | 'potential_daily_savings_with_cluster_agent', required — The discriminator property that determines which fields are populated in the 'result' object.
    - `result` object — The result data for this resource. Which fields are populated depends on the resultType. For security_risk: critical, high, medium, low. For potential_daily_savings: value. For potential_daily_savings_with_recommendation: value, current, recommendation. For potential_daily_savings_with_cluster_agent: value, agentInstalled.
      - `value` number, double — the daily saving amount for this result
      - `critical` integer — number of critical security risks
      - `high` integer — number of high security risks
      - `medium` integer — number of medium security risks
      - `low` integer — number of low security risks
      - `current` string — the current state (i.e. current instance type)
      - `recommendation` string — the recommended state (i.e. recommended instance type)
      - `agentInstalled` boolean — true if the agent is installed
  - `pageToken` string
  - `rowCount` integer, required

## Other responses

- `400` — Bad Request - The server cannot process the request, often due to a malformed request.
- `401` — Unauthorized - Invalid API key.
- `403` — Forbidden - The client is not authorized to perform the request.
- `404` — Not Found - The requested resource does not exist.
- `500` — Internal Server Error - Something went wrong with the DoiT API server.

---

[API](https://skmtc.dev/doit/apis/doit-cloud-intelligence.md) · [All operations](https://skmtc.dev/doit/apis/doit-cloud-intelligence/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/doit/doit-cloud-intelligence/revisions/9416402fc119/schema)
