Deployments API
Trigger and manage deployments for your Git Deploy projects via the API.
List Deployments
Get all deployments for a project:
curl https://api.teenode.com/v1/projects/proj_abc123/deployments \
-H "Authorization: Bearer YOUR_API_KEY"Response:
{
"deployments": [
{
"id": "dep_xyz789",
"project_id": "proj_abc123",
"status": "ACTIVE",
"commit_sha": "abc123def456",
"commit_message": "Fix authentication bug",
"branch": "main",
"created_at": "2024-01-15T14:30:00Z",
"completed_at": "2024-01-15T14:35:00Z",
"url": "https://my-app-dep-xyz789.teenode.app"
}
],
"total": 15,
"page": 1,
"per_page": 20
}Create a Deployment
Trigger a new deployment:
curl -X POST https://api.teenode.com/v1/projects/proj_abc123/deployments \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"commit_sha": "abc123def456",
"commit_message": "Deploy new feature",
"branch": "main"
}'Response:
{
"id": "dep_xyz789",
"status": "QUEUED",
"created_at": "2024-01-15T14:30:00Z"
}Get Deployment Details
Get information about a specific deployment:
curl https://api.teenode.com/v1/deployments/dep_xyz789 \
-H "Authorization: Bearer YOUR_API_KEY"Get Deployment Logs
Retrieve build and deployment logs:
curl https://api.teenode.com/v1/deployments/dep_xyz789/logs \
-H "Authorization: Bearer YOUR_API_KEY"Stream logs in real-time:
curl https://api.teenode.com/v1/deployments/dep_xyz789/logs?follow=true \
-H "Authorization: Bearer YOUR_API_KEY" \
-NCancel a Deployment
Cancel an in-progress deployment:
curl -X POST https://api.teenode.com/v1/deployments/dep_xyz789/cancel \
-H "Authorization: Bearer YOUR_API_KEY"Deployment Status
QUEUED- Deployment is waiting in the build queueBUILDING- Docker image is being builtDEPLOYING- Built image is being deployedACTIVE- Deployment is live and serving trafficFAILED- Build or deployment failedCANCELED- Deployment was manually canceled
Webhooks
Configure webhooks to receive deployment notifications:
curl -X POST https://api.teenode.com/v1/projects/proj_abc123/webhooks \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-app.com/webhooks/teenode",
"events": ["deployment.started", "deployment.succeeded", "deployment.failed"]
}'Webhook payload example:
{
"event": "deployment.succeeded",
"deployment": {
"id": "dep_xyz789",
"project_id": "proj_abc123",
"status": "ACTIVE",
"commit_sha": "abc123def456",
"url": "https://my-app-dep-xyz789.teenode.app"
},
"timestamp": "2024-01-15T14:35:00Z"
}Rollback
Rollback to a previous deployment:
curl -X POST https://api.teenode.com/v1/deployments/dep_xyz789/rollback \
-H "Authorization: Bearer YOUR_API_KEY"Rollback creates a new deployment using the configuration from the specified deployment.
Environment Variables
Manage environment variables for deployments:
curl -X PUT https://api.teenode.com/v1/projects/proj_abc123/env \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"DATABASE_URL": "postgres://...",
"API_KEY": "secret123"
}'