---
title: "PUT /external-services/{id}/tls"
method: PUT
path: "/external-services/{id}/tls"
tags: ["External Services"]
---

# PUT /external-services/{id}/tls

`PUT /external-services/{id}/tls`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/external-services/{id}/tls`
- Auth: HTTP bearer

## Path parameters

- `id` integer, required

## Request body

- UpdateServiceTlsRequest
  - `mode` 'off' | 'available' | 'required', required: The new mode. `required` is rejected until it is supported.

## Response `200`

Mode changed and applied (a running database is restarted)

- UpdateServiceTlsResponse
  - `previous_mode` 'off' | 'available' | 'required', required: Server-side TLS mode of one managed service.
  - `tls` ServiceTlsStatusResponse, required: A service's effective server TLS status.
    - `accepts_plaintext` boolean, required: Whether the server accepts unencrypted connections in this mode.
    - `active` boolean, nullable: Whether the managed certificate is served: by the container, or by every data node of a cluster. `null` when it cannot be inspected (not created yet, no Docker daemon here, or cluster members disagree).
    - `ca_certificate_path` string, nullable: Where to download the CA certificate, once it exists.
    - `certificate` ServiceTlsCertificateResponse, nullable: The certificate currently issued for a service. Public facts only.
      - `fingerprint_sha256` string, required: SHA-256 (lowercase hex) of the certificate's DER encoding.
      - `not_after` string, date-time, required
      - `not_before` string, date-time, required
      - `subject_alt_names` string[], required: Names the certificate is valid for.
    - `certificate_authority` ManagedCaInfoResponse, nullable: The managed-services CA. Public facts only.
      - `fingerprint_sha256` string, required: SHA-256 (lowercase hex) of the CA certificate's DER encoding: compare it with the downloaded file before trusting it.
      - `not_after` string, date-time, required
      - `not_before` string, date-time, required
    - `change_restarts_database` boolean, required: Whether changing the mode restarts the database. False for a cluster, whose data nodes switch certificates in place.
    - `members` ServiceTlsMemberResponse[], required: A cluster's data nodes; empty for a standalone service.
      - `active` boolean, nullable: Whether it serves the managed certificate. `null` when it could not be read (see `detail`).
      - `container_name` string, required
      - `detail` string, nullable: Why its state is unknown, when it is.
      - `pending` boolean, required: Whether it lags the setting; the next start applies it.
      - `self_signed` boolean, required: Whether it still serves pg_auto_failover's self-signed certificate, which clients cannot verify.
      - `status` string, required: The member's lifecycle status (`running`, `stopped`, ...).
    - `mode` 'off' | 'available' | 'required', required: `off`, `available` (TLS offered, plaintext still accepted) or `required` (plaintext rejected; not yet supported).
    - `pending_restart` boolean, required: What runs lags the setting; the next start (or a restart) applies it.
    - `service_id` integer, required
    - `supported` boolean, required: Whether this service can use managed TLS at all.
    - `unsupported_reason` string, nullable: Why not, when `supported` is false.

## Other responses

- `400`: The service cannot use this mode
- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Service not found
- `409`: A major upgrade is in progress, the service is still being created or starting, or the recreate guard kept its existing container so the mode was not applied
- `500`: Applying the mode failed; the previous mode was kept

## Changes

- **2026-11-11** `3ecb08be4b2c`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/external-services/:id/tls/put.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)
