---
title: "How to get build plan's repository ID"
canonical: "https://support.appfire.com/space/SUPPORT/89135727/How%20to%20get%20build%20plan's%20repository%20ID"
format: markdown
---
# Description

[This question](https://answers.atlassian.com/questions/172552/how-can-i-get-the-repositoryid-in-the-bamboo-cli) was asked on [http://answers.atlassian.com](http://answers.atlassian.com) and reproduced here. A build plan can have 0 or more associated repositories. This provides the answer for the normal case of a single source repository. There is no formal remote API for retrieving it, so, we have to resort to using the UI. This works against 4.2 to 5.0 (at least).

# Example

This uses the standard [renderRequest](https://appfire.atlassian.net/wiki/display/BCLI/Documentation#Documentation-renderRequest) action together with [findReplaceRegex](https://appfire.atlassian.net/wiki/display/BCLI/Documentation#Documentation-findReplaceRegex) parameter to parse the response data looking for the first **repositoryId** field. Blank is returned if no repositories are specified.

##### **CLI action to retrieve a build plan's source repository id**

```
--action renderRequest --quiet --request "/chain/admin/config/editChainRepository.action?buildKey=XXX-DEF" --findReplaceRegex ".*repositoryId=(\d+).*|.*:\$1"
 
To get:
37159110
```