---
updatedAt: 2026-07-22T13:02:35.000Z
agentTools:
  projectIndex: https://developer.doit.com/llms.txt
---

# Replace resource results for an insight

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.


# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "DoiT Cloud Intelligence",
    "description": "Programmatic access to DoiT Platform",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api.doit.com"
    }
  ],
  "security": [
    {
      "api_key": []
    },
    {
      "tenantId": [],
      "api_key": []
    }
  ],
  "tags": [
    {
      "name": "Insights",
      "description": "Manage cloud insights representing recommendations and findings for cloud resources."
    }
  ],
  "paths": {
    "/insights/v1/results/source/{sourceID}/insight/{insightKey}/resource-results": {
      "post": {
        "tags": [
          "Insights"
        ],
        "summary": "Replace resource results for an insight",
        "description": "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.\n",
        "operationId": "postInsightResourceResults",
        "x-cli-name": "replace-insight-resource-results",
        "x-cli-aliases": [
          "post-insight-resource-results"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "sourceID",
            "description": "Only insights created via the public API can be managed. Currently only \"public-api\" is supported.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "public-api"
              ]
            }
          },
          {
            "in": "path",
            "name": "insightKey",
            "description": "The unique key identifying the insight.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "maxResults",
            "description": "Maximum number of results per page in the response (default 1000, max 5000).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5000,
              "default": 1000
            },
            "required": false
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateResourceResultsBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resource results created/replaced successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResourceResultsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CreateResourceResultsBody": {
        "type": "object",
        "description": "Request body for creating or replacing resource results for an insight.",
        "required": [
          "resourceResults"
        ],
        "properties": {
          "resourceResults": {
            "$ref": "#/components/schemas/ResourceResults"
          }
        }
      },
      "ResourceResults": {
        "type": "array",
        "description": "A list of resource-level results for creating or updating an insight.",
        "items": {
          "$ref": "#/components/schemas/ResourceResultRequest"
        }
      },
      "ResourceResultRequest": {
        "type": "object",
        "description": "A single resource-level result for creating or updating an insight. Server-computed fields (severity, resolved, enhancement) are not accepted here and will be ignored. Identity fields (resourceId, resultType, account, cloudProvider) form the composite key. The fields location and resource_type are set on creation only — any values provided for these fields during subsequent upserts are silently ignored.\n",
        "required": [
          "resourceId",
          "resultType",
          "account",
          "cloudProvider"
        ],
        "properties": {
          "resourceId": {
            "type": "string",
            "description": "The cloud resource identifier."
          },
          "resourceType": {
            "description": "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.\n",
            "type": "string",
            "example": "instance, disk, cache"
          },
          "cloudProvider": {
            "description": "Immutable after creation — updates to this field are silently ignored.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CloudProvider"
              }
            ]
          },
          "account": {
            "type": "string",
            "description": "The cloud account or project ID containing this resource. Immutable after creation — updates to this field are silently ignored."
          },
          "location": {
            "type": "string",
            "description": "Represents the region/zone of the resource in AWS, or equivalent for other providers. Immutable after creation — updates to this field are silently ignored.\n",
            "example": "eu-west-2"
          },
          "externalId": {
            "type": "string",
            "description": "the external ID of the resource in the provider's system for the resource"
          },
          "externalUrl": {
            "type": "string",
            "description": "the URL to the resource-level issue in the provider's system"
          },
          "metadata": {
            "type": "object",
            "description": "contains any additional information for the resource results"
          },
          "resultType": {
            "type": "string",
            "enum": [
              "security_risk",
              "potential_daily_savings",
              "potential_daily_savings_with_recommendation",
              "potential_daily_savings_with_cluster_agent"
            ],
            "description": "The discriminator property that determines which fields are populated in the 'result' object."
          },
          "result": {
            "description": "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.\n",
            "type": "object",
            "properties": {
              "value": {
                "type": "number",
                "format": "double",
                "description": "the daily saving amount for this result"
              },
              "critical": {
                "type": "integer",
                "description": "number of critical security risks"
              },
              "high": {
                "type": "integer",
                "description": "number of high security risks"
              },
              "medium": {
                "type": "integer",
                "description": "number of medium security risks"
              },
              "low": {
                "type": "integer",
                "description": "number of low security risks"
              },
              "current": {
                "type": "string",
                "description": "the current state (i.e. current instance type)"
              },
              "recommendation": {
                "type": "string",
                "description": "the recommended state (i.e. recommended instance type)"
              },
              "agentInstalled": {
                "type": "boolean",
                "description": "true if the agent is installed"
              }
            }
          }
        }
      },
      "ResourceResult": {
        "type": "object",
        "description": "A single resource-level result within an insight, as returned in API responses.",
        "required": [
          "resourceId",
          "resultType",
          "account",
          "cloudProvider"
        ],
        "properties": {
          "resourceId": {
            "description": "The cloud resource identifier.",
            "type": "string"
          },
          "resourceType": {
            "description": "What the resource actually is, eg. for an EC2 resource ID, this field would be `instance`",
            "type": "string",
            "example": "instance, disk, cache"
          },
          "cloudProvider": {
            "$ref": "#/components/schemas/CloudProvider"
          },
          "account": {
            "type": "string",
            "description": "The cloud account or project ID containing this resource."
          },
          "location": {
            "type": "string",
            "description": "represents the region/zone of the resource in AWS, or equivalent for other providers",
            "example": "eu-west-2"
          },
          "resolved": {
            "type": "boolean",
            "description": "Whether this resource-level issue has been resolved. Computed server-side."
          },
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "high",
              "medium",
              "low"
            ],
            "description": "The severity level of the finding. Computed server-side from the security risk counts."
          },
          "externalId": {
            "type": "string",
            "description": "the external ID of the resource in the provider's system for the resource"
          },
          "externalUrl": {
            "type": "string",
            "description": "the URL to the resource-level issue in the provider's system"
          },
          "metadata": {
            "type": "object",
            "description": "contains any additional information for the resource results"
          },
          "enhancement": {
            "$ref": "#/components/schemas/ResourceResultEnhancement"
          },
          "resultType": {
            "type": "string",
            "enum": [
              "security_risk",
              "potential_daily_savings",
              "potential_daily_savings_with_recommendation",
              "potential_daily_savings_with_cluster_agent"
            ],
            "description": "The discriminator property that determines which fields are populated in the 'result' object."
          },
          "result": {
            "description": "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.\n",
            "type": "object",
            "properties": {
              "value": {
                "type": "number",
                "format": "double",
                "description": "the daily saving amount for this result"
              },
              "critical": {
                "type": "integer",
                "description": "number of critical security risks"
              },
              "high": {
                "type": "integer",
                "description": "number of high security risks"
              },
              "medium": {
                "type": "integer",
                "description": "number of medium security risks"
              },
              "low": {
                "type": "integer",
                "description": "number of low security risks"
              },
              "current": {
                "type": "string",
                "description": "the current state (i.e. current instance type)"
              },
              "recommendation": {
                "type": "string",
                "description": "the recommended state (i.e. recommended instance type)"
              },
              "agentInstalled": {
                "type": "boolean",
                "description": "true if the agent is installed"
              }
            }
          }
        }
      },
      "ResourceResultEnhancement": {
        "type": "object",
        "description": "DoiT-managed metadata associated with a resource result.",
        "properties": {
          "tags": {
            "type": "array",
            "description": "Tags assigned to this resource result.",
            "items": {
              "type": "string"
            }
          },
          "priority": {
            "type": "object",
            "description": "Priority information for this resource result.",
            "properties": {
              "value": {
                "type": "string",
                "description": "The priority level (e.g. Low, Medium, High)."
              },
              "priorityScore": {
                "type": "number",
                "format": "double",
                "description": "Numeric priority score."
              }
            }
          },
          "lastUpdatedBy": {
            "type": "string",
            "description": "The user who last updated this enhancement."
          },
          "lastUpdatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of the last update."
          }
        }
      },
      "CloudProvider": {
        "type": "string",
        "example": "aws",
        "description": "The cloud provider associated with the resource."
      },
      "ResourceResultsResponse": {
        "type": "object",
        "required": [
          "resourceResults",
          "rowCount"
        ],
        "properties": {
          "resourceResults": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResourceResult"
            }
          },
          "pageToken": {
            "type": "string"
          },
          "rowCount": {
            "type": "integer"
          }
        }
      },
      "Error": {
        "type": "object",
        "description": "Standard error response structure.",
        "properties": {
          "error": {
            "type": "string",
            "description": "Detailed error message."
          }
        },
        "example": {
          "error": "The request could not be completed."
        }
      }
    },
    "responses": {
      "400": {
        "description": "Bad Request - The server cannot process the request, often due to a malformed request.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "401": {
        "description": "Unauthorized - Invalid API key.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "403": {
        "description": "Forbidden - The client is not authorized to perform the request.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "404": {
        "description": "Not Found - The requested resource does not exist.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "500": {
        "description": "Internal Server Error - Something went wrong with the DoiT API server.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "api_key": {
        "type": "apiKey",
        "name": "Authorization",
        "description": "Use the \"Bearer <API_KEY>\" format or sign in for autofill",
        "in": "header"
      },
      "tenantId": {
        "type": "apiKey",
        "name": "X-Tenant-Id",
        "description": "Customer (tenant) ID for the request. Separate from your API token: always authenticate with `Authorization: Bearer <token>` (personal or service account). See [Get Started](https://developer.doit.com/docs/start). Omit when your token is scoped to a single customer (resolved automatically). A service account can select an active direct or nested descendant of its home customer; the endpoint's normal permissions, entitlements, and resource-ownership checks still apply. A service-account target outside that customer subtree returns `403 Forbidden`. Prefer this header over the legacy `customerContext` query parameter, which only applies to legacy API keys and is ignored by personal and service account tokens.",
        "in": "header"
      }
    }
  },
  "x-samples-languages": [
    "curl",
    "go",
    "node",
    "python"
  ],
  "x-cli-config": {
    "security": "oauth2",
    "params": {
      "client_id": "cli"
    }
  }
}
```