# API: filter GET pipelines by name

**URL:** <https://forum.buildkite.community/t/api-filter-get-pipelines-by-name/2319>\
**Category:** Features Requests\
**Created:** [October 21, 2022, 8:47am UTC](https://forum.buildkite.community/t/api-filter-get-pipelines-by-name/2319 "2022-10-21T08:47:06Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dvnrsn](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/dvnrsn/32/1151_2.png) [@dvnrsn](https://forum.buildkite.community/u/dvnrsn)\
**Post date:** [October 21, 2022, 8:47am UTC](https://forum.buildkite.community/t/api-filter-get-pipelines-by-name/2319/1 "2022-10-21T08:47:06Z")

</div>

I am wondering if [list pipelines](https://buildkite.com/docs/apis/rest-api/pipelines#list-pipelines) can be extended to support filtering

---

<div class="post-metadata">

**Author:** ![paula](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/paula/32/954_2.png) [@paula](https://forum.buildkite.community/u/paula)\
**Post date:** [October 21, 2022, 2:05pm UTC](https://forum.buildkite.community/t/api-filter-get-pipelines-by-name/2319/2 "2022-10-21T14:05:14Z")

</div>

Hey @dvnrsn!

Welcome to the community! 😊

It’s not possible to add filtering to the REST API at the moment, but you can do it with [GraphQL](https://buildkite.com/docs/apis/graphql-api). For example filtering by name, you can have something like:

```auto
query {
  organization(slug:"{org-slug}") {
    pipelines(first:100, search:"something") {
      edges {
        node {
          name
        }
      }
    }
  }
}

```

Best!

---

<div class="post-metadata">

**Author:** ![dvnrsn](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/dvnrsn/32/1151_2.png) [@dvnrsn](https://forum.buildkite.community/u/dvnrsn)\
**Post date:** [October 24, 2022, 12:20pm UTC](https://forum.buildkite.community/t/api-filter-get-pipelines-by-name/2319/3 "2022-10-24T12:20:39Z")

</div>

Thank you this is interesting.

I would need to filter on repository (i.e., get pipelines that include a certain repo name).

Also I see there is a max of 500 and given the requirement of “first” or “last” is there a way to paginate. We’re looking at a few thousand.

---

<div class="post-metadata">

**Author:** ![paula](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/paula/32/954_2.png) [@paula](https://forum.buildkite.community/u/paula)\
**Post date:** [October 24, 2022, 2:11pm UTC](https://forum.buildkite.community/t/api-filter-get-pipelines-by-name/2319/4 "2022-10-24T14:11:10Z")

</div>

Hey!

You can filter by repository, you have available the [PipelineRepositoryInput](https://buildkite.com/docs/apis/graphql/schemas/input-object/pipelinerepositoryinput) object, and you can also do pagination with the [PageInfo](https://buildkite.com/docs/apis/graphql/schemas/object/pageinfo) object.

Best!

---

<div class="post-metadata">

**Author:** ![dvnrsn](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/dvnrsn/32/1151_2.png) [@dvnrsn](https://forum.buildkite.community/u/dvnrsn)\
**Post date:** [October 25, 2022, 9:39am UTC](https://forum.buildkite.community/t/api-filter-get-pipelines-by-name/2319/5 "2022-10-25T09:39:10Z")

</div>

Forgive my ignorance of GraphQL and thank you for your help! I am able to get the PageInfo object on pipelines but I am still a little unsure how to filter by repo. I’ve tried

```auto
repository(url:"git@github.com:dvnrsn/my-repo.git") {

```

```auto
pipelines(repository:"git@github.com:dvnrsn/my-repo.git") {

```

Essentially I want to get only the pipelines that have repos that match some URL ^.

---

<div class="post-metadata">

**Author:** ![dvnrsn](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/dvnrsn/32/1151_2.png) [@dvnrsn](https://forum.buildkite.community/u/dvnrsn)\
**Post date:** [October 25, 2022, 9:53am UTC](https://forum.buildkite.community/t/api-filter-get-pipelines-by-name/2319/6 "2022-10-25T09:53:29Z")

</div>

Perhaps the answer would be something like this:

```auto
    pipelines(filter: {url: {eq: "git@github"}}) {
      edges {
        node {
        	name
          repository {
            url
          }
        }
      }
    }
```

---

<div class="post-metadata">

**Author:** ![dvnrsn](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/dvnrsn/32/1151_2.png) [@dvnrsn](https://forum.buildkite.community/u/dvnrsn)\
**Post date:** [October 25, 2022, 9:56am UTC](https://forum.buildkite.community/t/api-filter-get-pipelines-by-name/2319/7 "2022-10-25T09:56:58Z")

</div>

It also seems not to support a `where` which could be useful:

```auto
pipelines(where: {node: {repository: {eq:""}}}) {

```

---

<div class="post-metadata">

**Author:** ![paula](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/paula/32/954_2.png) [@paula](https://forum.buildkite.community/u/paula)\
**Post date:** [October 25, 2022, 1:57pm UTC](https://forum.buildkite.community/t/api-filter-get-pipelines-by-name/2319/8 "2022-10-25T13:57:53Z")

</div>

Hey!

That is correct, the query will be something like:

```auto
query {
  organization(slug:"{org}") {
    pipelines(first:100, repository: { url: "{url}"}) {
      edges {
        node {
          name
        }
      }
    }
  }
}

```

We don’t support where clause.

Best,

---

<div class="post-metadata">

**Author:** ![dvnrsn](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/dvnrsn/32/1151_2.png) [@dvnrsn](https://forum.buildkite.community/u/dvnrsn)\
**Post date:** [October 26, 2022, 8:55am UTC](https://forum.buildkite.community/t/api-filter-get-pipelines-by-name/2319/9 "2022-10-26T08:55:49Z")

</div>

Resolved with

```auto
query GetPipelines(
  $repo0: PipelineRepositoryInput!
  $repo1: PipelineRepositoryInput!
) {
  organization(slug: "org-slug") {
    repos_0: pipelines(first: 500, repository: $repo0) {
      ...PipelineConnectionFields
    }
    repos_1: pipelines(first: 500, repository: $repo1) {
      ...PipelineConnectionFields
    }
  }
}

```

Fragment PipelineConnectionFields can also include

```auto
pageInfo {
    endCursor
    hasNextPage
  }
```
