# Await the completion of a check session (v2) - Checkly Docs

> Call this endpoint to await the completion of a check session. A successful response will be returned once the check session reaches its final state (i.e. when it passes, fails, degrades, or is cancelled). If the check session takes a long time to complete, the endpoint will return a timeout error code. You should keep calling the endpoint until you receive a successful response, or a non-timeout related error code. If using curl, its --retry option is suitable. The successful response of this endpoint is equivalent to the GET /v2/check-sessions/{checkSessionId} endpoint's response for a completed check session. The status field may return CANCELLED for sessions cancelled via POST /v1/check-sessions/{checkSessionId}/cancel, and each per-result object includes an isCancelled boolean.

Source: https://www.checklyhq.com/docs/api-reference/check-sessions/await-the-completion-of-a-check-session-v2/

---

Await the completion of a check session

```
curl --request GET \
--url https://api.checklyhq.com/v2/check-sessions/{checkSessionId}/completion \
--header 'Authorization: Bearer '
```

```
import requests

url = "https://api.checklyhq.com/v2/check-sessions/{checkSessionId}/completion"

headers = {"Authorization": "Bearer "}

response = requests.get(url, headers=headers)

print(response.text)
```

```
const options = {method: 'GET', headers: {Authorization: 'Bearer '}};

fetch('https://api.checklyhq.com/v2/check-sessions/{checkSessionId}/completion', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
```

```
"https://api.checklyhq.com/v2/check-sessions/{checkSessionId}/completion",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer "
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
```

```
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.checklyhq.com/v2/check-sessions/{checkSessionId}/completion"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer ")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
```

```
HttpResponse response = Unirest.get("https://api.checklyhq.com/v2/check-sessions/{checkSessionId}/completion")
.header("Authorization", "Bearer ")
.asString();
```

```
require 'uri'
require 'net/http'

url = URI("https://api.checklyhq.com/v2/check-sessions/{checkSessionId}/completion")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer '

response = http.request(request)
puts response.read_body
```

```
{
"checkSessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"checkSessionLink": " ",
"checkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"checkType": "AGENTIC",
"status": "PASSED",
"startedAt": "2023-11-07T05:31:56Z",
"stoppedAt": "2023-11-07T05:31:56Z",
"timeElapsed": 123,
"runLocations": [
" "
],
"runSource": "CLI_DEPLOY",
"results": [
{
"checkResultId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"checkResultLink": " ",
"checkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"checkType": "AGENTIC",
"name": " ",
"runLocation": " ",
"resultType": "FINAL",
"hasErrors": true,
"hasFailures": true,
"isDegraded": true,
"aborted": true,
"isCancelled": true,
"responseTime": 123,
"startedAt": "2023-11-07T05:31:56Z",
"stoppedAt": "2023-11-07T05:31:56Z"
}
],
"name": " "
}
```

```
{
"statusCode": 123,
"error": " ",
"message": " ",
"errorCode": "ERR_ACCOUNT_NOT_ACCESSIBLE"
}
```

```
{
"statusCode": 123,
"error": " ",
"message": " ",
"errorCode": "ERR_ACCOUNT_NOT_ACCESSIBLE"
}
```

```
{
"statusCode": 123,
"error": " ",
"message": " ",
"errorCode": "ERR_ACCOUNT_NOT_ACCESSIBLE"
}
```

```
{
"statusCode": 123,
"error": " ",
"message": " ",
"errorCode": "ERR_ACCOUNT_NOT_ACCESSIBLE"
}
```

```
{
"statusCode": 123,
"error": " ",
"message": " ",
"errorCode": "ERR_ACCOUNT_NOT_ACCESSIBLE"
}
```

```
{
"statusCode": 123,
"error": " ",
"message": " ",
"errorCode": "ERR_ACCOUNT_NOT_ACCESSIBLE"
}
```

Check Sessions

# Await the completion of a check session (v2)

Call this endpoint to await the completion of a check session. A successful response will be returned once the check session reaches its final state (i.e. when it passes, fails, degrades, or is cancelled).

If the check session takes a long time to complete, the endpoint will return a timeout error code. You should keep calling the endpoint until you receive a successful response, or a non-timeout related error code. If using _curl_, its `--retry` option is suitable.

The successful response of this endpoint is equivalent to the `GET /v2/check-sessions/{checkSessionId}` endpoint’s response for a completed check session.

The `status` field may return `CANCELLED` for sessions cancelled via `POST /v1/check-sessions/{checkSessionId}/cancel`, and each per-result object includes an `isCancelled` boolean.

GET

/

v2

/

check-sessions

/

{checkSessionId}

/

completion

Await the completion of a check session

```
curl --request GET \
--url https://api.checklyhq.com/v2/check-sessions/{checkSessionId}/completion \
--header 'Authorization: Bearer '
```

```
import requests

url = "https://api.checklyhq.com/v2/check-sessions/{checkSessionId}/completion"

headers = {"Authorization": "Bearer "}

response = requests.get(url, headers=headers)

print(response.text)
```

```
const options = {method: 'GET', headers: {Authorization: 'Bearer '}};

fetch('https://api.checklyhq.com/v2/check-sessions/{checkSessionId}/completion', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
```

```
"https://api.checklyhq.com/v2/check-sessions/{checkSessionId}/completion",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer "
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
```

```
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.checklyhq.com/v2/check-sessions/{checkSessionId}/completion"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer ")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
```

