Environments
An environment is one deployed copy of a project's gateway, with its own URL. A project has three types:
production: one, for the project's default Git branch.preview: one for each other branch, for example to try a change before it is merged.working-copy: one for each person who edits the project in the portal. Each person sees only their own.
An AI Gateway project has only its production environment.
Environments are listed, created and read in their project
(/v4/projects/{projectId}/environments/{environmentId}). A project connected
to a Git repository creates a branch's environment on the first push to it,
and deletes it with the branch. What an environment serves is its live
deployment (see Deployments).
An AI Gateway environment has no status (it is null): nothing reliably says
that a gateway serves its newest configuration, so v4 does not claim it. Read
its deployments instead (see Deployments).
List environments
Lists the project's environments, oldest first. Filter by type to list only
its production or preview environments, and by branch to find the
environment of a Git branch. Each person sees their own working copies, and
nobody else's.
path Parameters
projectIdThe project ID (prj_…). Its members, environments and deployments are addressed under it.
query Parameters
typeOnly return environments of this type.
The environment of a project. New values may be added.
branchOnly return the environment of this Git branch.
limitThe maximum number of items to return.
offsetThe number of items to skip before the first item returned.
List environments › Responses
A page of environments.
The environments on this page.
limitThe page size that was applied.
offsetThe number of items skipped before this page.
totalThe number of items in the whole collection.
hasMoreWhether there are more items after this page.
nextThe relative URL of the next page, or null on the last page.
Create an environment
Creates the environment of a Git branch in the project. It is the project's
production environment when branch is the project's default branch, and a
preview environment otherwise. It has no URL and its status is
provisioning until its first deployment succeeds: deploy to it with
POST /v4/projects/{projectId}/deployments.
A project connected to a Git repository creates a branch's environment itself, on the first push to the branch, and deploys every push. Create one here to deploy a branch from the CLI or the API. Working copies are created in the portal, for the person who edits the project there.
Fails with 409 when the project already has an environment for branch,
and with 400 for an ai-gateway project, which has its production
environment only.
path Parameters
projectIdThe project ID (prj_…). Its members, environments and deployments are addressed under it.
Create an environment › Request Body
branch^[^\s~]+$ · requiredThe Git branch the environment deploys, without refs/heads/. It cannot
contain ~ or whitespace, and cannot be changed later.
Create an environment › Responses
The environment was created. Nothing is deployed to it yet.
idThe environment ID.
projectIdThe project the environment belongs to.
nameThe environment's name, unique across Zuplo and the first label of its
URL's host: the project name, the branch and a random suffix. The CLI and
logs show it. Not an identifier; address environments by id.
typeThe environment of a project. New values may be added.
branchThe Git branch the environment deploys, unique among the project's production and preview environments. The production environment's is the project's default branch. Null for a working copy, which deploys what its person edits in the portal.
The person whose working copy this is. Null for production and preview environments.
bucketIdThe bucket the environment keeps its gateway data in, such as consumers and API keys. A project's environments of one type share their bucket: every preview environment uses the project's preview bucket. An AI Gateway keeps its data in its production bucket.
Whether the environment serves a deployment. Null for an AI Gateway
environment: nothing reliably says that every edge of an AI Gateway
serves its newest configuration, so v4 does not report it. Read the
environment's newest deployment
(GET /v4/projects/{projectId}/deployments?environmentId=…&limit=1)
until it has succeeded instead, and send the gateway a request to know
what it serves.
urlThe environment's default URL. Null until its first deployment succeeds.
liveDeploymentIdThe deployment the environment serves, the last one that succeeded. Null until one has.
hasCustomDomainWhether a custom domain points at the environment. An environment with one cannot be deleted.
createdOnWhen the environment was created.
updatedOnWhen the environment last changed.
Get an environment
Returns an environment: its type, Git branch, URL, and the deployment it
serves. Read it until status is live after its first deployment, or until
it is gone (404) after deleting it. An AI Gateway environment has no
status (null): read its newest deployment,
GET /v4/projects/{projectId}/deployments?environmentId=…&limit=1, until it
has succeeded instead.
path Parameters
projectIdThe project ID (prj_…). Its members, environments and deployments are addressed under it.
environmentIdThe environment ID, a UUID.
Get an environment › Responses
The environment.
idThe environment ID.
projectIdThe project the environment belongs to.
nameThe environment's name, unique across Zuplo and the first label of its
URL's host: the project name, the branch and a random suffix. The CLI and
logs show it. Not an identifier; address environments by id.
typeThe environment of a project. New values may be added.
branchThe Git branch the environment deploys, unique among the project's production and preview environments. The production environment's is the project's default branch. Null for a working copy, which deploys what its person edits in the portal.
The person whose working copy this is. Null for production and preview environments.
bucketIdThe bucket the environment keeps its gateway data in, such as consumers and API keys. A project's environments of one type share their bucket: every preview environment uses the project's preview bucket. An AI Gateway keeps its data in its production bucket.
Whether the environment serves a deployment. Null for an AI Gateway
environment: nothing reliably says that every edge of an AI Gateway
serves its newest configuration, so v4 does not report it. Read the
environment's newest deployment
(GET /v4/projects/{projectId}/deployments?environmentId=…&limit=1)
until it has succeeded instead, and send the gateway a request to know
what it serves.
urlThe environment's default URL. Null until its first deployment succeeds.
liveDeploymentIdThe deployment the environment serves, the last one that succeeded. Null until one has.
hasCustomDomainWhether a custom domain points at the environment. An environment with one cannot be deleted.
createdOnWhen the environment was created.
updatedOnWhen the environment last changed.
Delete an environment
Deletes a preview environment and its deployments. Zuplo stops serving its
URL and removes what it runs on in the background: until then it is listed
with status: deleting, and reads of it return 404 once it is gone. Its
bucket is shared by the project's other preview environments and stays.
A project connected to a Git repository deletes a branch's preview environment itself when the branch is deleted. Deleting it here while the branch still exists does not stop the next push from creating it again.
Only preview environments can be deleted: the production environment goes
with its project, and working copies are managed in the portal. Fails with
409 for either, and while a custom domain points at the environment
(hasCustomDomain). A repeated delete returns 404 once the
environment is gone, which clients should treat as success.
path Parameters
projectIdThe project ID (prj_…). Its members, environments and deployments are addressed under it.
environmentIdThe environment ID, a UUID.
Delete an environment › Responses
The environment is being deleted.