Create Application
Create a new application (service) in an environment using the Thevenin API.
Endpoint
POST {envId}/app
Authentication
Requires a valid API token with Bearer authentication. See Authentication for details.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
envId | string | Yes | The UUID of the environment where the application will be created |
Request Body
The request body must be a JSON object with the following structure:
Required Fields
| Field | Type | Description |
|---|---|---|
name | string | Application name (unique within the environment) |
source | object | Source configuration (see below) |
resourceRequests | object | Resource requirements (see below) |
Source Object
Specify the container image to deploy:
{
"source": {
"image": {
"name": "nginx",
"tag": "latest"
}
}
}
| Field | Type | Required | Description |
|---|---|---|---|
source.image.name | string | Yes | Docker image name (e.g., "nginx", "postgres") |
source.image.tag | string | Yes | Image tag (e.g., "latest", "1.21", "alpine") |
Resource Requests Object
{
"resourceRequests": {
"cpu": "100m",
"memory": "128Mi",
"filesystemStorage": "1Gi"
}
}
| Field | Type | Required | Description |
|---|---|---|---|
cpu | string | Yes | CPU request in millicores (e.g., "100m" = 0.1 core, "1000m" = 1 core) |
memory | string | Yes | Memory request (e.g., "128Mi", "1Gi") |
filesystemStorage | string | No | Ephemeral storage (e.g., "1Gi", "5Gi") |
Optional Fields
Ports
Expose container ports:
{
"ports": [
{
"name": "http",
"number": 80,
"protocol": "TCP"
}
]
}
| Field | Type | Description |
|---|---|---|
name | string | Port name for identification |
number | integer | Port number (1-65535) |
protocol | string | Protocol: "TCP" or "UDP" (default: "TCP") |
Public Endpoint
Expose the application to the internet:
{
"publicEndpoint": {
"externalPort": 443,
"appPort": 80
}
}
| Field | Type | Description |
|---|---|---|
externalPort | integer | External port (usually 443 for HTTPS) |
appPort | integer | Internal application port to route to |
Command and Arguments
Override the default container entrypoint:
{
"command": "/bin/sh",
"args": "-c 'echo Hello World'"
}
Volume Mounts
Attach persistent volumes:
{
"volumeMounts": [
{
"volNameRef": "my-data-volume",
"volIdRef": "vol-123",
"path": "/data"
}
]
}
Environment Variables (Variable Sets)
Inject environment variables:
{
"variableSetMounts": [
{
"varSetNameRef": "app-config",
"varSetIdRef": "var-123"
}
]
}
File Mounts
Mount configuration files:
{
"fileMounts": [
{
"fileNameRef": "nginx.conf",
"fileIdRef": "file-123",
"mountPath": "/etc/nginx/nginx.conf",
"fileOwner": "nginx"
}
]
}
Response
Success Response (201 Created)
Returns the created application object:
{
"id": "app-abc123",
"companyIdRef": "company-xyz",
"envIdRef": "env-789",
"name": "nginx-demo",
"version": "1",
"source": {
"image": {
"name": "nginx",
"tag": "latest"
}
},
"ports": [
{
"name": "http",
"number": 80,
"protocol": "TCP",
"hostname": "nginx-demo.thevenin.app"
}
],
"publicEndpoint": {
"externalPort": 443,
"appPort": 80,
"hostname": "nginx-demo.thevenin.app"
},
"resourceRequests": {
"cpu": "100m",
"memory": "128Mi",
"filesystemStorage": "1Gi"
},
"isActive": true,
"isDeleted": false,
"createdBy": "user-456",
"createdAt": "2025-10-31T12:00:00Z"
}
Error Responses
400 Bad Request - Invalid Payload
{
"code": "VALIDATION_FAILED",
"message": "Invalid request body",
"details": "Application name is required"
}
401 Unauthorized - Invalid Token
{
"code": "UNAUTHORIZED",
"message": "Invalid or missing authentication token"
}
403 Forbidden - 2FA Required
{
"error": "2fa_required",
"message": "Two-factor authentication setup is required to access this resource",
"current_aal": "aal1",
"required_aal": "aal2"
}
404 Not Found - Environment Not Found
{
"code": "NOT_FOUND",
"message": "Environment not found"
}
409 Conflict - Name Already Exists
{
"code": "CONFLICT",
"message": "Application with this name already exists in the environment"
}
Example
curl -X POST https://api.thevenin.com/api/v1/{envId}/app \
-H "Authorization: Bearer tvn_your_token_here" \
-H "Content-Type: application/json" \
-d '{
"name": "nginx-demo",
"source": {
"image": {
"name": "nginx",
"tag": "latest"
}
},
"resourceRequests": {
"cpu": "100m",
"memory": "128Mi"
},
"ports": [
{
"name": "http",
"number": 80,
"protocol": "TCP"
}
],
"publicEndpoint": {
"externalPort": 443,
"appPort": 80
},
"isActive": true
}'