Authorizations
Use your Secret API key in the form 'Bearer <SECRET KEY>' (without the quotation marks)
Body
application/json
Response
Schedule created successfully
The response is of type object
.
import { schedules } from "@trigger.dev/sdk/v3";
const schedule = await schedules.create({
task: 'my-task',
cron: '0 0 * * *'
});
{
"id": "sched_1234",
"task": "my-scheduled-task",
"active": true,
"deduplicationKey": "dedup_key_1234",
"externalId": "user_1234",
"generator": {
"type": "CRON",
"expression": "0 0 * * *",
"description": "Every day at midnight"
},
"nextRun": "2024-04-01T00:00:00Z",
"environments": [
{
"id": "<string>",
"type": "<string>",
"userName": "<string>"
}
]
}
Create a new schedule based on the specified options.
import { schedules } from "@trigger.dev/sdk/v3";
const schedule = await schedules.create({
task: 'my-task',
cron: '0 0 * * *'
});
{
"id": "sched_1234",
"task": "my-scheduled-task",
"active": true,
"deduplicationKey": "dedup_key_1234",
"externalId": "user_1234",
"generator": {
"type": "CRON",
"expression": "0 0 * * *",
"description": "Every day at midnight"
},
"nextRun": "2024-04-01T00:00:00Z",
"environments": [
{
"id": "<string>",
"type": "<string>",
"userName": "<string>"
}
]
}
Use your Secret API key in the form 'Bearer <SECRET KEY>' (without the quotation marks)
Schedule created successfully
The response is of type object
.
Was this page helpful?