Manage Services with the Public API
Here are examples to help you manage your services using the Public API.
Get a service
Fetch a service by ID:
Get a service instance
Get detailed service configuration for a specific environment:
Create a service
From a GitHub repository
From a Docker image
Empty service (no source)
Create an empty service that you can configure later:
Update a service
Update service name or icon:
Update service instance settings
Update build/deploy settings for a service in a specific environment. Click "Additional options" to see all available settings:
Connect a service to a repo
Connect an existing service to a GitHub repository:
Disconnect a service from a repo
Deploy a service
Trigger a new deployment for a service. Returns the deployment ID.
By default this deploys the commit currently associated with the service (the same commit serviceInstanceRedeploy would use). To deploy a specific commit — for example, the latest HEAD of a connected GitHub branch — pass commitSha:
The commitSha is validated against the connected GitHub repo; an unknown SHA returns a "Commit not found" error and no deployment is created.
Redeploy a service
Redeploy the service's latest deployment using its existing commit. This does not check the connected GitHub repo for new commits — use the commitSha argument on serviceInstanceDeployV2 to deploy a specific commit.
Get resource limits
Get the resource limits for a service instance (returns a JSON object):