> 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/target-variants.md).

# Target Variants

Access and modify Scan Target Variants

## GET /api/v2/targets/{targetId}/variants

> List a collection of Scan Target Variants

```json
{"openapi":"3.0.3","info":{"title":"Harness Security Test Orchestration API","version":"1.0.0"},"tags":[{"name":"Target Variants","description":"Access and modify Scan Target Variants"}],"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_testtarget_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":{"ArtifactsListArtifactVariantsResponseBody":{"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/Pagination"},"results":{"type":"array","items":{"$ref":"#/components/schemas/TargetVariant"}}},"required":["results","pagination"]},"Pagination":{"type":"object","properties":{"link":{"type":"string","description":"Link-based paging"},"page":{"type":"integer","description":"Page number (starting from 0)","format":"int64"},"pageSize":{"type":"integer","description":"Requested page size","format":"int64"},"totalItems":{"type":"integer","description":"Total results available","format":"int64"},"totalPages":{"type":"integer","description":"Total pages available","format":"int64"}},"required":["page","pageSize","totalPages","totalItems"]},"TargetVariant":{"type":"object","properties":{"created":{"type":"integer","description":"Unix timestamp at which the resource was created","format":"int64"},"hash":{"type":"string","description":"Git Commit or Container Image hash","maxLength":64},"id":{"type":"string","description":"Resource identifier","pattern":"^[a-zA-Z0-9_-]{22}$"},"isVirtualBaseline":{"type":"boolean","description":"True for the virtual baseline lane entry (one per target, collects every baseline scan across tags). For the lane, parameters.variant holds the current physical tag. Absent/false for real tags and branches."},"lastModified":{"type":"integer","description":"Unix timestamp at which the resource was most recently modified","format":"int64"},"parameters":{"type":"object","description":"Parameters for this Variant, as a JSON-encoded string","additionalProperties":{"type":"string"}},"targetId":{"type":"string","description":"Associated Target ID","pattern":"^[a-zA-Z0-9_-]{22}$"}},"description":"Information about a Scan Target Variant","required":["targetId","parameters","id","created","lastModified"]},"NotFound":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"integer","default":404,"format":"int64"}},"required":["message"]}}},"paths":{"/api/v2/targets/{targetId}/variants":{"get":{"tags":["Target Variants"],"description":"List a collection of Scan Target Variants","operationId":"Target Variants#ListTargetVariants","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":"page","in":"query","description":"Page number to fetch (starting from 0)","allowEmptyValue":true,"schema":{"type":"integer","description":"Page number to fetch (starting from 0)","default":0,"format":"int64","minimum":0}},{"name":"pageSize","in":"query","description":"Number of results per page","allowEmptyValue":true,"schema":{"type":"integer","description":"Number of results per page","default":30,"format":"int64","minimum":1,"maximum":100}},{"name":"name","in":"query","description":"Resource name","allowEmptyValue":true,"schema":{"type":"string","description":"Resource name"}},{"name":"targetId","in":"path","description":"Associated Target ID","required":true,"schema":{"type":"string","description":"Associated Target ID","pattern":"^[a-zA-Z0-9_-]{22}$"}},{"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/ArtifactsListArtifactVariantsResponseBody"}}}},"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"}}}},"404":{"description":"NotFound: Not Found 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"}}}}}}}}}
```

## POST /api/v2/targets/{targetId}/variants

> Create a new Scan Target Variant

```json
{"openapi":"3.0.3","info":{"title":"Harness Security Test Orchestration API","version":"1.0.0"},"tags":[{"name":"Target Variants","description":"Access and modify Scan Target Variants"}],"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_testtarget_edit"]}],"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":{"CreateTargetVariantRequestBody":{"type":"object","properties":{"hash":{"type":"string","description":"Git Commit or Container Image hash","maxLength":64},"parameters":{"type":"object","description":"Parameters for this Variant, as a JSON-encoded string","additionalProperties":{"type":"string"}}},"required":["parameters","id","created","lastModified"]},"ExemptionRulesCreateExemptionRuleResponseBody":{"$ref":"#/components/schemas/IDResult"},"IDResult":{"type":"object","properties":{"id":{"type":"string","description":"Resource identifier","pattern":"^[a-zA-Z0-9_-]{22}$"}},"required":["id"]},"NotFound":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"integer","default":404,"format":"int64"}},"required":["message"]}}},"paths":{"/api/v2/targets/{targetId}/variants":{"post":{"tags":["Target Variants"],"description":"Create a new Scan Target Variant","operationId":"Target Variants#CreateTargetVariant","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":"targetId","in":"path","description":"Associated Target ID","required":true,"schema":{"type":"string","description":"Associated Target ID","pattern":"^[a-zA-Z0-9_-]{22}$"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTargetVariantRequestBody"}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExemptionRulesCreateExemptionRuleResponseBody"}}}},"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"}}}}}}}}}
```

