Prepares an uploaded dataset for training. Returns immediately; the dataset moves to
PROCESSING. Poll GET /api/v1/datasets/{datasetKey} for the outcome.
Call it only once both input files have been uploaded.
Call it once. The artefacts a training run reads are built one time.
Do not call it on a dataset created from a refinement. That route starts the work itself.
A 409 means one of two things, and the message says which: an input has not arrived, or the
dataset was already cleaned.
Size is not checked before cleaning starts. The train file needs at least 25 labelled rows for the
least common target value, counted after the split. A dataset below that moves to ERROR rather than
COMPLETED, with the reason in errors, and cleaning the same files again will not change the
outcome.
Where to PUT the CSV on the single-file route. Prefer uploadTargets, which names each file it
expects.
uploadUrl is a signed URL valid for 60 minutes. PUT the CSV as a binary body with
Content-Type: text/csv and every header listed in extraHeaders (one colon-joined
Name:value pair per header, semicolon-separated). Send no Authorization header: the signature
covers the request, and an extra header breaks it.
Where to PUT each input file. A dataset built from a train and a labelled test file returns one target per file; a dataset whose files came from a completed refinement returns none, because nothing is uploaded. Empty on the single-file pipeline.
Show child attributes
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"MathFi.ai","colors":{"primary":"#0D5E4F","light":"#4ADE80","dark":"#0D5E4F"},"logo":{"light":"https://mintcdn.com/mathficast/obGjwhvkcHRG-84d/logo/light.svg?fit=max\u0026auto=format\u0026n=obGjwhvkcHRG-84d\u0026q=85\u0026s=0d58083744fd1f821588093372fdf5bf","dark":"https://mintcdn.com/mathficast/obGjwhvkcHRG-84d/logo/dark.svg?fit=max\u0026auto=format\u0026n=obGjwhvkcHRG-84d\u0026q=85\u0026s=19477dd054446b9035d2b5a62c2f9053","href":"https://mathfi.ai"},"favicon":"https://mintcdn.com/mathficast/obGjwhvkcHRG-84d/favicon.svg?fit=max\u0026auto=format\u0026n=obGjwhvkcHRG-84d\u0026q=85\u0026s=cda0bc0ee08c401c35cb53e3635d4ffa","api":{"examples":{"languages":["curl","python"]}},"navbar":{},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"mathficast","hasAudioNarration":false,"actualSubdomain":"mathficast","customDomains":["docs.mathfi.ai"],"gitSource":{"type":"github","owner":"mathfi-ai","repo":"mathfi-ai-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ad385e785ceb1c912c842c7","collectionId":"7643eed5-d1ae-4c8a-855f-a54304d6c976","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ad385e785ceb1c912c842c7"},"entitlements":{},"buildId":"6ad385e785ceb1c912c842c7","clientVersion":"0.0.4054","searchFilterCounts":[{"language":"default","tag":"API Reference","count":33},{"language":"default","tag":"Model Crucible","count":20},{"language":"default","tag":"Documentation","count":11},{"language":"default","tag":"Feature Refinery","count":8},{"language":"default","tag":"Training","count":7},{"language":"default","tag":"Getting started","count":7},{"language":"default","tag":"Predictions","count":6},{"language":"default","tag":"Datasets","count":5},{"language":"default","tag":"Guides","count":3},{"language":"default","tag":"Use cases","count":3}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"api-reference/datasets/clean-dataset","slug":"/api-reference/datasets/clean-dataset","pageMetadata":{"title":"Clean the dataset","openapi":"api-reference/openapi.yaml POST /api/v1/datasets/{datasetKey}/clean","description":"Prepares an uploaded dataset for training. Returns immediately; the dataset moves to\n`PROCESSING`. Poll `GET /api/v1/datasets/{datasetKey}` for the outcome.\n\n- Call it only once both input files have been uploaded.\n- Call it once. The artefacts a training run reads are built one time.\n- Do not call it on a dataset created from a refinement. That route starts the work itself.\n\nA `409` means one of two things, and the message says which: an input has not arrived, or the\ndataset was already cleaned.\n\nSize is not checked before cleaning starts. The train file needs at least 25 labelled rows for the\nleast common target value, counted after the split. A dataset below that moves to `ERROR` rather than\n`COMPLETED`, with the reason in `errors`, and cleaning the same files again will not change the\noutcome.\n","href":"/api-reference/datasets/clean-dataset"},"description":{"compiledSource":"\"use strict\";\nconst {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n code: \"code\",\n li: \"li\",\n p: \"p\",\n ul: \"ul\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_Fragment, {\n children: [_jsxs(_components.p, {\n children: [\"Prepares an uploaded dataset for training. Returns immediately; the dataset moves to\\n\", _jsx(_components.code, {\n children: \"PROCESSING\"\n }), \". Poll \", _jsx(_components.code, {\n children: \"GET /api/v1/datasets/{datasetKey}\"\n }), \" for the outcome.\"]\n }), \"\\n\", _jsxs(_components.ul, {\n children: [\"\\n\", _jsx(_components.li, {\n children: \"Call it only once both input files have been uploaded.\"\n }), \"\\n\", _jsx(_components.li, {\n children: \"Call it once. The artefacts a training run reads are built one time.\"\n }), \"\\n\", _jsx(_components.li, {\n children: \"Do not call it on a dataset created from a refinement. That route starts the work itself.\"\n }), \"\\n\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"A \", _jsx(_components.code, {\n children: \"409\"\n }), \" means one of two things, and the message says which: an input has not arrived, or the\\ndataset was already cleaned.\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"Size is not checked before cleaning starts. The train file needs at least 25 labelled rows for the\\nleast common target value, counted after the split. A dataset below that moves to \", _jsx(_components.code, {\n children: \"ERROR\"\n }), \" rather than\\n\", _jsx(_components.code, {\n children: \"COMPLETED\"\n }), \", with the reason in \", _jsx(_components.code, {\n children: \"errors\"\n }), \", and cleaning the same files again will not change the\\noutcome.\"]\n })]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Clean the dataset","openapi":"api-reference/openapi.yaml POST /api/v1/datasets/{datasetKey}/clean","description":"Prepares an uploaded dataset for training. Returns immediately; the dataset moves to\n`PROCESSING`. Poll `GET /api/v1/datasets/{datasetKey}` for the outcome.\n\n- Call it only once both input files have been uploaded.\n- Call it once. The artefacts a training run reads are built one time.\n- Do not call it on a dataset created from a refinement. That route starts the work itself.\n\nA `409` means one of two things, and the message says which: an input has not arrived, or the\ndataset was already cleaned.\n\nSize is not checked before cleaning starts. The train file needs at least 25 labelled rows for the\nleast common target value, counted after the split. A dataset below that moves to `ERROR` rather than\n`COMPLETED`, with the reason in `errors`, and cleaning the same files again will not change the\noutcome.\n","href":"/api-reference/datasets/clean-dataset"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"tags":["Datasets"],"summary":"Clean the dataset","description":"Prepares an uploaded dataset for training. Returns immediately; the dataset moves to\n`PROCESSING`. Poll `GET /api/v1/datasets/{datasetKey}` for the outcome.\n\n- Call it only once both input files have been uploaded.\n- Call it once. The artefacts a training run reads are built one time.\n- Do not call it on a dataset created from a refinement. That route starts the work itself.\n\nA `409` means one of two things, and the message says which: an input has not arrived, or the\ndataset was already cleaned.\n\nSize is not checked before cleaning starts. The train file needs at least 25 labelled rows for the\nleast common target value, counted after the split. A dataset below that moves to `ERROR` rather than\n`COMPLETED`, with the reason in `errors`, and cleaning the same files again will not change the\noutcome.\n","operationId":"cleanDataset","parameters":["8800b374-da31-401a-be0a-41bbad2bba17"],"responses":{"202":"0acfff70-7a52-4613-89e5-f53a301f8c22","401":"66f95b8a-70b9-480f-a221-cef53ebbf152","404":"cb285281-33be-47fd-979d-e09b73886235","409":"43da0631-d566-43fb-a80b-e8424d557f69"},"security":["27241cc0-1553-4152-a178-1237e083f960"],"method":"post","type":"path","servers":["0215795f-7d3c-442e-bfcb-454b8d8c6f91"],"path":"/api/v1/datasets/{datasetKey}/clean","baseUrlOptions":["https://{tenant}-api.mathfi.ai"],"title":"Clean the dataset","codeSamples":[],"requestExampleLanguages":["bash","python"],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{"8800b374-da31-401a-be0a-41bbad2bba17":{"name":"datasetKey","in":"path","required":true,"schema":{"type":"string","format":"uuid","isRequired":true,"uniqueKey":"","typeLabel":"string\u003cuuid>"}}},"responses":{"0acfff70-7a52-4613-89e5-f53a301f8c22":{"description":"Cleaning started.","content":{"application/json":{"schema":{"required":["datasetCreationProgressUrl","datasetKey","status"],"type":"object","properties":{"datasetKey":{"pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[4][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$","type":"string","format":"uuid","isRequired":true,"uniqueKey":"datasetKey","typeLabel":"string\u003cuuid>"},"status":{"type":"string","description":"Status of dataset creation: \n\n* `PENDING` - The dataset has been created and is pending further actions. Mainly data addition\n* `PROCESSING` - The dataset is currently being processed. When this status is returned an url to check status is returned too\n* `COMPLETED` - The dataset has been processed and is completed. The dataset is now ready to be used for training models\n* `FAILED` - The dataset processing has failed\n\n","enum":["PENDING","PROCESSING","COMPLETED","FAILED"],"isRequired":true,"uniqueKey":"status","typeLabel":"enum\u003cstring>"},"datasetCreationProgressUrl":{"type":"string","isRequired":true,"uniqueKey":"datasetCreationProgressUrl","typeLabel":"string"},"numberOfBuckets":{"type":"integer","uniqueKey":"numberOfBuckets","typeLabel":"integer"},"datasetUploadInfo":{"description":"Where to PUT the CSV on the single-file route. Prefer `uploadTargets`, which names each file it\nexpects.\n\n`uploadUrl` is a signed URL valid for 60 minutes. PUT the CSV as a binary body with\n`Content-Type: text/csv` and every header listed in `extraHeaders` (one colon-joined\n`Name:value` pair per header, semicolon-separated). Send no `Authorization` header: the signature\ncovers the request, and an extra header breaks it.\n","type":"object","properties":{"uploadUrl":{"type":"string","description":"The signed URL for uploading the CSV file using a PUT request.","uniqueKey":"datasetUploadInfo.uploadUrl","typeLabel":"string"},"extraHeaders":{"type":"string","description":"Additional headers required for the PUT request. These are formatted as a \ncomma-separated string (e.g., `headerName1:headerValue1,headerName2:headerValue2`). \nEnsure all specified headers are included in the request.\n","uniqueKey":"datasetUploadInfo.extraHeaders","typeLabel":"string"}},"uniqueKey":"datasetUploadInfo","typeLabel":"object"},"uploadTargets":{"description":"Where to PUT each input file. A dataset built from a train and a labelled test file returns one target per file; a dataset whose files came from a completed refinement returns none, because nothing is uploaded. Empty on the single-file pipeline.","type":"array","items":{"description":"One place the client must PUT an input file to.","required":["kind","url"],"type":"object","properties":{"kind":{"type":"string","enum":["TRAIN","TEST"],"description":"TRAIN is the 80% training file; TEST is the 20% file WITH its labels, which is what the models are scored against.","isRequired":true,"uniqueKey":"uploadTargets.items.[INDEX].kind","typeLabel":"enum\u003cstring>"},"url":{"type":"string","description":"Signed upload URL — PUT the CSV directly to it.","isRequired":true,"uniqueKey":"uploadTargets.items.[INDEX].url","typeLabel":"string"},"requiredHeader":{"oneOf":[{"type":"string","description":"A single request header the PUT must include, as one colon-joined \"Name:value\" string. The PUT must ALSO send \"Content-Type: text/csv\". Null when no extra header is required.","uniqueKey":"uploadTargets.items.[INDEX].requiredHeader.oneOf.0","typeLabel":"string"},{"type":"null","description":"A single request header the PUT must include, as one colon-joined \"Name:value\" string. The PUT must ALSO send \"Content-Type: text/csv\". Null when no extra header is required.","uniqueKey":"uploadTargets.items.[INDEX].requiredHeader.oneOf.1","typeLabel":"null"}],"uniqueKey":"uploadTargets.items.[INDEX].requiredHeader","typeLabel":"string | null"}},"uniqueKey":"uploadTargets.items.[INDEX]","typeLabel":"object"},"uniqueKey":"uploadTargets","typeLabel":"object[]"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"datasetKey":"3c90c3cc-0d44-4b50-8888-8dd25736052a","status":"PENDING","datasetCreationProgressUrl":"\u003cstring>","numberOfBuckets":123,"datasetUploadInfo":{"uploadUrl":"\u003cstring>","extraHeaders":"\u003cstring>"},"uploadTargets":[{"kind":"TRAIN","url":"\u003cstring>","requiredHeader":"\u003cstring>"}]}}},"exampleType":"generated"}},"exampleType":"generated"},"66f95b8a-70b9-480f-a221-cef53ebbf152":{"description":"Not authenticated.","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}},"cb285281-33be-47fd-979d-e09b73886235":{"description":"No such dataset.","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}},"43da0631-d566-43fb-a80b-e8424d557f69":{"description":"An input file is still missing, or the dataset has already been cleaned.","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}}},"security":{"27241cc0-1553-4152-a178-1237e083f960":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","scopes":[],"schemeName":"BearerAuth"}}},"servers":{"0215795f-7d3c-442e-bfcb-454b8d8c6f91":{"url":"https://{tenant}-api.mathfi.ai","description":"Your tenant's API. Each customer has their own, so the host varies. Replace {tenant} with the name issued when your tenant was created.","variables":{"tenant":{"default":"your-tenant","description":"The tenant name issued to you."}}}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","bearerFormat":"JWT","scopes":[],"schemeName":"BearerAuth"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your auth token.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"BearerAuth","name":"Authorization"}],"title":"BearerAuth"}]},"originalFileLocation":"api-reference/openapi.yaml"},"subdomain":"mathficast","siteName":"MathFi.ai","title":"Clean the dataset - MathFi.ai","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-17T07:04:30.661Z","originalFileLocation":"api-reference/datasets/clean-dataset.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Prepares an uploaded dataset for training. Returns immediately; the dataset moves to PROCESSING. Poll GET /api/v1/datasets/{datasetKey} for the outcome. - Call it only once both input files have been uploaded. - Call it once. The artefacts a training run reads are built one time. - Do not call it on a dataset created from a refinement. That route starts the work itself. A 409 means one of two things, and the message says which: an input has not arrived, or the dataset was already cleaned. Size is not checked before cleaning starts. The train file needs at least 25 labelled rows for the least common target value, counted after the split. A dataset below that moves to ERROR rather than COMPLETED, with the reason in errors, and cleaning the same files again will not change the outcome.\">\u003cmeta data-mint-head name=\"application-name\" content=\"MathFi.ai\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/mathficast/DPpupBGAr--8eP5g/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/mathficast/DPpupBGAr--8eP5g/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/mathficast/DPpupBGAr--8eP5g/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/mathficast/DPpupBGAr--8eP5g/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/mathficast/DPpupBGAr--8eP5g/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/mathficast/DPpupBGAr--8eP5g/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/mathficast/DPpupBGAr--8eP5g/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/mathficast/DPpupBGAr--8eP5g/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/mathficast/DPpupBGAr--8eP5g/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Clean the dataset - MathFi.ai\">\u003cmeta data-mint-head property=\"og:description\" content=\"Prepares an uploaded dataset for training. Returns immediately; the dataset moves to PROCESSING. Poll GET /api/v1/datasets/{datasetKey} for the outcome. - Call it only once both input files have been uploaded. - Call it once. The artefacts a training run reads are built one time. - Do not call it on a dataset created from a refinement. That route starts the work itself. A 409 means one of two things, and the message says which: an input has not arrived, or the dataset was already cleaned. Size is not checked before cleaning starts. The train file needs at least 25 labelled rows for the least common target value, counted after the split. A dataset below that moves to ERROR rather than COMPLETED, with the reason in errors, and cleaning the same files again will not change the outcome.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"MathFi.ai\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.mathfi.ai/api-reference/datasets/clean-dataset\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://mathficast.mintlify.app/_mintlify/api/og/v2?division=Datasets\u0026amp;title=Clean+the+dataset\u0026amp;description=Prepares+an+uploaded+dataset+for+training.+Returns+immediately%3B+the+dataset+moves+to%0A%60PROCESSING%60.+Poll+%60GET+%2Fapi%2Fv1%2Fdatasets%2F%7BdatasetKey%7D%60+for+the+outcome.%0A%0A-+\u0026amp;theme=cbd1a49d9809485b2cbd71fb\u0026amp;signature=549597d4da0d286223ebe0eb1d68d951217849d23757a4251640c5d62eb97dca\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Clean the dataset - MathFi.ai\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Prepares an uploaded dataset for training. Returns immediately; the dataset moves to PROCESSING. Poll GET /api/v1/datasets/{datasetKey} for the outcome. - Call it only once both input files have been uploaded. - Call it once. The artefacts a training run reads are built one time. - Do not call it on a dataset created from a refinement. That route starts the work itself. A 409 means one of two things, and the message says which: an input has not arrived, or the dataset was already cleaned. Size is not checked before cleaning starts. The train file needs at least 25 labelled rows for the least common target value, counted after the split. A dataset below that moves to ERROR rather than COMPLETED, with the reason in errors, and cleaning the same files again will not change the outcome.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://mathficast.mintlify.app/_mintlify/api/og/v2?division=Datasets\u0026amp;title=Clean+the+dataset\u0026amp;description=Prepares+an+uploaded+dataset+for+training.+Returns+immediately%3B+the+dataset+moves+to%0A%60PROCESSING%60.+Poll+%60GET+%2Fapi%2Fv1%2Fdatasets%2F%7BdatasetKey%7D%60+for+the+outcome.%0A%0A-+\u0026amp;theme=cbd1a49d9809485b2cbd71fb\u0026amp;signature=549597d4da0d286223ebe0eb1d68d951217849d23757a4251640c5d62eb97dca\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/mathficast/DPpupBGAr--8eP5g/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"MathFi.ai\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0D5E4F\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.mathfi.ai/api-reference/datasets/clean-dataset\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/datasets/clean-dataset.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.mathfi.ai/#organization\",\"name\":\"MathFi.ai\",\"url\":\"https://docs.mathfi.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/mathficast/obGjwhvkcHRG-84d/logo/light.svg?fit=max\u0026auto=format\u0026n=obGjwhvkcHRG-84d\u0026q=85\u0026s=0d58083744fd1f821588093372fdf5bf\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.mathfi.ai#website\",\"name\":\"MathFi.ai\",\"url\":\"https://docs.mathfi.ai\",\"publisher\":{\"@id\":\"https://docs.mathfi.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.mathfi.ai/api-reference/datasets/clean-dataset#webpage\",\"url\":\"https://docs.mathfi.ai/api-reference/datasets/clean-dataset\",\"name\":\"Clean the dataset\",\"description\":\"Prepares an uploaded dataset for training. Returns immediately; the dataset moves to PROCESSING. Poll GET /api/v1/datasets/{datasetKey} for the outcome. - Call it only once both input files have been uploaded. - Call it once. The artefacts a training run reads are built one time. - Do not call it on a dataset created from a refinement. That route starts the work itself. A 409 means one of two things, and the message says which: an input has not arrived, or the dataset was already cleaned. Size is not checked before cleaning starts. The train file needs at least 25 labelled rows for the least common target value, counted after the split. A dataset below that moves to ERROR rather than COMPLETED, with the reason in errors, and cleaning the same files again will not change the outcome.\",\"dateModified\":\"2026-10-17T07:04:30.661Z\",\"isPartOf\":{\"@id\":\"https://docs.mathfi.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.mathfi.ai/api-reference/datasets/clean-dataset#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.mathfi.ai/api-reference/datasets/clean-dataset#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Model Crucible\",\"item\":\"https://docs.mathfi.ai/api-reference/datasets/create-dataset\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Datasets\",\"item\":\"https://docs.mathfi.ai/api-reference/datasets/create-dataset\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Clean the dataset\",\"item\":\"https://docs.mathfi.ai/api-reference/datasets/clean-dataset\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.mathfi.ai/api-reference/datasets/clean-dataset#apireference\",\"headline\":\"Clean the dataset\",\"name\":\"Clean the dataset\",\"description\":\"Prepares an uploaded dataset for training. Returns immediately; the dataset moves to PROCESSING. Poll GET /api/v1/datasets/{datasetKey} for the outcome. - Call it only once both input files have been uploaded. - Call it once. The artefacts a training run reads are built one time. - Do not call it on a dataset created from a refinement. That route starts the work itself. A 409 means one of two things, and the message says which: an input has not arrived, or the dataset was already cleaned. Size is not checked before cleaning starts. The train file needs at least 25 labelled rows for the least common target value, counted after the split. A dataset below that moves to ERROR rather than COMPLETED, with the reason in errors, and cleaning the same files again will not change the outcome.\",\"url\":\"https://docs.mathfi.ai/api-reference/datasets/clean-dataset\",\"mainEntityOfPage\":{\"@id\":\"https://docs.mathfi.ai/api-reference/datasets/clean-dataset#webpage\"},\"dateModified\":\"2026-10-17T07:04:30.661Z\",\"publisher\":{\"@id\":\"https://docs.mathfi.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.mathfi.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"MathFi.ai\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"MathFi.ai","nav":{"global":null,"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":""}]},{"tab":"API Reference","groups":[{"group":"Getting started","pages":[{"title":"API overview","icon":"code","href":"/developers/api-overview"},{"title":"Authentication","icon":"key","href":"/developers/authentication"},{"title":"API recipes","icon":"terminal","href":"/developers/api-recipes"},{"title":"Build a CLI or agent","icon":"robot","href":"/developers/agents"}]},{"group":"Authentication","pages":[{"title":"Log in and obtain a bearer token","openapi":"api-reference/openapi.yaml POST /api/login","href":"/api-reference/authentication/login"}]},{"group":"Feature Refinery","pages":[{"title":"Create a feature refinement","openapi":"api-reference/openapi.yaml POST /api/v1/feature-refinery","href":"/api-reference/feature-refinery/create-feature-refinement"},{"title":"Start the run once inputs are uploaded","openapi":"api-reference/openapi.yaml POST /api/v1/feature-refinery/{featureRefinementKey}/start","href":"/api-reference/feature-refinery/start-feature-refinement"},{"title":"Feature refinement progress","openapi":"api-reference/openapi.yaml GET /api/v1/feature-refinery/{featureRefinementKey}/progress","href":"/api-reference/feature-refinery/get-feature-refinement-progress"},{"title":"Feature refinement result — columnStatus + refined download links","openapi":"api-reference/openapi.yaml GET /api/v1/feature-refinery/{featureRefinementKey}/result","href":"/api-reference/feature-refinery/get-feature-refinement-result"},{"title":"Run detail","openapi":"api-reference/openapi.yaml GET /api/v1/feature-refinery/{featureRefinementKey}","href":"/api-reference/feature-refinery/get-feature-refinement"},{"title":"List the caller's feature refinements","openapi":"api-reference/openapi.yaml GET /api/v1/feature-refinery","href":"/api-reference/feature-refinery/list-feature-refinements"},{"title":"Cancel a run","openapi":"api-reference/openapi.yaml POST /api/v1/feature-refinery/{featureRefinementKey}/cancel","href":"/api-reference/feature-refinery/cancel-feature-refinement"},{"title":"Non-destructive delete of a run","openapi":"api-reference/openapi.yaml DELETE /api/v1/feature-refinery/{featureRefinementKey}","href":"/api-reference/feature-refinery/delete-feature-refinement"}]},{"group":"Model Crucible","pages":[{"group":"Datasets","pages":[{"title":"Create a dataset","openapi":"api-reference/openapi.yaml POST /api/v1/datasets","description":"Create a dataset. A dataset is the labelled data a training run reads: an 80% train CSV and a 20%\ntest CSV that keeps its labels.\n\nTwo ways to fill it:\n\n* **Upload.** The response carries one `uploadTargets` entry per file (`TRAIN` and `TEST`). PUT each\n CSV to its signed URL, then call `POST /api/v1/datasets/{datasetKey}/clean`.\n* **From a refinement.** Send `featureRefinementKey` instead. The refined train and test files and\n the target that refinement reached come across with it, `uploadTargets` comes back empty, and\n there is nothing to upload.\n\nThe dataset starts `PENDING`, moves to `PROCESSING` when cleaning starts, and is ready to train from\nat `COMPLETED`. Poll `GET /api/v1/datasets/{datasetKey}` for the status.\n\nBoth files need a header row, a unique id in the first column and the target in the last, in the same\ncolumn order. The train file needs at least 25 labelled rows for the least common target value,\ncounted after you split train from test rather than before. Several hundred rows in total is a\nrealistic minimum. See [Input data](/guides/input-csv-creation).\n","href":"/api-reference/datasets/create-dataset"},{"title":"Clean the dataset","openapi":"api-reference/openapi.yaml POST /api/v1/datasets/{datasetKey}/clean","href":"/api-reference/datasets/clean-dataset"},{"title":"Retrieve dataset details","openapi":"api-reference/openapi.yaml GET /api/v1/datasets/{datasetKey}","description":"Retrieve dataset details by dataset key","href":"/api-reference/datasets/get-dataset-by-key"},{"title":"List all datasets","openapi":"api-reference/openapi.yaml GET /api/v1/datasets","href":"/api-reference/datasets/list-datasets"},{"title":"Non-destructive delete of a dataset","openapi":"api-reference/openapi.yaml DELETE /api/v1/datasets/{datasetKey}","href":"/api-reference/datasets/delete-dataset"}]},{"group":"Training","pages":[{"title":"Start a training run on a dataset","openapi":"api-reference/openapi.yaml POST /api/v1/training/datasets/{datasetKey}","href":"/api-reference/training/create-training"},{"title":"Get training job progress","openapi":"api-reference/openapi.yaml GET /api/v1/training/{trainingJobKey}/progress","href":"/api-reference/training/get-training-progress"},{"title":"Get training job detail","openapi":"api-reference/openapi.yaml GET /api/v1/training/{trainingJobKey}","href":"/api-reference/training/get-training-detail"},{"title":"Choose which model predictions run against","openapi":"api-reference/openapi.yaml POST /api/v1/training/{trainingJobKey}/champion","href":"/api-reference/training/select-champion"},{"title":"Cancel a training job","openapi":"api-reference/openapi.yaml PATCH /api/v1/training/{trainingJobKey}/cancel","href":"/api-reference/training/cancel-training-job"},{"title":"List training jobs","openapi":"api-reference/openapi.yaml GET /api/v1/training","href":"/api-reference/training/list-training-by-user"},{"title":"List training jobs by dataset","openapi":"api-reference/openapi.yaml GET /api/v1/training/datasets/{datasetKey}","href":"/api-reference/training/list-training-by-dataset"}]},{"group":"Models","pages":[{"title":"Get model detail","openapi":"api-reference/openapi.yaml GET /api/v1/models/{modelKey}","href":"/api-reference/models/get-model-detail"},{"title":"List models by dataset","openapi":"api-reference/openapi.yaml GET /api/v1/models/datasets/{datasetKey}","href":"/api-reference/models/list-models-by-dataset"}]},{"group":"Predictions","pages":[{"title":"Create a prediction","openapi":"api-reference/openapi.yaml POST /api/v1/predictions","href":"/api-reference/predictions/create-prediction-model-payload"},{"title":"Create a prediction","openapi":"api-reference/openapi.yaml POST /api/v1/predictions/models/{modelKey}","href":"/api-reference/predictions/create-prediction"},{"title":"Get prediction progress","openapi":"api-reference/openapi.yaml GET /api/v1/predictions/{predictionKey}/progress","href":"/api-reference/predictions/get-prediction-progress"},{"title":"Get prediction detail","openapi":"api-reference/openapi.yaml GET /api/v1/predictions/{predictionKey}","href":"/api-reference/predictions/get-prediction-detail"},{"title":"List predictions by model","openapi":"api-reference/openapi.yaml GET /api/v1/predictions/models/{modelKey}","href":"/api-reference/predictions/list-predictions-by-model"},{"title":"List predictions by dataset","openapi":"api-reference/openapi.yaml GET /api/v1/predictions/datasets/{datasetKey}","href":"/api-reference/predictions/list-predictions-by-dataset"}]}]}]},{"tab":"Help","pages":[{"title":"Help","href":"/help/faq"}]}]},"basePath":"","title":"Clean the dataset - MathFi.ai","buildId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","deploymentId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-C8RPHPxo.js","utils-0BK-9q6z.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-DfjzsUJT.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-B4v9psJ4.js","snippetPresets-CpTQv-Ez.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-BNP-Fvr0.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-BSgu6h1D.js","shallow-Biv1i9Gs.js","getApiPlaygroundDisplay-BoGOXhtF.js","CodeSnippet-DvQoT18_.js","CodeSnippets-Dnpa15xT.js","Page-Buji1S4J.js","getPastedJson-xAIyhUFE.js","icon-S6FBih11.js","MethodPill-SaYeUZyk.js","DuplicateIcon-Cs-p3v2Q.js","createIcon-DjCFEoHq.js","DynamicMarkdown-BcnBltEQ.js","SectionHeading-BUBl0eEF.js","axios-vUo_bRtp.js","Markdown-h4cOoD8d.js","clsx-B2v50t8t.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-DJnKvr0g.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-BHrrjR1K.js"]}