# Schedules

4 endpoints at `https://api.kosa8.com`, sent with `Authorization: Bearer $KOSA8_API_KEY`. Generated from the API's own [OpenAPI description](https://api.kosa8.com/openapi.json), which a test holds to the router.

## The sandbox's schedules, each with its last run[#]

GET`/v1/sandboxes/{id}/schedules`scope sandboxes:read

Parameters

`id`requiredpath · string

Sandbox id (sbx_…)

Responses

200401403404

```
curl -s -X GET https://api.kosa8.com/v1/sandboxes/$SBX/schedules \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Run a command in the sandbox on a cron schedule (UTC)[#]

POST`/v1/sandboxes/{id}/schedules`scope sandboxes:write

Run by the control plane's minute tick as a buffered exec (stopped at 90 s). A run that would wake the sandbox is held to the wake rules (payment, spending cap, running limit); one refused is recorded as skipped. At most 10 per sandbox.

Parameters

`id`requiredpath · string

Sandbox id (sbx_…)

JSON body

`cron`requiredstring

—

`cmd`requiredarray of string

—

`env`array of string

NAME=value

`name`string

Max length 64.

`wake`boolean

Wake the sandbox for a run due while it sleeps (default true); false skips that run

Responses

201400401403404409

```
curl -s -X POST https://api.kosa8.com/v1/sandboxes/$SBX/schedules \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

## Stop and remove a schedule[#]

DELETE`/v1/sandboxes/{id}/schedules/{sid}`scope sandboxes:write

Parameters

`id`requiredpath · string

Sandbox id (sbx_…)

`sid`requiredpath · string

Schedule id (sch_…)

Responses

200401403404

```
curl -s -X DELETE https://api.kosa8.com/v1/sandboxes/$SBX/schedules/$SID \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Run a schedule now, under the same rules; its next time is unchanged[#]

POST`/v1/sandboxes/{id}/schedules/{sid}/run`scope sandboxes:write

Parameters

`id`requiredpath · string

Sandbox id (sbx_…)

`sid`requiredpath · string

Schedule id (sch_…)

Responses

200401403404

```
curl -s -X POST https://api.kosa8.com/v1/sandboxes/$SBX/schedules/$SID/run \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

---
Source: https://docs.kosa8.com/api/schedules/
