Logo ZenifraZenifra

Update Deploy Image

Learn how to update your project's Docker image via API.

Update Deploy Image

Updates the Docker image of the project to initiate a new deploy.

PATCH /project/:id/image

Path Parameters

ParameterTypeDescription
idstringProject ID (ObjectId)

Body

FieldTypeRequiredDescription
imagestringYesDocker image name with registry and tag (e.g., docker.io/nginx:perl, myregistry.com/myapp:v1.0). Important: Always use a specific, immutable tag (like v1.0.0) instead of latest to avoid pulling different images unexpectedly.

Example

{
  "image": "docker.io/nginx:perl"
}

Response

{
  "status": "success",
  "data": {
    "deployment_id": "deploy_abc123",
    "status": "deploying"
  }
}

Examples

curl

curl -X PATCH "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/image" \
  -H "x-api-key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"image": "docker.io/nginx:perl"}'

Python

import requests

API_KEY = "your-api-key"
PROJECT_ID = "507f1f77bcf86cd799439011"

response = requests.patch(
    f"https://api.zenifra.com/v1/project/{PROJECT_ID}/image",
    headers={"x-api-key": API_KEY},
    json={"image": "docker.io/nginx:perl"}
)
print(response.json())

Node.js

const axios = require('axios');

const API_KEY = 'your-api-key';
const PROJECT_ID = '507f1f77bcf86cd799439011';

axios.patch(
  `https://api.zenifra.com/v1/project/${PROJECT_ID}/image`,
  { image: 'docker.io/nginx:perl' },
  { headers: { 'x-api-key': API_KEY } }
).then(res => console.log(res.data));