curl --request POST \
--url https://api.trunk.io/v1/listPullRequests \
--header 'Content-Type: application/json' \
--header 'x-api-token: <api-key>' \
--data '
{
"repo": {
"host": "github.com",
"owner": "trunk-io",
"name": "trunk"
},
"targetBranch": "main",
"since": "2024-01-01T00:00:00Z",
"until": "2024-02-01T00:00:00Z",
"cursor": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"take": 50
}
'import requests
url = "https://api.trunk.io/v1/listPullRequests"
payload = {
"repo": {
"host": "github.com",
"owner": "trunk-io",
"name": "trunk"
},
"targetBranch": "main",
"since": "2024-01-01T00:00:00Z",
"until": "2024-02-01T00:00:00Z",
"cursor": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"take": 50
}
headers = {
"x-api-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
repo: {host: 'github.com', owner: 'trunk-io', name: 'trunk'},
targetBranch: 'main',
since: '2024-01-01T00:00:00Z',
until: '2024-02-01T00:00:00Z',
cursor: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
take: 50
})
};
fetch('https://api.trunk.io/v1/listPullRequests', 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.trunk.io/v1/listPullRequests",
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([
'repo' => [
'host' => 'github.com',
'owner' => 'trunk-io',
'name' => 'trunk'
],
'targetBranch' => 'main',
'since' => '2024-01-01T00:00:00Z',
'until' => '2024-02-01T00:00:00Z',
'cursor' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'take' => 50
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-token: <api-key>"
],
]);
$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.trunk.io/v1/listPullRequests"
payload := strings.NewReader("{\n \"repo\": {\n \"host\": \"github.com\",\n \"owner\": \"trunk-io\",\n \"name\": \"trunk\"\n },\n \"targetBranch\": \"main\",\n \"since\": \"2024-01-01T00:00:00Z\",\n \"until\": \"2024-02-01T00:00:00Z\",\n \"cursor\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"take\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-token", "<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.trunk.io/v1/listPullRequests")
.header("x-api-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"repo\": {\n \"host\": \"github.com\",\n \"owner\": \"trunk-io\",\n \"name\": \"trunk\"\n },\n \"targetBranch\": \"main\",\n \"since\": \"2024-01-01T00:00:00Z\",\n \"until\": \"2024-02-01T00:00:00Z\",\n \"cursor\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"take\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trunk.io/v1/listPullRequests")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"repo\": {\n \"host\": \"github.com\",\n \"owner\": \"trunk-io\",\n \"name\": \"trunk\"\n },\n \"targetBranch\": \"main\",\n \"since\": \"2024-01-01T00:00:00Z\",\n \"until\": \"2024-02-01T00:00:00Z\",\n \"cursor\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"take\": 50\n}"
response = http.request(request)
puts response.read_body{
"pullRequests": [
{
"stateChangedAt": "<string>",
"priorityValue": 123,
"priorityName": "<string>",
"skipTheLine": true,
"noBatch": true,
"prNumber": 123,
"prTitle": "<string>",
"prSha": "<string>",
"prBaseBranch": "<string>",
"prAuthor": "<string>",
"id": "<string>",
"state": "not_ready",
"usedDefaultPriorityName": "<string>"
}
],
"nextCursor": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}"<string>""<string>""<string>""<string>"List pull requests in a merge queue.
Returns a paginated list of pull requests in the merge queue. Optionally filter by state and/or by a time range for concluded pull requests.
curl --request POST \
--url https://api.trunk.io/v1/listPullRequests \
--header 'Content-Type: application/json' \
--header 'x-api-token: <api-key>' \
--data '
{
"repo": {
"host": "github.com",
"owner": "trunk-io",
"name": "trunk"
},
"targetBranch": "main",
"since": "2024-01-01T00:00:00Z",
"until": "2024-02-01T00:00:00Z",
"cursor": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"take": 50
}
'import requests
url = "https://api.trunk.io/v1/listPullRequests"
payload = {
"repo": {
"host": "github.com",
"owner": "trunk-io",
"name": "trunk"
},
"targetBranch": "main",
"since": "2024-01-01T00:00:00Z",
"until": "2024-02-01T00:00:00Z",
"cursor": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"take": 50
}
headers = {
"x-api-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
repo: {host: 'github.com', owner: 'trunk-io', name: 'trunk'},
targetBranch: 'main',
since: '2024-01-01T00:00:00Z',
until: '2024-02-01T00:00:00Z',
cursor: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
take: 50
})
};
fetch('https://api.trunk.io/v1/listPullRequests', 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.trunk.io/v1/listPullRequests",
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([
'repo' => [
'host' => 'github.com',
'owner' => 'trunk-io',
'name' => 'trunk'
],
'targetBranch' => 'main',
'since' => '2024-01-01T00:00:00Z',
'until' => '2024-02-01T00:00:00Z',
'cursor' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'take' => 50
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-token: <api-key>"
],
]);
$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.trunk.io/v1/listPullRequests"
payload := strings.NewReader("{\n \"repo\": {\n \"host\": \"github.com\",\n \"owner\": \"trunk-io\",\n \"name\": \"trunk\"\n },\n \"targetBranch\": \"main\",\n \"since\": \"2024-01-01T00:00:00Z\",\n \"until\": \"2024-02-01T00:00:00Z\",\n \"cursor\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"take\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-token", "<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.trunk.io/v1/listPullRequests")
.header("x-api-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"repo\": {\n \"host\": \"github.com\",\n \"owner\": \"trunk-io\",\n \"name\": \"trunk\"\n },\n \"targetBranch\": \"main\",\n \"since\": \"2024-01-01T00:00:00Z\",\n \"until\": \"2024-02-01T00:00:00Z\",\n \"cursor\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"take\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trunk.io/v1/listPullRequests")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"repo\": {\n \"host\": \"github.com\",\n \"owner\": \"trunk-io\",\n \"name\": \"trunk\"\n },\n \"targetBranch\": \"main\",\n \"since\": \"2024-01-01T00:00:00Z\",\n \"until\": \"2024-02-01T00:00:00Z\",\n \"cursor\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"take\": 50\n}"
response = http.request(request)
puts response.read_body{
"pullRequests": [
{
"stateChangedAt": "<string>",
"priorityValue": 123,
"priorityName": "<string>",
"skipTheLine": true,
"noBatch": true,
"prNumber": 123,
"prTitle": "<string>",
"prSha": "<string>",
"prBaseBranch": "<string>",
"prAuthor": "<string>",
"id": "<string>",
"state": "not_ready",
"usedDefaultPriorityName": "<string>"
}
],
"nextCursor": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}"<string>""<string>""<string>""<string>"Authorizations
Body
Show child attributes
Show child attributes
The target branch of the merge queue.
"main"
Optional filter for the state of pull requests. If not provided, pull requests of all states will be returned.
not_ready, pending, testing, tests_passed, merged, failed, cancelled, pending_failure Optional ISO 8601 timestamp. When provided, returns pull requests that concluded (merged, failed, or cancelled) since this time. Defaults to the beginning of time when only until is provided.
"2024-01-01T00:00:00Z"
Optional ISO 8601 timestamp bounding the upper end of the concluded time range. When either since or until is provided, only pull requests that concluded (merged, failed, or cancelled) within the range are returned. Defaults to now.
"2024-02-01T00:00:00Z"
Optional cursor for pagination. Use the nextCursor from the previous response.
Number of pull requests to return (1-100). Defaults to 50.
1 <= x <= 100Was this page helpful?