Skip to main content
POST
/
api
/
v1
/
schedules
TypeScript
import { schedules } from "@trigger.dev/sdk";

const schedule = await schedules.create({
  task: 'my-task',
  cron: '0 0 * * *'
  deduplicationKey: 'my-schedule',
  timezone: 'America/New_York'
});
{
  "id": "sched_1234",
  "task": "my-scheduled-task",
  "type": "IMPERATIVE",
  "active": true,
  "deduplicationKey": "dedup_key_1234",
  "externalId": "user_1234",
  "generator": {
    "type": "CRON",
    "expression": "0 0 * * *",
    "description": "Every day at midnight"
  },
  "timezone": "America/New_York",
  "nextRun": "2024-04-01T00:00:00Z",
  "environments": [
    {
      "id": "<string>",
      "type": "<string>",
      "userName": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

Body

application/json
task
string
required
cron
string
required
deduplicationKey
string
required
externalId
string
timezone
string
Example:

Response

id
string
Example:
task
string
Example:
type
string
Example:
active
boolean
Example:
deduplicationKey
string
Example:
externalId
string
Example:
generator
object
timezone
string
Example:
nextRun
string<date-time>
Example:
environments
object[]