> ## Documentation Index
> Fetch the complete documentation index at: https://trigger-v3-fix-additional-files.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# io.registerCron()

> `io.registerCron()` allows you to register a [DynamicSchedule](/sdk/dynamicschedule) that will trigger any jobs it's attached to on a regular CRON schedule.

<Warning>
  This has been deprecated in favor of [DynamicSchedule.register](/sdk/dynamicschedule/register)
</Warning>

## Parameters

<Snippet file="stable-key-param.mdx" />

<ResponseField name="dynamicSchedule" type="DynamicSchedule" required>
  A [DynamicSchedule](/sdk/dynamicschedule) that will trigger any Jobs it's
  attached to on a regular interval.
</ResponseField>

<ResponseField name="id" type="string" required>
  A unique id for the schedule. This is used to identify and unregister the schedule later.
</ResponseField>

<ResponseField name="options" type="object" required>
  An object containing options about the interval.

  <Expandable title="options" defaultOpen>
    <ResponseField name="cron" type="string" required>
      A CRON expression that defines the schedule. A useful tool when writing CRON expressions is
      [crontab guru](https://crontab.guru). Note that the timezone used is UTC.
    </ResponseField>
  </Expandable>
</ResponseField>

## Returns

A Promise that resolves to an object with the following fields:

<ResponseField name="id" type="string" required>
  A unique id for the interval. This is used to identify and unregister the interval later.
</ResponseField>

<ResponseField name="metadata" type="any" required>
  Any additional metadata about the interval.
</ResponseField>

<ResponseField name="accountId" type="string" required>
  This will be used by the Trigger.dev Connect feature, which is coming soon.
</ResponseField>

<ResponseField name="schedule" type="object" required>
  <Expandable title="properties" defaultOpen>
    <ResponseField name="type" type="string" required>
      The type of schedule. This will always be "cron".
    </ResponseField>

    <ResponseField name="options" type="object" required>
      An object containing options about the CRON schedule.

      <Expandable title="options" defaultOpen>
        <ResponseField name="cron" type="string" required>
          The registered CRON expression.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="metadata" type="any" required>
      Any additional metadata about the interval.
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```typescript
  client.defineJob({
  id: "my-job",
  name: "My job",
  version: "0.1.1",
  trigger: eventTrigger({
    name: "dynamic.cron",
    schema: z.object({
      id: z.string(),
      cron: z.string(),
    }),
  }),
  run: async (payload, io, ctx) => {
    //registers a DynamicSchedule with a CRON expression 
    await io.registerCron("register-cron", dynamicSchedule, payload.id, {
      cron: payload.cron,
    });
  },
  });
  ```
</RequestExample>
