# List repositories in the project

GET

/projects/{projectId}/repositories

```js
const url = 'https://zkao.io/api/v1/projects/example/repositories';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};


try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```sh
curl --request GET \
  --url https://zkao.io/api/v1/projects/example/repositories \
  --header 'Authorization: Bearer <token>'
```

* Production`zkao.io/api/v1/projects/{projectId}/repositories`
* Staging`staging.zkao.io/api/v1/projects/{projectId}/repositories`

Requires scope: `read`. Limited to the token’s repo allowlist when set.

## Authorizations

* **[bearerAuth](https://docs.staging.zkao.io/api/#bearerauth)**

## Parameters

### Path Parameters

* **projectId**

  required

  string

## Responses

### 200

OK

application/json

object

* **repositories**

  required

  Array\<object>

  object

  * **id**

    required

    string

  * **slug**

    required

    URL segment of the repository inside its project (`/orgs/<org>/projects/<project>/repos/<slug>`). Unique per project.

    string

  * **owner**

    required

    string

  * **name**

    required

    string

  * **url**

    required

    string

  * **defaultBranch**

    string | null

  * **status**

    required

    ACTIVE | MARKED_FOR_DELETION

    string

  * **readiness**

    required

    Whether a scan can start on this repository. A newly added repository is `analyzing` until a one-time pass over it finishes; launching a scan meanwhile fails with `repository_initializing`. Poll this endpoint rather than retrying the launch blind.

    string

    Allowed values: ready analyzing

##### Example

```json
{
  "repositories": [
    {
      "readiness": "ready"
    }
  ]
}
```

### 401

Missing, malformed, expired, or revoked token

application/json

object

* **error**

  required

  object

  * **code**

    required

    string

    Allowed values: unauthorized forbidden not_found bad_request conflict insufficient_credits budget_below_minimum repository_initializing diff_base_required diff_base_not_allowed diff_base_invalid diff_empty rate_limited internal

  * **message**

    required

    string

  * **minimumCredits**

    Budget_below_minimum only: the least the launch could have reserved, in credits. A diff scan’s first scan of a repository also builds its overview, so its minimum is higher.

    integer

##### Example

```json
{
  "error": {
    "code": "unauthorized"
  }
}
```

### 403

The token lacks the required scope

application/json

object

* **error**

  required

  object

  * **code**

    required

    string

    Allowed values: unauthorized forbidden not_found bad_request conflict insufficient_credits budget_below_minimum repository_initializing diff_base_required diff_base_not_allowed diff_base_invalid diff_empty rate_limited internal

  * **message**

    required

    string

  * **minimumCredits**

    Budget_below_minimum only: the least the launch could have reserved, in credits. A diff scan’s first scan of a repository also builds its overview, so its minimum is higher.

    integer

##### Example

```json
{
  "error": {
    "code": "unauthorized"
  }
}
```

### 404

Resource not in this token’s project or repo allowlist

application/json

object

* **error**

  required

  object

  * **code**

    required

    string

    Allowed values: unauthorized forbidden not_found bad_request conflict insufficient_credits budget_below_minimum repository_initializing diff_base_required diff_base_not_allowed diff_base_invalid diff_empty rate_limited internal

  * **message**

    required

    string

  * **minimumCredits**

    Budget_below_minimum only: the least the launch could have reserved, in credits. A diff scan’s first scan of a repository also builds its overview, so its minimum is higher.

    integer

##### Example

```json
{
  "error": {
    "code": "unauthorized"
  }
}
```
