Create Code Review
curl --request POST \
--url https://getunblocked.com/api/v1/code-reviews \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prUrl": "https://github.com/acme/backend/pull/123",
"headSha": "8a1b2c3d4e5f678901234567890123456789abcd",
"deepReview": true
}
'import requests
url = "https://getunblocked.com/api/v1/code-reviews"
payload = {
"prUrl": "https://github.com/acme/backend/pull/123",
"headSha": "8a1b2c3d4e5f678901234567890123456789abcd",
"deepReview": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prUrl: 'https://github.com/acme/backend/pull/123',
headSha: '8a1b2c3d4e5f678901234567890123456789abcd',
deepReview: true
})
};
fetch('https://getunblocked.com/api/v1/code-reviews', 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://getunblocked.com/api/v1/code-reviews",
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([
'prUrl' => 'https://github.com/acme/backend/pull/123',
'headSha' => '8a1b2c3d4e5f678901234567890123456789abcd',
'deepReview' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://getunblocked.com/api/v1/code-reviews"
payload := strings.NewReader("{\n \"prUrl\": \"https://github.com/acme/backend/pull/123\",\n \"headSha\": \"8a1b2c3d4e5f678901234567890123456789abcd\",\n \"deepReview\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://getunblocked.com/api/v1/code-reviews")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prUrl\": \"https://github.com/acme/backend/pull/123\",\n \"headSha\": \"8a1b2c3d4e5f678901234567890123456789abcd\",\n \"deepReview\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://getunblocked.com/api/v1/code-reviews")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prUrl\": \"https://github.com/acme/backend/pull/123\",\n \"headSha\": \"8a1b2c3d4e5f678901234567890123456789abcd\",\n \"deepReview\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "processing",
"headSha": "8a1b2c3d4e5f678901234567890123456789abcd",
"prUrl": "https://github.com/acme/backend/pull/123",
"headBranch": "feature/add-validation",
"baseBranch": "main",
"trigger": "Public API",
"deepReview": true,
"error": "Unable to retrieve the pull request diff.",
"comments": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filePath": "src/auth/session.kt",
"lineSide": "right",
"startLine": 42,
"endLine": 45,
"category": "LogicError",
"title": "Expired sessions remain valid",
"description": "Check the session expiration before allowing the request."
}
]
}{
"message": "<string>",
"documentationUrl": "<string>"
}Code Reviews
Create Code Review
Start an asynchronous code review for the pull request identified by prUrl.
The URL is normalized to identify the pull request, accepting equivalent pull request URL forms.
Optionally provide headSha to review a specific commit on the pull request branch; otherwise the current head is used.
The response includes the review ID (reviewId), head commit SHA, and base branch.
Poll GET /code-reviews/{reviewId} until the status is complete or failed.
This operation does not post comments, reviews, or statuses to the pull request or modify it.
POST
/
code-reviews
Create Code Review
curl --request POST \
--url https://getunblocked.com/api/v1/code-reviews \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prUrl": "https://github.com/acme/backend/pull/123",
"headSha": "8a1b2c3d4e5f678901234567890123456789abcd",
"deepReview": true
}
'import requests
url = "https://getunblocked.com/api/v1/code-reviews"
payload = {
"prUrl": "https://github.com/acme/backend/pull/123",
"headSha": "8a1b2c3d4e5f678901234567890123456789abcd",
"deepReview": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prUrl: 'https://github.com/acme/backend/pull/123',
headSha: '8a1b2c3d4e5f678901234567890123456789abcd',
deepReview: true
})
};
fetch('https://getunblocked.com/api/v1/code-reviews', 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://getunblocked.com/api/v1/code-reviews",
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([
'prUrl' => 'https://github.com/acme/backend/pull/123',
'headSha' => '8a1b2c3d4e5f678901234567890123456789abcd',
'deepReview' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://getunblocked.com/api/v1/code-reviews"
payload := strings.NewReader("{\n \"prUrl\": \"https://github.com/acme/backend/pull/123\",\n \"headSha\": \"8a1b2c3d4e5f678901234567890123456789abcd\",\n \"deepReview\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://getunblocked.com/api/v1/code-reviews")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prUrl\": \"https://github.com/acme/backend/pull/123\",\n \"headSha\": \"8a1b2c3d4e5f678901234567890123456789abcd\",\n \"deepReview\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://getunblocked.com/api/v1/code-reviews")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prUrl\": \"https://github.com/acme/backend/pull/123\",\n \"headSha\": \"8a1b2c3d4e5f678901234567890123456789abcd\",\n \"deepReview\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "processing",
"headSha": "8a1b2c3d4e5f678901234567890123456789abcd",
"prUrl": "https://github.com/acme/backend/pull/123",
"headBranch": "feature/add-validation",
"baseBranch": "main",
"trigger": "Public API",
"deepReview": true,
"error": "Unable to retrieve the pull request diff.",
"comments": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filePath": "src/auth/session.kt",
"lineSide": "right",
"startLine": 42,
"endLine": 45,
"category": "LogicError",
"title": "Expired sessions remain valid",
"description": "Check the session expiration before allowing the request."
}
]
}{
"message": "<string>",
"documentationUrl": "<string>"
}Authorizations
Body
application/json
Response
Accepted - The run has been queued