# List deployments

From **GitHub v3 REST API**.

`GET /repos/{owner}/{repo}/deployments`

Simple filtering of deployments is available via query parameters:

## Parameters

### `owner`

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

### `repo`

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

### `sha`

- Location: query
- Required: false
- Type: `string`
- Default: `none`

The SHA recorded at creation time.

### `ref`

- Location: query
- Required: false
- Type: `string`
- Default: `none`

The name of the ref. This can be a branch, tag, or SHA.

### `task`

- Location: query
- Required: false
- Type: `string`
- Default: `none`

The name of the task for the deployment (e.g., `deploy` or `deploy:migrations`).

### `environment`

- Location: query
- Required: false
- Type: `string`
- Nullable: true
- Default: `none`

The name of the environment that was deployed to (e.g., `staging` or `production`).

### `per_page`

- Location: query
- Required: false
- Type: `integer`
- Default: `30`

Results per page (max 100)

### `page`

- Location: query
- Required: false
- Type: `integer`
- Default: `1`

Page number of the results to fetch.

## Responses

### `200`

Response

#### Headers

##### `Link`

- Type: `string`

- Example: `<https://api.github.com/resource?page=2>; rel="next", <https://api.github.com/resource?page=5>; rel="last"`

### `application/json`

- Type: `array`

```json
[
  {
    "created_at": "2012-07-20T01:19:13Z",
    "creator": {
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
      "followers_url": "https://api.github.com/users/octocat/followers",
      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
      "gravatar_id": "",
      "html_url": "https://github.com/octocat",
      "id": 1,
      "login": "octocat",
      "node_id": "MDQ6VXNlcjE=",
      "organizations_url": "https://api.github.com/users/octocat/orgs",
      "received_events_url": "https://api.github.com/users/octocat/received_events",
      "repos_url": "https://api.github.com/users/octocat/repos",
      "site_admin": false,
      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
      "type": "User",
      "url": "https://api.github.com/users/octocat"
    },
    "description": "Deploy request from hubot",
    "environment": "production",
    "id": 1,
    "node_id": "MDEwOkRlcGxveW1lbnQx",
    "original_environment": "staging",
    "payload": {},
    "production_environment": true,
    "ref": "topic-branch",
    "repository_url": "https://api.github.com/repos/octocat/example",
    "sha": "a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",
    "statuses_url": "https://api.github.com/repos/octocat/example/deployments/1/statuses",
    "task": "deploy",
    "transient_environment": false,
    "updated_at": "2012-07-20T01:19:13Z",
    "url": "https://api.github.com/repos/octocat/example/deployments/1"
  }
]
```

```json
{"items":{"$ref":"#/components/schemas/deployment"},"type":"array"}
```

## Request examples

### cURL

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