---
title: Get a pull request
description: A pull request with Hacktron's review of it.
url: https://www.hacktron.ai/docs/api/pull-requests/get-pull-request
---

# Get a pull request

Returns a pull or merge request with Hacktron's [review](/docs/review) of its head commit. Send either its `url`, or `repository_id` from [`GET /repos`](/docs/api/repos/list-repos) with its `number`.

`review` is `null` when the head commit has no review. Otherwise its `status` is `in_progress` or `completed`, and its `scan_id` reads the review's findings with [`GET /scans/{id}/findings`](/docs/api/scans/list-scan-findings). To start a review, call [`POST /pull-requests/review`](/docs/api/pull-requests/review-pull-request).

## Request

`GET /pull-requests/details`

Send an [API key](/docs/api/authentication) with the `read` scope in the `X-Api-Key` header.

:::examples

```bash title="Request" wrap=false
curl -G "https://api.hacktron.ai/v1/pull-requests/details" \
  -H "X-Api-Key: $HACKTRON_API_KEY" \
  --data-urlencode "url=https://github.com/acme/api/pull/42"
```

```json title="Response 200 OK" showLineNumbers=false wrap=false
{
  "repository_id": "123e4567-e89b-12d3-a456-426614174000",
  "repository": "acme/api",
  "provider": "github",
  "number": 42,
  "title": "Add link previews",
  "url": "https://github.com/acme/api/pull/42",
  "author": "alice",
  "is_yours": true,
  "draft": false,
  "source_branch": "feat/link-previews",
  "target_branch": "main",
  "updated_at": "2026-11-08T09:41:20.000Z",
  "state": "open",
  "head_sha": "4b825dc642cb6eb9a060e54bf8d69288fbee4904",
  "review": {
    "scan_id": "6f1c2d3e-4a5b-4c6d-8e7f-9a0b1c2d3e4f",
    "task_id": "string",
    "status": "completed"
  }
}
```

:::

### Query parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `url` | string | The pull or merge request's web link. Give this, or repository_id and number. |
| `repository_id` | string (uuid) | Id from the repository list. |
| `number` | number | The pull or merge request number in that repository. |

## Responses

### 200 OK

| Field | Type | Description |
| --- | --- | --- |
| `repository_id` | string (uuid), required | Id from the repository list. |
| `repository` | string, required | Repository full name. |
| `provider` | string, required | One of `github`, `gitlab`, `bitbucket`, or `azure`. |
| `number` | number, required | |
| `title` | string, required | |
| `url` | string, required | Web link to the pull request. |
| `author` | string, required, nullable | The author's name on the provider. |
| `is_yours` | boolean, required | Whether the caller opened it, matched through their linked source control accounts. |
| `draft` | boolean, required | |
| `source_branch` | string, required | |
| `target_branch` | string, required | |
| `updated_at` | string, required, nullable | Last update, or creation where the provider reports no update time. |
| `state` | string, required | One of `open`, `closed`, or `merged`. |
| `head_sha` | string, required, nullable | The commit at the head of the pull request; null when the provider reports none, such as a closed pull request whose fork is gone. |
| `review` | object, required, nullable | Hacktron's review of the head commit, running or finished; null when it has none. |
| `review.scan_id` | string (uuid), required, nullable | Scan id, for the scans routes. |
| `review.task_id` | string, required | |
| `review.status` | string, required | One of `in_progress` or `completed`. |

### 400 Bad Request

Not a pull request link, a repository not enabled for Hacktron, or a GitHub repository connected with a personal access token.

### 404 Not Found

The pull request, or its repository in the organization, wasn't found.

### 503 Service Unavailable

The repository's provider could not be read; try again later.
