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

# Preview Schedule

> Validates a schedule definition and returns the next planned occurrences.

### **Code Examples**

```http cURL theme={null}
curl --request POST \
  --url 'https://api.tess.im/digital-employees/schedule-preview' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --header 'x-workspace-id: YOUR_WORKSPACE_ID' \
  --data '{
    "heartbeat_cron": "0 9 * * 1-5",
    "execution_timezone": "America/Sao_Paulo"
  }'
```

```json Node.js theme={null}
const axios = require('axios');

const data = {
  "heartbeat_cron": "0 9 * * 1-5",
  "execution_timezone": "America/Sao_Paulo"
};

const config = {
  method: 'post',
  url: 'https://api.tess.im/digital-employees/schedule-preview',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
    'x-workspace-id': 'YOUR_WORKSPACE_ID'
  },
  data: data
};

try {
  const response = await axios(config);
  console.log(response.data);
} catch (error) {
  console.error(error);
}
```

```python Python theme={null}
import requests
import json

url = "https://api.tess.im/digital-employees/schedule-preview"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
    "x-workspace-id": "YOUR_WORKSPACE_ID"
}
data = {
    "heartbeat_cron": "0 9 * * 1-5",
    "execution_timezone": "America/Sao_Paulo"
}

response = requests.post(url, headers=headers, json=data)
print(response.json())
```

```php PHP theme={null}
<?php
$curl = curl_init();

$data = [
    "heartbeat_cron" => "0 9 * * 1-5",
    "execution_timezone" => "America/Sao_Paulo"
];

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.tess.im/digital-employees/schedule-preview",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode($data),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer YOUR_API_KEY",
    "Content-Type: application/json",
    "x-workspace-id: YOUR_WORKSPACE_ID"
  ]
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "Error: " . $err;
} else {
  echo $response;
}
```

```java Java theme={null}
import com.fasterxml.jackson.databind.ObjectMapper;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Map;

public class Main {
    public static void main(String[] args) throws Exception {
        ObjectMapper mapper = new ObjectMapper();

        Map<String, Object> data = Map.of(
            "heartbeat_cron", "0 9 * * 1-5",
            "execution_timezone", "America/Sao_Paulo"
        );

        String jsonPayload = mapper.writeValueAsString(data);

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.tess.im/digital-employees/schedule-preview"))
            .header("Authorization", "Bearer YOUR_API_KEY")
            .header("Content-Type", "application/json")
            .header("x-workspace-id", "YOUR_WORKSPACE_ID")
            .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
            .build();

        HttpResponse<String> response = client.send(request,
            HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
```

```go Go theme={null}
package main

import (
    "fmt"
    "strings"
    "io/ioutil"
    "net/http"
)

func main() {
    payload := `{
        "heartbeat_cron": "0 9 * * 1-5",
        "execution_timezone": "America/Sao_Paulo"
    }`

    client := &http.Client{}
    req, err := http.NewRequest("POST", "https://api.tess.im/digital-employees/schedule-preview", strings.NewReader(payload))
    if err != nil {
        fmt.Println(err)
        return
    }

    req.Header.Add("Authorization", "Bearer YOUR_API_KEY")
    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("x-workspace-id", "YOUR_WORKSPACE_ID")

    resp, err := client.Do(req)
    if err != nil {
        fmt.Println(err)
        return
    }
    defer resp.Body.Close()

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        fmt.Println(err)
        return
    }

    fmt.Println(string(body))
}
```

```jsonnet .NET theme={null}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

class Program
{
    static async Task Main(string[] args)
    {
        using (var client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");
            client.DefaultRequestHeaders.Add("x-workspace-id", "YOUR_WORKSPACE_ID");

            var data = new
            {
                heartbeat_cron = "0 9 * * 1-5",
                execution_timezone = "America/Sao_Paulo"
            };

            var jsonPayload = JsonConvert.SerializeObject(data);
            var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");

            try
            {
                var response = await client.PostAsync(
                    "https://api.tess.im/digital-employees/schedule-preview",
                    content
                );
                response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();
                Console.WriteLine(responseBody);
            }
            catch (HttpRequestException e)
            {
                Console.WriteLine("\nException Caught!");
                Console.WriteLine("Message :{0} ", e.Message);
            }
        }
    }
}
```

```ruby Ruby theme={null}
require 'uri'
require 'net/http'
require 'json'

uri = URI('https://api.tess.im/digital-employees/schedule-preview')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request['x-workspace-id'] = 'YOUR_WORKSPACE_ID'
request.body = {
    "heartbeat_cron": "0 9 * * 1-5",
    "execution_timezone": "America/Sao_Paulo"
}.to_json

response = http.request(request)
puts response.read_body
```

### **Headers**

> [!NOTE]
>
> Authentication is performed via the `Authorization: Bearer YOUR_API_KEY` header.

**x-workspace-id** `integer` *required*

ID of the workspace. Required for all Digital Employees API endpoints.

### **Body Parameters**

> [!NOTE]
>
> At least one of `heartbeat_cron` or `heartbeat_schedule_json` must be provided in the request body.

**heartbeat\_cron** `string`

Cron expression defining the schedule (e.g. `0 9 * * 1-5` for weekdays at 9 AM). At least one of `heartbeat_cron` or `heartbeat_schedule_json` must be provided.

**heartbeat\_schedule\_json** `object`

Schedule builder config object. Alternative to `heartbeat_cron`. At least one of `heartbeat_cron` or `heartbeat_schedule_json` must be provided.

**execution\_timezone** `string`

Timezone for evaluating the schedule (e.g. `America/Sao_Paulo`). Defaults to UTC if not provided.

### **Response**

```json theme={null}
{
  "data": {
    "effective_cron": "0 9 * * 1-5",
    "next_occurrences": [
      "2026-06-30T09:00:00-03:00",
      "2026-07-01T09:00:00-03:00",
      "2026-07-02T09:00:00-03:00"
    ]
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.