deployment_service_create
Create a service inside an environment.
Create a service in an existing environment from a git branch, a container image, or a static build. Requires product-scoped write access. Choose persistent mode for a running service or scheduled mode for a job; mode cannot change after creation. Returns: `{ id, environmentId, name, slug, source, ... }` — a service object, not a deployment id. Typical sequence: deployment_service_create → deployment_deployment_list with the returned service id → deployment_deployment_get with a deployment id from that list. Fails when: scheduled mode is combined with containerPort, replicas, or scaleToZero. Replace the example environmentId with your environment's UUID.
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
| mode | string | — | persistent keeps a service running; scheduled runs a job. Cannot change after creation.default: persistent |
| name | string | • | Service name, 1–80 characters. The example uses api. |
| slug | string | — | URL slug, 1–40 characters. |
| canvas | object | — | Position on the environment canvas, with numeric x and y fields. |
| probes | object | — | Readiness and liveness checks. Each configured check requires a path starting with /; timing fields use seconds.default: {} |
| source | object | • | Source object: type is git, image, or static. Git requires branch; image requires registry and tag. The example uses the main branch; replace it with your branch and supply the repository details for your source. |
| command | string | null | — | Shell command for a scheduled run, 1–4096 characters. Omit it or use null to run the image entrypoint. |
| tracing | string | — | Tracing instrumentation: off, node, or python. Applied when a deployment builds the workload.default: off |
| replicas | integer | — | Number of replicas, 0–50. Persistent mode only. |
| schedule | string | null | — | Five-field UTC cron expression: minute hour day-of-month month day-of-week. Use null for a job that runs only on demand. |
| resources | object | — | CPU and memory limits, supplied as strings in limits.cpu and limits.memory. |
| containerPort | integer | — | Container port, 1–65535. Persistent mode only. |
| environmentId | string | • | UUID of the existing environment. Replace the example UUID with yours. |
| jobTimeoutSec | integer | — | Maximum duration of a scheduled run, in seconds, from 60 to 86400. A run exceeding this limit is terminated. |
| jobConcurrency | string | — | When a previous run is still active: forbid skips the next run, allow runs both, and replace terminates the previous run. |
Try it
Create a service called api in my staging environment from the main branch of my repo.