---
title: "Edit job"
method: PUT
path: "/job/{jobId}"
tags: ["Job Main Calls"]
---

# Edit job

`PUT /job/{jobId}`

## Request

- Base URL: `https://api.qovery.com`
- URL: `https://api.qovery.com/job/{jobId}`
- Auth: one of:
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/qovery/apis/qovery-api/docs/job/:jobId/put.ts> (a function with typed inputs; its response is checked against the schema)

- To edit the job you must have the admin permission.

## Path parameters

- `jobId` string, uuid, required

## Request body

- JobRequest
  - `name` string, required: name is case insensitive
  - `description` string
  - `cpu` integer: unit is millicores (m). 1000m = 1 cpu
  - `memory` integer: unit is MB. 1024 MB = 1GB
  - `gpu` integer
  - `max_nb_restart` integer: Maximum number of restart allowed before the job is considered as failed 0 means that no restart/crash of the job is allowed
  - `max_duration_seconds` integer: Maximum number of seconds allowed for the job to run before killing it and mark it as failed
  - `auto_preview` boolean: Indicates if the 'environment preview option' is enabled for this container. If enabled, a preview environment will be automatically cloned when `/preview` endpoint is called. If not specified, it takes the value of the `auto_preview` property from the associated environment.
  - `port` integer, nullable: Port where to run readiness and liveliness probes checks. The port will not be exposed externally
  - `source` object
    - `image` object, nullable
      - `image_name` string: The image name pattern differs according to chosen container registry provider: * `ECR`: `repository` * `SCALEWAY_CR`: `namespace/image` * `DOCKER_HUB`: `image` or `repository/image` * `PUBLIC_ECR`: `registry_alias/repository`
      - `tag` string: tag of the image container
      - `registry_id` string: tag of the image container
    - `docker` object, nullable
      - `git_repository` ApplicationGitRepositoryRequest
        - `url` string, required: application git repository URL
        - `branch` string: Name of the branch to use. This is optional If not specified, then the branch used is the `main` or `master` one
        - `root_path` string: indicates the root path of the application.
        - `git_token_id` string, uuid, nullable: The git token id on Qovery side
        - `provider` 'BITBUCKET' | 'GITHUB' | 'GITLAB', required
      - `dockerfile_path` string, nullable: The path of the associated Dockerfile. Only if you are using build_mode = DOCKER
      - `dockerfile_raw` string, nullable: The content of your dockerfile if it is not stored inside your git repository
      - `docker_target_build_stage` string, nullable: The target build stage in the Dockerfile to build
  - `healthchecks` Healthcheck, required
    - `readiness_probe` Probe, nullable
      - `type` object
        - `tcp` object, nullable
          - `port` integer
          - `host` string, nullable
        - `http` object, nullable
          - `path` string
          - `scheme` string
          - `port` integer
        - `exec` object, nullable
          - `command` string[]
        - `grpc` object, nullable
          - `service` string, nullable
          - `port` integer
      - `initial_delay_seconds` integer
      - `period_seconds` integer
      - `timeout_seconds` integer
      - `success_threshold` integer
      - `failure_threshold` integer
    - `liveness_probe` Probe, nullable
      - `type` object
        - `tcp` object, nullable
          - `port` integer
          - `host` string, nullable
        - `http` object, nullable
          - `path` string
          - `scheme` string
          - `port` integer
        - `exec` object, nullable
          - `command` string[]
        - `grpc` object, nullable
          - `service` string, nullable
          - `port` integer
      - `initial_delay_seconds` integer
      - `period_seconds` integer
      - `timeout_seconds` integer
      - `success_threshold` integer
      - `failure_threshold` integer
  - `schedule` object: If you want to define a Cron job, only the `cronjob` property must be filled A Lifecycle job should contain at least one property `on_XXX` among the 3 properties: `on_start`, `on_stop`, `on_delete`
    - `on_start` object
      - `arguments` string[]
      - `entrypoint` string: optional entrypoint when launching container
    - `on_stop` object
      - `arguments` string[]
      - `entrypoint` string: optional entrypoint when launching container
    - `on_delete` object
      - `arguments` string[]
      - `entrypoint` string: optional entrypoint when launching container
    - `cronjob` object
      - `arguments` string[]
      - `entrypoint` string: optional entrypoint when launching container
      - `timezone` string: Specify a timezone identifier to run the schedule at. By default Etc/UTC
      - `scheduled_at` string, cron, required: Can only be set if the event is CRON. Represent the cron format for the job schedule without seconds. For example: `* * * * *` represent the cron to launch the job every minute. See https://crontab.guru/ to WISIWIG interface. Timezone is UTC
    - `lifecycle_type` 'GENERIC' | 'TERRAFORM' | 'CLOUDFORMATION'
  - `auto_deploy` boolean, nullable: Specify if the job will be automatically updated after receiving a new image tag or a new commit according to the source type. The new image tag shall be communicated via the "Auto Deploy job" endpoint https://api-doc.qovery.com/#tag/Jobs/operation/autoDeployJobEnvironments
  - `annotations_groups` ServiceAnnotationRequest[]
    - `id` string, uuid, required
  - `labels_groups` ServiceLabelRequest[]
    - `id` string, uuid, required
  - `icon_uri` string, uri: Icon URI representing the job.

