---
title: "Save a sandbox file as a project file"
method: POST
path: "/v1/sandboxes/{sandbox_id}/files/export"
tags: ["Sandboxes"]
---

# Save a sandbox file as a project file

`POST /v1/sandboxes/{sandbox_id}/files/export`

## Request

- Base URL: `https://api.dexto.ai`
- URL: `https://api.dexto.ai/v1/sandboxes/{sandbox_id}/files/export`
- Auth: HTTP bearer

Save a file of the running sandbox as a project file, up to 5 GiB. A taken file_path is a 409 unless overwrite is true. Admitted like any upload: its storage is charged to the project from credits, and without credits or at a spend limit it is refused with 402.

## Path parameters

- `sandbox_id` string, required

## Request body

- object
  - `content_type` string: The file's media type; inferred from its extension when omitted.
  - `file_path` string, required: The project file path to save it as.
  - `overwrite` boolean: Replace a project file that already has file_path.
  - `path` string, required: The sandbox file, under /workspace.

## Response `200`

Replaced the file at file_path.

- object
  - `content_type` string, required
  - `created_at` string, date-time, required
  - `created_by` object, required: The key, agent or person that wrote the file first; a key or agent is null once deleted.
    - `agent_id` string, uuid, nullable, required
    - `api_key_id` string, uuid, nullable, required
    - `user_id` string, nullable, required: The person who wrote it, by their key or an OAuth token; null for agents and deployed code.
  - `expires_at` string, date-time, nullable, required
  - `id` string, uuid, required
  - `metadata` object, required
  - `object` 'file', required
  - `path` string, required
  - `sha256` string, required
  - `size_bytes` integer, required
  - `updated_at` string, date-time, required

## Other responses

- `201`: Created the file.
- `400`: Invalid JSON or request fields.
- `401`: Missing or invalid API key.
- `402`: The account has insufficient credits.
- `403`: The account cannot perform this operation.
- `404`: The requested resource was not found.
- `409`: The request conflicts with existing resource state.
- `429`: The account exceeded this operation's request rate.
- `500`: Unexpected Dexto failure.
- `502`: The upstream model provider failed.
- `503`: A required Dexto service is temporarily unavailable.

---

[API](https://skmtc.dev/dexto/apis/dexto-api.md) - [All operations](https://skmtc.dev/dexto/apis/dexto-api/llms.txt) - [OpenAPI document](https://skmtc.dev/dexto/apis/dexto-api/revisions/47eb880cffa5?raw)
