# Test Run

## Trigger Test Run for a specific Target

> A Test Run is triggered for a specific target, each test run contains a set of probes used to check for specific vulnerabilities. These probes are pre-configured through the platform's UI.

```json
{"openapi":"3.0.4","info":{"title":"API","version":"v1.0"},"tags":[{"name":"TestRun","description":"The API provides endpoints for triggering and canceling test runs, and for retrieving detailed information about their execution status and results."}],"servers":[{"url":"https://api.probe.splx.ai","description":"EU Server"},{"url":"https://us.api.probe.splx.ai","description":"US Server"}],"security":[{"API Key":[]}],"components":{"securitySchemes":{"API Key":{"type":"apiKey","description":"API Key for authentication","name":"X-Api-Key","in":"header"}},"schemas":{"TriggerTestRunRequest":{"required":["name","notifyWhenFinished","probeIds","runAiAnalysis","targetId"],"type":"object","properties":{"targetId":{"type":"integer","description":"The id of the Target for which the Test Run will be triggered.","format":"int32"},"probeIds":{"type":"array","items":{"type":"integer","format":"int32"},"description":"The ids of the Probes that will be used in a Test Run.","nullable":true},"name":{"type":"string","description":"Name of the Test Run."},"notifyWhenFinished":{"type":"boolean","default":false},"runAiAnalysis":{"type":"boolean","default":false}},"additionalProperties":false,"description":"Request payload to trigger the execution of a Test Run."},"TestRunTriggerDto":{"required":["testRunId"],"type":"object","properties":{"testRunId":{"type":"integer","description":"The id of the Test Run.","format":"int32"}},"additionalProperties":false,"description":"Response payload to triggered Test Run."},"ErrorResponse":{"required":["error"],"type":"object","properties":{"error":{"oneOf":[{"$ref":"#/components/schemas/ErrorDetailsDto"},{"$ref":"#/components/schemas/BadRequestErrorDetailsDto"}],"description":"Error object."}},"additionalProperties":false,"description":"Response payload for error."},"ErrorDetailsDto":{"required":["message"],"type":"object","properties":{"message":{"type":"string","description":"Error detailed message."},"code":{"type":"string","description":"Error code."}},"additionalProperties":false},"BadRequestErrorDetailsDto":{"type":"object","allOf":[{"$ref":"#/components/schemas/ErrorDetailsDto"}],"properties":{"validationErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"description":"Specific validation errors.","nullable":true}},"additionalProperties":false},"UnauthorizedError":{"type":"object","allOf":[{"$ref":"#/components/schemas/ErrorResponse"}],"additionalProperties":false,"description":"Response payload for Unauthorized access error."},"UnauthorizedWithLogoutError":{"type":"object","allOf":[{"$ref":"#/components/schemas/ErrorResponse"}],"additionalProperties":false,"description":"Response payload for Unauthorized access error."},"ForbiddenError":{"type":"object","allOf":[{"$ref":"#/components/schemas/ErrorResponse"}],"additionalProperties":false,"description":"Response payload for Forbidden access error."},"InternalServerError":{"type":"object","allOf":[{"$ref":"#/components/schemas/ErrorResponse"}],"additionalProperties":false,"description":"Response payload for Internal Server error."},"NotFoundExampleError":{"type":"object","allOf":[{"$ref":"#/components/schemas/ErrorResponse"}],"additionalProperties":false,"description":"Response payload for Not Found error."}}},"paths":{"/api/workspaces/{workspaceId}/test-run/trigger":{"post":{"tags":["TestRun"],"summary":"Trigger Test Run for a specific Target","description":"A Test Run is triggered for a specific target, each test run contains a set of probes used to check for specific vulnerabilities. These probes are pre-configured through the platform's UI.","parameters":[{"name":"workspaceId","in":"path","description":"Workspace Id.","required":true,"schema":{"type":"integer","format":"int32"}}],"requestBody":{"content":{"application/json-patch+json":{"schema":{"$ref":"#/components/schemas/TriggerTestRunRequest"}},"application/json":{"schema":{"$ref":"#/components/schemas/TriggerTestRunRequest"}},"text/json":{"schema":{"$ref":"#/components/schemas/TriggerTestRunRequest"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/TriggerTestRunRequest"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestRunTriggerDto"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ErrorResponse"},{"$ref":"#/components/schemas/UnauthorizedError"},{"$ref":"#/components/schemas/UnauthorizedWithLogoutError"},{"$ref":"#/components/schemas/ForbiddenError"},{"$ref":"#/components/schemas/InternalServerError"},{"$ref":"#/components/schemas/NotFoundExampleError"}],"description":"Response payload for error."}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenError"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}}}}}
```