## Response `200`

Edit job

- union
  - LifecycleJobResponse
    - `id` string, uuid, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time
    - `environment` ReferenceObject, required
      - `id` string, uuid, required
    - `maximum_cpu` integer, required: Maximum cpu that can be allocated to the job based on organization cluster configuration. unit is millicores (m). 1000m = 1 cpu
    - `maximum_memory` integer, required: Maximum memory that can be allocated to the job based on organization cluster configuration. unit is MB. 1024 MB = 1GB
    - `maximum_gpu` integer, required: Maximum memory that can be allocated to the job based on organization cluster configuration. unit is MB. 1024 MB = 1GB
    - `name` string, required: name is case insensitive
    - `description` string
    - `cpu` integer, required: unit is millicores (m). 1000m = 1 cpu
    - `memory` integer, required: unit is MB. 1024 MB = 1GB
    - `gpu` integer, required
    - `max_nb_restart` integer: Maximum number of restart allowed before the job is considered as failed 0 means that no restart/crash of the job is allowed
    - `max_duration_seconds` integer: Maximum number of seconds allowed for the job to run before killing it and mark it as failed
    - `auto_preview` boolean, required: Indicates if the 'environment preview option' is enabled for this container. If enabled, a preview environment will be automatically cloned when `/preview` endpoint is called. If not specified, it takes the value of the `auto_preview` property from the associated environment.
    - `port` integer, nullable: Port where to run readiness and liveliness probes checks. The port will not be exposed externally
    - `source` union, required
      - object
        - `image` ContainerSource, required
          - `image_name` string, required: The image name pattern differs according to chosen container registry provider: * `ECR`: `repository` * `SCALEWAY_CR`: `namespace/image` * `DOCKER_HUB`: `image` or `repository/image` * `PUBLIC_ECR`: `registry_alias/repository`
          - `tag` string, required: tag of the image container
          - `registry_id` string: tag of the image container
          - `registry` ContainerRegistryProviderDetailsResponse, required
            - `id` string, uuid, required
            - `name` string, required
            - `url` string, required: URL of the container registry
            - `kind` 'ECR' | 'SCALEWAY_CR' | 'DOCKER_HUB' | 'GITHUB_CR' | 'GITHUB_ENTERPRISE_CR' | 'GITLAB_CR' | 'PUBLIC_ECR' | 'DOCR' | 'GENERIC_CR' | 'GCP_ARTIFACT_REGISTRY' | 'AZURE_CR', required: The type of your container registry
      - object
        - `docker` JobSourceDockerResponse, required
          - `git_repository` ApplicationGitRepository
            - `has_access` boolean
            - `provider` 'BITBUCKET' | 'GITHUB' | 'GITLAB', required
            - `owner` string, required
            - `url` string, uri, required
            - `name` string, required: repository name
            - `branch` string
            - `root_path` string
            - `deployed_commit_id` string: Git commit ID corresponding to the deployed version of the app
            - `deployed_commit_date` string, date-time: Git commit date corresponding to the deployed version of the app
            - `deployed_commit_contributor` string: Git commit user corresponding to the deployed version of the app
            - `deployed_commit_tag` string
            - `git_token_id` string, nullable
            - `git_token_name` string, nullable
          - `dockerfile_path` string, nullable: The path of the associated Dockerfile. Only if you are using build_mode = DOCKER
          - `dockerfile_raw` string, nullable: The content of your dockerfile if it is not stored inside your git repository
          - `docker_target_build_stage` string, nullable: The target build stage in the Dockerfile to build
    - `healthchecks` Healthcheck, required
      - `readiness_probe` Probe, nullable
        - `type` object
          - `tcp` object, nullable
            - `port` integer
            - `host` string, nullable
          - `http` object, nullable
            - `path` string
            - `scheme` string
            - `port` integer
          - `exec` object, nullable
            - `command` string[]
          - `grpc` object, nullable
            - `service` string, nullable
            - `port` integer
        - `initial_delay_seconds` integer
        - `period_seconds` integer
        - `timeout_seconds` integer
        - `success_threshold` integer
        - `failure_threshold` integer
      - `liveness_probe` Probe, nullable
        - `type` object
          - `tcp` object, nullable
            - `port` integer
            - `host` string, nullable
          - `http` object, nullable
            - `path` string
            - `scheme` string
            - `port` integer
          - `exec` object, nullable
            - `command` string[]
          - `grpc` object, nullable
            - `service` string, nullable
            - `port` integer
        - `initial_delay_seconds` integer
        - `period_seconds` integer
        - `timeout_seconds` integer
        - `success_threshold` integer
        - `failure_threshold` integer
    - `auto_deploy` boolean: Specify if the job will be automatically updated after receiving a new image tag or a new commit according to the source type. The new image tag shall be communicated via the "Auto Deploy job" endpoint https://api-doc.qovery.com/#tag/Jobs/operation/autoDeployJobEnvironments
    - `icon_uri` string, uri, required: Icon URI representing the job.
    - `service_type` 'APPLICATION' | 'DATABASE' | 'CONTAINER' | 'JOB' | 'HELM' | 'TERRAFORM', required: type of the service (application, database, job, ...)
    - `job_type` 'LIFECYCLE' | 'CRON', required: type of job
    - `schedule` object, required
      - `on_start` object
        - `arguments` string[]
        - `entrypoint` string: optional entrypoint when launching container
      - `on_stop` object
        - `arguments` string[]
        - `entrypoint` string: optional entrypoint when launching container
      - `on_delete` object
        - `arguments` string[]
        - `entrypoint` string: optional entrypoint when launching container
      - `lifecycle_type` 'GENERIC' | 'TERRAFORM' | 'CLOUDFORMATION'
    - `annotations_groups` OrganizationAnnotationsGroupResponse[]
      - `id` string, uuid, required
      - `created_at` string, date-time, required
      - `updated_at` string, date-time
      - `name` string, required
      - `annotations` Annotation[], required
        - `key` string, required
        - `value` string, required
      - `scopes` OrganizationAnnotationsGroupScopeEnum[], required
    - `labels_groups` OrganizationLabelsGroupResponse[]
      - `id` string, uuid, required
      - `created_at` string, date-time, required
      - `updated_at` string, date-time
      - `name` string, required
      - `labels` Label[], required
        - `key` string, required
        - `value` string, required
        - `propagate_to_cloud_provider` boolean, required
  - CronJobResponse
    - `id` string, uuid, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time
    - `environment` ReferenceObject, required
      - `id` string, uuid, required
    - `maximum_cpu` integer, required: Maximum cpu that can be allocated to the job based on organization cluster configuration. unit is millicores (m). 1000m = 1 cpu
    - `maximum_memory` integer, required: Maximum memory that can be allocated to the job based on organization cluster configuration. unit is MB. 1024 MB = 1GB
    - `maximum_gpu` integer, required: Maximum memory that can be allocated to the job based on organization cluster configuration. unit is MB. 1024 MB = 1GB
    - `name` string, required: name is case insensitive
    - `description` string
    - `cpu` integer, required: unit is millicores (m). 1000m = 1 cpu
    - `memory` integer, required: unit is MB. 1024 MB = 1GB
    - `gpu` integer, required
    - `max_nb_restart` integer: Maximum number of restart allowed before the job is considered as failed 0 means that no restart/crash of the job is allowed
    - `max_duration_seconds` integer: Maximum number of seconds allowed for the job to run before killing it and mark it as failed
    - `auto_preview` boolean, required: Indicates if the 'environment preview option' is enabled for this container. If enabled, a preview environment will be automatically cloned when `/preview` endpoint is called. If not specified, it takes the value of the `auto_preview` property from the associated environment.
    - `port` integer, nullable: Port where to run readiness and liveliness probes checks. The port will not be exposed externally
    - `source` union, required
      - object
        - `image` ContainerSource, required
          - `image_name` string, required: The image name pattern differs according to chosen container registry provider: * `ECR`: `repository` * `SCALEWAY_CR`: `namespace/image` * `DOCKER_HUB`: `image` or `repository/image` * `PUBLIC_ECR`: `registry_alias/repository`
          - `tag` string, required: tag of the image container
          - `registry_id` string: tag of the image container
          - `registry` ContainerRegistryProviderDetailsResponse, required
            - `id` string, uuid, required
            - `name` string, required
            - `url` string, required: URL of the container registry
            - `kind` 'ECR' | 'SCALEWAY_CR' | 'DOCKER_HUB' | 'GITHUB_CR' | 'GITHUB_ENTERPRISE_CR' | 'GITLAB_CR' | 'PUBLIC_ECR' | 'DOCR' | 'GENERIC_CR' | 'GCP_ARTIFACT_REGISTRY' | 'AZURE_CR', required: The type of your container registry
      - object
        - `docker` JobSourceDockerResponse, required
          - `git_repository` ApplicationGitRepository
            - `has_access` boolean
            - `provider` 'BITBUCKET' | 'GITHUB' | 'GITLAB', required
            - `owner` string, required
            - `url` string, uri, required
            - `name` string, required: repository name
            - `branch` string
            - `root_path` string
            - `deployed_commit_id` string: Git commit ID corresponding to the deployed version of the app
            - `deployed_commit_date` string, date-time: Git commit date corresponding to the deployed version of the app
            - `deployed_commit_contributor` string: Git commit user corresponding to the deployed version of the app
            - `deployed_commit_tag` string
            - `git_token_id` string, nullable
            - `git_token_name` string, nullable
          - `dockerfile_path` string, nullable: The path of the associated Dockerfile. Only if you are using build_mode = DOCKER
          - `dockerfile_raw` string, nullable: The content of your dockerfile if it is not stored inside your git repository
          - `docker_target_build_stage` string, nullable: The target build stage in the Dockerfile to build
    - `healthchecks` Healthcheck, required
      - `readiness_probe` Probe, nullable
        - `type` object
          - `tcp` object, nullable
            - `port` integer
            - `host` string, nullable
          - `http` object, nullable
            - `path` string
            - `scheme` string
            - `port` integer
          - `exec` object, nullable
            - `command` string[]
          - `grpc` object, nullable
            - `service` string, nullable
            - `port` integer
        - `initial_delay_seconds` integer
        - `period_seconds` integer
        - `timeout_seconds` integer
        - `success_threshold` integer
        - `failure_threshold` integer
      - `liveness_probe` Probe, nullable
        - `type` object
          - `tcp` object, nullable
            - `port` integer
            - `host` string, nullable
          - `http` object, nullable
            - `path` string
            - `scheme` string
            - `port` integer
          - `exec` object, nullable
            - `command` string[]
          - `grpc` object, nullable
            - `service` string, nullable
            - `port` integer
        - `initial_delay_seconds` integer
        - `period_seconds` integer
        - `timeout_seconds` integer
        - `success_threshold` integer
        - `failure_threshold` integer
    - `auto_deploy` boolean: Specify if the job will be automatically updated after receiving a new image tag or a new commit according to the source type. The new image tag shall be communicated via the "Auto Deploy job" endpoint https://api-doc.qovery.com/#tag/Jobs/operation/autoDeployJobEnvironments
    - `icon_uri` string, uri, required: Icon URI representing the job.
    - `service_type` 'APPLICATION' | 'DATABASE' | 'CONTAINER' | 'JOB' | 'HELM' | 'TERRAFORM', required: type of the service (application, database, job, ...)
    - `job_type` 'LIFECYCLE' | 'CRON', required: type of job
    - `schedule` object, required
      - `cronjob` object, required
        - `arguments` string[]
        - `entrypoint` string: optional entrypoint when launching container
        - `timezone` string, required: tz identifier at which the schedule at will be executed
        - `scheduled_at` string, cron, required: Can only be set if the event is CRON. Represent the cron format for the job schedule without seconds. For example: `* * * * *` represent the cron to launch the job every minute. See https://crontab.guru/ to WISIWIG interface. Timezone is UT
    - `annotations_groups` OrganizationAnnotationsGroupResponse[]
      - `id` string, uuid, required
      - `created_at` string, date-time, required
      - `updated_at` string, date-time
      - `name` string, required
      - `annotations` Annotation[], required
        - `key` string, required
        - `value` string, required
      - `scopes` OrganizationAnnotationsGroupScopeEnum[], required
    - `labels_groups` OrganizationLabelsGroupResponse[]
      - `id` string, uuid, required
      - `created_at` string, date-time, required
      - `updated_at` string, date-time
      - `name` string, required
      - `labels` Label[], required
        - `key` string, required
        - `value` string, required
        - `propagate_to_cloud_provider` boolean, required

## Other responses

- `400`: Bad request
- `401`: Access token is missing or invalid
- `403`: Access forbidden
- `404`: Resource not found
- `409`: Job name within the environment is already taken

---

[API](https://skmtc.dev/qovery/apis/qovery-api.md) - [All operations](https://skmtc.dev/qovery/apis/qovery-api/llms.txt) - [OpenAPI document](https://skmtc.dev/qovery/apis/qovery-api/revisions/93c4960a44ba?raw)
