Raw crontab
Section titled “Raw crontab”These endpoints read and write the full crontab text for a single system user or for every user on a container. They exchange only the raw crontab string (and a user echo), which makes them the right choice when you want to inspect or replace the crontab file exactly as it lives on disk. If you need to operate on individual scheduled entries by id, comment, schedule, or command, use the managed-entry endpoints under /users/{user}/entries/{id} instead, which are documented on a separate page.
The base URL for every request on this page is:
https://{projectId}-{containerId}-cron-1.{server}.containers.hoody.comList all user crontabs
Section titled “List all user crontabs”Returns a paginated listing of the raw crontab text for every system user on the container.
GET /api/v1/cron/crontab
Section titled “GET /api/v1/cron/crontab”Parameters
Section titled “Parameters”| Name | In | Type | Required | Description |
|---|---|---|---|---|
page | query | integer | No | Page number (1-based, default 1) |
limit | query | integer | No | Items per page (default 50, max 200) |
This endpoint takes no request body.
curl -X GET "https://{projectId}-{containerId}-cron-1.{server}.containers.hoody.com/api/v1/cron/crontab?page=1&limit=50" \ -H "Authorization: Bearer <token>"import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-cron-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
for await (const item of client.cron.crontabs.listIterator({ page: 1, limit: 50 })) { console.log(item);}{ "items": [ { "user": "root", "crontab": "# m h dom mon dow command\n0 * * * * /usr/local/bin/cleanup.sh\n" }, { "user": "app", "crontab": "" } ], "page": 1, "limit": 50, "total": 2}{ "code": "INVALID_PAGINATION", "message": "Limit must be between 1 and 200", "details": "limit=\"-1\" is not a whole number"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
INVALID_PAGINATION | Invalid pagination | Page or limit is not a whole number or is out of range | Use page >= 1 and limit between 1 and 200 |
{ "code": "STORED_CRONTAB_INVALID", "message": "The crontab stored for user root cannot be read; replace it with PUT /users/root/crontab to repair it", "details": "line 3: contains U+2028 (a Unicode line break), which a crontab may not contain"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
STORED_CRONTAB_INVALID | Stored crontab invalid | The crontab already stored for the user cannot be used, so the request was not carried out although nothing in it is wrong: the stored crontab holds a Unicode line break, a # hoody-cron: line with two id fields, or more than the parser cap of 10000 lines or 40960000 bytes, or crontab(1) refuses its lines when they are written back (without expired entries, without a deleted entry, or with a new or updated entry next to an invalid raw line); details says which | Replace the whole crontab with PUT /api/v1/cron/users/{user}/crontab, which does not read the stored one |
{ "code": "BACKEND_ERROR", "message": "Internal server error"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
BACKEND_ERROR | Backend error | Failed to read or write system crontab | Check crontab availability and permissions |
Read a user’s raw crontab
Section titled “Read a user’s raw crontab”Returns the current crontab text for a single system user, exactly as stored on disk.
GET /api/v1/cron/users/{user}/crontab
Section titled “GET /api/v1/cron/users/{user}/crontab”Parameters
Section titled “Parameters”| Name | In | Type | Required | Description |
|---|---|---|---|---|
user | path | string | Yes | System username |
This endpoint takes no request body.
curl -X GET "https://{projectId}-{containerId}-cron-1.{server}.containers.hoody.com/api/v1/cron/users/app/crontab" \ -H "Authorization: Bearer <token>"import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-cron-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.cron.crontabs.get('app');{ "user": "app", "crontab": "# m h dom mon dow command\n0 * * * * /usr/local/bin/cleanup.sh\n"}{ "code": "INVALID_USER", "message": "Invalid user"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
INVALID_USER | Invalid user | User parameter failed validation | Provide a valid system username |
{ "code": "USER_NOT_FOUND", "message": "User not found"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
USER_NOT_FOUND | User not found | The requested system user does not exist | Create the user or choose an existing username |
{ "code": "STORED_CRONTAB_INVALID", "message": "The crontab stored for user root cannot be read; replace it with PUT /users/root/crontab to repair it", "details": "line 3: contains U+2028 (a Unicode line break), which a crontab may not contain"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
STORED_CRONTAB_INVALID | Stored crontab invalid | The crontab already stored for the user cannot be used, so the request was not carried out although nothing in it is wrong: the stored crontab holds a Unicode line break, a # hoody-cron: line with two id fields, or more than the parser cap of 10000 lines or 40960000 bytes, or crontab(1) refuses its lines when they are written back (without expired entries, without a deleted entry, or with a new or updated entry next to an invalid raw line); details says which | Replace the whole crontab with PUT /api/v1/cron/users/{user}/crontab, which does not read the stored one |
{ "code": "BACKEND_ERROR", "message": "Internal server error"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
BACKEND_ERROR | Backend error | Failed to read or write system crontab | Check crontab availability and permissions |
Replace a user’s raw crontab
Section titled “Replace a user’s raw crontab”Replaces the entire crontab file for a single system user with the supplied text. The previous crontab is overwritten.
PUT /api/v1/cron/users/{user}/crontab
Section titled “PUT /api/v1/cron/users/{user}/crontab”Parameters
Section titled “Parameters”| Name | In | Type | Required | Description |
|---|---|---|---|---|
user | path | string | Yes | System username |
Request Body
Section titled “Request Body”| Name | Type | Required | Description |
|---|---|---|---|
crontab | string | Yes | The full crontab text to write for the user |
curl -X PUT "https://{projectId}-{containerId}-cron-1.{server}.containers.hoody.com/api/v1/cron/users/app/crontab" \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{ "crontab": "# m h dom mon dow command\n0 * * * * /usr/local/bin/backup.sh\n" }'import { HoodyClient } from 'hoody-sdk';
const client = new HoodyClient({ baseURL: 'https://{projectId}-{containerId}-cron-1.{server}.containers.hoody.com', token: process.env.HOODY_TOKEN });
await client.cron.crontabs.set('app', { crontab: '# m h dom mon dow command\n0 * * * * /usr/local/bin/backup.sh\n'});{ "user": "app", "crontab": "# m h dom mon dow command\n0 * * * * /usr/local/bin/backup.sh\n", "removed_expired": 0}{ "code": "INVALID_USER", "message": "Invalid user"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
INVALID_USER | Invalid user | User parameter failed validation | Provide a valid system username |
INVALID_SCHEDULE | Invalid schedule | Schedule is not a valid cron expression; details names the field and the reason | Use a standard 5-field cron expression or @daily style macros |
INVALID_COMMAND | Invalid command | Command is empty, longer than 4096 bytes, or contains a line break; details says which. Also returned when a crontab request body holds a Unicode line break | Provide a single-line command of at most 4096 bytes |
INVALID_NAME | Invalid name | Name is empty, longer than 120 bytes, or contains a line break; details says which | Provide a single-line name of at most 120 bytes |
INVALID_COMMENT | Invalid comment | Comment is empty, longer than 500 bytes, or contains a line break; details says which | Provide a single-line comment of at most 500 bytes |
INVALID_ID | Invalid id | Entry id in the path is not a UUID, a # hoody-cron: line of a crontab request body holds two id fields, or two managed entries of a crontab body share an id | Use the id returned when the entry was created or listed; give each managed entry of a crontab body its own id |
INVALID_CRONTAB | Invalid crontab | A line of the crontab body is not valid crontab syntax, or crontab(1) refused the crontab body or the crontab with the created or updated entry; details names the line and the reason. The body or the entry is not written | Fix the named line; use 5 time fields (or an @ macro) and a command, an environment assignment, or a # comment |
INVALID_JSON | Invalid JSON | Request body is not valid JSON; details gives the position | Send a well-formed JSON object |
INVALID_BODY | Invalid body | Request body is valid JSON but a required field is missing or a field has the wrong type; details names it. Also returned when the body could not be read to its end | Send the fields of the request schema with their documented types |
{ "code": "USER_NOT_FOUND", "message": "User not found"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
USER_NOT_FOUND | User not found | The requested system user does not exist | Create the user or choose an existing username |
{ "code": "PAYLOAD_TOO_LARGE", "message": "Request body exceeds the configured size limit"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
PAYLOAD_TOO_LARGE | Payload too large | Request body is larger than --max-crontab-bytes, or a crontab request body exceeds the parser cap of 10000 lines or 40960000 bytes | Send a smaller body; shorten the crontab |
{ "code": "UNSUPPORTED_MEDIA_TYPE", "message": "Content-Type must be application/json or application/*+json"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
UNSUPPORTED_MEDIA_TYPE | Unsupported media type | Request has no Content-Type header, or one that is neither application/json nor application/*+json (parameters allowed) | Send the body with Content-Type: application/json |
{ "code": "BACKEND_ERROR", "message": "Internal server error"}| Error Code | Title | Description | Resolution |
|---|---|---|---|
BACKEND_ERROR | Backend error | Failed to read or write system crontab | Check crontab availability and permissions |