# Gantt Chart & Critical Path API

> Tasks in JSON, CSV or Excel → schedule on working days (Vietnamese holidays), FS / SS / FF / SF links, critical path, Gantt chart as SVG, PNG or PDF.

- Endpoint: `GET | POST https://apibox.io.vn/v1/gantt-chart`
- Category: Images & Codes
- HTML docs: https://apibox.io.vn/docs/gantt-chart/ (Vietnamese: https://apibox.io.vn/vi/docs/gantt-chart/)
- Online tool: https://apibox.io.vn/tools/gantt-chart/
- Authentication: `Authorization: Bearer <API key>` or `X-API-Key: <API key>` (free key: https://apibox.io.vn/dashboard/#signup)

Send `tasks` (JSON array), `csv` (header row) or an Excel `file`. Each task has an `id`, `name`, either `duration` (working days) or `start` + `end`, optional `start` constraint, `depends` (`"A"`, `"A FS+2"`, `"B SS"`, `"C FF-1"`, several separated by commas), `group`, `progress` (%), `milestone` and `wbs`. Vietnamese column names (Tên công việc, Bắt đầu, Thời lượng, Phụ thuộc, Nhóm, Tiến độ) and dd/mm/yyyy dates are understood.

The schedule skips weekends (`workweek=mon-fri`, `mon-sat` or `all`) and public holidays: Vietnam by default (official Tết, 30/4–1/5, 2/9 and 24/11 schedules), any country code from the holidays dataset, or `holidays=none`, plus `extra_holidays` / `extra_workdays`. A forward and backward pass (critical path method) gives early / late dates, total float and the critical path.

`format=json` (default) returns the schedule; `svg`, `png` and `pdf` draw the Gantt chart: task table, bars coloured by group, progress, milestones, dependency arrows, critical path in red, weekends and holidays shaded, a "today" line, day / week / month scale (`scale=auto`), Vietnamese or English labels (`lang`). The PDF is A3 landscape by default (`page=A4`) and paginated for long schedules. Up to 500 tasks; nothing is stored.

## Parameters

| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
| `tasks` | body|query | array | no |  | Tasks: `{id, name, duration \| start + end, start?, depends?, group?, progress?, milestone?, wbs?}`. Or send `csv` or an Excel `file`. |
| `csv` | body | string | no |  | CSV with a header row (English or Vietnamese column names). |
| `file` | body | file | no |  | XLSX file (first visible sheet, or `sheet`). |
| `project_start` | body|query | string | no |  | Project start (YYYY-MM-DD) when no task has a start date. |
| `workweek` | body|query | string | no | `mon-fri` | `mon-fri`, `mon-sat` or `all`. |
| `holidays` | body|query | string | no | `VN` | `VN`, another country code (e.g. `US`, `JP`) or `none`. |
| `extra_holidays` | body|query | array | no |  | Extra non-working dates. |
| `extra_workdays` | body|query | array | no |  | Extra working dates (e.g. a Saturday make-up day). |
| `format` | body|query | string | no | `json` | `json`, `svg`, `png` or `pdf`. |
| `scale` | body|query | string | no | `auto` | Timeline scale: `auto`, `day`, `week`, `month`. |
| `lang` | body|query | string | no | `vi` | Chart labels: `vi` or `en`. |
| `title` | body|query | string | no |  | Chart title. |
| `today` | body|query | string | no |  | Date of the "today" line (default: today in Vietnam; `show_today=0` hides it). |
| `page` | body|query | string | no | `A3` | PDF page: `A3` or `A4` (landscape). |

## Example request

```bash
curl -X POST "https://apibox.io.vn/v1/gantt-chart" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tasks":[{"id":"A","name":"Khảo sát","start":"2026-11-20","duration":3},{"id":"B","name":"Thiết kế","duration":5,"depends":"A"},{"id":"C","name":"Xin phép","duration":2,"depends":"A"},{"id":"D","name":"Thi công","duration":10,"depends":"B,C"},{"id":"M","name":"Bàn giao","milestone":true,"depends":"D"}]}'
```

## Example response

```json
{
  "project": {
    "start": "2026-11-20",
    "finish": "2026-12-16",
    "working_days": 18,
    "calendar_days": 27,
    "tasks": 5
  },
  "calendar": {
    "workweek": "mon-fri",
    "holidays": "VN",
    "holidays_in_schedule": [
      {
        "date": "2026-11-24",
        "name": "Vietnamese Culture Day"
      }
    ]
  },
  "critical_path": [
    "A",
    "B",
    "D",
    "M"
  ],
  "tasks": [
    {
      "id": "A",
      "name": "Khảo sát",
      "duration": 3,
      "start": "2026-11-20",
      "finish": "2026-11-25",
      "late_start": "2026-11-20",
      "late_finish": "2026-11-25",
      "total_float": 0,
      "critical": true,
      "progress": 0
    },
    {
      "id": "B",
      "name": "Thiết kế",
      "duration": 5,
      "start": "2026-11-26",
      "finish": "2026-12-02",
      "late_start": "2026-11-26",
      "late_finish": "2026-12-02",
      "total_float": 0,
      "critical": true,
      "progress": 0,
      "depends": [
        "AFS"
      ]
    },
    {
      "id": "C",
      "name": "Xin phép",
      "duration": 2,
      "start": "2026-11-26",
      "finish": "2026-11-27",
      "late_start": "2026-12-01",
      "late_finish": "2026-12-02",
      "total_float": 3,
      "critical": false,
      "progress": 0,
      "depends": [
        "AFS"
      ]
    },
    {
      "id": "D",
      "name": "Thi công",
      "duration": 10,
      "start": "2026-12-03",
      "finish": "2026-12-16",
      "late_start": "2026-12-03",
      "late_finish": "2026-12-16",
      "total_float": 0,
      "critical": true,
      "progress": 0,
      "depends": [
        "BFS",
        "CFS"
      ]
    },
    {
      "id": "M",
      "name": "Bàn giao",
      "duration": 0,
      "milestone": true,
      "start": "2026-12-16",
      "finish": "2026-12-16",
      "late_start": "2026-12-16",
      "late_finish": "2026-12-16",
      "total_float": 0,
      "critical": true,
      "progress": 0,
      "depends": [
        "DFS"
      ]
    }
  ],
  "note": "Durations and lags are in working days. Finish dates are the last working day of a task. Milestones (duration 0) sit at the end of their predecessor. Use format=svg / png / pdf for the chart."
}
```

## Use cases

- Draw the construction schedule for a tender dossier on A3 paper
- Turn a task list from Google Sheets or Excel into a weekly report chart
- Compute the critical path and float of a project from a PM tool export
- Embed an up-to-date Gantt chart image in an e-mail or dashboard

## FAQ

### Are Vietnamese holidays handled?

Yes. By default the schedule skips Saturdays, Sundays and the official Vietnamese days off (Tết, Hùng Kings, 30/4–1/5, 2/9, 24/11). Use workweek=mon-sat for a six-day site week or holidays=none to ignore holidays.

### Which dependency types are supported?

Finish-to-start (default), start-to-start, finish-to-finish and start-to-finish, each with a positive or negative lag in working days, e.g. "3FS+2" or "B SS".

### How large can a project be?

Up to 500 tasks and 10 years. PNG output is limited to 16 megapixels; use SVG or PDF (paginated) for large charts.
