---
title: "Add a Docs7 site"
method: POST
path: "/v2/teamspaces/{teamspaceId}/sites"
tags: ["Docs7 Sites"]
---

# Add a Docs7 site

`POST /v2/teamspaces/{teamspaceId}/sites`

## Request

- Base URL: `https://context7.com/api`
- URL: `https://context7.com/api/v2/teamspaces/{teamspaceId}/sites`
- Auth: HTTP bearer

Connect a GitHub repository. Docs7 checks that both the Docs7 GitHub App and the caller's own GitHub account can read the repository. The caller must have connected GitHub in the Context7 dashboard once (the dashboard stores the GitHub authorization); without it the answer is 400 `github_access_missing`. `hosting` chooses whether Docs7 publishes the docs (`"on"`, first build starts) or the site is added for the agents only (`"off"`); without it, a `docsPath` with `docs.json` or `mint.json` is published and any other is added for the agents only. Developers can set only `repoUrl`, `branch`, `docsPath`, `context7Index` and `hosting`. Docs7 Free includes 3 sites and public repositories only.

## Path parameters

- `teamspaceId` string, uuid, required

## Request body

- Docs7CreateSiteRequest
  - `repoUrl` string, uri, required
  - `branch` string: Production branch. Default: the repository's default branch.
  - `docsPath` string, required: Docs folder; `.` for the root.
  - `context7Index` boolean: Also index the repository in Context7.
  - `hosting` 'on' | 'off': `on` publishes the docs and needs `docs.json` or `mint.json` in `docsPath`; without one the answer is 400 `docs_config_missing`, and its message names the folders that have one. `off` adds the repository for the agents only. Default: `on` when `docsPath` has a config, else `off`.
  - `slug` string: First label of the platform hostname. Default: `owner-repo`. Owner or admin.
  - `customDomain` string: Owner or admin.
  - `customDomainPath` string: Required with `proxy` routing. Owner or admin.
  - `customDomainRouting` 'dns' | 'proxy': Required with `customDomain`. Owner or admin.

## Response `201`

The new site

- object
  - `data` Docs7Site, required: A Docs7 site built from a GitHub repository.
    - `id` string, uuid, required
    - `projectId` string, uuid, required: Teamspace id.
    - `createdBy` string, nullable
    - `repoUrl` string, uri, required
    - `repositoryId` string: GitHub repository id.
    - `installationId` integer: GitHub App installation id.
    - `branch` string, nullable: Pinned production branch. Null follows the default branch.
    - `defaultBranch` string, nullable
    - `docsPath` string, required: Docs folder in the repository; `.` is the root.
    - `hosting` 'off' | 'on', required: `off`: added for the agents only, nothing is published.
    - `analyticsUrl` string, uri, nullable: External docs URL for browser analytics of a site that Docs7 does not host.
    - `workerName` string
    - `platformHostname` string, required
    - `customDomain` string, nullable
    - `customDomainPath` string, nullable: Path prefix the docs are served under on the custom domain.
    - `customDomainRouting` 'dns' | 'proxy', nullable
    - `customHostnameId` string, nullable
    - `customDomainStatus` 'none' | 'pending_ownership' | 'pending_dns' | 'pending_validation' | 'pending_certificate' | 'pending_proxy' | 'active' | 'failed', required
    - `customDomainError` string, nullable
    - `customDomainRecords` Docs7DnsRecord[]
      - `purpose` 'domain_ownership' | 'tls_certificate', required
      - `type` 'CNAME' | 'TXT', required
      - `name` string, required
      - `value` string, required
    - `context7Index` boolean, required: Whether the repository is indexed in Context7.
    - `context7LibraryName` string
    - `improveSchedule` 'off' | 'daily' | 'weekly', required: How often the Context7 Agent runs on its own.
    - `pullRequestReview` Docs7PullRequestReview: PR Review Agent settings.
      - `enabled` boolean, required
      - `response` 'comment' | 'pull_request' | 'commit', required: What the agent does with its fixes. The findings comment is always posted, and every check always runs.
    - `codeWatch` object: Code Watch Agent settings: code repositories whose merged pull requests can change the docs.
      - `enabled` boolean, required
      - `repositories` object[], required
        - `repositoryId` string, required
        - `repoUrl` string, uri, required
    - `createdAt` string, date-time, required
    - `updatedAt` string, date-time, required
    - `buildFixSchedule` 'off' | 'after_build' | 'daily' | 'weekly': When the Build Fix Agent fixes the issues of the latest production build (hosted sites).
    - `snippetSchedule` 'off' | 'monthly': Whether the Example Check Agent runs every code example of the docs once a month (Docs7 Pro).
  - `deploymentId` string, uuid, nullable: The first build, when one started.

## Other responses

- `400`: Invalid body (`invalid_payload`, with `details`), docs folder missing (`docs_path_missing`), a custom domain on a repository without docs config (`docs_config_missing`), or no GitHub access (`github_access_missing`)
- `401`: Missing or invalid bearer
- `403`: Role not allowed (`forbidden`), or the plan does not allow it (`docs7_pro_required`)
- `404`: No such site in this teamspace
- `409`: The repository, slug or domain is taken (`site_conflict`), or the teamspace is changing (`project_busy`)
- `500`: Internal error
- `502`: GitHub could not be read

## Changes

- **2026-10-27** `2ead96d131a7`: 1 info
  - added the optional property `data/snippetSchedule` to the response with the `201` status
- **2026-10-27** `d0544e4323da`: 1 info
  - added the new optional request property `hosting`
- **2026-10-22** `e17589fd8767`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/context7/apis/context7-public-api/changes/v2/teamspaces/:teamspaceId/sites/post.md)

---

[API](https://skmtc.dev/context7/apis/context7-public-api.md) - [All operations](https://skmtc.dev/context7/apis/context7-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/context7/apis/context7-public-api/revisions/945f7834fa8c?raw)
