> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/api-reference/security-testing-agent-apis/security-testing-orchestration/remediation-agent.md).

# Remediation Agent

Internal endpoints for remediation-agent plugins and account-scoped STO base-image approval lookup

## GetBaseImageApproval RemediationAgent

> List the approved variants of one or more base images across an account (not scoped to org/project). Customers scan base images manually as their own container targets and approve variants via the target variant status update; this lookup does not depend on base image auto-detection (STO\_BASE\_IMAGE\_DETECTION). For each requested target name, returns every variant of the container target with that name whose base image status is approved, newest scan first, de-duplicated. Variant strings are the bare parameters.variant value (for example 3.21), not the STO UI display form (tag: 3.21); tag: and branch: prefixes are stripped. Duplicate request names are collapsed; results follow request order and always contain one entry per distinct name. Does not pick a single upgrade tag.

```json
{"openapi":"3.0.3","info":{"title":"Harness Security Test Orchestration API","version":"1.0.0"},"tags":[{"name":"RemediationAgent","description":"Internal endpoints for remediation-agent plugins and account-scoped STO base-image approval lookup"}],"servers":[{"url":"https://app.harness.io/gateway/sto"},{"url":"http://127.0.0.1:4000"}],"security":[{"jwt_header_Authorization":["sto_internal_use_only"]}],"components":{"securitySchemes":{"jwt_header_Authorization":{"type":"http","scheme":"bearer"}},"schemas":{"GetBaseImageApprovalRequestBody":{"type":"object","properties":{"targetNames":{"type":"array","items":{"type":"string","minLength":1,"maxLength":256},"description":"STO container test target names to look up (for example alpine). Matched exactly; duplicates are collapsed","minItems":1,"maxItems":50}},"required":["targetNames"]},"GetBaseImageApprovalResponseBody":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/RemAgentBaseImageApproval"},"description":"One entry per distinct requested target name, in request order"}},"required":["results"]},"RemAgentBaseImageApproval":{"type":"object","properties":{"approvedVariants":{"type":"array","items":{"$ref":"#/components/schemas/RemAgentApprovedBaseImageVariant"},"description":"Approved variants of the target name across the account, newest scan first, bare variant strings, de-duplicated. Empty when the target was never scanned or has no approved variant"},"targetName":{"type":"string","description":"Requested STO target name"}},"required":["targetName","approvedVariants"]},"RemAgentApprovedBaseImageVariant":{"type":"object","properties":{"lastScanned":{"type":"integer","description":"Unix timestamp of the latest scan of this variant, when known","format":"int64"},"variant":{"type":"string","description":"Bare parameters.variant value (for example 3.21), not tag: 3.21"}},"required":["variant"]},"NotFound":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"integer","default":404,"format":"int64"}},"required":["message"]}}},"paths":{"/api/v2/remediation-agent/base-image-approval":{"post":{"tags":["RemediationAgent"],"summary":"GetBaseImageApproval RemediationAgent","description":"List the approved variants of one or more base images across an account (not scoped to org/project). Customers scan base images manually as their own container targets and approve variants via the target variant status update; this lookup does not depend on base image auto-detection (STO_BASE_IMAGE_DETECTION). For each requested target name, returns every variant of the container target with that name whose base image status is approved, newest scan first, de-duplicated. Variant strings are the bare parameters.variant value (for example 3.21), not the STO UI display form (tag: 3.21); tag: and branch: prefixes are stripped. Duplicate request names are collapsed; results follow request order and always contain one entry per distinct name. Does not pick a single upgrade tag.","operationId":"RemediationAgent#GetBaseImageApproval","parameters":[{"name":"accountId","in":"query","description":"Harness Account ID","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Harness Account ID","pattern":"^[a-zA-Z0-9_-]{22}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetBaseImageApprovalRequestBody"}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetBaseImageApprovalResponseBody"}}}},"400":{"description":"BadRequest: Bad Request response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"401":{"description":"Unauthorized: Unauthorized response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"403":{"description":"Forbidden: Forbidden response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"429":{"description":"TooManyRequests: Too Many Requests response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"500":{"description":"InternalServerError: Internal Server Error response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}}}}}}}
```

