> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maximem.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# memories.create_from_file

> Ingest a file from disk, an open file-like object, or raw text into the memory pipeline.

```python theme={null}
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

<ParamField path="user_id" type="string" required>
  The user this memory is about.
</ParamField>

<ParamField path="customer_id" type="string" required>
  The customer this memory belongs to. Required on B2B; auto-resolved on B2C. See [B2C vs B2B](/concepts/memory-scopes#b2c-vs-b2b-which-scopes-apply-to-you).
</ParamField>

<ParamField path="relationship_type" type="string">
  Scope hint for the upload. One of `"b2c"` (default) or `"b2b"`.
</ParamField>

<ParamField path="file_path" type="string">
  Path on disk to read and upload. Mutually exclusive with `file` and `text`.
</ParamField>

<ParamField path="file" type="IO[bytes]">
  An open binary file-like object. When using this, you must also pass `filename`. Mutually exclusive with `file_path` and `text`.
</ParamField>

<ParamField path="filename" type="string">
  Name to use for the upload. Required when passing `file=`.
</ParamField>

<ParamField path="text" type="string">
  Raw text content to ingest instead of a file. Mutually exclusive with `file_path` and `file`.
</ParamField>

<ParamField path="document_type" type="string">
  Override the auto-detected document type (for example, `"pdf"`, `"email"`, `"meeting-transcript"`).
</ParamField>

<ParamField path="mode" type="string">
  Ingestion mode: `"fast"` or `"long-range"` (default), the ingestion axis of [Retrieval Modes](/concepts/retrieval-modes).
</ParamField>

<ParamField path="metadata" type="object">
  Additional metadata to attach to the memory. Serialized to JSON before upload.
</ParamField>

### Returns

`CreateMemoryResponse` with the ingestion job identifiers and initial status.

<ResponseField name="ingestion_id" type="UUID">
  Unique identifier for tracking this ingestion job.
</ResponseField>

<ResponseField name="document_id" type="string">
  The document identifier assigned to the upload.
</ResponseField>

<ResponseField name="status" type="string">
  Initial status of the ingestion job. Typically `queued`.
</ResponseField>

<ResponseField name="queued_at" type="datetime">
  Timestamp at which the job was accepted into the queue.
</ResponseField>

### Example

```python theme={null}
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

* [memories.create](/sdk-reference/memories/create)
* [memories.batch\_create](/sdk-reference/memories/batch-create)
* [memories.wait\_for\_completion](/sdk-reference/memories/wait-for-completion)
