# Get a branch

From **GitHub v3 REST API**.

`GET /repos/{owner}/{repo}/branches/{branch}`

Get a branch

## Parameters

### `owner`

- Location: path
- Required: true
- Type: `string`

### `repo`

- Location: path
- Required: true
- Type: `string`

### `branch`

- Location: path
- Required: true
- Type: `string`

The name of the branch.

## Responses

### `200`

Response

### `application/json`

- Type: `object`

Branch With Protection

```json
{"description":"Branch With Protection","properties":{"_links":{"properties":{"html":{"type":"string"},"self":{"format":"uri","type":"string"}},"required":["html","self"],"type":"object"},"commit":{"$ref":"#/components/schemas/commit"},"name":{"type":"string"},"pattern":{"example":"\"mas*\"","type":"string"},"protected":{"type":"boolean"},"protection":{"$ref":"#/components/schemas/branch-protection"},"protection_url":{"format":"uri","type":"string"},"required_approving_review_count":{"example":1,"type":"integer"}},"required":["name","commit","_links","protection","protected","protection_url"],"title":"Branch With Protection","type":"object"}
```

### `301`

Moved permanently

### `application/json`

- Type: `object`

Basic Error

```json
{"description":"Basic Error","properties":{"documentation_url":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"title":"Basic Error","type":"object"}
```

### `404`

Resource not found

### `application/json`

- Type: `object`

Basic Error

```json
{"description":"Basic Error","properties":{"documentation_url":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"title":"Basic Error","type":"object"}
```

### `415`

Preview header missing

### `application/json`

- Type: `object`

```json
{"properties":{"documentation_url":{"type":"string"},"message":{"type":"string"}},"required":["message","documentation_url"],"type":"object"}
```

## Request examples

### cURL

```shell
curl --request GET \
  --url {protocol}://{hostname}/api/v3/repos/{owner}/{repo}/branches/{branch}
```