## DiffOccurrences RemediationAgent

> Diff the validation execution's scan against the original scan's ignore set. Resolves validationScanId from validationExecutionId (account-scoped — validation pipeline may live in a different org/project than the original scan), derives the original scan's ignored occurrences (every occurrence on the original scan minus the in-scope ones for the scoped issue type, same computation as ListOccurrencesInScope), and removes those (matched by fingerprint) from the validation scan. Remaining occurrences are split into existingOccurrences (fingerprint also present in original in-scope) and newOccurrences (introduced on the validation scan).

```json
{"openapi":"3.0.3","info":{"title":"Harness Security Test Orchestration API","version":"1.0.0"},"tags":[{"name":"RemediationAgent","description":"Internal endpoints for remediation-agent plugins and account-scoped STO base-image approval lookup"}],"servers":[{"url":"https://app.harness.io/gateway/sto"},{"url":"http://127.0.0.1:4000"}],"security":[{"X-Api-Key_header_X-Api-Key":[],"jwt_header_Authorization":["sto_issue_view"]}],"components":{"securitySchemes":{"X-Api-Key_header_X-Api-Key":{"type":"apiKey","name":"X-Api-Key","in":"header"},"jwt_header_Authorization":{"type":"http","scheme":"bearer"}},"schemas":{"DiffOccurrencesResponseBody":{"type":"object","properties":{"existingCount":{"type":"integer","format":"int64"},"existingOccurrences":{"type":"array","items":{"$ref":"#/components/schemas/RemAgentOccurrenceRef"},"description":"Validation-scan occurrences whose fingerprint was also in the original scan's in-scope set"},"matchedCount":{"type":"integer","description":"existingCount + newCount","format":"int64"},"newCount":{"type":"integer","format":"int64"},"newOccurrences":{"type":"array","items":{"$ref":"#/components/schemas/RemAgentOccurrenceRef"},"description":"Validation-scan occurrences introduced after the original scan (not in original in-scope or ignored)"},"validationScanId":{"type":"string","pattern":"^[a-zA-Z0-9_-]{22}$"}},"required":["validationScanId","existingOccurrences","newOccurrences","existingCount","newCount","matchedCount"]},"RemAgentOccurrenceRef":{"type":"object","properties":{"issueId":{"type":"string","pattern":"^[a-zA-Z0-9_-]{22}$"},"issueTitle":{"type":"string"},"issueType":{"type":"string","description":"STO issue type for this occurrence (i.type)"},"occurrenceDetails":{"type":"string","description":"Issue details merged under occurrence unique_details overrides","format":"binary"},"occurrenceInternalId":{"type":"integer","format":"int64"},"severityCode":{"type":"string"}},"description":"In-scope occurrence for the remediation pre-plugin. occurrenceDetails is issue+occurrence hydrated so each row is self-contained. Fingerprint stays server-side for Diff matching only — not on the wire.","required":["issueId","occurrenceInternalId","issueTitle","severityCode"]},"NotFound":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"integer","default":404,"format":"int64"}},"required":["message"]}}},"paths":{"/api/v2/remediation-agent/diff-occurrences":{"get":{"tags":["RemediationAgent"],"summary":"DiffOccurrences RemediationAgent","description":"Diff the validation execution's scan against the original scan's ignore set. Resolves validationScanId from validationExecutionId (account-scoped — validation pipeline may live in a different org/project than the original scan), derives the original scan's ignored occurrences (every occurrence on the original scan minus the in-scope ones for the scoped issue type, same computation as ListOccurrencesInScope), and removes those (matched by fingerprint) from the validation scan. Remaining occurrences are split into existingOccurrences (fingerprint also present in original in-scope) and newOccurrences (introduced on the validation scan).","operationId":"RemediationAgent#DiffOccurrences","parameters":[{"name":"accountId","in":"query","description":"Harness Account ID","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Harness Account ID","pattern":"^[a-zA-Z0-9_-]{22}$"}},{"name":"orgId","in":"query","description":"Harness Organization ID","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Harness Organization ID","pattern":"^[A-Za-z_][A-Za-z0-9_]*$","maxLength":128}},{"name":"projectId","in":"query","description":"Harness Project ID","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Harness Project ID","pattern":"^[A-Za-z_][A-Za-z0-9_]*$","maxLength":128}},{"name":"scanId","in":"query","description":"Original STO scan id","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Original STO scan id","pattern":"^[a-zA-Z0-9_-]{22}$"}},{"name":"validationExecutionId","in":"query","description":"Validation pipeline execution id","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Validation pipeline execution id","maxLength":128}},{"name":"issueTypes","in":"query","description":"Issue types to scope (v1: SAST, SECRET, SCA). Filters i.type. Empty or omitted matches no occurrences.","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","enum":["SAST","SECRET","SCA"]},"description":"Issue types to scope (v1: SAST, SECRET, SCA). Filters i.type. Empty or omitted matches no occurrences."}},{"name":"onlyTruePositiveIssueTypes","in":"query","description":"Issue types that must have a TRUE_POSITIVE triage verdict to stay in scope. Other scoped types are not TP-filtered. Empty + onlyTruePositive=false → no TP filter. Empty + onlyTruePositive=true (legacy) → all resolved issueTypes.","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","enum":["SAST","SECRET","SCA"]},"description":"Issue types that must have a TRUE_POSITIVE triage verdict to stay in scope. Other scoped types are not TP-filtered. Empty + onlyTruePositive=false → no TP filter. Empty + onlyTruePositive=true (legacy) → all resolved issueTypes."}},{"name":"onlyTruePositive","in":"query","description":"Legacy: when true and onlyTruePositiveIssueTypes is empty, apply TP filter to all resolved issueTypes. Prefer onlyTruePositiveIssueTypes for per-type Exclude False Positives.","allowEmptyValue":true,"schema":{"type":"boolean","description":"Legacy: when true and onlyTruePositiveIssueTypes is empty, apply TP filter to all resolved issueTypes. Prefer onlyTruePositiveIssueTypes for per-type Exclude False Positives.","default":false}},{"name":"excludeUnreachable","in":"query","description":"When true, exclude occurrences whose reachability is 'unreachable' (SAST). Missing/unknown reachability stays in scope.","allowEmptyValue":true,"schema":{"type":"boolean","description":"When true, exclude occurrences whose reachability is 'unreachable' (SAST). Missing/unknown reachability stays in scope.","default":false}},{"name":"limit","in":"query","description":"Maximum number of occurrences","allowEmptyValue":true,"schema":{"type":"integer","description":"Maximum number of occurrences","default":1000,"format":"int64","minimum":1,"maximum":10000}},{"name":"severityCodes","in":"query","description":"Subset of severities: CRITICAL, HIGH, MEDIUM, LOW, INFO. Empty means all.","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","enum":["CRITICAL","HIGH","MEDIUM","LOW","INFO"]},"description":"Subset of severities: CRITICAL, HIGH, MEDIUM, LOW, INFO. Empty means all."}},{"name":"excludeRepoPatterns","in":"query","description":"Glob patterns matching target.name on repository targets","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","maxLength":256},"description":"Glob patterns matching target.name on repository targets"}},{"name":"issueIds","in":"query","description":"Restrict scope to these issue ids (issue.id). Empty = no restriction.","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","maxLength":256},"description":"Restrict scope to these issue ids (issue.id). Empty = no restriction.","maxItems":200}},{"name":"X-Api-Key","in":"header","description":"Harness personal or service access token","allowEmptyValue":true,"schema":{"type":"string","description":"Harness personal or service access token"}}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiffOccurrencesResponseBody"}}}},"400":{"description":"BadRequest: Bad Request response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"401":{"description":"Unauthorized: Unauthorized response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"403":{"description":"Forbidden: Forbidden response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"429":{"description":"TooManyRequests: Too Many Requests response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"500":{"description":"InternalServerError: Internal Server Error response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}}}}}}}
```

