# Get a repository's Continuous Security schedule

GET

/projects/{projectId}/repositories/{repositoryId}/continuous-testing

```js
const url = 'https://zkao.io/api/v1/projects/example/repositories/example/continuous-testing';
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/example/continuous-testing \
  --header 'Authorization: Bearer <token>'
```

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

Requires scope: `read`. Continuous Security scans one branch on a schedule paid from a monthly budget. With no schedule on the branch, `enabled` is false and the schedule fields are null. The recommended monthly budget supports ongoing analysis. The minimum funds one useful analysis step. `availableFeatures` lists the analyses this branch offers. `enabledFeatures` lists the branch’s selected analyses, including while paused.

## Authorizations

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

## Parameters

### Path Parameters

* **projectId**

  required

  string

* **repositoryId**

  required

  string

### Query Parameters

* **branch**

  string

  The scheduled branch. Defaults to the repository’s default branch.

## Responses

### 200

OK

application/json

object

* **repositoryId**

  required

  string

* **available**

  required

  False when Continuous Security is not offered.

  boolean

* **enabled**

  required

  False when there is no schedule or it is paused.

  boolean

* **state**

  required

  Why an enabled schedule is not running: `budget_reached` when the schedule’s or project’s monthly automation cap is reached, `needs_credits` when the organization’s credits cannot fund the next run (it resumes on its own once they can), `error` after repeated failures. Null with no schedule.

  string | null

  Allowed values: active converged budget_reached needs_credits error

* **branch**

  required

  string

* **monthlyBudgetCredits**

  required

  The configured monthly spending cap. Legacy schedules derive the budget from their cadence and per-run budget.

  integer | null

* **cadence**

  required

  Legacy fixed cadence. Null for a custom interval or no schedule. Use intervalHours for the actual interval.

  string | null

  Allowed values: daily weekly biweekly monthly

* **intervalHours**

  required

  Hours between scheduled runs. Null when no schedule exists.

  integer | null

  \>= 1

* **perRunBudgetCredits**

  required

  integer | null

* **areaKeys**

  required

  Audit areas the runs rotate through, one per run, least recently scanned first. Empty means every run scans the whole repository.

  Array\<string>

* **availableFeatures**

  required

  Analyses offered on this branch. Empty when Continuous Security is unavailable.

  Array\<string>

  unique items

  Allowed values: bug-hunting formal-verification dependency-analysis weak-key-analysis security-invariants

* **enabledFeatures**

  required

  Selected analyses. A branch with no saved selection defaults to bug hunting when Continuous Security is available. A paused schedule keeps its selection.

  Array\<string>

  unique items

  Allowed values: bug-hunting formal-verification dependency-analysis weak-key-analysis security-invariants

* **spentThisMonthCredits**

  required

  Credits the branch was charged for Continuous Security since the UTC month began, net of refunds. Counts its analysis steps, change assessments, public-key reviews, agent questions and the planning included in steps.

  integer

* **runsThisMonth**

  required

  Runs the schedule launched since the UTC month began.

  integer

* **lastRunAt**

  required

  string | null format: date-time

* **nextRunAt**

  required

  When the next run becomes due. A past time means within the hour. Null when paused or stopped.

  string | null format: date-time

* **defaultMonthlyCredits**

  required

  The monthly budget a new schedule gets when the request names none. It funds at least one analysis step.

  integer | null

* **recommendedMonthlyCredits**

  required

  A monthly budget that funds about four analysis steps, within the minimum and maximum. A suggestion to pass as `monthlyBudgetCredits`. It is never applied when the request names no budget.

  integer | null

* **minimumMonthlyCredits**

  required

  The smallest month that funds one analysis step. Less is refused.

  integer | null

* **maximumMonthlyCredits**

  required

  The largest monthly budget currently allowed for the repository. Administrators can raise it.

  integer | null

##### Example

```json
{
  "state": "active",
  "cadence": "daily",
  "availableFeatures": [
    "bug-hunting"
  ],
  "enabledFeatures": [
    "bug-hunting"
  ]
}
```

### 400

Invalid request

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"
  }
}
```

### 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"
  }
}
```
