Skip to main content
POST
/
deployments
JavaScript
import Kernel from '@onkernel/sdk';

const client = new Kernel({
  apiKey: 'My API Key',
});

const deployment = await client.deployments.create({
  entrypoint_rel_path: 'src/app.py',
  file: fs.createReadStream('path/to/file'),
});

console.log(deployment.id);
{
  "id": "rr33xuugxj9h0bkf1rdt2bet",
  "status": "queued",
  "status_reason": "Deployment in progress",
  "region": "aws.us-east-1a",
  "entrypoint_rel_path": "src/app.py",
  "env_vars": {},
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data

App deployment data

file
file
required

ZIP file containing the application source directory

entrypoint_rel_path
string
required

Relative path to the entrypoint of the application

Example:

"src/app.py"

version
string
default:latest

Version of the application. Can be any string.

Example:

"1.0.0"

region
string
default:aws.us-east-1a

Region for deployment. Currently we only support "aws.us-east-1a"

Allowed value: "aws.us-east-1a"
Example:

"aws.us-east-1a"

force
boolean
default:false

Allow overwriting an existing app version

Example:

false

env_vars
object

Map of environment variables to set for the deployed application. Each key-value pair represents an environment variable.

Response

Deployment created successfully

Deployment record information.

id
string
required

Unique identifier for the deployment

Example:

"rr33xuugxj9h0bkf1rdt2bet"

status
enum<string>
required

Current status of the deployment

Available options:
queued,
in_progress,
running,
failed,
stopped
Example:

"queued"

region
string
required

Deployment region code

Allowed value: "aws.us-east-1a"
Example:

"aws.us-east-1a"

created_at
string<date-time>
required

Timestamp when the deployment was created

status_reason
string

Status reason

Example:

"Deployment in progress"

entrypoint_rel_path
string

Relative path to the application entrypoint

Example:

"src/app.py"

env_vars
object

Environment variables configured for this deployment

updated_at
string<date-time> | null

Timestamp when the deployment was last updated

I