## RecallMemory RemediationAgent

> Return the remediation agent memory page for one target and agent profile. The page is advisory text for the fix prompt. Empty when nothing is stored. A failed read must not change the remediation run.

```json
{"openapi":"3.0.3","info":{"title":"Harness Security Test Orchestration API","version":"1.0.0"},"tags":[{"name":"RemediationAgent","description":"Internal endpoints for remediation-agent plugins and account-scoped STO base-image approval lookup"}],"servers":[{"url":"https://app.harness.io/gateway/sto"},{"url":"http://127.0.0.1:4000"}],"security":[{"jwt_header_Authorization":["sto_internal_use_only"]}],"components":{"securitySchemes":{"jwt_header_Authorization":{"type":"http","scheme":"bearer"}},"schemas":{"RecallMemoryResponseBody":{"type":"object","properties":{"entryCount":{"type":"integer","description":"Lessons selected for this run, before the page cap","format":"int64"},"page":{"type":"string","description":"Markdown lessons for this run, capped at 12 KB. Empty when there are none."}},"required":["page","entryCount"]},"NotFound":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"integer","default":404,"format":"int64"}},"required":["message"]}}},"paths":{"/api/v2/remediation-agent/memory":{"get":{"tags":["RemediationAgent"],"summary":"RecallMemory RemediationAgent","description":"Return the remediation agent memory page for one target and agent profile. The page is advisory text for the fix prompt. Empty when nothing is stored. A failed read must not change the remediation run.","operationId":"RemediationAgent#RecallMemory","parameters":[{"name":"accountId","in":"query","description":"Harness Account ID","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Harness Account ID","pattern":"^[a-zA-Z0-9_-]{22}$"}},{"name":"orgId","in":"query","description":"Harness Organization ID","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Harness Organization ID","pattern":"^[A-Za-z_][A-Za-z0-9_]*$","maxLength":128}},{"name":"projectId","in":"query","description":"Harness Project ID","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Harness Project ID","pattern":"^[A-Za-z_][A-Za-z0-9_]*$","maxLength":128}},{"name":"targetId","in":"query","description":"STO target id. Blank matches nothing.","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"STO target id. Blank matches nothing.","pattern":"^[a-zA-Z0-9_-]{22}$"}},{"name":"paths","in":"query","description":"Repo-relative files this run fixes. The lookup is the repo, every parent directory, each file, and the functions under those files, plus pinned rows. Empty looks up the repo node and pinned rows only.","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string"},"description":"Repo-relative files this run fixes. The lookup is the repo, every parent directory, each file, and the functions under those files, plus pinned rows. Empty looks up the repo node and pinned rows only."}},{"name":"agent","in":"query","description":"Remediation agent profile. Defaults to sast_remediation when omitted.","allowEmptyValue":true,"schema":{"type":"string","description":"Remediation agent profile. Defaults to sast_remediation when omitted.","pattern":"^[a-z][a-z0-9_]{0,63}$"}},{"name":"repositoryUrl","in":"query","description":"Clone URL for this run. Used only when the target has no URL and no repository memory is stored for it.","allowEmptyValue":true,"schema":{"type":"string","description":"Clone URL for this run. Used only when the target has no URL and no repository memory is stored for it.","maxLength":2048}}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecallMemoryResponseBody"}}}},"400":{"description":"BadRequest: Bad Request response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"401":{"description":"Unauthorized: Unauthorized response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"403":{"description":"Forbidden: Forbidden response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"429":{"description":"TooManyRequests: Too Many Requests response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"500":{"description":"InternalServerError: Internal Server Error response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}}}}}}}
```

