---
title: "Create or Update Scan Schedule"
method: POST
path: "/api/v2/scans/upsertSchedule"
tags: ["Scans"]
---

# Create or Update Scan Schedule

`POST /api/v2/scans/upsertSchedule`

## Request

- Base URL: `https://zeropath.com`
- URL: `https://zeropath.com/api/v2/scans/upsertSchedule`
- Auth: API key in header `X-ZeroPath-API-Token-Id` and API key in header `X-ZeroPath-API-Token-Secret`

Create or update an automated full scan schedule. Schedules run recurring full scans on the specified repositories at the given cron interval. Pass an existing schedule ID to update, or omit to create new.

## Request body

- ScanScheduleUpsertRequest: Input for creating or updating an automated scan schedule
  - `organizationId` string: Organization ID that owns the repositories. If omitted, resolved from the authenticated user.
  - `crontab` string, required: Cron expression defining when scans run (e.g. "0 0 * * 1" for every Monday at midnight UTC). Minimum interval is weekly.
  - `timezone` string: IANA timezone for the cron expression (e.g. "America/New_York"). Defaults to UTC. Note: timezone is accepted for compatibility but the underlying scheduler uses UTC.
  - `repositoryIds` string[], required: IDs of the repositories to create or update scan schedules for.
  - `id` string: Existing schedule ID to update. If omitted, a new schedule is created for each repository.
  - `scanBranch` string, nullable: Branch to scan. When set, creates a branch-specific schedule. A repository can have multiple schedules targeting different branches. If omitted or null, the schedule targets the repository default branch.

## Response `200`

Schedule created or updated successfully

- ScanScheduleUpsertResponse
  - `ok` boolean, required: Whether the operation succeeded

## Other responses

- `400`: Error Response
- `401`: Error Response

---

[API](https://skmtc.dev/zeropath/apis/zeropath-api.md) - [All operations](https://skmtc.dev/zeropath/apis/zeropath-api/llms.txt) - [OpenAPI document](https://skmtc.dev/zeropath/apis/zeropath-api/revisions/126e9c80ba0d?raw)
