---
title: "Restart a published service"
description: "Restarts the configured durable service as a new persisted revision."
canonical: "https://www.cool.computer/docs/api-reference/services/restart-a-published-service"
---
# Restart a published service

> Restarts the configured durable service as a new persisted revision.

```http
POST https://api.cool.computer/api/computers/{id}/service/restart
```

Restarts the configured durable service as a new persisted revision. Send an Idempotency-Key so a lost response cannot trigger another restart.

## Authorization

- A Cool Computers API key, user access token, or claimed agent access token in the Authorization header. Follow https://www.cool.computer/auth.md for agent registration and https://www.cool.computer/authentication.md for direct user credentials.

## Parameters

- `id` (path, string, at least 1 characters, required): The computer's name, such as agent-atlas, or its id (cmp_…). Every caller may use either, the computer's own runtime token included.
- `Idempotency-Key` (header, string, pattern `^[!-~]+$`, 1 to 128 characters): A caller-generated key for safely retrying this side effect. The server retains the key and response for 24 hours. Reusing it with the same request replays the original response, except after a failure that proves nothing happened: that is kept for one minute, and one that sets Retry-After is not kept, so a retry after it runs the request again; reusing it with different input returns 409.

## Responses

- `200`: The restarted service and current process state.
  - `application/json` (object)
    - `configured` (boolean, required)
    - `status` (string, required): unconfigured; starting (the program runs but is not ready yet); running (ready); restarting (waiting to start the program again after a crash); stopped; exited (the program ended with code 0); failed; unknown or unavailable when the VM cannot say; or the computer's status while it is not running.
    - `ready` (boolean, required): With a port, the port accepts connections; without one, the program has stayed up 5 s.
    - `url` (string, uri)
    - `command` (string)
    - `cwd` (string)
    - `port` (integer, 1 to 65535): Absent for a program that serves no port.
    - `exec_id` (string)
    - `pid` (integer, at least 1)
    - `started_at` (string, date-time)
    - `ended_at` (string, date-time)
    - `exit_code` (integer)
    - `signal` (string)
    - `restarts` (integer, at least 0, required): How often the program was started again after a crash since the service was last started.
    - `last_exit` (object): The last crash it was restarted after.
      - `code` (integer, required)
      - `at` (string, date-time, required)
    - `last_output` (string): The program's last line of output, while it is not ready.
    - `logs` (object)
      - `retention` ("disk_ring", required)
      - `bytes_written` (integer, int64, at least 0, required)
      - `bytes_dropped` (integer, int64, at least 0, required)
      - `dropped_frames` (integer, at least 0, required)
      - `next_id` (integer, int64, at least 0, required)
- `202`: The service is still starting in the background: its program runs, but was not ready within 60 seconds. It is kept, and its port, if it has one, is exposed once it is ready; detail says what happens next.
  - `application/json` (object)
    - `configured` (boolean, required)
    - `status` (string, required): unconfigured; starting (the program runs but is not ready yet); running (ready); restarting (waiting to start the program again after a crash); stopped; exited (the program ended with code 0); failed; unknown or unavailable when the VM cannot say; or the computer's status while it is not running.
    - `ready` (boolean, required): With a port, the port accepts connections; without one, the program has stayed up 5 s.
    - `url` (string, uri)
    - `command` (string)
    - `cwd` (string)
    - `port` (integer, 1 to 65535): Absent for a program that serves no port.
    - `exec_id` (string)
    - `pid` (integer, at least 1)
    - `started_at` (string, date-time)
    - `ended_at` (string, date-time)
    - `exit_code` (integer)
    - `signal` (string)
    - `restarts` (integer, at least 0, required): How often the program was started again after a crash since the service was last started.
    - `last_exit` (object): The last crash it was restarted after.
      - `code` (integer, required)
      - `at` (string, date-time, required)
    - `last_output` (string): The program's last line of output, while it is not ready.
    - `logs` (object)
      - `retention` ("disk_ring", required)
      - `bytes_written` (integer, int64, at least 0, required)
      - `bytes_dropped` (integer, int64, at least 0, required)
      - `dropped_frames` (integer, at least 0, required)
      - `next_id` (integer, int64, at least 0, required)
    - `detail` (string, required)
- `400`: Bad Request.
- `401`: Unauthorized.
- `402`: Payment Required. `pro_required`: VMs need Pro; start Pro with cool billing upgrade, or fix a lapsed subscription with cool billing portal, or use the Account page.
- `403`: Forbidden.
- `404`: Not Found. `computer_not_found`: the computer does not exist or is not yours.
- `409`: Conflict.
- `429`: Too Many Requests. If the problem code is api_request_rate_exceeded, wait for Retry-After seconds; other problem codes describe a separate limit.
- `500`: Internal Server Error.
- `503`: Service Unavailable. `computer_starting` means the computer is starting, or stopped and being started again; wait for Retry-After seconds, then retry. Otherwise inspect the problem code and resolution.
- `default`: A machine-readable API error with a stable code and recovery instruction.

An error is an `application/problem+json` document with a stable `code`; [API errors](/docs/api-reference/errors) says how to handle one.

## Example

```sh
curl -X POST "https://api.cool.computer/api/computers/$PARAM_ID/service/restart" \
  -H "authorization: Bearer $TOKEN"
```
