---
title: "Check upload method"
method: POST
path: "/api/datasets/{namespace}/{repo}/preupload/{rev}"
tags: ["datasets"]
---

# Check upload method

`POST /api/datasets/{namespace}/{repo}/preupload/{rev}`

Check if a file should be uploaded through the Large File mechanism or directly.

## Path parameters

- `namespace` string, required
- `repo` string, required
- `rev` string, required

## Request body

- object
  - `files` object[], required
    - `path` string, required
    - `size` number, required
    - `sample` string, required
  - `gitAttributes` string — Provide this parameter if you plan to modify `.gitattributes` yourself at the same time as uploading LFS files. Note that this is not needed if you solely rely on automatic LFS detection from HF: the commit endpoint will automatically edit the `.gitattributes` file to track the files passed to its `lfsFiles` param.
  - `gitIgnore` string — Content of the .gitignore file for the revision. Optional, otherwise takes the existing content of `.gitignore` for the revision.

## Response `200`

Files to be uploaded.

- object
  - `files` object[], required
    - `path` string, required
    - `uploadMode` 'lfs' | 'regular', required
    - `shouldIgnore` boolean, required
    - `oid` string — The oid of the blob if it already exists in the repository. If the blob is a LFS file, it'll be the lfs oid.
  - `commitOid` string, required

## Other responses

- `422` — The request is invalid

## Changes

- **2026-09-08** `bd17546f47b8` — 1 breaking
  - the `files/items/uploadMode` response's property type changed from no type to `string` for status `200`

[Change history](https://skmtc.dev/huggingface/apis/hub-api-endpoints/changes/api/datasets/:namespace/:repo/preupload/:rev/post.md)

---

[API](https://skmtc.dev/huggingface/apis/hub-api-endpoints.md) · [All operations](https://skmtc.dev/huggingface/apis/hub-api-endpoints/llms.txt) · [OpenAPI document](https://skmtc.dev/huggingface/apis/hub-api-endpoints/revisions/805b42ee6d4c?raw)
