---
title: "Create new external service"
method: POST
path: "/external-services"
tags: ["External Services"]
---

# Create new external service

`POST /external-services`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/external-services`
- Auth: none declared

Create a managed external service. The `parameters` object is service-type-specific. Read `get_service_type_parameters` for the chosen `service_type` immediately before creating the service and provide every field that schema marks as required. Set `project_id` to create and link the service in one approval-gated operation.

## Request body

- CreateExternalServiceRequest
  - `members` ClusterMemberRequest[]: Cluster member specifications for topology "cluster". Optional: when omitted the cluster gets a monitor, a primary and a replica, all on the control plane (one host, so it survives a member failing, not the host failing). When given it must hold exactly one `monitor` and at least one `primary` or `replica`; set `node_id` to spread members across worker nodes.
    - `node_id` integer, nullable: Target worker node ID. Omit or null to run on the control plane.
    - `role` string, required: Service-type-specific role (e.g., "monitor", "primary", "replica")
  - `name` string, required
  - `node_id` integer, nullable: Target node ID for the service. Omit or null to run on the control plane.
  - `parameters` object, required: Service-type-specific configuration. Read `GET /external-services/types/{service_type}/parameters` before creating a service and provide every field its schema marks as required. Secret values that the schema describes as auto-generated may be omitted.
  - `project_id` integer, nullable: Optionally link the new service to this project as part of the same request. The caller must have write access to the target project. If linking fails, Temps removes the newly created service so callers do not have to recover an ambiguous half-created resource.
  - `service_type` 'mariadb' | 'mongodb' | 'postgres' | 'redis' | 's3' | 'kv' | 'blob' | 'rustfs', required
  - `topology` string: Service topology: "standalone" (default) or "cluster" (HA multi-member).
  - `version` string, nullable

## Response `201`

Service created successfully

- ExternalServiceInfo
  - `connection_info` string, nullable
  - `continuous_archive_pinned_at` string, nullable: When `continuous_archive_s3_source_id` was last set. Null alongside a non-null source id means it was set by the original provisioning flow rather than an explicit repoint.
  - `continuous_archive_s3_source_id` integer, nullable: S3 source ID that this service's continuous archiving (Postgres/ Timescale WAL-G `archive_command`, or MariaDB's binlog shipper) currently writes to. Null for service types with no continuous archiving concept, or a Postgres/MariaDB service that has never had one provisioned. Change it with `repoint_continuous_archive_source`.
  - `created_at` string, required
  - `error_message` string, nullable: Error message from failed initialization.
  - `id` integer, required
  - `members` ServiceMemberInfo[]: Cluster members (empty for standalone services).
    - `compute_ip` string, nullable: Container's IP on the `temps-overlay` multi-host network. Populated by the lifecycle hook (ADR-011 Phase 3); `None` on single-host clusters where the overlay isn't attached.
    - `container_name` string, required
    - `hostname` string, nullable
    - `id` integer, required
    - `live_state` string, nullable: Live FSM state from the pg_auto_failover monitor (`primary`, `secondary`, `catchingup`, `report_lsn`, …). `None` when the monitor is unreachable, the service is not a cluster, or the row is the monitor itself. **The UI must render the role badge from this field**, falling back to `role` only when `live_state` is null. `role` is now config-only (`monitor` or `replica`); flipping the badge to "primary" when the monitor elects a new one used to require a reconciler that lagged ~5s behind real failovers — and during that window the UI showed two primaries. `live_state` is read directly from the monitor on every list, so it can never lag.
    - `node_id` integer, nullable
    - `ordinal` integer, required
    - `port` integer, nullable
    - `provisioning_error` string, nullable: Most recent provisioning failure message, when `status='failed'`. Set by the background task so the UI can show *why* the new replica didn't come up.
    - `provisioning_step` string, nullable: Last-attempted phase of the async `add_cluster_member` background task (e.g. `validating`, `provisioning_container`, `done`, `failed`). `None` for members not created through that flow — the UI falls back to the `status` column for those.
    - `role` string, required: Configured member kind. For a PostgreSQL cluster this is `monitor` or `replica`, and every data node is `replica`, including the current primary: which node is primary is runtime state, read it from `live_state`.
    - `status` string, required
  - `metrics_enabled` boolean: Whether metric collection is enabled for this service. The UI uses this to decide whether to poll the monitoring endpoints.
  - `name` string, required
  - `node_id` integer, nullable: Node ID where the service runs. Null means control plane (local).
  - `readiness` ServiceReadiness, nullable: Startup readiness of a service that is `starting` or failed to start.
    - `deadline_secs` integer, required: How long the gate waits before reporting failure.
    - `failure` InitializationFailure, nullable: A failed initialization, as shown to the operator.
      - `kind` 'store_init_failed' | 'restart_loop' | 'timeout', required: Why the gate gave up.
      - `log_excerpt` string[], required: Container log lines that explain the failure, oldest first. Secrets are redacted. Empty when the logs could not be read.
      - `next_actions` ReadinessNextAction[], required: Suggested next steps, most useful first.
      - `reason` string, required: What happened, including the last probe's typed reason.
    - `phase` 'starting' | 'failed', required: Where the gate is for a service.
    - `reason` string, nullable: Latest reason the service is not usable yet, from the engine's authenticated probe. Null before the first probe.
    - `restart_count` integer, required: Container restarts since the gate started.
    - `started_at` string, required: When the gate started waiting (ISO 8601, UTC).
  - `service_type` 'mariadb' | 'mongodb' | 'postgres' | 'redis' | 's3' | 'kv' | 'blob' | 'rustfs' | 'minio', required
  - `status` string, required
  - `topology` string, required: Service topology: "standalone" (single container) or "cluster" (HA multi-member).
  - `updated_at` string, required
  - `version` string, nullable

## Other responses

- `400`: Invalid request
- `409`: Service name, container, or volumes are already owned by another service or an active restore
- `500`: Internal server error

## Changes

- **2026-10-09** `42b90102d176`: 1 info
  - added the non-success response with the status `409`
- **2026-10-09** `c2e6bffeca6c`: 1 info
  - added the optional property `readiness` to the response with the `201` status
- **2026-09-09** `961c884b4940`: 1 info
  - added the new optional request property `project_id`
- **2026-09-07** `cfd9d4606e8c`: 2 info
  - added the optional property `continuous_archive_pinned_at` to the response with the `201` status
  - added the optional property `continuous_archive_s3_source_id` to the response with the `201` status
- **2026-09-07** `e2dec7aec75d`: 1 warning
  - removed the request property `project_id`

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/external-services/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
