Backfill dated content by setting date on each document, sorting the source records oldest to newest, and sending them in batches. Each request can contain up to 600 documents.Endpoint:POST /ns/{namespace}/document/batch
import { Supermemory } from "supermemory";type SourceDocument = { id: string; content: string; createdAt: string;};const supermemory = new Supermemory({ apiKey: process.env.SUPERMEMORY_API_KEY });const batchSize = 100;async function backfillHistoricalData(sourceDocuments: SourceDocument[]) { const documents = sourceDocuments .map((document) => ({ content: document.content, id: document.id, date: new Date(document.createdAt).toISOString() })) .sort((a, b) => a.date.localeCompare(b.date)); for (let offset = 0; offset < documents.length; offset += batchSize) { const result = await supermemory.documents.batchAdd("historical_import", { documents: documents.slice(offset, offset + batchSize), }); if (result.failed > 0) { throw new Error(`${result.failed} documents failed to ingest`); } }}
from datetime import datetime, timezonefrom supermemory import Supermemoryclient = Supermemory()batch_size = 100def to_utc(value: str) -> str: parsed = datetime.fromisoformat(value.replace("Z", "+00:00")) if parsed.tzinfo is None: raise ValueError("created_at must include a timezone") return parsed.astimezone(timezone.utc).isoformat().replace("+00:00", "Z")def backfill_historical_data(source_documents: list[dict[str, str]]) -> None: documents = sorted( [ { "content": document["content"], "id": document["id"], "date": to_utc(document["created_at"]), } for document in source_documents ], key=lambda document: document["date"], ) for offset in range(0, len(documents), batch_size): result = client.documents.batch_add( "historical_import", documents=documents[offset : offset + batch_size], ) if result.failed > 0: raise RuntimeError(f"{result.failed} documents failed to ingest")
results lists accepted documents first, in request order, then failed ones, so match each result by id. Inspect count (accepted), failed, and every item in results; a batch can contain successful and failed items together.
Endpoint:GET /ns/{namespace}/document/{id}The batch endpoint returns after accepting the documents. If a later step depends on the documents being indexed, poll the returned document IDs until system.status is done. If that later step also needs the extracted memories, send the batch with dreaming: "instant"; under the default dynamic mode memory extraction is batched and can lag done by minutes. Each document reports system.dreamingStatus: "done" once its memories are ready.
async function waitUntilDone(ids: string[]) { while (true) { const documents = await Promise.all( ids.map((id) => supermemory.documents.get("historical_import", id)) ); if (documents.some((document) => document.system.status === "failed")) { throw new Error("A document failed to process"); } if (documents.every((document) => document.system.status === "done")) { return; } await new Promise((resolve) => setTimeout(resolve, 10_000)); }}
import timedef wait_until_done(ids: list[str]) -> None: while True: documents = [ client.documents.get("historical_import", document_id) for document_id in ids ] if any(document.system.status == "failed" for document in documents): raise RuntimeError("A document failed to process") if all(document.system.status == "done" for document in documents): return time.sleep(10)
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"supermemory | Memory API for the AI era","description":"Frontier agent memory and context platform","colors":{"primary":"#091120","light":"#F5F5F5","dark":"#091120"},"logo":{"light":"https://mintcdn.com/supermemory/1szAHJ3-ym4bjQ4U/logo/light.svg?fit=max\u0026auto=format\u0026n=1szAHJ3-ym4bjQ4U\u0026q=85\u0026s=e4571d11b31900b962a200bf7206e7d9","dark":"https://mintcdn.com/supermemory/1szAHJ3-ym4bjQ4U/logo/dark.svg?fit=max\u0026auto=format\u0026n=1szAHJ3-ym4bjQ4U\u0026q=85\u0026s=23c339f1eafcd1c5ad241c14d94dad53"},"favicon":{"light":"https://mintcdn.com/supermemory/p0zPjih-OxhkPwgX/favicon-light-mode.png?fit=max\u0026auto=format\u0026n=p0zPjih-OxhkPwgX\u0026q=85\u0026s=2f4fb184e0e1a2b9a5e9fd27d3aca4b7","dark":"https://mintcdn.com/supermemory/p0zPjih-OxhkPwgX/favicon-dark-mode.png?fit=max\u0026auto=format\u0026n=p0zPjih-OxhkPwgX\u0026q=85\u0026s=839400ffc6b2249c0930e3d7376b4459"},"api":{"openapi":"https://api.supermemory.ai/v4/openapi","examples":{"defaults":"required","languages":["typescript","python","bash"],"prefill":true}},"background":{"color":{"light":"#FFFFFF","dark":"#0A0A0A"}},"navbar":{"links":[{"href":"https://supermemory.ai/changelog","label":"Changelog"},{"href":"mailto:support@supermemory.com","label":"Support"}],"primary":{"type":"button","label":"Dashboard","href":"https://console.supermemory.ai"}},"footer":{"socials":{"github":"https://github.com/supermemoryai","linkedin":"https://linkedin.com/company/supermemory","x":"https://x.com/supermemory"}},"fonts":{"heading":{"family":"Geist","weight":500},"body":{"family":"Geist"}},"icons":{"library":"lucide"},"styling":{"eyebrows":"breadcrumbs","codeblocks":{"theme":{"light":"github-light-default","dark":"github-dark-default"}},"latex":false},"banner":{"content":"**v3 and v4 are deprecated and will be shut down on December 31, 2026.** Move to v5 before then. [Read the migration guide](/migration/api-v5).","dismissible":true},"contextual":{"options":["copy","view","assistant","chatgpt","claude","mcp","add-mcp","cursor","vscode","download-spec"],"display":"header"},"thumbnails":{"appearance":"dark","background":"https://mintcdn.com/supermemory/h0P1q8R9RVJPj3Y5/images/og-background.jpg?fit=max\u0026auto=format\u0026n=h0P1q8R9RVJPj3Y5\u0026q=85\u0026s=c415d91bd85a6db507dd36eb330edb9a","fonts":{"family":"Geist"}},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"supermemory","hasAudioNarration":false,"actualSubdomain":"supermemory","customDomains":["supermemory.ai","docs.supermemory.ai"],"gitSource":{"type":"github","owner":"supermemoryai","repo":"supermemory","deployBranch":"main","contentDirectory":"apps/docs","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true,"edits":true,"issues":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae8d9beeaa655dafddd744c","clientVersion":"0.0.4088","searchFilterCounts":[{"language":"default","tag":"Developer platform","count":189},{"language":"default","tag":"API reference","count":91},{"language":"default","tag":"Developer platform (API)","count":75},{"language":"default","tag":"Using supermemory","count":31},{"language":"default","tag":"Plugins and MCP","count":24},{"language":"default","tag":"API integrations","count":23},{"language":"default","tag":"Connectors","count":19},{"language":"default","tag":"Migration guides","count":15},{"language":"default","tag":"Ingest","count":13},{"language":"default","tag":"Connections","count":11}]},"assistantConfig":{"enableAskAiButton":true,"enableStarterQuestions":true,"enableContextualStarterQuestions":true,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"email":"support@supermemory.com","showHelpButton":true}},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":true,"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":"rbac-expansion","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":"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":"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":"editor-metadata","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":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[{"_id":"6902c52aad086969d32e674e","deploymentId":"679c28b9bb8558c304aa0d79","questionText":"User profiles and tool use together for multimodal use cases","status":"active","generatedBy":"manual","createdAt":"2025-10-30T01:53:46.092Z","updatedAt":"2025-10-30T01:53:46.092Z","__v":0},{"_id":"6902c51ead086969d32e6474","deploymentId":"679c28b9bb8558c304aa0d79","questionText":"I am building XYZ. how do I use user profiles with the python SDK?","status":"active","generatedBy":"manual","createdAt":"2025-10-30T01:53:34.162Z","updatedAt":"2025-10-30T01:53:34.162Z","__v":0}],"googleFontsInlined":true},"customCss":[{"filePath":"style.css","href":"/docs/_mintlify/custom/supermemory/0ad5c1b8d894c2cb/style.css"}],"page":{"pagePath":"ingestion/batch-ingest-historical-data","slug":"/ingestion/batch-ingest-historical-data","pageMetadata":{"title":"How to backfill historical data into Supermemory","sidebarTitle":"Backfill historical data","description":"Backfill historical documents into Supermemory with date, stable IDs, and the batch ingestion API.","icon":"/icons/hugeicons/clock-01.svg","href":"/ingestion/batch-ingest-historical-data"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Backfill historical documents into Supermemory with date, stable IDs, and the batch ingestion API.\"\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,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Use `,_jsx(_components.code,{children:`POST /ns/{namespace}/document/batch`}),` to backfill exports, emails, messages, or other dated records.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Sort the source data oldest to newest, add `,_jsx(_components.code,{children:`date`}),` to every document.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`backfill-in-batches`,children:`Backfill in batches`}),`\n`,_jsxs(_components.p,{children:[`Backfill dated content by setting `,_jsx(_components.code,{children:`date`}),` on each document, sorting the source records oldest to newest, and sending them in batches. Each request can contain up to 600 documents.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Endpoint:`}),` `,_jsx(_components.a,{href:`/api-reference/ingest/batch-add-documents`,children:_jsx(_components.code,{children:`POST /ns/{namespace}/document/batch`})})]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript`,numberOfLines:`30`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default github-dark-default`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0d1117`,color:`#1f2328`,\"--shiki-dark\":`#e6edf3`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`30`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` { Supermemory } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` \"supermemory\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:` SourceDocument`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:` id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:` content`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:` createdAt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`};`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` supermemory`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:` Supermemory`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`({ apiKey: process.env.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`SUPERMEMORY_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` });`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` batchSize`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` 100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:` backfillHistoricalData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:`sourceDocuments`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:` SourceDocument`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`[]) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` documents`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` sourceDocuments`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` .`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:`map`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:`document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` ({`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` content: document.content,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` id: document.id,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` date: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:` Date`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(document.createdAt).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:`toISOString`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` }))`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` .`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:`sort`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:`a`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:`b`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` a.date.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:`localeCompare`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(b.date));`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` offset `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`; offset `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` documents.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`length`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`; offset `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`+=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` batchSize) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` result`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` supermemory.documents.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:`batchAdd`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"historical_import\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` documents: documents.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:`slice`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(offset, offset `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`+`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` batchSize),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` (result.failed `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:` Error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:\"`${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`result`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`failed`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:\"} documents failed to ingest`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`}`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,numberOfLines:`33`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default github-dark-default`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0d1117`,color:`#1f2328`,\"--shiki-dark\":`#e6edf3`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`33`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` datetime `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` datetime, timezone`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` supermemory `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` Supermemory`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`client `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` Supermemory()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`batch_size `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` 100`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:` to_utc`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(value: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` parsed `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` datetime.fromisoformat(value.replace(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"Z\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"+00:00\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` parsed.tzinfo `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`is`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` raise`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` ValueError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"created_at must include a timezone\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` parsed.astimezone(timezone.utc).isoformat().replace(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"+00:00\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"Z\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:` backfill_historical_data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(source_documents: list[dict[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`]]) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` documents `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` sorted`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` [`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`: document[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`: document[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` \"date\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`: to_utc(document[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"created_at\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`]),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` document `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` source_documents`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:` key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=lambda`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` document: document[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"date\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` )`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` offset `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`in`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` range`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`len`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(documents), batch_size):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` result `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` client.documents.batch_add(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` \"historical_import\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:` documents`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`documents[offset : offset `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`+`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` batch_size],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` )`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` result.failed `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` raise`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` RuntimeError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`result.failed`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` documents failed to ingest\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`)`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`curl`,numberOfLines:`9`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default github-dark-default`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0d1117`,color:`#1f2328`,\"--shiki-dark\":`#e6edf3`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` POST`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` \"https://api.supermemory.ai/ns/historical_import/document/batch\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` \"Authorization: Bearer `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`$SUPERMEMORY_API_KEY`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` \"documents\": [`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` { \"content\": \"first message\", \"id\": \"msg_001\", \"date\": \"2023-01-05T09:00:00Z\" },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` { \"content\": \"second message\", \"id\": \"msg_002\", \"date\": \"2023-01-06T14:30:00Z\" }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` }'`})}),`\n`]})})})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`results`}),` lists accepted documents first, in request order, then failed ones, so match each result by `,_jsx(_components.code,{children:`id`}),`. Inspect `,_jsx(_components.code,{children:`count`}),` (accepted), `,_jsx(_components.code,{children:`failed`}),`, and every item in `,_jsx(_components.code,{children:`results`}),`; a batch can contain successful and failed items together.`]}),`\n`,_jsx(Heading,{level:`2`,id:`optional-wait-for-processing-to-finish`,children:`Optional: wait for processing to finish`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Endpoint:`}),` `,_jsx(_components.a,{href:`/api-reference/documents/get-document`,children:_jsx(_components.code,{children:`GET /ns/{namespace}/document/{id}`})})]}),`\n`,_jsxs(_components.p,{children:[`The batch endpoint returns after accepting the documents. If a later step depends on the documents being indexed, poll the returned document IDs until `,_jsx(_components.code,{children:`system.status`}),` is `,_jsx(_components.code,{children:`done`}),`. If that later step also needs the extracted memories, send the batch with `,_jsx(_components.code,{children:`dreaming: \"instant\"`}),`; under the default `,_jsx(_components.code,{children:`dynamic`}),` mode memory extraction is batched and can lag `,_jsx(_components.code,{children:`done`}),` by minutes. Each document reports `,_jsx(_components.code,{children:`system.dreamingStatus: \"done\"`}),` once its memories are ready.`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript`,numberOfLines:`16`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default github-dark-default`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0d1117`,color:`#1f2328`,\"--shiki-dark\":`#e6edf3`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:` waitUntilDone`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:`ids`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`[]) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` while`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` (`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` documents`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` await`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:`all`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` ids.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:`map`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` supermemory.documents.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"historical_import\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`, id))`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` );`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` (documents.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:`some`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:`document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` document.system.status `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` \"failed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`)) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:` Error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"A document failed to process\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` (documents.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:`every`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:`document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` document.system.status `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` \"done\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`)) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` await`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` new`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:`resolve`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=>`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:` setTimeout`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(resolve, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`10_000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`));`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`}`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,numberOfLines:`15`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default github-dark-default`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0d1117`,color:`#1f2328`,\"--shiki-dark\":`#e6edf3`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` time`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#D2A8FF`},children:` wait_until_done`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(ids: list[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`]) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` while`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` documents `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` client.documents.get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"historical_import\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`, document_id) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` document_id `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` ids`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` if`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` any`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(document.system.status `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` \"failed\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` document `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` documents):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` raise`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` RuntimeError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"A document failed to process\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` if`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` all`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`(document.system.status `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` \"done\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` document `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` documents):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` return`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:` time.sleep(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:`10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`)`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`curl`,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default github-dark-default`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0d1117`,color:`#1f2328`,\"--shiki-dark\":`#e6edf3`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#FFA657`},children:`curl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` \"https://api.supermemory.ai/ns/historical_import/document/msg_001\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#FF7B72`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#79C0FF`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:` \"Authorization: Bearer `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#E6EDF3`},children:`$SUPERMEMORY_API_KEY`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#A5D6FF`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#8B949E`},children:`# repeat until \"system\": { \"status\": \"done\" }`})}),`\n`]})})})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":{"theme":{"light":"github-light-default","dark":"github-dark-default"}},"config":{},"pageMetadata":{"title":"How to backfill historical data into Supermemory","sidebarTitle":"Backfill historical data","description":"Backfill historical documents into Supermemory with date, stable IDs, and the batch ingestion API.","icon":"/icons/hugeicons/clock-01.svg","href":"/ingestion/batch-ingest-historical-data"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Backfill in batches","slug":"backfill-in-batches","depth":2,"children":[]},{"title":"Optional: wait for processing to finish","slug":"optional-wait-for-processing-to-finish","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/supermemory/71b914845a04a595/theme-switch.js"],"subdomain":"supermemory","siteName":"supermemory | Memory API for the AI era","title":"How to backfill historical data into Supermemory - supermemory | Memory API for the AI era","contextualStarterQuestions":[{"_id":"6ad1235445cca927f5ba0257","deploymentId":"679c28b9bb8558c304aa0d79","questionText":"Why sort data oldest to newest?","status":"active","generatedBy":"contextual","path":"ingestion/batch-ingest-historical-data","createdAt":"2026-10-15T19:02:44.626Z","updatedAt":"2026-10-15T19:02:44.626Z","__v":0},{"_id":"6ad1235445cca927f5ba0256","deploymentId":"679c28b9bb8558c304aa0d79","questionText":"What's the max batch size limit?","status":"active","generatedBy":"contextual","path":"ingestion/batch-ingest-historical-data","createdAt":"2026-10-15T19:02:44.626Z","updatedAt":"2026-10-15T19:02:44.626Z","__v":0},{"_id":"6ad1235445cca927f5ba0255","deploymentId":"679c28b9bb8558c304aa0d79","questionText":"How do I backfill historical data?","status":"active","generatedBy":"contextual","path":"ingestion/batch-ingest-historical-data","createdAt":"2026-10-15T19:02:44.626Z","updatedAt":"2026-10-15T19:02:44.626Z","__v":0}],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-15T19:02:37.683Z","originalFileLocation":"ingestion/batch-ingest-historical-data.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=\"Backfill historical documents into Supermemory with date, stable IDs, and the batch ingestion API.\">\u003cmeta data-mint-head name=\"application-name\" content=\"supermemory | Memory API for the AI era\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/supermemory/GrDCAjqJehqOwU42/_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=\"/docs/mintlify-assets/_mintlify/favicons/supermemory/GrDCAjqJehqOwU42/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/supermemory/GrDCAjqJehqOwU42/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/supermemory/GrDCAjqJehqOwU42/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/supermemory/GrDCAjqJehqOwU42/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/supermemory/GrDCAjqJehqOwU42/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/supermemory/GrDCAjqJehqOwU42/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/supermemory/GrDCAjqJehqOwU42/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/supermemory/GrDCAjqJehqOwU42/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"How to backfill historical data into Supermemory - supermemory | Memory API for the AI era\">\u003cmeta data-mint-head property=\"og:description\" content=\"Backfill historical documents into Supermemory with date, stable IDs, and the batch ingestion API.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"supermemory | Memory API for the AI era\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://supermemory.ai/docs/ingestion/batch-ingest-historical-data\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://supermemory.mintlify.site/docs/_mintlify/api/og/v2?division=General\u0026amp;title=How+to+backfill+historical+data+into+Supermemory\u0026amp;description=Backfill+historical+documents+into+Supermemory+with+date%2C+stable+IDs%2C+and+the+batch+ingestion+API.\u0026amp;theme=56f8f47184c0da030f976e8e\u0026amp;signature=20c3c2335d5ec17e76e786923901668184fd72b5e989ce24e651b34a0c2bad28\">\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=\"How to backfill historical data into Supermemory - supermemory | Memory API for the AI era\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Backfill historical documents into Supermemory with date, stable IDs, and the batch ingestion API.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://supermemory.mintlify.site/docs/_mintlify/api/og/v2?division=General\u0026amp;title=How+to+backfill+historical+data+into+Supermemory\u0026amp;description=Backfill+historical+documents+into+Supermemory+with+date%2C+stable+IDs%2C+and+the+batch+ingestion+API.\u0026amp;theme=56f8f47184c0da030f976e8e\u0026amp;signature=20c3c2335d5ec17e76e786923901668184fd72b5e989ce24e651b34a0c2bad28\">\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=\"/docs/mintlify-assets/_mintlify/favicons/supermemory/GrDCAjqJehqOwU42/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"supermemory | Memory API for the AI era\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#091120\">\u003clink data-mint-head rel=\"canonical\" href=\"https://supermemory.ai/docs/ingestion/batch-ingest-historical-data\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/ingestion/batch-ingest-historical-data.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://supermemory.ai/#organization\",\"name\":\"supermemory | Memory API for the AI era\",\"url\":\"https://supermemory.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/supermemory/1szAHJ3-ym4bjQ4U/logo/light.svg?fit=max\u0026auto=format\u0026n=1szAHJ3-ym4bjQ4U\u0026q=85\u0026s=e4571d11b31900b962a200bf7206e7d9\"}},{\"@type\":\"WebSite\",\"@id\":\"https://supermemory.ai/docs#website\",\"name\":\"supermemory | Memory API for the AI era\",\"url\":\"https://supermemory.ai/docs\",\"publisher\":{\"@id\":\"https://supermemory.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://supermemory.ai/docs/ingestion/batch-ingest-historical-data#webpage\",\"url\":\"https://supermemory.ai/docs/ingestion/batch-ingest-historical-data\",\"name\":\"How to backfill historical data into Supermemory\",\"description\":\"Backfill historical documents into Supermemory with date, stable IDs, and the batch ingestion API.\",\"dateModified\":\"2026-10-15T19:02:37.683Z\",\"isPartOf\":{\"@id\":\"https://supermemory.ai/docs#website\"},\"breadcrumb\":{\"@id\":\"https://supermemory.ai/docs/ingestion/batch-ingest-historical-data#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://supermemory.ai/docs/ingestion/batch-ingest-historical-data#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"supermemory | Memory API for the AI era\",\"item\":\"https://supermemory.ai/docs\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to backfill historical data into Supermemory\",\"item\":\"https://supermemory.ai/docs/ingestion/batch-ingest-historical-data\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://supermemory.ai/docs/ingestion/batch-ingest-historical-data#article\",\"headline\":\"How to backfill historical data into Supermemory\",\"name\":\"How to backfill historical data into Supermemory\",\"description\":\"Backfill historical documents into Supermemory with date, stable IDs, and the batch ingestion API.\",\"url\":\"https://supermemory.ai/docs/ingestion/batch-ingest-historical-data\",\"mainEntityOfPage\":{\"@id\":\"https://supermemory.ai/docs/ingestion/batch-ingest-historical-data#webpage\"},\"dateModified\":\"2026-10-15T19:02:37.683Z\",\"publisher\":{\"@id\":\"https://supermemory.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://supermemory.ai/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"supermemory | Memory API for the AI era\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"supermemory | Memory API for the AI era","nav":{"global":null,"tabs":[{"tab":"Overview","pages":[{"title":"Overview","href":""}]},{"tab":"Developer platform","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/source-code.svg","anchors":[{"anchor":"Developer platform (API)","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/book-open-01.svg","pages":[{"group":"Getting started","pages":[{"title":"What is Supermemory?","sidebarTitle":"What is Supermemory?","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/book-open-01.svg","href":"/overview/what-is-supermemory"},{"title":"Comparison - should I use supermemory?","sidebarTitle":"Comparison","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/balance-scale.svg","href":"/overview/comparison"},{"title":"Quickstart","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/play.svg","href":"/quickstart"},{"title":"Agents, skills and MCP","sidebarTitle":"Agents, skills and MCP","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/robotic.svg","href":"/agents-and-mcp"}]},{"group":"Concepts","pages":[{"title":"How Supermemory works","sidebarTitle":"How it works","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/cpu.svg","href":"/concepts/how-it-works"},{"title":"Graph memory","sidebarTitle":"Graph memory","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/share-08.svg","href":"/concepts/graph-memory"},{"title":"Supported content types","sidebarTitle":"Multi-modal ingestion","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/files-01.svg","href":"/concepts/content-types"},{"group":"Retrieval","icon":"/icons/hugeicons/search-01.svg","pages":[{"title":"SuperRAG (managed RAG as a service)","sidebarTitle":"SuperRAG","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/flash.svg","href":"/concepts/super-rag"},{"title":"Memory vs RAG: Understanding the difference","sidebarTitle":"Memory vs RAG","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/balance-scale.svg","href":"/concepts/memory-vs-rag"}]},{"group":"Multi-tenancy and filtering","icon":"/icons/hugeicons/user-multiple.svg","pages":[{"title":"Multi-tenancy overview","sidebarTitle":"Overview","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/user-multiple.svg","href":"/concepts/multi-tenancy"},{"title":"Multi-tenancy examples","sidebarTitle":"Examples","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/check-list.svg","href":"/concepts/multi-tenancy-examples"},{"title":"Namespaces","sidebarTitle":"Namespaces","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/folder-01.svg","href":"/concepts/container-tags"},{"title":"Organizing \u0026 filtering memories","sidebarTitle":"Metadata filtering","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/filter.svg","href":"/concepts/filtering"}]},{"group":"User profiles","icon":"/icons/hugeicons/id.svg","pages":[{"title":"User profiles","sidebarTitle":"Profiles","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/user-circle.svg","href":"/concepts/user-profiles"},{"title":"Profile buckets","sidebarTitle":"Buckets","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/tag-01.svg","href":"/user-profiles/buckets"}]}]},{"group":"Using supermemory","pages":[{"title":"Using Supermemory","sidebarTitle":"Overview","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/compass-01.svg","href":"/using-supermemory"},{"title":"API keys \u0026 auth","sidebarTitle":"API keys","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/key-01.svg","href":"/authentication"},{"title":"Invite team members","sidebarTitle":"Invite Team Members","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/user-multiple.svg","href":"/invite-team-members"},{"title":"Customizing for your use case","sidebarTitle":"Customizing","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/settings-02.svg","href":"/concepts/customization"},{"group":"Ingestion","icon":"/icons/hugeicons/download-01.svg","pages":[{"title":"Ingesting context to supermemory","sidebarTitle":"API","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/plus-sign.svg","href":"/ingestion/add-memories"},{"title":"Document operations","sidebarTitle":"Documents","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/files-02.svg","href":"/ingestion/document-operations"}]},{"group":"Connectors","icon":"/icons/hugeicons/plug-01.svg","pages":[{"title":"Connectors overview","sidebarTitle":"Overview","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/layers-01.svg","href":"/connectors/overview"},{"title":"Notion connector","sidebarTitle":"Notion","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/images/notion-icon.svg","href":"/connectors/notion"},{"title":"Google Drive connector","sidebarTitle":"Google Drive","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/images/google-drive-icon.svg","href":"/connectors/google-drive"},{"title":"Gmail connector","sidebarTitle":"Gmail","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/mail-01.svg","href":"/connectors/gmail"},{"title":"OneDrive connector","sidebarTitle":"OneDrive","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/images/microsoft-icon.svg","href":"/connectors/onedrive"},{"title":"S3 Connector","sidebarTitle":"S3","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/database-01.svg","href":"/connectors/s3"},{"title":"Granola connector","sidebarTitle":"Granola","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/images/granola.svg","href":"/connectors/granola"},{"title":"GitHub connector","sidebarTitle":"GitHub","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/images/github-icon.svg","href":"/connectors/github"},{"title":"Web Crawler connector","sidebarTitle":"Web Crawler","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/globe-02.svg","href":"/connectors/web-crawler"},{"title":"Connector troubleshooting","sidebarTitle":"Troubleshooting","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/wrench-01.svg","href":"/connectors/troubleshooting"},{"title":"Managing Connector Selection","sidebarTitle":"Managing Resources","icon":"folder-sync","href":"/connectors/managing-resources"}]},{"group":"Recall","icon":"/icons/hugeicons/upload-01.svg","pages":[{"title":"Search","sidebarTitle":"Search API","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/search-01.svg","href":"/recall/search"},{"title":"User profiles","sidebarTitle":"Overview","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/user.svg","href":"/recall/user-profiles"},{"title":"Memory Operations","sidebarTitle":"CRUD \u0026 Forgetting","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/database-01.svg","href":"/recall/memory-operations"},{"title":"Review inferred memories","sidebarTitle":"Memory review","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/check-list.svg","href":"/recall/memory-review"}]},{"group":"SMFS","icon":"/icons/hugeicons/database-01.svg","pages":[{"title":"SMFS","sidebarTitle":"Overview","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/database-01.svg","href":"/smfs/overview"},{"title":"Install SMFS","sidebarTitle":"Install","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/download-01.svg","href":"/smfs/install"},{"title":"Mount","sidebarTitle":"Mount","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/hard-drive.svg","href":"/smfs/mount"},{"title":"Bash tool","sidebarTitle":"Bash tool","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/command-line.svg","href":"/smfs/bash-tool"},{"title":"Bash tool (Python)","sidebarTitle":"Bash tool (Python)","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/command-line.svg","href":"/smfs/bash-tool-python"},{"group":"Providers","icon":"/icons/hugeicons/cloud.svg","pages":[{"title":"Daytona","href":"/smfs/providers/daytona"},{"title":"E2B","href":"/smfs/providers/e2b"},{"title":"Vercel AI SDK","href":"/smfs/providers/vercel"},{"title":"Cloudflare","href":"/smfs/providers/cloudflare"}]},{"title":"Examples","sidebarTitle":"Examples","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/source-code.svg","href":"/smfs/examples"}]},{"title":"Rules of supermemory","sidebarTitle":"Rules of supermemory","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/justice-scale-01.svg","href":"/concepts/rules"}]},{"group":"Deployment","pages":[{"group":"Supermemory local","icon":"/icons/hugeicons/server-stack-01.svg","pages":[{"title":"Supermemory local","sidebarTitle":"Overview","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/server-stack-01.svg","href":"/self-hosting/overview"},{"title":"Self-hosting quickstart","sidebarTitle":"Quickstart","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/play.svg","href":"/self-hosting/quickstart"},{"title":"Run Supermemory with Docker","sidebarTitle":"Docker","icon":"docker","href":"/self-hosting/docker"},{"title":"Self-hosting configuration","sidebarTitle":"Configuration","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/settings-01.svg","href":"/self-hosting/configuration"},{"title":"Embeddings (self-hosted)","sidebarTitle":"Embeddings","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/route-02.svg","href":"/self-hosting/embeddings"},{"title":"Using supermemory local with different providers","sidebarTitle":"Providers","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/route-01.svg","href":"/self-hosting/providers"},{"title":"Local vs. Enterprise","sidebarTitle":"Local vs. Enterprise","description":"Supermemory local is for builders. Supermemory Enterprise is for organizations.","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/building-03.svg","href":"/self-hosting/local-vs-enterprise"}]}]},{"group":"Other resources","pages":[{"group":"General","icon":"/icons/hugeicons/book-open-01.svg","pages":[{"title":"How to backfill historical data into Supermemory","sidebarTitle":"Backfill historical data","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/clock-01.svg","href":"/ingestion/batch-ingest-historical-data"}]},{"group":"Benchmarking","icon":"/icons/hugeicons/test-tube-01.svg","pages":[{"title":"MemoryBench","description":"Open-source framework for benchmarking memory providers, including your own.","sidebarTitle":"Overview","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/test-tube-01.svg","href":"/memorybench/overview"},{"title":"Building a benchmark","sidebarTitle":"Building a benchmark","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/test-tube-01.svg","href":"/memorybench/extend-benchmark"},{"title":"Adding a provider","sidebarTitle":"Adding a provider","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/plug-01.svg","href":"/memorybench/extend-provider"},{"title":"Measuring results","sidebarTitle":"Measuring","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/dashboard-speed-01.svg","href":"/memorybench/memscore"}]},{"title":"Billing \u0026 usage","sidebarTitle":"Billing \u0026 usage","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/credit-card.svg","href":"/overview/billing"},{"title":"Security \u0026 compliance","sidebarTitle":"Security \u0026 compliance","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/shield-01.svg","href":"/overview/security"},{"title":"Use cases","sidebarTitle":"Use cases","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/idea-01.svg","href":"/overview/use-cases"},{"title":"Analytics \u0026 monitoring","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/chart-line-data-01.svg","href":"/overview/analytics"}]},{"group":"Migration guides","pages":[{"group":"Supermemory API upgrades","icon":"arrow-up-right","pages":[{"title":"Migrate Supermemory v3/v4 to v5","sidebarTitle":"Legacy API to v5","icon":"arrow-up-right","href":"/migration/api-v5"},{"title":"Migrate document ingestion to v5","sidebarTitle":"Document ingestion","href":"/migration/api-v5-document-writes"},{"title":"Migrate document and file updates to v5","sidebarTitle":"Document updates","href":"/migration/api-v5-document-updates"},{"title":"Migrate content management to v5","sidebarTitle":"Content management","href":"/migration/api-v5-document-reads"},{"title":"Migrate search to v5","sidebarTitle":"Search","href":"/migration/api-v5-recall"},{"title":"Migrate profiles and buckets to v5","sidebarTitle":"Profiles and buckets","href":"/migration/api-v5-profiles"},{"title":"Migrate memory forgetting to v5","sidebarTitle":"Memory forgetting","href":"/migration/api-v5-memory-forgetting"},{"title":"Migrate container tags to namespaces","sidebarTitle":"Namespaces","href":"/migration/api-v5-settings"},{"title":"Migrate organization settings to v5","sidebarTitle":"Organization settings","href":"/migration/api-v5-organization"},{"title":"Migrate metadata filters to v5","sidebarTitle":"Typed filters","href":"/migration/api-v5-filters"},{"title":"Verify and roll out a v5 migration","sidebarTitle":"Verification and rollout","href":"/migration/api-v5-rollout"}]},{"group":"From another provider","icon":"/icons/hugeicons/delivery-truck-01.svg","pages":[{"title":"Migrating from Mem0 to Supermemory","sidebarTitle":"From Mem0","href":"/migration/from-mem0"},{"title":"Migrating from Zep to Supermemory","sidebarTitle":"From Zep","href":"/migration/from-zep"}]}]}]},{"anchor":"API integrations","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/plug-01.svg","pages":[{"title":"API integrations","href":"/integrations/supermemory-sdk"}]},{"anchor":"API reference","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/plug-socket.svg","versions":[{"version":"Legacy (v3, v4)","pages":[{"title":"Legacy (v3, v4)","href":"/api-reference/overview"}]},{"version":"Latest (v5)","default":true,"pages":[{"title":"API reference","sidebarTitle":"Overview","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/plug-socket.svg","href":"/v5/api-reference/overview"},{"title":"API keys \u0026 auth","sidebarTitle":"API keys","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/key-01.svg","href":"/authentication"},{"group":"Ingest","icon":"/icons/hugeicons/download-01.svg","pages":[{"title":"Ingest","sidebarTitle":"Overview","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/book-open-01.svg","href":"/v5/api-reference/ingest"},{"title":"Add document","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi post /ns/{namespace}/document","href":"/v5/api-reference/ingest/add-document"},{"title":"Batch add documents","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi post /ns/{namespace}/document/batch","href":"/v5/api-reference/ingest/batch-add-documents"},{"title":"Upload file","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi post /ns/{namespace}/document/file","href":"/v5/api-reference/ingest/upload-file"},{"title":"Update document","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi patch /ns/{namespace}/document/{id}","href":"/v5/api-reference/ingest/update-document"},{"title":"Replace document with file","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi post /ns/{namespace}/document/file/{id}","href":"/v5/api-reference/ingest/replace-document-with-file"},{"title":"Partially update document file","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi patch /ns/{namespace}/document/file/{id}","href":"/v5/api-reference/ingest/partially-update-document-file"}]},{"group":"Content Management","icon":"/icons/hugeicons/file-02.svg","pages":[{"title":"Content management","sidebarTitle":"Overview","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/book-open-01.svg","href":"/v5/api-reference/content-management"},{"title":"Get document","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi get /ns/{namespace}/document/{id}","href":"/v5/api-reference/content-management/get-document"},{"title":"Get memory","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi get /ns/{namespace}/memories/{id}","href":"/v5/api-reference/content-management/get-memory"},{"title":"List resources","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi post /ns/{namespace}/list/{type}","href":"/v5/api-reference/content-management/list-resources"},{"title":"Delete documents","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi delete /ns/{namespace}/document","href":"/v5/api-reference/content-management/delete-documents"},{"title":"Forget memories by ID","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi delete /ns/{namespace}/memories","href":"/v5/api-reference/content-management/forget-memories-by-id"},{"title":"Forget memories semantically","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi delete /ns/{namespace}/memories/semantic","href":"/v5/api-reference/content-management/forget-memories-semantically"}]},{"group":"Search","icon":"/icons/hugeicons/search-01.svg","pages":[{"title":"Search","sidebarTitle":"Overview","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/book-open-01.svg","href":"/v5/api-reference/search"},{"title":"Search memories","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi post /ns/{namespace}/search","href":"/v5/api-reference/recall-search/search-memories"}]},{"group":"Profiles","icon":"/icons/hugeicons/id.svg","pages":[{"title":"Profiles","sidebarTitle":"Overview","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/id.svg","href":"/v5/api-reference/profiles"},{"title":"Get profile","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi post /ns/{namespace}/profile","href":"/v5/api-reference/profiles/get-profile"},{"title":"Get profile buckets","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi get /ns/{namespace}/profile/buckets","href":"/v5/api-reference/profiles/get-profile-buckets"},{"title":"Add or update profile buckets","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi put /ns/{namespace}/profile/buckets","href":"/v5/api-reference/profiles/add-or-update-profile-buckets"},{"title":"Delete profile buckets","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi delete /ns/{namespace}/profile/buckets","href":"/v5/api-reference/profiles/delete-profile-buckets"}]},{"group":"Namespaces","icon":"/icons/hugeicons/layers-01.svg","pages":[{"title":"Namespaces","sidebarTitle":"Overview","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/book-open-01.svg","href":"/v5/api-reference/namespaces"},{"title":"List namespaces","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi get /namespaces","href":"/v5/api-reference/namespaces/list-namespaces"},{"title":"Get namespace settings","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi get /ns/{namespace}","href":"/v5/api-reference/namespaces/get-namespace-settings"},{"title":"Update namespace settings","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi patch /ns/{namespace}","href":"/v5/api-reference/namespaces/update-namespace-settings"},{"title":"Delete namespace","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi delete /ns/{namespace}","href":"/v5/api-reference/namespaces/delete-namespace"}]},{"group":"Connectors","icon":"/icons/hugeicons/plug-01.svg","pages":[{"title":"Connectors","sidebarTitle":"Overview","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/book-open-01.svg","href":"/v5/api-reference/connectors"},{"title":"Create connector","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi post /ns/{namespace}/connectors","href":"/v5/api-reference/connectors/create-connector"},{"title":"List connectors","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi get /ns/{namespace}/connectors","href":"/v5/api-reference/connectors/list-connectors"},{"title":"Get connector","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi get /ns/{namespace}/connectors/{id}","href":"/v5/api-reference/connectors/get-connector"},{"title":"Update connector","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi patch /ns/{namespace}/connectors/{id}","href":"/v5/api-reference/connectors/update-connector"},{"title":"Sync connector","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi post /ns/{namespace}/connectors/{id}/sync","href":"/v5/api-reference/connectors/sync-connector"},{"title":"Delete connector","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi delete /ns/{namespace}/connectors/{id}","href":"/v5/api-reference/connectors/delete-connector"},{"title":"List all connectors","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi get /connectors","href":"/v5/api-reference/connectors/list-all-connectors"}]},{"group":"Organization","icon":"/icons/hugeicons/building-03.svg","pages":[{"title":"Organization","sidebarTitle":"Overview","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/book-open-01.svg","href":"/v5/api-reference/organization"},{"title":"Get organization settings","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi get /organization","href":"/v5/api-reference/organization/get-organization-settings"},{"title":"Update organization settings","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi patch /organization","href":"/v5/api-reference/organization/update-organization-settings"}]},{"group":"Feedback","pages":[{"title":"Send feedback","deprecated":null,"version":null,"openapi":"https://api.supermemory.ai/v5/openapi post /feedback","href":"/v5/api-reference/feedback/send-feedback"}]}]}]}]},{"tab":"Plugins and MCP","icon":"https://mintlify.s3.us-west-1.amazonaws.com/supermemory/icons/hugeicons/puzzle.svg","pages":[{"title":"Plugins and MCP","href":"/supermemory-mcp/mcp"}]}]},"basePath":"","title":"How to backfill historical data into Supermemory - supermemory | Memory API for the AI era","buildId":"dpl_6dVqRXFR2Go5vF5RLvAdHuv189oT","deploymentId":"dpl_6dVqRXFR2Go5vF5RLvAdHuv189oT","dynamics":["10e4515597"],"chunks":["BannerMarkdown-BunTQ12o.js","dist-BWxsj3I0.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-CrPa459s.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js"]}