> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langdock.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Scheduled Tasks API Overview

> List, create, update, pause, and run scheduled tasks owned by a workspace API key

The Scheduled Tasks API manages tasks owned by a workspace API key. List them, create a schedule, update the prompt or clock, pause and resume them, or enqueue a run now.

## Base URL

```
https://api.langdock.com
```

<Warning>
  **Dedicated deployments**

  Replace `api.langdock.com` with `<your-deployment-url>/api/public` in all requests.
</Warning>

## API key scopes

Every endpoint uses one scope.

| Scope            | Settings label          | Endpoints                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ---------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AUTOMATION_API` | **Scheduled Tasks API** | [List](/en/developer/scheduled-tasks-api/list-scheduled-tasks), [create](/en/developer/scheduled-tasks-api/create-scheduled-task), [get](/en/developer/scheduled-tasks-api/get-scheduled-task), [update](/en/developer/scheduled-tasks-api/update-scheduled-task), [delete](/en/developer/scheduled-tasks-api/delete-scheduled-task), [pause](/en/developer/scheduled-tasks-api/pause-scheduled-task), [resume](/en/developer/scheduled-tasks-api/resume-scheduled-task), and [run](/en/developer/scheduled-tasks-api/run-scheduled-task) |

Create the key under [Settings > Workspace > Products > API](/en/admin/workspace/workspace#api). Personal API keys cannot call this API, even if the scope appears on the key.

The key must belong to a service account. Scheduled Tasks must be enabled for the workspace, and that service account must have access. General access covers the account. Member access covers it only when the account or one of its groups is included.

Each task is owned by the service account that created it. The key can only see and change its own tasks. A workspace can hold 10 tasks per owner. The 11th create returns `400` with `AUTOMATION_LIMIT_REACHED`.

If that service account no longer has a live key with `AUTOMATION_API`, active tasks that are not `MANUAL` are paused. A remaining key, including one you created while rotating, keeps those tasks running. `MANUAL` tasks have no clock, so this pause does not change them.

## Available endpoints

| Method   | Endpoint                                | Description                                                                        |
| -------- | --------------------------------------- | ---------------------------------------------------------------------------------- |
| `GET`    | `/automations/v1`                       | [List scheduled tasks](/en/developer/scheduled-tasks-api/list-scheduled-tasks)     |
| `POST`   | `/automations/v1`                       | [Create a scheduled task](/en/developer/scheduled-tasks-api/create-scheduled-task) |
| `GET`    | `/automations/v1/{automationId}`        | [Get a scheduled task](/en/developer/scheduled-tasks-api/get-scheduled-task)       |
| `PATCH`  | `/automations/v1/{automationId}`        | [Update a scheduled task](/en/developer/scheduled-tasks-api/update-scheduled-task) |
| `DELETE` | `/automations/v1/{automationId}`        | [Delete a scheduled task](/en/developer/scheduled-tasks-api/delete-scheduled-task) |
| `POST`   | `/automations/v1/{automationId}/pause`  | [Pause a scheduled task](/en/developer/scheduled-tasks-api/pause-scheduled-task)   |
| `POST`   | `/automations/v1/{automationId}/resume` | [Resume a scheduled task](/en/developer/scheduled-tasks-api/resume-scheduled-task) |
| `POST`   | `/automations/v1/{automationId}/run`    | [Run a scheduled task](/en/developer/scheduled-tasks-api/run-scheduled-task)       |

## Scheduled task object

List and get include `runCount`. Create, update, pause, and resume return the same object without `runCount`.

```typescript theme={null}
{
  id: string; // automation UUID
  createdAt: string; // ISO 8601
  name: string;
  prompt: string;
  modelId: string | null;
  modelMode: "UNSET" | "EXPLICIT" | "AUTO";
  assistantId: string | null; // primary agent
  taggedAssistantId: string | null; // extra @Agent mention
  frequency:
    | "MANUAL"
    | "DAILY"
    | "WEEKDAYS"
    | "WEEKLY"
    | "MONTHLY"
    | "SELECTED_WEEKDAYS";
  timeOfDay: string | null; // HH:mm, 24 hour
  dayOfWeek: number | null; // 0 is Sunday, 6 is Saturday
  dayOfMonth: number | null; // 1 to 31
  daysOfWeek: number[]; // 0 is Sunday, 6 is Saturday
  timezone: string | null; // IANA name, or null for MANUAL
  active: boolean;
  lastRunAt: string | null;
  runCount: number; // list and get only
  attachments: Array<{
    id: string;
    name: string;
    mimeType: string | null;
    type: string | null;
  }>;
  taggedIntegrationIds: string[];
  taggedKnowledgeFolderIds: string[];
  taggedWorkflowIds: string[];
  taggedSkillSlugs: string[];
}
```

There is no `updatedAt` field.

## Schedule

| Frequency           | Required clock fields     | Stored result                                                                                                         |
| ------------------- | ------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `MANUAL`            | None                      | Clock fields and `timezone` are cleared. Use [run](/en/developer/scheduled-tasks-api/run-scheduled-task) to start it. |
| `DAILY`             | `timeOfDay`               | Other day fields are cleared. An empty `timezone` is stored as `UTC`.                                                 |
| `WEEKDAYS`          | `timeOfDay`               | Runs Monday through Friday. Other day fields are cleared.                                                             |
| `WEEKLY`            | `timeOfDay`, `dayOfWeek`  | `dayOfWeek` is 0 (Sunday) through 6 (Saturday).                                                                       |
| `MONTHLY`           | `timeOfDay`, `dayOfMonth` | `dayOfMonth` is 1 through 31. A month without that day runs on its last day.                                          |
| `SELECTED_WEEKDAYS` | `timeOfDay`, `daysOfWeek` | At least one day, each 0 through 6. Duplicate days are stored once, in ascending order.                               |

`timeOfDay` uses 24 hour `HH:mm`. A missing or invalid clock for a scheduled frequency returns `400`.

## Context on the task

`assistantId` is the primary agent. It must be available to the key, or create and update return `403` with `AUTOMATION_TAG_ACCESS_DENIED:assistant:{id}`.

`modelMode` `EXPLICIT` requires `modelId` in the same request. The model must be selectable for that service account. Otherwise the response is `403` with `AUTOMATION_TAG_ACCESS_DENIED:model:missing` or `AUTOMATION_TAG_ACCESS_DENIED:model:{id}`. `AUTO` and `UNSET` store `modelId` as `null`. If you omit `modelMode` and send `modelId`, the task is stored as `EXPLICIT`. If you omit both, it is stored as `UNSET`.

Tagged integrations, folders, workflows, skills, and `taggedAssistantId` that the key cannot use are dropped on save. They do not fail the request. `attachmentIds` must already belong to the key's service account in this workspace. An attachment it does not own returns `403` with `AUTOMATION_TAG_ACCESS_DENIED:attachment:unknown`.

Each tag array accepts at most 20 values. Each skill slug is at most 100 characters. `attachmentIds` accepts at most 20 ids.

## Rate limits

The Scheduled Tasks API follows standard API rate limits. If you exceed the limit, you receive a `429` response. Wait and retry with exponential backoff.

<Info>
  Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on [API Key Best Practices](/en/admin/ai-adoption-and-rollout/best-practices/api-key-best-practices).
</Info>
