# Turn a paid check on or off

- **OpenAPI Version:** `3.2.0`
- **API Version:** `3.1.0`
- **Contact:** Syndai <https://syndai.ai>

## Contents

**Operations**

- [PUT /api/v1/external/coding/repositories/{repository\_id}/scans](#scalar-operation-put-apiv1externalcodingrepositoriesrepository-idscans)

**Schemas**

- [ScansUpdateRequest](#scalar-schema-scansupdaterequest)
- [ScansRead](#scalar-schema-scansread)
- [ScanKindRead](#scalar-schema-scankindread)
- [BugScanLastScan](#scalar-schema-bugscanlastscan)
- [ProblemDetail](#scalar-schema-problemdetail)
- [ExternalErrorCode](#scalar-schema-externalerrorcode)

<a id="scalar-context-global-servers"></a>

## Servers

- **URL:** `https://api.syndai.ai`

<a id="scalar-context-global-authentication"></a>

## Authentication

- **CustomerApiKey**: HTTP bearer (`API Key`)

  Customer API key sent as a bearer token

## Tags

### Findings

Bugs Syndai's scanner found in your repositories. List findings, read or change a repository's weekly scan setting, or start a scan now; each scan is capped by the per-scan limit. List the Sentry projects bound to your repositories.

## Operations

<a id="scalar-operation-put-apiv1externalcodingrepositoriesrepository-idscans"></a>

### Turn a paid check on or off

- **Method:** `PUT`
- **Path:** `/api/v1/external/coding/repositories/{repository_id}/scans`
- **Operation ID:** `setScanRoutine`
- **Tags:** Findings

Set a paid check's (`code` or `app`) cadence (`daily`, `weekly`, `monthly`, or `off`) and its per-run limit (`limit_usd`, 5 to 300, default 25). Turning it on is your consent to spend up to that limit per run, at most the monthly maximum GET shows; a first turn-on also starts a first scan now. Off pauses it, withdraws that consent and cancels its scan in progress. Owners and admins only (403 otherwise). Idempotent.

**Servers:** [Inherited servers](#scalar-context-global-servers)

**Authentication:** [Global authentication](#scalar-context-global-authentication)

#### Path parameters

- **`repository_id` (required)**: `string`, format: `uuid`

#### Query parameters

- **`customer_id`**: `string | null`, format: `uuid`

#### Request body

**Required:** `true`

**Content type:** `application/json`

[ScansUpdateRequest](#scalar-schema-scansupdaterequest)

<a id="scalar-example-1"></a>

**Generated example:**

```json
{
  "cadence": "off",
  "kind": "",
  "limit_usd": 5
}
```

#### Responses

##### 200 Request fulfilled, document follows

**Content type:** `application/json`

[ScansRead](#scalar-schema-scansread)

<a id="scalar-example-2"></a>

**Generated example:**

```json
{
  "free_scan_state": "",
  "free_scan_usd": 1,
  "full_subscription": "",
  "full_until": "",
  "funding": "",
  "kinds": [
    {
      "cadence": "",
      "cadences": [
        ""
      ],
      "description": "",
      "kind": "",
      "label": "",
      "last_scan": {
        "app": false,
        "app_check": "",
        "charged_usd": 1,
        "completed_at": "",
        "files_planned": 1,
        "first_scan_areas": 1,
        "funded_by": "",
        "groups_done": 0,
        "groups_planned": 1,
        "limit_usd": 1,
        "over_limit_groups": 1,
        "run_id": "",
        "started_at": "",
        "stats": {
          "additionalProperty": "anything"
        },
        "status": "",
        "stopped_at_ceiling": false,
        "top_up_usd": 1,
        "waiting_on": ""
      },
      "limit_usd": 1,
      "monthly_max_usd": 1,
      "needs_consent": false,
      "next_run_at": "",
      "paused_no_credits": false,
      "price": "",
      "scanning": false,
      "typical_usd": 1
    }
  ]
}
```

##### 400, 401, 403, 404

- `400` Bad request syntax or unsupported method
- `401` Invalid or missing customer API key
- `403` Insufficient scope or forbidden customer access
- `404` Resource not found

**Content type:** `application/problem+json`

[ProblemDetail](#scalar-schema-problemdetail)

RFC 7807 problem detail returned for public CaaS errors.

<a id="scalar-example-3"></a>

**Generated example:**

```json
{
  "code": "BUDGET_EXHAUSTED",
  "detail": null,
  "existing_run_id": null,
  "instance": null,
  "status": 1,
  "title": "",
  "type": "about:blank",
  "additionalProperty": "anything"
}
```

##### 429 Rate limit exceeded

**Headers:**

- **`Retry-After`**

  Seconds to wait before retrying the request

  `integer`

**Content type:** `application/problem+json`

[ProblemDetail](#scalar-schema-problemdetail)

RFC 7807 problem detail returned for public CaaS errors.

[Generated example](#scalar-example-3)

##### default Unexpected error

**Content type:** `application/problem+json`

[ProblemDetail](#scalar-schema-problemdetail)

<a id="scalar-example-4"></a>

**Generated example:**

```json
null
```

## Schemas

<a id="scalar-schema-scansupdaterequest"></a>

### ScansUpdateRequest

**Type:** `object`

- **`cadence` (required)**: `string`, possible values: `"off", "daily", "weekly", "monthly"`
- **`kind` (required)**: `string`
- **`limit_usd`**: `number`, minimum: `5`, maximum: `300`

  **One of:**
  - `number`
  - `null`

<a id="scalar-example-5"></a>

**Generated example:**

```json
{
  "cadence": "off",
  "kind": "",
  "limit_usd": 5
}
```

<a id="scalar-schema-scansread"></a>

### ScansRead

**Type:** `object`

- **`free_scan_state` (required)**: `string`
- **`free_scan_usd` (required)**: `number`
- **`funding` (required)**: `string`
- **`kinds` (required)**: array of [ScanKindRead](#scalar-schema-scankindread)
- **`full_subscription`**: `string | null`
- **`full_until`**: `string | null`, format: `date-time`

<a id="scalar-example-6"></a>

**Generated example:**

```json
{
  "free_scan_state": "",
  "free_scan_usd": 1,
  "full_subscription": "",
  "full_until": "",
  "funding": "",
  "kinds": [
    {
      "cadence": "",
      "cadences": [
        ""
      ],
      "description": "",
      "kind": "",
      "label": "",
      "last_scan": {
        "app": false,
        "app_check": "",
        "charged_usd": 1,
        "completed_at": "",
        "files_planned": 1,
        "first_scan_areas": 1,
        "funded_by": "",
        "groups_done": 0,
        "groups_planned": 1,
        "limit_usd": 1,
        "over_limit_groups": 1,
        "run_id": "",
        "started_at": "",
        "stats": {
          "additionalProperty": "anything"
        },
        "status": "",
        "stopped_at_ceiling": false,
        "top_up_usd": 1,
        "waiting_on": ""
      },
      "limit_usd": 1,
      "monthly_max_usd": 1,
      "needs_consent": false,
      "next_run_at": "",
      "paused_no_credits": false,
      "price": "",
      "scanning": false,
      "typical_usd": 1
    }
  ]
}
```

<a id="scalar-schema-scankindread"></a>

### ScanKindRead

**Type:** `object`

- **`cadence` (required)**: `string`
- **`cadences` (required)**: `array of string`
- **`description` (required)**: `string`
- **`kind` (required)**: `string`
- **`label` (required)**: `string`
- **`price` (required)**: `string`
- **`last_scan`**: [BugScanLastScan](#scalar-schema-bugscanlastscan) | `null`
- **`limit_usd`**: `number | null`
- **`monthly_max_usd`**: `number | null`
- **`needs_consent`**: `boolean`, default: `false`
- **`next_run_at`**: `string | null`, format: `date-time`
- **`paused_no_credits`**: `boolean`, default: `false`
- **`scanning`**: `boolean`, default: `false`
- **`typical_usd`**: `number | null`

<a id="scalar-example-7"></a>

**Generated example:**

```json
{
  "cadence": "",
  "cadences": [
    ""
  ],
  "description": "",
  "kind": "",
  "label": "",
  "last_scan": {
    "app": false,
    "app_check": "",
    "charged_usd": 1,
    "completed_at": "",
    "files_planned": 1,
    "first_scan_areas": 1,
    "funded_by": "",
    "groups_done": 0,
    "groups_planned": 1,
    "limit_usd": 1,
    "over_limit_groups": 1,
    "run_id": "",
    "started_at": "",
    "stats": {
      "additionalProperty": "anything"
    },
    "status": "",
    "stopped_at_ceiling": false,
    "top_up_usd": 1,
    "waiting_on": ""
  },
  "limit_usd": 1,
  "monthly_max_usd": 1,
  "needs_consent": false,
  "next_run_at": "",
  "paused_no_credits": false,
  "price": "",
  "scanning": false,
  "typical_usd": 1
}
```

<a id="scalar-schema-bugscanlastscan"></a>

### BugScanLastScan

**Type:** `object`

- **`run_id` (required)**: `string`, format: `uuid`
- **`status` (required)**: `string`
- **`app`**: `boolean`, default: `false`
- **`app_check`**: `string | null`
- **`charged_usd`**: `number | null`
- **`completed_at`**: `string | null`, format: `date-time`
- **`files_planned`**: `integer | null`
- **`first_scan_areas`**: `integer | null`
- **`funded_by`**: `string | null`
- **`groups_done`**: `integer`, default: `0`
- **`groups_planned`**: `integer | null`
- **`limit_usd`**: `number | null`
- **`over_limit_groups`**: `integer | null`
- **`started_at`**: `string | null`, format: `date-time`
- **`stats`**: `object | null`
- **`stopped_at_ceiling`**: `boolean`, default: `false`
- **`top_up_usd`**: `number | null`
- **`waiting_on`**: `string | null`

<a id="scalar-example-8"></a>

**Generated example:**

```json
{
  "app": false,
  "app_check": "",
  "charged_usd": 1,
  "completed_at": "",
  "files_planned": 1,
  "first_scan_areas": 1,
  "funded_by": "",
  "groups_done": 0,
  "groups_planned": 1,
  "limit_usd": 1,
  "over_limit_groups": 1,
  "run_id": "",
  "started_at": "",
  "stats": {
    "additionalProperty": "anything"
  },
  "status": "",
  "stopped_at_ceiling": false,
  "top_up_usd": 1,
  "waiting_on": ""
}
```

<a id="scalar-schema-problemdetail"></a>

### ProblemDetail

**Type:** `object`

RFC 7807 problem detail returned for public CaaS errors.

- **`code` (required)**: `string`, possible values: `"BUDGET_EXHAUSTED", "QUOTA_EXCEEDED", "INSUFFICIENT_CREDITS", "RUN_CONCURRENCY_LIMIT", "CUSTOMER_DISABLED", "REPO_NOT_BOUND", "REPO_ARCHIVED", "IDEMPOTENCY_REPLAY", "CONFLICT", "MISSION_BUSY_RETRY", "HITL_REQUEST_CONFLICT", "HITL_REQUEST_SETTLED", "RUN_TERMINATED_BEFORE_RESPONSE", "INVALID_POLICY", "INVALID_SCOPE", "RATE_LIMITED", "INSTALLATION_INCOMPLETE", "SUBSCRIPTION_USAGE_UNAVAILABLE", "INVALID_TOKEN", "ROLE_REQUIRED", "PLAN_UPGRADE_REQUIRED", "EMAIL_MISMATCH", "EXPIRED_TOKEN", "NOT_FOUND", "OVERSCOPE_ACK_REQUIRED", "VERIFY_FAILED", "PUBLISH_IN_FLIGHT", "PUBLISH_UNSUPPORTED_REPO", "PUBLICATION_NOT_LIVE", "NO_APP_DATA", "FEATURE_REQUESTS_NEEDS_MEMBERS", "EMPTY_UPDATE", "BAD_CURSOR", "HUMAN_APPROVAL_REQUIRED", "PROTECTED_PATHS_MANAGED_ONLY", "RUN_IN_FLIGHT", "TEXT_EDIT_REFUSED", "CLI_UPGRADE_REQUIRED", "PRODUCTION_STEP_UP_REQUIRED", "PRICES_UPDATING", "GITHUB_UNAVAILABLE", "PUBLISH_NOT_SET_UP", "PUBLISH_TAG_EXISTS", "PUBLISH_VERSION_EXISTS", "VERSION_NOT_DEPLOYED", "DATA_REFUSED", "HARNESS_MODEL_UNSUPPORTED", "ECONOMY_CONFLICTS_WITH_MODEL", "HARNESS_UNKNOWN", "INTERNAL_ERROR"`

  Stable error codes surfaced to public CaaS clients.
- **`status` (required)**: `integer`
- **`title` (required)**: `string`
- **`detail`**: `string | null`, default: `null`
- **`existing_run_id`**: `string | null`, default: `null`
- **`instance`**: `string | null`, default: `null`
- **`type`**: `string`, default: `"about:blank"`

<a id="scalar-example-9"></a>

**Generated example:**

```json
{
  "code": "BUDGET_EXHAUSTED",
  "detail": null,
  "existing_run_id": null,
  "instance": null,
  "status": 1,
  "title": "",
  "type": "about:blank",
  "additionalProperty": "anything"
}
```

<a id="scalar-schema-externalerrorcode"></a>

### ExternalErrorCode

**Type:** `string`, possible values: `"BUDGET_EXHAUSTED", "QUOTA_EXCEEDED", "INSUFFICIENT_CREDITS", "RUN_CONCURRENCY_LIMIT", "CUSTOMER_DISABLED", "REPO_NOT_BOUND", "REPO_ARCHIVED", "IDEMPOTENCY_REPLAY", "CONFLICT", "MISSION_BUSY_RETRY", "HITL_REQUEST_CONFLICT", "HITL_REQUEST_SETTLED", "RUN_TERMINATED_BEFORE_RESPONSE", "INVALID_POLICY", "INVALID_SCOPE", "RATE_LIMITED", "INSTALLATION_INCOMPLETE", "SUBSCRIPTION_USAGE_UNAVAILABLE", "INVALID_TOKEN", "ROLE_REQUIRED", "PLAN_UPGRADE_REQUIRED", "EMAIL_MISMATCH", "EXPIRED_TOKEN", "NOT_FOUND", "OVERSCOPE_ACK_REQUIRED", "VERIFY_FAILED", "PUBLISH_IN_FLIGHT", "PUBLISH_UNSUPPORTED_REPO", "PUBLICATION_NOT_LIVE", "NO_APP_DATA", "FEATURE_REQUESTS_NEEDS_MEMBERS", "EMPTY_UPDATE", "BAD_CURSOR", "HUMAN_APPROVAL_REQUIRED", "PROTECTED_PATHS_MANAGED_ONLY", "RUN_IN_FLIGHT", "TEXT_EDIT_REFUSED", "CLI_UPGRADE_REQUIRED", "PRODUCTION_STEP_UP_REQUIRED", "PRICES_UPDATING", "GITHUB_UNAVAILABLE", "PUBLISH_NOT_SET_UP", "PUBLISH_TAG_EXISTS", "PUBLISH_VERSION_EXISTS", "VERSION_NOT_DEPLOYED", "DATA_REFUSED", "HARNESS_MODEL_UNSUPPORTED", "ECONOMY_CONFLICTS_WITH_MODEL", "HARNESS_UNKNOWN", "INTERNAL_ERROR"`

Stable error codes surfaced to public CaaS clients.
