Skip to main content
await sdk.memories.create_from_file(user_id, customer_id, ...)
Ingest a file or raw text into the memory pipeline. Use this when you want Synap to upload and parse a document (PDF, text file, transcript, etc.) rather than passing a string directly. Exactly one of file_path, file, or text must be provided.

Parameters

user_id
string
required
The user this memory is about.
customer_id
string
required
The customer this memory belongs to. Required on B2B; auto-resolved on B2C — see B2C vs B2B.
relationship_type
string
Scope hint for the upload. One of "b2c" (default) or "b2b".
file_path
string
Path on disk to read and upload. Mutually exclusive with file and text.
file
IO[bytes]
An open binary file-like object. When using this, you must also pass filename. Mutually exclusive with file_path and text.
filename
string
Name to use for the upload. Required when passing file=.
text
string
Raw text content to ingest instead of a file. Mutually exclusive with file_path and file.
document_type
string
Override the auto-detected document type (for example, "pdf", "email", "meeting-transcript").
mode
string
Ingestion mode: "fast" or "long-range" (default) — the ingestion axis of Retrieval Modes.
metadata
object
Additional metadata to attach to the memory. Serialized to JSON before upload.

Returns

CreateMemoryResponse with the ingestion job identifiers and initial status.
ingestion_id
UUID
Unique identifier for tracking this ingestion job.
document_id
string
The document identifier assigned to the upload.
status
string
Initial status of the ingestion job. Typically queued.
queued_at
datetime
Timestamp at which the job was accepted into the queue.

Example

from maximem_synap import MaximemSynapSDK

sdk = MaximemSynapSDK(api_key="synap_your_key_here")
await sdk.initialize()

# Upload from disk
result = await sdk.memories.create_from_file(
    user_id="user_789",
    customer_id="cust_456",
    file_path="/data/transcripts/2026-05-17-call.pdf",
    document_type="pdf",
    mode="long-range",
    metadata={"source": "support-call"},
)
print(result.ingestion_id)

# Upload raw text
result = await sdk.memories.create_from_file(
    user_id="user_789",
    customer_id="cust_456",
    text="Customer prefers email follow-ups over phone.",
    document_type="note",
)

Raises

  • ValueError — when none of file_path, file, or text is provided.
  • SynapAuthError — when the API key is missing or invalid.
  • SynapValidationError — when the upload payload is malformed.

See also