---
title: "Rename a space, archive/unarchive it, or gate the whole space."
method: PATCH
path: "/spaces/{idOrSlug}"
tags: ["Client spaces"]
---

# Rename a space, archive/unarchive it, or gate the whole space.

`PATCH /spaces/{idOrSlug}`

## Request

- Base URL: `https://api.stacktr.ee`
- URL: `https://api.stacktr.ee/spaces/{idOrSlug}`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://api.stacktr.ee/oauth/authorize`, token URL `https://api.stacktr.ee/oauth/token`, scopes: `sites:write`, `sites:read`)

Renames change the display name only; the slug is a forever addressing contract and never changes. Only the fields present in the body are touched; on the two gate fields `null` means remove the gate.

## Request body

- object
  - `name` string: New display name.
  - `archived` boolean: true to archive (the plan slot is freed; the portal and the address close to readers, each page keeps its own link), false to unarchive.
  - `password` string, nullable: Passcode covering every page in the space, inherited by pages already filed under it and by ones published later. null clears it.
  - `allowed_email_domain` string, nullable: Email gate covering every page in the space: domains and/or single addresses separated by commas ("acme.com, jane@globex.com"; strict-equal, no subdomains), up to 20. null clears it.

## Response `200`

Updated.

- object
  - `ok` boolean, required

## Other responses

- `402`: A plan ceiling was hit. The feature or the quota is not on this plan; the caller needs a different plan or an x402 unlock.
- `404`: Resource not found.
- `409`: Another active space already answers to that name.

---

[API](https://skmtc.dev/stacktr/apis/stacktree-api.md) · [All operations](https://skmtc.dev/stacktr/apis/stacktree-api/llms.txt) · [OpenAPI document](https://skmtc.dev/stacktr/apis/stacktree-api/revisions/5878cce46977?raw)
