---
title: "POST /v1/sandboxes/{id}/source"
method: POST
path: "/v1/sandboxes/{id}/source"
tags: ["Sandboxes"]
---

# POST /v1/sandboxes/{id}/source

`POST /v1/sandboxes/{id}/source`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/v1/sandboxes/{id}/source`
- Auth: HTTP bearer

## Path parameters

- `id` string, required

## Request body

- union: Initial content to seed into the sandbox work dir. Mirrors the `@vercel/sandbox` `source` option. `type` is one of: - `git` — clone `url`; optionally check out `revision` - `tarball` — download `url` (must be tar or tar.gz) and extract For private git repos, pass credentials one of two ways: 1. **Inline (SDK-compatible):** `username` + `password`. GitHub tokens use `username: "x-access-token"`. 2. **Stored connection (temps-native):** `git_connection_id` references a row in the caller's git provider connections. Temps resolves the token server-side and injects it safely. `git_connection_id` is mutually exclusive with `username`/`password`.
  - object
    - `depth` integer, nullable
    - `destination` string, nullable: Optional path relative to the sandbox work directory.
    - `git_connection_id` integer, nullable
    - `password` string, nullable
    - `revision` string, nullable
    - `strip_git_metadata` boolean: Remove `<destination>/.git` after cloning. Requires destination.
    - `type` 'git', required
    - `url` string, required
    - `username` string, nullable
  - object
    - `type` 'tarball', required
    - `url` string, required

## Response `200`

Source content seeded into the sandbox work dir

- SandboxResponse: `@vercel/sandbox` wraps every single-sandbox response as `{ sandbox: {...}, routes: [...] }`. The SDK reads both.
  - `routes` SandboxRoute[], required
    - `port` integer, required
    - `subdomain` string, required
    - `url` string, required
  - `sandbox` SandboxInner, required: Inner `sandbox` object in `@vercel/sandbox` responses. Strict shape — the SDK's zod validator rejects missing required fields.
    - `agent_run_id` integer, nullable: Agent run this sandbox executes (autofixer / workflow agent). `None` for sandboxes created via this API.
    - `allow_docker` boolean, required: Normal guest-root semantics enabled for Docker (microsandbox only).
    - `backend` string, nullable: Isolation backend: "docker" | "firecracker" | "microsandbox". `None` on legacy rows created before the backend was recorded.
    - `createdAt` integer, required
    - `cwd` string, required
    - `disk_size_mb` integer, nullable: Configured root disk size in MB (Firecracker). `None` when unknown or the default.
    - `egress_policy` SandboxEgressPolicy, required: Which outside destinations the sandbox may reach (temps-native).
      - `mode` 'internet' | 'restricted': How a sandbox may reach the outside world.
      - `rules` EgressRule[]: Allowed destinations, in `restricted` mode. At most 100.
        - `cidr` string, nullable: An IPv4 or IPv6 address or CIDR block (`198.51.100.7`, `2606:4700::/32`), matched against a literal IP the sandbox asked for or the address a hostname resolved to.
        - `host` string, nullable: A hostname, matched case-insensitively against the name the sandbox asked for (`api.example.com`). A leading `*.` matches subdomains only: `*.example.com` matches `a.example.com` and `a.b.example.com`, never `example.com` itself.
        - `ports` integer[]: Destination ports this rule permits, 1-65535. Empty means 80 and 443.
    - `id` string, required
    - `image` string, nullable
    - `lifecycle` string, required: Lifecycle class (ADR-036): `"ephemeral"` or `"workspace"`. Always present — a client that doesn't know about workspaces sees `"ephemeral"` and behaves exactly as before.
    - `memory` integer, required
    - `name` string, required
    - `node_id` integer, nullable: Worker node hosting the sandbox (ADR-048). `null` = the control plane.
    - `node_name` string, required: Name of the hosting node; `"control-plane"` for control-plane sandboxes.
    - `preview_access` 'temps_login' | 'password' | 'public', required: Who may open the preview URLs: `temps_login` (a signed-in Temps user who may read this sandbox; the default), `password` (whoever knows the preview password) or `public` (anyone).
    - `preview_allowed_cidrs` string[], required: Client networks allowed to open the preview URLs, as normalised CIDRs. Checked before `preview_access`; empty = any address.
    - `preview_password_hint` string, nullable
    - `preview_url_template` string, required
    - `project_id` integer, nullable: Project this sandbox was created from, when created from one.
    - `region` string, required
    - `requestedAt` integer, required: Creation time as Unix epoch milliseconds.
    - `runtime` string, required
    - `source_repo_url` string, nullable: Repo the work dir was seeded from. Never carries credentials.
    - `status` string, required
    - `timeout` integer, required: Idle timeout in milliseconds (SDK convention).
    - `updatedAt` integer, required
    - `vcpus` number, double, required

## Other responses

- `400`: Validation error (embedded creds, conflicting fields, etc.)
- `404`: Sandbox not found
- `409`: Sandbox is not running
- `500`: Source seed failed inside sandbox

## Changes

- **2026-10-28** `b8d51a990805`: 3 info
  - added the required property `sandbox/egress_policy` to the response with the `200` status
  - added the required property `sandbox/preview_access` to the response with the `200` status
  - added the required property `sandbox/preview_allowed_cidrs` to the response with the `200` status
- **2026-10-14** `4ddae13b7241`: 1 info
  - added the required property `sandbox/allow_docker` to the response with the `200` status
- **2026-10-05** `4b228ebed583`: 2 info
  - added the optional property `sandbox/node_id` to the response with the `200` status
  - added the required property `sandbox/node_name` to the response with the `200` status
- **2026-10-05** `63a80791dc58`: 1 breaking, 1 warning
  - removed the required property `sandbox/node_name` from the response with the `200` status
  - removed the optional property `sandbox/node_id` from the response with the `200` status
- **2026-10-02** `185fa8a10fca`: 2 info
  - added the optional property `sandbox/node_id` to the response with the `200` status
  - added the required property `sandbox/node_name` to the response with the `200` status

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/v1/sandboxes/:id/source/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