## ListOccurrencesInScope RemediationAgent

> List (issue, occurrence) tuples for the remediation pre-plugin. Scoped to one scan and issue type; optionally filters to TRUE\_POSITIVE triage verdicts.

```json
{"openapi":"3.0.3","info":{"title":"Harness Security Test Orchestration API","version":"1.0.0"},"tags":[{"name":"RemediationAgent","description":"Internal endpoints for remediation-agent plugins and account-scoped STO base-image approval lookup"}],"servers":[{"url":"https://app.harness.io/gateway/sto"},{"url":"http://127.0.0.1:4000"}],"security":[{"jwt_header_Authorization":["sto_internal_use_only"]}],"components":{"securitySchemes":{"jwt_header_Authorization":{"type":"http","scheme":"bearer"}},"schemas":{"ListOccurrencesInScopeResponseBody":{"type":"object","properties":{"ignoredOccurrenceIds":{"type":"array","items":{"type":"integer","format":"int64"},"description":"Occurrence internal IDs excluded from scope because they already have remediation agent augmentation for this target variant"},"originalOccurrenceCount":{"type":"integer","description":"Uncapped SUM(issue_scan.num_occurrences) for the scoped issue type on the scan; not limited by the result list cap","format":"int64"},"results":{"type":"array","items":{"$ref":"#/components/schemas/RemAgentOccurrenceRef"}}},"required":["results","ignoredOccurrenceIds","originalOccurrenceCount"]},"RemAgentOccurrenceRef":{"type":"object","properties":{"issueId":{"type":"string","pattern":"^[a-zA-Z0-9_-]{22}$"},"issueTitle":{"type":"string"},"issueType":{"type":"string","description":"STO issue type for this occurrence (i.type)"},"occurrenceDetails":{"type":"string","description":"Issue details merged under occurrence unique_details overrides","format":"binary"},"occurrenceInternalId":{"type":"integer","format":"int64"},"severityCode":{"type":"string"}},"description":"In-scope occurrence for the remediation pre-plugin. occurrenceDetails is issue+occurrence hydrated so each row is self-contained. Fingerprint stays server-side for Diff matching only — not on the wire.","required":["issueId","occurrenceInternalId","issueTitle","severityCode"]},"NotFound":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"integer","default":404,"format":"int64"}},"required":["message"]}}},"paths":{"/api/v2/remediation-agent/occurrences-in-scope":{"get":{"tags":["RemediationAgent"],"summary":"ListOccurrencesInScope RemediationAgent","description":"List (issue, occurrence) tuples for the remediation pre-plugin. Scoped to one scan and issue type; optionally filters to TRUE_POSITIVE triage verdicts.","operationId":"RemediationAgent#ListOccurrencesInScope","parameters":[{"name":"accountId","in":"query","description":"Harness Account ID","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Harness Account ID","pattern":"^[a-zA-Z0-9_-]{22}$"}},{"name":"orgId","in":"query","description":"Harness Organization ID","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Harness Organization ID","pattern":"^[A-Za-z_][A-Za-z0-9_]*$","maxLength":128}},{"name":"projectId","in":"query","description":"Harness Project ID","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Harness Project ID","pattern":"^[A-Za-z_][A-Za-z0-9_]*$","maxLength":128}},{"name":"scanId","in":"query","description":"STO scan id","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"STO scan id","pattern":"^[a-zA-Z0-9_-]{22}$"}},{"name":"targetId","in":"query","description":"Optional STO target id","allowEmptyValue":true,"schema":{"type":"string","description":"Optional STO target id","pattern":"^[a-zA-Z0-9_-]{22}$"}},{"name":"issueTypes","in":"query","description":"Issue types to scope (v1: SAST, SECRET, SCA). Filters i.type. Empty or omitted matches no occurrences.","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","enum":["SAST","SECRET","SCA"]},"description":"Issue types to scope (v1: SAST, SECRET, SCA). Filters i.type. Empty or omitted matches no occurrences."}},{"name":"onlyTruePositiveIssueTypes","in":"query","description":"Issue types that must have a TRUE_POSITIVE triage verdict to stay in scope. Other scoped types are not TP-filtered. Empty + onlyTruePositive=false → no TP filter. Empty + onlyTruePositive=true (legacy) → all resolved issueTypes.","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","enum":["SAST","SECRET","SCA"]},"description":"Issue types that must have a TRUE_POSITIVE triage verdict to stay in scope. Other scoped types are not TP-filtered. Empty + onlyTruePositive=false → no TP filter. Empty + onlyTruePositive=true (legacy) → all resolved issueTypes."}},{"name":"onlyTruePositive","in":"query","description":"Legacy: when true and onlyTruePositiveIssueTypes is empty, apply TP filter to all resolved issueTypes. Prefer onlyTruePositiveIssueTypes for per-type Exclude False Positives.","allowEmptyValue":true,"schema":{"type":"boolean","description":"Legacy: when true and onlyTruePositiveIssueTypes is empty, apply TP filter to all resolved issueTypes. Prefer onlyTruePositiveIssueTypes for per-type Exclude False Positives.","default":false}},{"name":"excludeUnreachable","in":"query","description":"When true, exclude occurrences whose reachability is 'unreachable' (SAST). Missing/unknown reachability stays in scope.","allowEmptyValue":true,"schema":{"type":"boolean","description":"When true, exclude occurrences whose reachability is 'unreachable' (SAST). Missing/unknown reachability stays in scope.","default":false}},{"name":"limit","in":"query","description":"Maximum number of occurrences","allowEmptyValue":true,"schema":{"type":"integer","description":"Maximum number of occurrences","default":1000,"format":"int64","minimum":1,"maximum":10000}},{"name":"severityCodes","in":"query","description":"Subset of severities: CRITICAL, HIGH, MEDIUM, LOW, INFO. Empty means all.","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","enum":["CRITICAL","HIGH","MEDIUM","LOW","INFO"]},"description":"Subset of severities: CRITICAL, HIGH, MEDIUM, LOW, INFO. Empty means all."}},{"name":"excludeRepoPatterns","in":"query","description":"Glob patterns matching target.name on repository targets","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","maxLength":256},"description":"Glob patterns matching target.name on repository targets"}},{"name":"issueIds","in":"query","description":"Restrict scope to these issue ids (issue.id). Empty = no restriction.","allowEmptyValue":true,"schema":{"type":"array","items":{"type":"string","maxLength":256},"description":"Restrict scope to these issue ids (issue.id). Empty = no restriction.","maxItems":200}}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListOccurrencesInScopeResponseBody"}}}},"400":{"description":"BadRequest: Bad Request response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"401":{"description":"Unauthorized: Unauthorized response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"403":{"description":"Forbidden: Forbidden response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"429":{"description":"TooManyRequests: Too Many Requests response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"500":{"description":"InternalServerError: Internal Server Error response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}}}}}}}
```