```
HttpResponse response = Unirest.get("https://api.checklyhq.com/v2/check-sessions/{checkSessionId}/completion")
.header("Authorization", "Bearer ")
.asString();
```

```
require 'uri'
require 'net/http'

url = URI("https://api.checklyhq.com/v2/check-sessions/{checkSessionId}/completion")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer '

response = http.request(request)
puts response.read_body
```

```
{
"checkSessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"checkSessionLink": " ",
"checkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"checkType": "AGENTIC",
"status": "PASSED",
"startedAt": "2023-11-07T05:31:56Z",
"stoppedAt": "2023-11-07T05:31:56Z",
"timeElapsed": 123,
"runLocations": [
" "
],
"runSource": "CLI_DEPLOY",
"results": [
{
"checkResultId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"checkResultLink": " ",
"checkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"checkType": "AGENTIC",
"name": " ",
"runLocation": " ",
"resultType": "FINAL",
"hasErrors": true,
"hasFailures": true,
"isDegraded": true,
"aborted": true,
"isCancelled": true,
"responseTime": 123,
"startedAt": "2023-11-07T05:31:56Z",
"stoppedAt": "2023-11-07T05:31:56Z"
}
],
"name": " "
}
```

```
{
"statusCode": 123,
"error": " ",
"message": " ",
"errorCode": "ERR_ACCOUNT_NOT_ACCESSIBLE"
}
```

```
{
"statusCode": 123,
"error": " ",
"message": " ",
"errorCode": "ERR_ACCOUNT_NOT_ACCESSIBLE"
}
```

```
{
"statusCode": 123,
"error": " ",
"message": " ",
"errorCode": "ERR_ACCOUNT_NOT_ACCESSIBLE"
}
```

```
{
"statusCode": 123,
"error": " ",
"message": " ",
"errorCode": "ERR_ACCOUNT_NOT_ACCESSIBLE"
}
```

```
{
"statusCode": 123,
"error": " ",
"message": " ",
"errorCode": "ERR_ACCOUNT_NOT_ACCESSIBLE"
}
```

```
{
"statusCode": 123,
"error": " ",
"message": " ",
"errorCode": "ERR_ACCOUNT_NOT_ACCESSIBLE"
}
```

#### Authorizations

Authorization

string

header

required

The Checkly Public API uses API keys to authenticate requests. You can get the API Key [here](https://app.checklyhq.com/settings/user/api-keys).
Your API key is like a password:
keep it secure!

Authentication to the API is performed using the Bearer auth method in the Authorization header and using the account ID.

For example, set Authorization header while using cURL: `curl -H "Authorization: Bearer [apiKey]" "X-Checkly-Account: [accountId]"`

#### Headers

x-checkly-account

string<uuid>

Your Checkly account ID, you can find it at [https://app.checklyhq.com/settings/account/general](https://app.checklyhq.com/settings/account/general)

#### Path Parameters

checkSessionId

string<uuid>

required

Check session ID.

#### Query Parameters

maxWaitSeconds

integer

Maximum time to wait for completion before returning a retryable timeout response.

Required range: `1

#### Response

Successful

checkSessionId

string<uuid>

required

checkSessionLink

string<uri>

required

checkId

string<uuid>

required

checkType

enum<string>

required

Available options: `AGENTIC`,

`API`,

`BROWSER`,

`HEARTBEAT`,

`ICMP`,

`MULTI_STEP`,

`TCP`,

`PLAYWRIGHT`,

`URL`,

`DNS`,

`SSL`,

`GRPC`,

`TRACEROUTE`

status

enum<string>

required

Available options: `PASSED`,

`FAILED`,

`DEGRADED`,

`TIMED_OUT`,

`CANCELLED`

startedAt

string<date-time>

required

stoppedAt

string<date-time>

required

timeElapsed

number

required

runLocations

string[]

required

runSource

enum<string> | null

required

Available options: `CLI_DEPLOY`,

`DEPLOYMENT`,

`DEPLOYMENT_CACHE_WARMER`,

`EDITOR`,

`GROUP_RUN_ALL`,

`LEGACY_TRIGGER`,

`SCHEDULER`,

`SCHEDULE_NOW`,

`TEST_NO_RECORD`,

`TEST_RECORD`,

`TRIGGER_NO_RECORD`,

`TRIGGER_RECORD`,

`TRIGGER_API`,

`null`

results

object[]

required

Show child attributes

name

string

Was this page helpful?

[Suggest edits](https://github.com/checkly/docs/edit/main/api-reference/check-sessions/await-the-completion-of-a-check-session-v2.mdx)[Raise issue](https://github.com/checkly/docs/issues/new?title=Issue%20on%20docs&body=Path:%20/api-reference/check-sessions/await-the-completion-of-a-check-session-v2)

[Await the completion of a check session Previous](https://www.checklyhq.com/docs/api-reference/check-sessions/await-the-completion-of-a-check-session)[Cancel a check session Next](https://www.checklyhq.com/docs/api-reference/check-sessions/cancel-a-check-session)

[x](https://x.com/checklyhq)[github](https://github.com/checkly)[linkedin](https://linkedin.com/company/checkly)

[Powered by This documentation is built and hosted on Mintlify, a developer documentation platform](https://www.mintlify.com/?utm_campaign=poweredBy&utm_medium=referral&utm_source=checkly-422f444a)
