> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zocomputer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Write space route

> Create a new route or fully rewrite an existing one in the user's zo.space site.

{/* Tool: write_space_route */}

Use for new routes or full rewrites. For edits to an existing route, prefer `edit_space_route` — it sends only the changed sections instead of the entire file.

## Parameters

<ParamField path="path" type="string" required={true}>
  Route path starting with '/'. Use '/' for custom home page.
</ParamField>

<ParamField path="route_type" type="string" required={true}>
  Either 'api' or 'page'.
</ParamField>

<ParamField path="code" type="string" default={""}>
  Full source code. Required — must be valid TypeScript/TSX with a default export.
</ParamField>

<ParamField path="public" type="string" default={""}>
  Whether the route is publicly accessible. API routes are always public. For pages, omit to preserve current visibility on updates; defaults to False for new pages (True for homepage).
</ParamField>
