---
title: "Tạo app từ git hoặc upload / Create an app from git or a local archive"
method: POST
path: "/api/apps"
tags: ["apps"]
---

# Tạo app từ git hoặc upload / Create an app from git or a local archive

`POST /api/apps`

## Request

- Base URL: `https://api.monacloud.vn`
- URL: `https://api.monacloud.vn/api/apps`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Token`

source=git (mặc định) cần repo_url và trả job; source=upload trả id app, upload_url, max_bytes, job_id và chờ upload / Git returns a deployment job; upload returns an app ID and upload instructions while its create job waits. Repo public HTTPS hoặc source=upload → job Dokploy → URL HTTPS / Deploy public git or local archives via Dokploy. Poll /api/jobs/{id} tới succeeded/failed. App host dùng billing LXC Wave A; app không tính thêm phí. POST /api/app-hosts với {} dùng 2 CPU/2 GB RAM/30 GB disk; hỗ trợ billing_mode monthly + plan_code + period. X-Vibecloud-Sandbox: 1 trên /api/apps tạo URL giả, trả estimated_app_host và charged_vnd=0. PUT env thay toàn bộ env, cần POST deploy để áp dụng. Custom domain trả CNAME và SSL pending. Xoá app giữ host; xoá /api/services/{app_host_id} để ngừng phí.

## Headers

- `X-Vibecloud-Sandbox` '1'

## Request body

- AppCreateRequest
  - `source` 'git' | 'upload': Nguồn git hoặc thư mục local / Git repository or local archive.
  - `name` string, nullable: Tên app (slug hoá) làm tiền tố hostname; để trống thì lấy tên repo hoặc local-<mã> / Optional app name used as hostname prefix.
  - `repo_url` string, nullable: Bắt buộc với source=git / Required for git sources.
  - `branch` string
  - `build_type` 'dockerfile' | 'nixpacks' | 'static': Git mặc định dockerfile; upload tự nhận diện nếu bỏ qua / Git defaults to dockerfile; uploads auto-detect when omitted.
  - `dockerfile` string
  - `env` object
  - `domain` string, nullable
  - `app_host_id` string, nullable
  - `port` integer

## Response `200`

Successful Response

- union
  - JobResponse
    - `id` string, required
    - `status` 'awaiting_upload' | 'queued' | 'pending' | 'running' | 'done' | 'succeeded' | 'failed' | 'retrying' | 'cancelled', required
    - `type` string, required
    - `result` object, nullable
    - `error` string, nullable
    - `attempts` integer
    - `max_attempts` integer
    - `stages` JobStage[]
      - `name` string, required
      - `status` 'running' | 'succeeded' | 'failed', required
      - `started_at` string, date-time, required
      - `updated_at` string, date-time, required
      - `completed_at` string, date-time, nullable
      - `duration_seconds` number, nullable
      - `error` string, nullable
      - `detail` object, nullable
    - `created_at` string, date-time, nullable
    - `updated_at` string, date-time, nullable
    - `sandbox` boolean
    - `expires_at` string, date-time, nullable
  - AppUploadCreateResponse
    - `id` string, required: ID app để upload / App ID for uploading.
    - `upload_url` string, nullable, required
    - `max_bytes` integer, nullable, required
    - `job_id` string, required: Job tạo app chờ upload đầu tiên / Create job waiting for the first upload.
    - `status` 'awaiting_upload' | 'done', required
    - `url` string, required
    - `sandbox` boolean
    - `result` object, nullable
    - `note` string, nullable: Ghi chú (sandbox không nhận file) / Note.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/monacloud/apis/mona-cloud-api-compute-truoc-ay-vibecloud.md) · [All operations](https://skmtc.dev/monacloud/apis/mona-cloud-api-compute-truoc-ay-vibecloud/llms.txt) · [OpenAPI document](https://skmtc.dev/monacloud/apis/mona-cloud-api-compute-truoc-ay-vibecloud/revisions/34a120ed37ce?raw)
