# Create cron

URL: https://docs.hanzo.ai/docs/openapi/auto/post-auto-cron

> Reads a schedule said in words — "every 5 minutes", "weekdays at 8:30", "every monday at 9am", "tomorrow at 7pm", "in 20 minutes", or a five-field cron expression — in your time zone, and answers the schedule an automation takes, said back in plain words, with when it would first run.

`POST /v1/auto/cron`

> [Auto →](https://docs.hanzo.ai/docs/openapi/auto) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                        |
| ------------- | -------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/auto/cron`    |
| **Method**    | `POST`                                 |
| **Operation** | `post_auto_cron`                       |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY` |

Reads a schedule said in words — "every 5 minutes", "weekdays at 8:30",
"every monday at 9am", "tomorrow at 7pm", "in 20 minutes", or a five-field
cron expression — in your time zone, and answers the schedule an automation
takes, said back in plain words, with when it would first run. Nothing is
created: send the schedule to POST /v1/auto/automations. A phrase that no rule
reads is read by a model; a phrase that names no schedule answers 422.

## Request

2 fields, body `application/json` (required).

| Field  | In   | Type   | Required | Description                                                       |
| ------ | ---- | ------ | -------- | ----------------------------------------------------------------- |
| `text` | body | string | —        | Text is when it runs, as a person says it: "every monday at 9am". |
| `tz`   | body | string | —        | TZ is the IANA zone the words are read in.                        |

## Response

| Status    | Body            | Meaning |
| --------- | --------------- | ------- |
| `200`     | auto.whenOut    | ok      |
| `default` | problem-details | refused |

`200` body — 8 fields.

| Field           | In   | Type          | Always | Description                                                                                                        |
| --------------- | ---- | ------------- | ------ | ------------------------------------------------------------------------------------------------------------------ |
| `next`          | body | string        | —      | Next is when it would first run, RFC 3339 UTC; null when it runs only on demand.                                   |
| `says`          | body | string        | —      | Says is the schedule said back in plain words.                                                                     |
| `schedule`      | body | auto.Schedule | —      |                                                                                                                    |
| `schedule.at`   | body | string        | —      | At is the local time, HH:MM on a 24-hour clock, for daily, weekdays and weekly.                                    |
| `schedule.cron` | body | string        | —      | Cron is a five-field cron expression (minute hour day-of-month month day-of-week), for kind cron only, read in TZ. |
| `schedule.day`  | body | string        | —      | Day is the weekday a weekly schedule runs on: mon, tue, wed, thu, fri, sat or sun.                                 |
| `schedule.kind` | body | string        | —      | Kind is manual, hourly, daily, weekdays, weekly, cron or once.                                                     |
| `schedule.tz`   | body | string        | —      | TZ is the IANA time zone every time here is read in.                                                               |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo auto cron
```

**SDK**

**.ts**

```ts
import { Configuration, AutoApi } from 'hanzoai';

const api = new AutoApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postAutoCron({ text: "<text>", tz: "<tz>" });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AutoApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AutoApi(client).post_auto_cron(text="<text>", tz="<tz>")
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.AutoAPI.PostAutoCron(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, auto_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = auto_api::post_auto_cron(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AutoApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new AutoApi(client).postAutoCron();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/auto/cron \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "text": "<text>",
       "tz": "<tz>"
     }'
```

**MCP**

MCP reaches **auto** through the `auto` tool, which names its 26 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_auto_automations"
         }
       }
     }'
```

---

[Auto API](https://docs.hanzo.ai/docs/openapi/auto) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