## Cancel Test Run execution

> Immediately cancel Test Run execution.

```json
{"openapi":"3.0.4","info":{"title":"API","version":"v1.0"},"tags":[{"name":"TestRun","description":"The API provides endpoints for triggering and canceling test runs, and for retrieving detailed information about their execution status and results."}],"servers":[{"url":"https://api.probe.splx.ai","description":"EU Server"},{"url":"https://us.api.probe.splx.ai","description":"US Server"}],"security":[{"API Key":[]}],"components":{"securitySchemes":{"API Key":{"type":"apiKey","description":"API Key for authentication","name":"X-Api-Key","in":"header"}},"schemas":{"ErrorResponse":{"required":["error"],"type":"object","properties":{"error":{"oneOf":[{"$ref":"#/components/schemas/ErrorDetailsDto"},{"$ref":"#/components/schemas/BadRequestErrorDetailsDto"}],"description":"Error object."}},"additionalProperties":false,"description":"Response payload for error."},"ErrorDetailsDto":{"required":["message"],"type":"object","properties":{"message":{"type":"string","description":"Error detailed message."},"code":{"type":"string","description":"Error code."}},"additionalProperties":false},"BadRequestErrorDetailsDto":{"type":"object","allOf":[{"$ref":"#/components/schemas/ErrorDetailsDto"}],"properties":{"validationErrors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"description":"Specific validation errors.","nullable":true}},"additionalProperties":false},"UnauthorizedError":{"type":"object","allOf":[{"$ref":"#/components/schemas/ErrorResponse"}],"additionalProperties":false,"description":"Response payload for Unauthorized access error."},"UnauthorizedWithLogoutError":{"type":"object","allOf":[{"$ref":"#/components/schemas/ErrorResponse"}],"additionalProperties":false,"description":"Response payload for Unauthorized access error."},"ForbiddenError":{"type":"object","allOf":[{"$ref":"#/components/schemas/ErrorResponse"}],"additionalProperties":false,"description":"Response payload for Forbidden access error."},"InternalServerError":{"type":"object","allOf":[{"$ref":"#/components/schemas/ErrorResponse"}],"additionalProperties":false,"description":"Response payload for Internal Server error."},"NotFoundExampleError":{"type":"object","allOf":[{"$ref":"#/components/schemas/ErrorResponse"}],"additionalProperties":false,"description":"Response payload for Not Found error."}}},"paths":{"/api/workspaces/{workspaceId}/test-run/{testRunId}/cancel":{"post":{"tags":["TestRun"],"summary":"Cancel Test Run execution","description":"Immediately cancel Test Run execution.","parameters":[{"name":"testRunId","in":"path","description":"Test Run id.","required":true,"schema":{"type":"integer","format":"int32"}},{"name":"workspaceId","in":"path","description":"Workspace Id.","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"OK"},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ErrorResponse"},{"$ref":"#/components/schemas/UnauthorizedError"},{"$ref":"#/components/schemas/UnauthorizedWithLogoutError"},{"$ref":"#/components/schemas/ForbiddenError"},{"$ref":"#/components/schemas/InternalServerError"},{"$ref":"#/components/schemas/NotFoundExampleError"}],"description":"Response payload for error."}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenError"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerError"}}}}}}}}}
```
