---
title: "Upload CSV file"
method: POST
path: "/tables/upload/{dbId}/{tableId}"
tags: ["Data Import"]
---

# Upload CSV file

`POST /tables/upload/{dbId}/{tableId}`

Upload CSV or ZIP file and create/update table definition. This is the first step in the import workflow; use `/import` to process data into the database.

**Direct upload:** multipart/form-data with field `file` (small files).

**Large / resumable upload:**
1. `POST /api/uploads/init` with filename, total_size, total_chunks, chunk_size
2. `POST /api/uploads/chunk/{upload_id}` for each chunk (resume via `GET /api/uploads/status/{upload_id}`)
3. `POST /tables/upload/{dbId}/{tableId}` with JSON body `{ "upload_id": "<uuid>" }`

Provide either `file` or `upload_id`, not both. For ZIP files, the CSV must match the ZIP filename (e.g. `data.zip` → `data.csv`).

## Path parameters

- `dbId` string, required
- `tableId` string, required

## Response `200`

successful operation

- UploadResponse
  - `status` string
  - `file_path` string — Partial file path for import
  - `upload_source` 'file' | 'upload_id' — Whether the file came from direct multipart upload or resumable upload_id
  - `action` 'created' | 'updated'
  - `csv_uploaded_at` string, date-time
  - `import_status` string
  - `links` object
    - `import` string — Import endpoint URL
  - `message` string

## Other responses

- `400` — Upload error

## Changes

- **2025-12-01** `c9fac12336ea` — 2 info
  - api tag `Data Import` added
  - api tag `Tables` removed
- **2025-09-06** `a278ba81f405` — 1 info
  - endpoint added
- **2023-12-21** `1451f79c7f04` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/ihsn/apis/data-tables/changes/tables/upload/:dbId/:tableId/post.md)

---

[API](https://skmtc.dev/ihsn/apis/data-tables.md) · [All operations](https://skmtc.dev/ihsn/apis/data-tables/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ihsn/data-tables/revisions/6fb7730a430d/schema)
