Upload File
Send a document and store the memories extracted from its text. Reuses the same parsers the connectors use, so a format supported by a connector is supported here.
Endpoint and form fields
This is the one memory operation that sends multipart/form-data rather than JSON.
| Field | Type | Contract |
|---|---|---|
file | file | Required. The parser is chosen from the filename extension, so a filename is required. |
source | string | Optional origin label. Defaults to upload. |
metadata | string | Optional JSON object, sent as a string in a form field. |
end_user_id | string | Optional; mirrors the X-End-User-ID header. |
Accepted formats
PDF, DOCX, PPTX, XLSX, CSV, plain text, Markdown, HTML and source code, plus images, audio and video wherever a transcriber is configured. This is the identical parser set the sync pipeline runs, so a format is never accepted by a connector and refused here.
Upload a document
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",project_id=os.environ["MEMORYSYNC_PROJECT_ID"],end_user_id="usr_7f3a9c2e",)with open("handbook.pdf", "rb") as fh:result = client.upload(fh,filename="handbook.pdf",source="onboarding",metadata={"team": "support"},)
Do not set Content-Type yourself
# Wrong — overrides the boundary and every field appears missingcurl --request POST https://api.memorysync.io/memory/upload \--header "Content-Type: multipart/form-data" \--form "file=@handbook.pdf"
Result paths
The response is the first stored Memory. A document usually yields several; use Query to see the rest.
Normal outcome. A blank scan, a sheet of empty cells, or content the extractor judges trivial all land here. Read reason; nothing was stored.
The file exceeded the upload ceiling. Enforced while reading the stream, not from the declared length.
{"status":"skipped","reason":"no_extractable_text","filename":"blank.pdf","file_type":"pdf","memory_ids":[]}
Billing
Billed as an add: one unit per memory created, exactly like the connector path. A document that produces fifteen memories costs fifteen. Over-quota uploads return the silent success envelope and store nothing.
Errors and next action
A 422 means the file could not be parsed as the type its extension claims. A 413 means the ceiling was exceeded. For 429 or 5xx, do not assume whether an interrupted upload stored anything — query before retrying.