Skip to main content
Each recipe uses only what the SDK and the API really do. Where the SDK is not enough, the recipe calls the API directly and says so. All of them assume this setup:

Start an application only when it is off

startApplication throws a 500 when the application is already running, so check first.

Create an application and wait until it is ready

A new application is creating for a while, and actions on it are refused until it is active. Poll with getApplication, and keep the pause longer than the 3 seconds the API needs between requests.
The data of an Application is never refreshed, so call getApplication again on every attempt, as above.

Change one setting and apply it

updateApplication always needs appName, memoryMB, runtimeEnvironment and, by its type, startupCommand. Read the current values from data and send them back with the one you want to change.
environmentVariables replaces the whole list. Leave it out to keep the current variables.

Deploy a new version of the code

Zip your project, send it to the root of the application and restart. Always pass path.
Files with the same name are overwritten. If the application is stopped, use start instead of restart.

Save a copy before you change something

The archive leaves out node_modules, .npm, .git, .cache and .bun. The API accepts 20 downloads per minute.

List every application

getApplications returns only the first 10 personal applications. To go through all of them, call the API with the page and limit parameters:
Add team: "YOUR_TEAM_ID" to params to list the applications of a team. axios is already installed with the SDK.

Find out why an application is offline

The SDK types do not include the suspension and shutdownNotice fields, but the API returns them, so read them with a cast:
See why an application stopped for what to do in each case.

Retry when the API answers 429

The SDK never retries. A 429 means the request was refused, so waiting and sending it again is safe.

Work on many applications without hitting the limits

Creating, updating and uploading accept one request every 3 seconds each. Do them one at a time, with a pause:
Start, stop and restart of applications are only part of the general limit (180 requests per minute), but keep the pause when you change many at once. See Limits.