---
title: "Make a copy"
description: "Copies the site into the caller's account as a new private site: a publish of the site's live release as its release 1, with every file the site serves, its cool.json and its functions module (never…"
canonical: "https://www.cool.computer/docs/api-reference/publishing/make-a-copy"
---
# Make a copy

> Copies the site into the caller's account as a new private site: a publish of the site's live release as its release 1, with every file the site serves, its cool.json and its functions module (never…

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

Copies the site into the caller's account as a new private site: a publish of the site's live release as its release 1, with every file the site serves, its cool.json and its functions module (never hidden files or node_modules), under the requested name or a generated one; with a database, the copy's database gets the original's tables, indexes, views and triggers but no rows. It takes no release history, comments, mail, custom domain or shares, and the original's later changes never reach it. A copy counts as a publish: the publish limits and the account's site creation budget apply (429 artifact_creation_rate_exceeded). A copy of another account's site gets none of the caller's secret sets: its cool.json is published without secrets, since its functions are that account's code; the owner's own copy keeps its set. Once the request is received the copy finishes even if the client disconnects; a copy that fails after its computer was created deletes it again. Send an Idempotency-Key: a retry with the same key returns the original response or finishes that copy, and never copies again. Only a site without a VM can be copied for now (409 computer_has_vm). The owner may always copy their computer. Anyone else may only when the owner allows copies (PUT /api/computers/{id}/copy-settings), and only a computer they may open: a public one with any account credential except a computer's runtime token, or a private one shared with them.

## 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.

## Request body

Optional.

- `application/json` (object)
  - `name` (string, pattern `^[a-z0-9]+(?:-[a-z0-9]+)*$`, at most 63 characters, not "abuse", "admin", "admin-api", "api", "edge-api", "hostmaster", "mail", "mailer-daemon", "no-reply", "noreply", "postmaster", "root", "security", "signup", "support", "webmaster", "www"): Name for the copy; omit it for a generated one.

## Responses

- `201`: The copy and the receipt of its live release.
  - `application/json` (object)
    - `computer` (object, required)
      - `id` (string, required)
      - `hostname` (string, required)
      - `name` (string, required)
      - `ip` (string, required)
      - `status` (string, required): artifact (no VM), creating, running, stopped while its account's Pro has lapsed (its VM is stopped and deleted at auto_delete_at unless Pro returns; once Pro returns it can show running briefly until the reconciler has started its VM), or deleting from when its deletion begins until it is gone.
      - `url` (string, uri)
      - `email_address` (string, email)
      - `visibility` ("private" or "public", required)
      - `access` ("owner" or "can_use" or "claim_key", required): What the caller holds: owner, can_use for a computer shared with them, or claim_key in the response to a publish without an account, whose claim key republishes to the computer and claims it.
      - `copy_enabled` (boolean, required): People other than the owner may copy the computer into their own accounts (PUT /api/computers/{id}/copy-settings).
      - `site` (boolean, required): The URL serves the computer's published files: from the edge, or from its VM's built-in site server until a port is first exposed, when the program on it takes every path but the functions' for good.
      - `network_policy` (object, required): Outbound access policy. open allows public destinations, none blocks outbound access, and allowlist permits only the named public hosts. Private and reserved addresses remain blocked.
        - `mode` ("open" or "none" or "allowlist", required)
        - `allowed_hosts` (array of string, at most 100 items): Required and non-empty only when mode is allowlist. Each value is a hostname, public IP, or leading wildcard such as \*.example.com, without a scheme, port, path, or CIDR.
      - `created_at` (string, date-time, required)
      - `auto_delete_at` (string or null, date-time): When the computer is deleted by itself: its own auto-delete deadline, or, for a VM of an account whose Pro lapsed, when its stopped VMs are deleted, whichever comes first.
      - `creation_mode` (string)
    - `release` (object, required)
      - `number` (integer, at least 1, required)
      - `state` ("uploading" or "ready" or "failed", required)
      - `live` (boolean, required)
      - `files` (integer, at least 0, required)
      - `bytes` (integer, int64, at least 0, required)
      - `created_at` (string, date-time, required)
      - `ready_at` (string, date-time)
    - `url` (string, uri, required): The computer's URL, which serves the live release.
    - `release_url` (string, uri): This release's own hostname r\<n>--\<name>. Absent once the computer's VM serves its URL.
    - `vm` (boolean, required): Whether the computer's VM serves its URL, because a server on it answered.
    - `next` (object, required): What to do next: upload the missing hashes, finalize, or nothing (done).
      - `action` ("upload" or "finalize" or "done", required)
      - `upload` (object)
        - `method` ("PUT" or "POST", required)
        - `href` (string, required): API path; {sha256} stands for each missing hash.
      - `finalize` (object)
        - `method` ("PUT" or "POST", required)
        - `href` (string, required): API path; {sha256} stands for each missing hash.
- `400`: Bad Request.
- `401`: Unauthorized.
- `402`: Payment Required. The trial expired or Pro is inactive; inspect the problem code and resolution.
- `403`: Forbidden. `copy_not_allowed`: the owner does not allow copies.
- `404`: Not Found. Also for a private computer that is not shared with the caller.
- `409`: Conflict. `computer_has_vm`: only a site without a VM can be copied for now. `nothing_to_copy`: the site has nothing published. `copy_source_changed`: the site changed while it was being copied; a new copy made nothing, while a retry may leave its unfinished copy in the account, so list computers before copying again. A taken name answers as a publish does.
- `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.
- `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/copy" \
  -H "authorization: Bearer $TOKEN"
```
