Create comment
curl --request POST \
--url https://api.cybr.com/api/v2/labs/{labId}/comments \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'x-cybr-learner-id: <x-cybr-learner-id>' \
--data '
{
"body": "Example question"
}
'import requests
url = "https://api.cybr.com/api/v2/labs/{labId}/comments"
payload = { "body": "Example question" }
headers = {
"x-cybr-learner-id": "<x-cybr-learner-id>",
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-cybr-learner-id': '<x-cybr-learner-id>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({body: JSON.stringify('Example question')})
};
fetch('https://api.cybr.com/api/v2/labs/{labId}/comments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cybr.com/api/v2/labs/{labId}/comments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'body' => 'Example question'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>",
"x-cybr-learner-id: <x-cybr-learner-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cybr.com/api/v2/labs/{labId}/comments"
payload := strings.NewReader("{\n \"body\": \"Example question\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-cybr-learner-id", "<x-cybr-learner-id>")
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cybr.com/api/v2/labs/{labId}/comments")
.header("x-cybr-learner-id", "<x-cybr-learner-id>")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"body\": \"Example question\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cybr.com/api/v2/labs/{labId}/comments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-cybr-learner-id"] = '<x-cybr-learner-id>'
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"body\": \"Example question\"\n}"
response = http.request(request)
puts response.read_body{
"id": "comment_id",
"authorName": "Learner",
"body": "Example question",
"createdAt": "2026-01-01T00:00:00Z",
"ownedByViewer": true,
"deleted": false,
"replies": []
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}REST API endpoints
Create comment
Creates a top-level comment or a reply to a top-level comment. SDK: labs.createComment().
Create comment
curl --request POST \
--url https://api.cybr.com/api/v2/labs/{labId}/comments \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'x-cybr-learner-id: <x-cybr-learner-id>' \
--data '
{
"body": "Example question"
}
'import requests
url = "https://api.cybr.com/api/v2/labs/{labId}/comments"
payload = { "body": "Example question" }
headers = {
"x-cybr-learner-id": "<x-cybr-learner-id>",
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-cybr-learner-id': '<x-cybr-learner-id>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({body: JSON.stringify('Example question')})
};
fetch('https://api.cybr.com/api/v2/labs/{labId}/comments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cybr.com/api/v2/labs/{labId}/comments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'body' => 'Example question'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>",
"x-cybr-learner-id: <x-cybr-learner-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cybr.com/api/v2/labs/{labId}/comments"
payload := strings.NewReader("{\n \"body\": \"Example question\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-cybr-learner-id", "<x-cybr-learner-id>")
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cybr.com/api/v2/labs/{labId}/comments")
.header("x-cybr-learner-id", "<x-cybr-learner-id>")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"body\": \"Example question\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cybr.com/api/v2/labs/{labId}/comments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-cybr-learner-id"] = '<x-cybr-learner-id>'
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"body\": \"Example question\"\n}"
response = http.request(request)
puts response.read_body{
"id": "comment_id",
"authorName": "Learner",
"body": "Example question",
"createdAt": "2026-01-01T00:00:00Z",
"ownedByViewer": true,
"deleted": false,
"replies": []
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}{
"message": "<string>",
"retryAfter": 123,
"activeCount": 123,
"limit": 123,
"errors": [
"<string>"
]
}SDK:
labs.createComment().Authorizations
Headers
Learner ID from the server session.
Required string length:
1 - 500Path Parameters
Body
application/json
Was this page helpful?
