Skip to content

Copy a site

POST
/api/v1/sites/{site}/copy
curl --request POST \
--url https://digize.com/api/v1/sites/example/copy \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: 5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69' \
--header 'x-api-key: <x-api-key>' \
--data '{ "name": "example" }'

Makes a new site that starts as a copy of another: its repo forked with every branch, the same plain variables and build settings, its own address under the workspace’s, and its first build started. Secrets aren’t copied, and storage its config declares (databases, buckets) is new and empty. For trying a whole new version of a site, such as the variant of a site experiment, which the agent then changes with a coding run on the copy.

Needs the sites:write permission.

site
required

The site to copy, by id or name.

string
>= 1 characters <= 64 characters
Idempotency-Key
string
>= 1 characters <= 255 characters

Makes the request safe to send again: for 24 hours the same key and request answer the first response without repeating the change.

Example

5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69
Media typeapplication/json
object
name
required

The copy’s name, such as bakery-v2: the start of its address.

string
>= 3 characters <= 40 characters /^[a-z0-9]([a-z0-9-]{1,38}[a-z0-9])?$/

Example generated

{
"name": "example"
}

Done

Media typeapplication/json
object
id
required
string
name
required
string
kind
required
string
Allowed values: site api consumer scheduled
description
required
string
hostnames
required
Array<string>
routes
required
Array<string>
crons
required
Array<string>
createdAt
required
string format: date-time
scriptName
required
string
gitRemote
required
string
source
required
Any of:
object
provider
required
string
Allowed value: github
repo
required
string
url
required
string
linkedBy
required
string
linkedAt
required
string format: date-time
platformHostname
required
string | null
addressHostname
required
string | null
mainHostname
required
string | null
status
required
string
Allowed values: live deploying not_deployed
liveVersion
required
number | null
lastDeployment
required
Any of:
object
id
required
string
version
required
number
status
required
string
Allowed values: queued building deploying live failed superseded
createdAt
required
string format: date-time
requests
required
number
errors
required
number
cpuTime
required
number
bindingCount
required
number
consumes
required
Array<string>

Example

{
"kind": "site",
"source": {
"provider": "github"
},
"status": "live",
"lastDeployment": {
"status": "queued"
}
}

What was sent isn’t valid (invalid).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

No key, or one that’s unknown, off or expired.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

The key doesn’t have the permission this needs.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Nothing has that id (not_found).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

A request with the same Idempotency-Key is still running (conflict).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

The Idempotency-Key was used with a different request.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Over the rate limit; see retry-after.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}