---
title: "Create a scheduled job"
method: POST
path: "/api/scheduled-jobs/{namespace}"
tags: ["jobs"]
---

# Create a scheduled job

`POST /api/scheduled-jobs/{namespace}`

## Path parameters

- `namespace` string, required

## Request body

- object
  - `jobSpec` object, required
    - `spaceId` string
    - `dockerImage` string
    - `arguments` string[]
    - `command` string[]
    - `environment` object
    - `secrets` object
    - `flavor` 'cpu-basic' | 'cpu-upgrade' | 'cpu-performance' | 'cpu-xl' | 'sprx8' | 'zero-a10g' | 't4-small' | 't4-medium' | 'l4x1' | 'l4x4' | 'l40sx1' | 'l40sx4' | 'l40sx8' | 'a10g-small' | 'a10g-large' | 'a10g-largex2' | 'a10g-largex4' | 'a100-large' | 'a100x4' | 'a100x8' | 'h200' | 'h200x2' | 'h200x4' | 'h200x8' | 'rtx-pro-6000' | 'rtx-pro-6000x2' | 'rtx-pro-6000x4' | 'rtx-pro-6000x8' | 'inf2x6', required
    - `arch` 'amd64' | 'arm64'
    - `timeoutSeconds` integer, nullable
    - `attempts` integer — Max number of attempts to make. For example, if you set this to 3, the job will be retried up to 2 times if it fails.
    - `labels` object — Labels for the job as key-value pairs. Both keys and values must be max 100 characters and contain only alphanumeric characters, dots, dashes, and underscores.
    - `volumes` object[] — HuggingFace Buckets or Repos to mount as volumes in the job container.
      - `type` 'bucket' | 'model' | 'dataset' | 'space', required
      - `source` string, required — Source identifier, e.g. 'username/my-bucket' or 'username/my-model'
      - `mountPath` string, required — Mount path inside the container, e.g. '/data'
      - `revision` string — Git revision (only for repos, defaults to 'main')
      - `readOnly` boolean — Read-only mount (true for repos, false default for buckets)
      - `path` string — Subfolder prefix inside the bucket/repo to mount, e.g. 'path/to/dir'
    - `expose` object — Ports to expose publicly through the jobs proxy. Each port is reachable at `https://<job_id>--<port>.<jobs-public-domain>`. Access requires a HF token with read access to the job's namespace, except for ports also listed in `portsPublic`.
      - `ports` integer[], required
      - `portsPublic` integer[] — Subset of `ports` reachable without any authentication.
    - `ssh` object — When `enabled`, the job's container is reachable over SSH at `ssh <job_id>@ssh.hf.jobs`. Only the job's owner is allowed in, authenticated by an SSH public key registered on the Hub.
      - `enabled` boolean
    - `resourceGroupId` string
  - `schedule` string, required — CRON schedule expression (e.g., '0 9 * * 1' for 9 AM every Monday).
  - `suspend` boolean — Whether the scheduled job is suspended (paused)
  - `concurrency` boolean — Whether multiple instances of this job can run concurrently

## Response `200`

The scheduled job data

- object
  - `id` string, required
  - `createdAt` string, date-time, required
  - `schedule` string, required
  - `suspend` boolean, required
  - `suspendReason` string
  - `concurrency` boolean, required
  - `status` object, required
    - `lastJob` object, nullable, required
      - `id` string, required
      - `at` string, date-time, required
    - `nextJobRunAt` string, date-time, required
  - `type` 'scheduled-job', required
  - `owner` object, required
    - `id` string, required
    - `name` string, required
    - `avatarUrl` string, required
    - `type` 'user' | 'org', required
  - `initiator` object
    - `id` string, required
    - `name` string, required
    - `avatarUrl` string, required
    - `type` 'user' | 'org', required
  - `jobSpec` object, required
    - `spaceId` string
    - `dockerImage` string
    - `timeout` number
    - `environment` object, required
    - `command` string[]
    - `arguments` string[]
    - `arch` 'amd64' | 'arm64'
    - `flavor` 'cpu-basic' | 'cpu-upgrade' | 'cpu-performance' | 'cpu-xl' | 'sprx8' | 'zero-a10g' | 't4-small' | 't4-medium' | 'l4x1' | 'l4x4' | 'l40sx1' | 'l40sx4' | 'l40sx8' | 'a10g-small' | 'a10g-large' | 'a10g-largex2' | 'a10g-largex4' | 'a100-large' | 'a100x4' | 'a100x8' | 'h200' | 'h200x2' | 'h200x4' | 'h200x8' | 'rtx-pro-6000' | 'rtx-pro-6000x2' | 'rtx-pro-6000x4' | 'rtx-pro-6000x8' | 'inf2x6', required
    - `resourceGroupId` string
    - `retry` number
    - `startedAt` string, date-time
    - `finishedAt` string, date-time
    - `durations` object
      - `schedulingSecs` number
      - `runningSecs` number
      - `totalSecs` number
    - `volumes` object[]
      - `type` string, required
      - `source` string, required
      - `mountPath` string, required
      - `revision` string
      - `readOnly` boolean
      - `path` string
    - `expose` object — Ports exposed through the jobs proxy (see `status.exposeUrls` for the reachable URLs).
      - `ports` integer[], required
      - `portsPublic` integer[] — Subset of `ports` reachable without any authentication.
    - `resourceGroup` object
      - `id` string, required
      - `name` string, required
      - `numUsers` number
    - `secrets` string[]
    - `labels` object
    - `hfToken` object
      - `ownerName` string, required
      - `orgName` string
      - `tokenRole` 'read' | 'write' | 'fineGrained'
      - `tokenId` string
      - `settingsUrl` string

---

[API](https://skmtc.net/huggingface/apis/hub-api-endpoints.md) · [All operations](https://skmtc.net/huggingface/apis/hub-api-endpoints/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/huggingface/hub-api-endpoints/versions/6ab9f7d9cfb5/schema)
