---
title: "Write one task file [write]"
method: PUT
path: "/tasks/{id}/files/{path}"
tags: ["tasks"]
---

# Write one task file \[write\]

`PUT /tasks/{id}/files/{path}`

## Request

- Base URL: `https://api.agentsky.dev/v1`
- URL: `https://api.agentsky.dev/v1/tasks/{id}/files/{path}`
- Auth: HTTP bearer

Streams raw body bytes into the current file with no application single-file, total-size or file-count limit; byte counts must be exactly representable integers. For a resumable transfer, first complete `/files/uploads`, then supply its `file_id` here and omit the body. The referenced file must pass the caller's downloadable-file authorization; its size and SHA-256 receipt are verified while streaming into the same version writer. `base_sha256` names what the caller last saw at the path (empty for nothing); when something else is current the default write is still made, both versions are kept, and the response says `conflict: true`. With `require_base_match=true`, a base is required and a mismatch instead returns 409 `revision_conflict` without updating the file. Sessions of the task pick the file up at the start of their next turn.

## Path parameters

- `id` string, required
- `path` string, required

## Query parameters

- `base_sha256` string
- `require_base_match` boolean
- `file_id` string

## Request body `application/octet-stream`

- string, binary

## Response `200`

OK

- object
  - `file` TaskFile, required
    - `path` string, required
    - `size_bytes` integer, required
    - `sha256` string, required
    - `updated_at` string, date-time, required
    - `updated_by_session` string, nullable, required: The session that last wrote it; null when a person or developer did
  - `conflict` boolean, required

## Other responses

- `default`: Error — { error: { code, message } }

## Changes

- **2026-11-03** `8280a065ef6a`: 2 info
  - added the new optional `query` request parameter `file_id`
  - request body became optional
- **2026-11-02** `e5e8f0229a99`: 2 info
  - added the new optional `query` request parameter `require_base_match`
  - added the optional property `error/request_id` to the response with the `default` status

[Operation history](https://skmtc.dev/agentsky/apis/agentsky-developer-api/changes/tasks/:id/files/:path/put.md)

---

[API](https://skmtc.dev/agentsky/apis/agentsky-developer-api.md) - [All operations](https://skmtc.dev/agentsky/apis/agentsky-developer-api/llms.txt) - [OpenAPI document](https://skmtc.dev/agentsky/apis/agentsky-developer-api/revisions/8280a065ef6a?raw)
