Skip to main content
POST
Connect a Git repository for deploys

Authorizations

Authorization
string
header
required

Personal API token, sent as Authorization: Bearer <SANDYWP_API_KEY>. Obtain one from the dashboard account menu (API keys), sandywp auth login, or POST /api/account/tokens. A missing or invalid token returns 401 auth_required. Scoped OAuth tokens are limited to the Imports family and GET /api/account/me; see the top-level conventions.

Headers

X-SandyWP-Workspace
string

Selects which of the caller's workspaces to act in, for accounts belonging to more than one (legacy alias: X-SandyWP-Organization). Defaults to the caller's own personal workspace when omitted. Every id in this API (sandboxes, Templates, repositories) is scoped to a single workspace, so this header changes which set of resources is visible.

Path Parameters

id
string
required

The sandbox id.

Body

application/json
repoUrl
string
required

Required. https:// URL with no embedded credentials for a public repo, or an SSH URL (git@host:owner/repo.git or ssh://git@host/owner/repo.git) for a private one — which grammar is enforced depends on isPrivate.

Example:

"https://github.com/you/my-plugin.git"

destination
enum<string>
required

Required. Where inside wp-content the repository is synced: pluginwp-content/plugins/<folderName>, themewp-content/themes/<folderName>, wp_contentwp-content/<folderName>.

Available options:
plugin,
theme,
wp_content
folderName
string
required

Required. A single path segment (no slashes) under the destination — the target folder name.

Pattern: ^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$
Example:

"my-plugin"

branch
string

Branch to deploy. Defaults to main.

Pattern: ^[A-Za-z0-9][A-Za-z0-9._/-]{0,200}$
isPrivate
boolean

Whether the repo is private. When true, a per-repository SSH deploy key is generated. Defaults to false.

autoDeploy
boolean

Deploy automatically on push, via the returned webhookUrl. Defaults to false.

Response

The connected repository and its webhook URL.

repository
object
required

The owner-facing view of a connected Git repository. Strips the webhook secret — the plaintext webhook URL is only ever returned once, at connect time.

webhookUrl
string<uri>
required

One-time-shown URL (carries an opaque token) to configure as the git host's push webhook for autoDeploy.