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

# List Crons

> List all cron jobs with optional pagination and filters

## Overview

List all cron jobs with optional pagination and filtering by active status.

<RequestExample>
  ```typescript List all crons theme={null}
  import { cuey } from "cuey";

  const { data: crons, pagination } = await cuey.crons.list();
  ```

  ```typescript With pagination theme={null}
  import { cuey } from "cuey";

  const { data: crons, pagination } = await cuey.crons.list({
    page: 1,
    limit: 50,
  });
  ```

  ```typescript Filter by active status theme={null}
  import { cuey } from "cuey";

  const { data: activeCrons } = await cuey.crons.list({
    is_active: true,
  });
  ```
</RequestExample>

## Parameters

<ParamField body="page" type="number" default="0">
  Page number (0-indexed). Defaults to 0.
</ParamField>

<ParamField body="limit" type="number" default="100">
  Number of items per page. Range: 1-1000. Defaults to 100.
</ParamField>

<ParamField body="is_active" type="boolean">
  Filter cron jobs by active status. `true` for active crons, `false` for inactive crons.
</ParamField>

## Response

<ResponseField name="data" type="Cron[]" required>
  Array of cron job objects.

  <Expandable title="Cron properties">
    <ResponseField name="id" type="string" required>
      Unique identifier for the cron job (UUID).
    </ResponseField>

    <ResponseField name="cron_expression" type="string" required>
      Cron expression defining the schedule (e.g., `0 9 * * *`).
    </ResponseField>

    <ResponseField name="timezone" type="string | null">
      Timezone for the cron schedule (e.g., `America/New_York`). `null` for UTC.
    </ResponseField>

    <ResponseField name="webhook_url" type="string" required>
      The webhook URL that will be called.
    </ResponseField>

    <ResponseField name="method" type="HttpMethod" required>
      HTTP method used for the webhook request. Defaults to `POST`.
    </ResponseField>

    <ResponseField name="headers" type="object | null">
      Custom headers to include in the webhook request. `null` if not set.
    </ResponseField>

    <ResponseField name="payload" type="object | null">
      Payload to send with the webhook request. `null` if not set.
    </ResponseField>

    <ResponseField name="retry_config" type="object | null">
      Retry configuration for failed webhooks.

      <Expandable title="RetryConfig properties">
        <ResponseField name="maxRetries" type="number" required>
          Maximum number of retry attempts (1-10).
        </ResponseField>

        <ResponseField name="backoffMs" type="number" required>
          Backoff delay in milliseconds (100-5000).
        </ResponseField>

        <ResponseField name="backoffType" type="string" required>
          Backoff strategy. Values: `exponential`, `linear`.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="is_active" type="boolean | null">
      Whether the cron job is active. `null` defaults to `true`.
    </ResponseField>

    <ResponseField name="created_at" type="string | null">
      ISO 8601 timestamp when the cron job was created.
    </ResponseField>

    <ResponseField name="updated_at" type="string | null">
      ISO 8601 timestamp when the cron job was last updated.
    </ResponseField>

    <ResponseField name="team_id" type="string | null">
      Team ID associated with the cron job.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="pagination" type="object" required>
  Pagination information.

  <Expandable title="Pagination properties">
    <ResponseField name="page" type="number" required>
      Current page number (0-indexed).
    </ResponseField>

    <ResponseField name="limit" type="number" required>
      Number of items per page.
    </ResponseField>

    <ResponseField name="total" type="number" required>
      Total number of items across all pages.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json Success response theme={null}
  {
    "data": [
      {
        "id": "cron-uuid-here",
        "cron_expression": "0 9 * * *",
        "timezone": "America/New_York",
        "webhook_url": "https://api.example.com/webhook",
        "method": "POST",
        "headers": null,
        "payload": {
          "report_type": "daily"
        },
        "retry_config": null,
        "is_active": true,
        "created_at": "2024-01-15T10:30:00Z",
        "updated_at": "2024-01-15T10:30:00Z",
        "team_id": "team-uuid-here"
      }
    ],
    "pagination": {
      "page": 0,
      "limit": 100,
      "total": 1
    }
  }
  ```
</ResponseExample>

## Errors

<Warning>
  Requesting a page number that is out of range (e.g., page 100 when only 10 pages exist) will throw an `InternalServerError`.
</Warning>

* `UnauthorizedError`: If API key is invalid or missing
* `InternalServerError`: If the requested page is out of range

## Examples

### List Active Crons

```typescript theme={null}
import { cuey } from "cuey";

const { data: activeCrons } = await cuey.crons.list({
  is_active: true,
});

console.log(`Found ${activeCrons.length} active cron jobs`);
```

### List Inactive Crons

```typescript theme={null}
import { cuey } from "cuey";

const { data: inactiveCrons } = await cuey.crons.list({
  is_active: false,
});

console.log(`Found ${inactiveCrons.length} inactive cron jobs`);
```
