Import an exact Hugging Face dataset commit server-side
const url = 'https://example.com/v1/datasets/import-hf';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"idempotency_key":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","repo_id":"example","revision":"example","name":"example","source_format":"lerobot_v2_1","hf_token":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/datasets/import-hf \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "idempotency_key": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "repo_id": "example", "revision": "example", "name": "example", "source_format": "lerobot_v2_1", "hf_token": "example" }'Admit one pinned Hugging Face commit as an upload attempt.
The import is the same durable object as an SDK upload — one attempt row, one worker, one publication — so this route does what the SDK’s own begin does: resolve the destination repository, register the token the worker will need, and call Begin. The idempotency key IS the operation id, so an identical resubmission replays the same attempt instead of starting a second one, and once that attempt has finished it returns it as it ended.
A new import is checked before anything runs: a name that already holds a dataset is refused (an import only ever creates a dataset, so it could only fail at publication), and the same import already running under another key — a second tab, a double press — is joined rather than started twice.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ”Act within this account (the dashboard’s active account).
Act within this account (the dashboard’s active account).
Request Body required
Section titled “Request Body required ”Server-side import of one exact public Hugging Face dataset commit.
object
Responses
Section titled “ Responses ”Successful Response
Example generated
exampleInvalid or missing API key
Standard error response.
object
Error message describing what went wrong
Example generated
{ "detail": "example"}The name already holds a dataset (dataset_name_taken), another import into it is running (dataset_name_importing), or the idempotency key names another import (idempotency_key_reused).
Validation Error
object
object
object
Example generated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}