---
title: "Write a file to the sandbox"
method: POST
path: "/v1/stacks/{id}/write-file"
tags: ["Stacks"]
---

# Write a file to the sandbox

`POST /v1/stacks/{id}/write-file`

Writes file content to a path inside the sandbox (via mount or exec under the hood)

## Path parameters

- `id` string, required — Stack identifier

## Request body

- object
  - `path` string, required — Absolute path inside the sandbox
  - `content` string, required — File contents

## Response `200`

File write result

- object
  - `sandbox_path` string
  - `method` string
  - `message` string
  - `host_path` string

## Other responses

- `403` — Path not writable
- `404` — Sandbox not found

## Changes

- **2025-11-06** `8510caff5164` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/benchify/apis/benchify-api/changes/v1/stacks/:id/write-file/post.md)

---

[API](https://skmtc.dev/benchify/apis/benchify-api.md) · [All operations](https://skmtc.dev/benchify/apis/benchify-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/benchify/benchify-api/revisions/1a65aea8dd7d/schema)