## GET /api/v2/targets/{targetId}/variants/{id}

> Find Scan Target Variant by ID

```json
{"openapi":"3.0.3","info":{"title":"Harness Security Test Orchestration API","version":"1.0.0"},"tags":[{"name":"Target Variants","description":"Access and modify Scan Target Variants"}],"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_testtarget_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":{"TargetVariant":{"type":"object","properties":{"created":{"type":"integer","description":"Unix timestamp at which the resource was created","format":"int64"},"hash":{"type":"string","description":"Git Commit or Container Image hash","maxLength":64},"id":{"type":"string","description":"Resource identifier","pattern":"^[a-zA-Z0-9_-]{22}$"},"isVirtualBaseline":{"type":"boolean","description":"True for the virtual baseline lane entry (one per target, collects every baseline scan across tags). For the lane, parameters.variant holds the current physical tag. Absent/false for real tags and branches."},"lastModified":{"type":"integer","description":"Unix timestamp at which the resource was most recently modified","format":"int64"},"parameters":{"type":"object","description":"Parameters for this Variant, as a JSON-encoded string","additionalProperties":{"type":"string"}},"targetId":{"type":"string","description":"Associated Target ID","pattern":"^[a-zA-Z0-9_-]{22}$"}},"description":"Information about a Scan Target Variant","required":["targetId","parameters","id","created","lastModified"]},"NotFound":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"integer","default":404,"format":"int64"}},"required":["message"]}}},"paths":{"/api/v2/targets/{targetId}/variants/{id}":{"get":{"tags":["Target Variants"],"description":"Find Scan Target Variant by ID","operationId":"Target Variants#FindTargetVariantById","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":"targetId","in":"path","description":"Associated Target ID","required":true,"schema":{"type":"string","description":"Associated Target ID","pattern":"^[a-zA-Z0-9_-]{22}$"}},{"name":"id","in":"path","description":"The ID of the Scan Target Variant to retrieve","required":true,"schema":{"type":"string","description":"The ID of the Scan Target Variant to retrieve","pattern":"^[a-zA-Z0-9_-]{22}$"}},{"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/TargetVariant"}}}},"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"}}}},"404":{"description":"NotFound: Not Found 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"}}}}}}}}}
```

## PUT /api/v2/targets/{targetId}/variants/{id}

> Update an existing Scan Target Variant

```json
{"openapi":"3.0.3","info":{"title":"Harness Security Test Orchestration API","version":"1.0.0"},"tags":[{"name":"Target Variants","description":"Access and modify Scan Target Variants"}],"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_testtarget_edit"]}],"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":{"UpdateTargetVariantRequestBody":{"type":"object","properties":{"hash":{"type":"string","description":"Git Commit or Container Image hash","maxLength":64},"parameters":{"type":"object","description":"Parameters for this Variant, as a JSON-encoded string","additionalProperties":{"type":"string"}}},"required":["parameters","created","lastModified"]},"TargetVariant":{"type":"object","properties":{"created":{"type":"integer","description":"Unix timestamp at which the resource was created","format":"int64"},"hash":{"type":"string","description":"Git Commit or Container Image hash","maxLength":64},"id":{"type":"string","description":"Resource identifier","pattern":"^[a-zA-Z0-9_-]{22}$"},"isVirtualBaseline":{"type":"boolean","description":"True for the virtual baseline lane entry (one per target, collects every baseline scan across tags). For the lane, parameters.variant holds the current physical tag. Absent/false for real tags and branches."},"lastModified":{"type":"integer","description":"Unix timestamp at which the resource was most recently modified","format":"int64"},"parameters":{"type":"object","description":"Parameters for this Variant, as a JSON-encoded string","additionalProperties":{"type":"string"}},"targetId":{"type":"string","description":"Associated Target ID","pattern":"^[a-zA-Z0-9_-]{22}$"}},"description":"Information about a Scan Target Variant","required":["targetId","parameters","id","created","lastModified"]},"NotFound":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"integer","default":404,"format":"int64"}},"required":["message"]}}},"paths":{"/api/v2/targets/{targetId}/variants/{id}":{"put":{"tags":["Target Variants"],"description":"Update an existing Scan Target Variant","operationId":"Target Variants#UpdateTargetVariant","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":"targetId","in":"path","description":"Associated Target ID","required":true,"schema":{"type":"string","description":"Associated Target ID","pattern":"^[a-zA-Z0-9_-]{22}$"}},{"name":"id","in":"path","description":"The ID of the Scan Target Variant to update","required":true,"schema":{"type":"string","description":"The ID of the Scan Target Variant to update","pattern":"^[a-zA-Z0-9_-]{22}$"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTargetVariantRequestBody"}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TargetVariant"}}}},"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"}}}},"404":{"description":"NotFound: Not Found 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"}}}}}}}}}
```
