---
title: "Autosave document files in one release"
description: "Saves a document artifact's edited files as one release: the document bridge's save (backend/docs/sites/comments.md#document-autosave)."
canonical: "https://www.cool.computer/docs/api-reference/files/autosave-document-files-in-one-release"
---
# Autosave document files in one release

> Saves a document artifact's edited files as one release: the document bridge's save (backend/docs/sites/comments.md#document-autosave).

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

Saves a document artifact's edited files as one release: the document bridge's save (backend/docs/sites/comments.md#document-autosave). Only a person who owns the computer or is an active share member saves, signed in through a browser session, user API key or person-bound access token; organization API keys answer 403 document_person_required, and computer tokens 401, since the route takes account credentials only. Field id is a save id of 1 to 128 bytes, kept per computer for 24 hours (the newest 32): a retry by the same person with the same id, base, paths and bytes returns that save's version, even after its release was coalesced away. Field base is the version the edits were made on. Every other part is one changed file, its field name the site-relative path encoded with encodeURIComponent (the filename is ignored). A docx, xlsx, pptx or pdf document, or a video (video.json), saves only artifact.json's declared file; slides save deck/deck.json, deck/slides/\<id>.html (id of 1 to 64 ASCII letters, digits, underscores or hyphens) and png, jpg, jpeg, gif, webp or svg files under deck/. Each file is at most 25 MiB, the changed files together at most 64 MiB. A base that is no longer live answers 409 document_conflict with the live version in context.version and writes nothing. Too many saves of the account at once, another save of the computer still publishing, or a publish holding the computer past the save's wait answer 429 document_save_busy with Retry-After: retry with the same id; an upload that sends less than 4 KiB in a minute of waiting, or takes over 15 minutes in all, is ended with 429 document_save_stalled, to retry the same way. Once the body is read, the save finishes within two minutes even if the client disconnects. Browser sessions need the same-origin Origin header. Comments may be off. Once the site has a VM, new saves answer 409 computer_has_vm.

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

## Request body

Required.

- `multipart/form-data` (object)
  - `id` (string, 1 to 128 characters, required)
  - `base` (string, 1 to 128 characters, required)
  - `*` (string, binary): Each value, under a name of the caller's.

## Responses

- `200`: Saved live release version.
  - `application/json` (object)
    - `version` (string, required)
- `400`: A machine-readable API error with a stable code and recovery instruction.
- `401`: Unauthorized.
- `403`: document_access_denied: ask the owner to share the computer. document_person_required: save with a person's credential. document_path_not_allowed: save only the declared document file, or deck JSON, slide HTML and images under deck/.
- `409`: document_conflict carries the live version in context.version: reload their version, or Download a copy of yours. not_document: the live release declares no document. computer_has_vm: the site has a VM and takes no more saves.
- `413`: document_too_large: each file is at most 25 MiB and the changed files together at most 64 MiB.
- `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.
- `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/files/document" \
  -H "authorization: Bearer $TOKEN" \
  -F "id=$FIELD_ID" \
  -F "base=$FIELD_BASE" \
  -F "index.html=@index.html"
```