## BatchPersistResults RemediationAgent

> Atomically upsert per-occurrence remediation rows for one agent run. STO Core resolves in-scope occurrences for originalScanId (same query as ListOccurrencesInScope, using the same RemAgentScopeFilters from sto-plugins) and stamps pullRequestMetadata onto each issue\_augmentation row. Run-level rollup counts on this payload are stored for audit/UI; the post-plugin ALSO posts the same counts to ssca-manager agentResults for the Agents Executions tab (same split as FP triage).

```json
{"openapi":"3.0.3","info":{"title":"Harness Security Test Orchestration API","version":"1.0.0"},"tags":[{"name":"RemediationAgent","description":"Internal endpoints for remediation-agent plugins and account-scoped STO base-image approval lookup"}],"servers":[{"url":"https://app.harness.io/gateway/sto"},{"url":"http://127.0.0.1:4000"}],"security":[{"jwt_header_Authorization":["sto_internal_use_only"]}],"components":{"securitySchemes":{"jwt_header_Authorization":{"type":"http","scheme":"bearer"}},"schemas":{"BatchPersistResultsRequestBody":{"type":"object","properties":{"activeOccurrenceCount":{"type":"integer","description":"original + new_introduced - remediated","format":"int64","minimum":0},"excludeRepoPatterns":{"type":"array","items":{"type":"string","maxLength":256},"description":"Glob patterns matching target.name on repository targets"},"excludeUnreachable":{"type":"boolean","description":"When true, exclude occurrences whose reachability is 'unreachable' (SAST). Missing/unknown reachability stays in scope.","default":false},"issueIds":{"type":"array","items":{"type":"string","maxLength":256},"description":"Restrict scope to these issue ids (issue.id). Empty = no restriction.","maxItems":200},"issueTypes":{"type":"array","items":{"type":"string","enum":["SAST","SECRET","SCA"]},"description":"Issue types to scope (v1: SAST, SECRET, SCA). Filters i.type. Empty or omitted matches no occurrences."},"jiraEnabled":{"type":"boolean","description":"When true, create a summary ticket after persist (still requires project External Tickets settings). Mirrors agent.jiraEnabled / pipeline setting jira_enabled. Default false when unset (older plugins omit → no ticket). Result is written to remediation_agent_summary.notification_metadata.jira {creationEnabled, ticketId, ticketUrl}.","default":false},"limit":{"type":"integer","description":"Maximum number of occurrences","default":1000,"format":"int64","minimum":1,"maximum":10000},"modelName":{"type":"string","maxLength":256},"newOccurrenceIntroducedCount":{"type":"integer","description":"New findings introduced by the fix branch that were not in the original scope","format":"int64","minimum":0},"occurrenceRemediatedCount":{"type":"integer","description":"Occurrences with verdict REMEDIATED","format":"int64","minimum":0},"onlyTruePositive":{"type":"boolean","description":"Legacy: when true and onlyTruePositiveIssueTypes is empty, apply TP filter to all resolved issueTypes. Prefer onlyTruePositiveIssueTypes for per-type Exclude False Positives.","default":false},"onlyTruePositiveIssueTypes":{"type":"array","items":{"type":"string","enum":["SAST","SECRET","SCA"]},"description":"Issue types that must have a TRUE_POSITIVE triage verdict to stay in scope. Other scoped types are not TP-filtered. Empty + onlyTruePositive=false → no TP filter. Empty + onlyTruePositive=true (legacy) → all resolved issueTypes."},"originalOccurrenceCount":{"type":"integer","description":"In-scope occurrence count from the pre-plugin (original_occurrence_count)","format":"int64","minimum":0},"originalScanId":{"type":"string","description":"STO scan id the agent remediated","pattern":"^[a-zA-Z0-9_-]{22}$"},"promptVersion":{"type":"string","maxLength":64},"pullRequestMetadata":{"type":"string","description":"Run-level PR stamp (PascalCase keys matching types.PullRequestMetadata): Provider, AccountID, OrgID, ProjectID, RepositoryName, Number, Title, SourceBranch, TargetBranch, Url, CommentUrl, BuildId, CommitsCount, ConnectorRef. ConnectorRef (SCM connector that opened the PR) enables live status refresh. BuildId = TRIGGERING_PIPELINE_BUILD_NUMBER (not parsed from SourceBranch). CommitsCount = fix commits on the PR. Copied onto issue_augmentation.pr_metadata for every in-scope occurrence.","format":"binary"},"severityCodes":{"type":"array","items":{"type":"string","enum":["CRITICAL","HIGH","MEDIUM","LOW","INFO"]},"description":"Subset of severities: CRITICAL, HIGH, MEDIUM, LOW, INFO. Empty means all."},"targetId":{"type":"string","description":"Target id the agent remediated; supplied by the plugin","pattern":"^[a-zA-Z0-9_-]{22}$"},"targetName":{"type":"string","description":"Target name the agent remediated; supplied by the plugin","maxLength":128},"targetVariantName":{"type":"string","description":"Target variant name the agent remediated; supplied by the plugin","maxLength":128},"userScanActiveCount":{"type":"integer","format":"int64","minimum":0},"validationMetadata":{"$ref":"#/components/schemas/RemAgentValidationMetadata"},"workflowExecutionId":{"type":"string","description":"Opaque ssca-manager workflow execution id","maxLength":64},"workflowType":{"type":"string","description":"Stored on remediation_agent_summary. Omitted or blank stays REMEDIATION (SAST remediation agent).","maxLength":64}},"required":["originalScanId"]},"RemAgentValidationMetadata":{"type":"object","properties":{"build":{"$ref":"#/components/schemas/RemAgentValidationBuildMeta"},"remediation":{"$ref":"#/components/schemas/RemAgentValidationRemediationMeta"}}},"RemAgentValidationBuildMeta":{"type":"object","properties":{"executionId":{"type":"string","maxLength":128},"orgId":{"type":"string","maxLength":128},"pipelineId":{"type":"string","maxLength":128},"projectId":{"type":"string","maxLength":128},"status":{"type":"string","description":"Free-form validation status from the plugin; null stays null.","maxLength":64}}},"RemAgentValidationRemediationMeta":{"type":"object","properties":{"executionId":{"type":"string","maxLength":128},"orgId":{"type":"string","maxLength":128},"pipelineId":{"type":"string","maxLength":128},"projectId":{"type":"string","maxLength":128},"scanId":{"type":"string","pattern":"^[a-zA-Z0-9_-]{22}$"},"status":{"type":"string","description":"Free-form validation status from the plugin; null stays null.","maxLength":64}}},"BatchPersistResultsResponseBody":{"type":"object","properties":{"summaryId":{"type":"integer","description":"remediation_agent_summary.internal_id for this run","format":"int64"},"ticketId":{"type":"string","description":"External ticket key/id (e.g. Jira STO-34219) when ticket creation succeeds; omit when not created","maxLength":128},"ticketUrl":{"type":"string","description":"URL of the summary ticket created for this remediation run, when ticket creation succeeds","format":"uri"},"written":{"type":"integer","description":"Number of per-occurrence augmentation rows written","format":"int64"}},"required":["written","summaryId"]},"NotFound":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"integer","default":404,"format":"int64"}},"required":["message"]}}},"paths":{"/api/v2/remediation-agent/results/batch":{"post":{"tags":["RemediationAgent"],"summary":"BatchPersistResults RemediationAgent","description":"Atomically upsert per-occurrence remediation rows for one agent run. STO Core resolves in-scope occurrences for originalScanId (same query as ListOccurrencesInScope, using the same RemAgentScopeFilters from sto-plugins) and stamps pullRequestMetadata onto each issue_augmentation row. Run-level rollup counts on this payload are stored for audit/UI; the post-plugin ALSO posts the same counts to ssca-manager agentResults for the Agents Executions tab (same split as FP triage).","operationId":"RemediationAgent#BatchPersistResults","parameters":[{"name":"accountId","in":"query","description":"Harness Account ID","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Harness Account ID","pattern":"^[a-zA-Z0-9_-]{22}$"}},{"name":"orgId","in":"query","description":"Harness Organization ID","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Harness Organization ID","pattern":"^[A-Za-z_][A-Za-z0-9_]*$","maxLength":128}},{"name":"projectId","in":"query","description":"Harness Project ID","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Harness Project ID","pattern":"^[A-Za-z_][A-Za-z0-9_]*$","maxLength":128}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchPersistResultsRequestBody"}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchPersistResultsResponseBody"}}}},"400":{"description":"BadRequest: Bad Request response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"401":{"description":"Unauthorized: Unauthorized response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"403":{"description":"Forbidden: Forbidden response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"429":{"description":"TooManyRequests: Too Many Requests response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}},"500":{"description":"InternalServerError: Internal Server Error response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotFound"}}}}}}}}}
```
