# Instances

Query spec file execution instances.

An instance represents a single spec file execution within a run. It contains detailed information about test results, duration, and machine that executed the spec file.

## Get instance

> Get a single spec file execution instance by ID with full test results

```json
{"openapi":"3.0.2","info":{"title":"Currents REST API","version":"1.0.0"},"tags":[{"name":"Instances","description":"Query spec file execution instances.\n\nAn instance represents a single spec file execution within a run. It contains\ndetailed information about test results, duration, and machine that executed\nthe spec file."}],"servers":[{"url":"https://api.currents.dev/v1","description":"Production API"},{"url":"https://api-staging.currents.dev/v1","description":"Staging API"},{"url":"http://localhost:4000/v1","description":"Local development"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key authentication using Bearer token"}},"parameters":{"InstanceIdPath":{"name":"instanceId","in":"path","required":true,"description":"The instance ID","schema":{"type":"string"}}},"schemas":{"InstanceResponse":{"type":"object","required":["status","data"],"properties":{"status":{"type":"string","enum":["OK"]},"data":{"$ref":"#/components/schemas/Instance"}}},"Instance":{"type":"object","properties":{"instanceId":{"type":"string","description":"Unique identifier for the instance"},"runId":{"type":"string"},"groupId":{"type":"string"},"spec":{"type":"string","description":"Spec file path"},"machineId":{"type":"string"},"claimedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true},"results":{"type":"object","nullable":true,"properties":{"stats":{"type":"object","description":"Instance-level totals. Uses `RecordedTestOutcome` (see components/schemas).","properties":{"tests":{"type":"integer"},"passes":{"type":"integer"},"failures":{"type":"integer"},"pending":{"type":"integer","description":"**pending** outcomes (intentional skips)."},"skipped":{"type":"integer","description":"**skipped** outcomes (runner skip / interrupted)."}}},"exception":{"type":"string","nullable":true},"flaky":{"type":"integer"},"tests":{"type":"array","items":{"$ref":"#/components/schemas/InstanceTest"}}}}}},"InstanceTest":{"type":"object","properties":{"testId":{"type":"string"},"title":{"type":"array","items":{"type":"string"}},"state":{"$ref":"#/components/schemas/RecordedTestOutcome"},"displayError":{"type":"string","nullable":true},"attempts":{"type":"array","items":{"type":"object","properties":{"attemptId":{"type":"string"},"state":{"type":"string"},"wallClockStartedAt":{"type":"string","format":"date-time"},"wallClockDuration":{"type":"integer"},"error":{"type":"object","nullable":true,"properties":{"message":{"type":"string"},"stack":{"type":"string"}}}}}}}},"RecordedTestOutcome":{"type":"string","description":"Final per-test outcome stored in Currents.\n\n- **passed** — Runner reported success.\n- **failed** — Runner reported failure (assertions, errors, timeouts, etc.).\n- **pending** — Intentional skip or disabled test (e.g. `test.skip()` / `it.skip()`). In **Tests Explorer** (`GET /tests/{projectId}`) this increments `metrics.ignored` and does **not** increment `metrics.failures`.\n- **skipped** — Runner reported a skip without a normal pass/fail (often interrupted or never executed as pass/fail). In **Tests Explorer** this increments `metrics.failures` together with `failed` (there is no separate `skipped` counter in that response). On **run and spec** payloads, `stats.skipped` is still reported separately from `stats.failures` and `stats.pending`.","enum":["passed","failed","pending","skipped"]},"ErrorResponse":{"type":"object","required":["status","error"],"properties":{"status":{"type":"string","enum":["FAILED"]},"error":{"type":"string","description":"Error message"}}}},"responses":{"BadRequest":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Authentication failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/instances/{instanceId}":{"get":{"summary":"Get instance","description":"Get a single spec file execution instance by ID with full test results","operationId":"getInstance","tags":["Instances"],"parameters":[{"$ref":"#/components/parameters/InstanceIdPath"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstanceResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.currents.dev/api/resources/instances.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
