memories.create, the same call you use for conversations. What changes is what you pass: a file, or text with a document type.
Documents are on for every Instance on Synap Cloud. Knowledge queries and document navigation (
documents.index and documents.read) need the Pro plan or above.Send a document
What you can send
Each file can be up to 10 MB, and one call takes up to 10 files. A file over the limit is refused. Each file in a call becomes its own document.
Document type
Say what the document is, or leave it out and Synap detects it from the file.
Free text such as
"employee handbook" is matched to the closest type. Conversation types (call-transcript, team-chat and the rest) are processed as conversations, even when sent as a file. Type affects how the document is split up, how deeply it is read (see How deeply a document is read), and whether older versions stay searchable: by default policies and contracts keep their history, so a fetch can ask what applied on a given date. The full list is on memories.create.
Objective
objective says what you are sending the document for.
Synap stores the objective with the document and uses it as a hint when it reads the file. It never changes who can see the document.
How a document is identified
Every document gets adocument_key when it is accepted. It is stable across versions and is what you pass to the documents methods and what a citation carries. Synap decides which document a call refers to in this order:
- The
document_idyou passed. It is unique within a scope, not across your whole account. - The source item, when you pass
sourcewith bothsystemandexternal_id. - The file’s content, when you pass neither.
Versions and re-uploads
Send a file again with the samedocument_id, in the same scope, and it becomes a new version of the same document.
- Identical file: nothing new is created or processed. The response says
version_status: "unchanged". - Changed file: a new version is created. The create response says
pending; the final status (new_version,unchangedorstale) is ondocuments.versionsonce Synap has read the file. A version whose text turns out identical to the current one isunchanged; one that is older than the current version by the source’s own clock (its revision or modified time) isstaleand never becomes current. - Readers see one version at a time. The previous version stays current until the new one is searchable, then the new one takes over. A fetch reads the current version. For types that keep history,
as_ofreads the version that applied on a date. - Every version keeps its original file.
documents.originalreturns the file of any version.
JSON Lines
Exports from other memory and knowledge tools usually ship one record per line. Send the file as aFilePart named .jsonl or .ndjson (or with a JSON Lines media type) and each record becomes its own document, so it can be found, cited, versioned and deleted on its own.
How it behaves:
- Ids. When the call or the
FileParthas adocument_id, each record’s id is that id, a slash, then the record’s id, for examplenotes-export/notion:8812. A record with no id is identified by its content. A date that cannot be read is left unset. - Versions. Upload the export again and each record is matched by its id: a changed record is a new version, an identical one is
unchanged. See Versions and re-uploads. - Type. A
document_typeyou declare applies to every record. - Datasets stay whole. When the first line has no text field, the file is not a record export and stays one document, read as JSON text.
- Empty records. A line whose text is empty is skipped.
- Bad input refuses everything. A line that is not JSON, not an object, or has no text field refuses the whole request with
UnsupportedFormatError(HTTP 415), naming the line, and nothing is stored. The file must be UTF-8. - At most 1,000 documents per request. A create, or a whole batch, that would produce more is refused with HTTP 413 (
FileTooLargeError). Split the file by line and send the parts separately. - Originals.
documents.originalreturns that record’s text, not the whole file. - One attachment per document. The result’s
attachmentslists one entry per document, in line order, each with its owndocument_key,document_idandversion_status. The top-level fields of the result describe the first document only.
memories.batch_create, a refused JSON Lines item fails on its own and the other items go ahead.
The TypeScript SDK sends a
.jsonl file as it would any file, with no media type of its own for it, and the server recognises it by its extension, so keep the extension, or pass media_type: 'application/x-ndjson'.How deeply a document is read
Every document is read for its main points, key fields, dates and the entities it mentions. What differs by type is whether Synap also extracts individual memories from it at upload.
Reading in detail costs more credits, and the estimate shown before a document is stored includes it. You can change the default for a type in these ways, from lowest to highest priority:
- A read frequency you state.
utility={"read_frequency": "frequent"}(utility: { read_frequency: 'frequent' }in TypeScript), or"constant", on a document that does not change often raises it to detailed. A frequency Synap only infers does not. - Your instance’s settings. The document settings Synap generates for your instance (see Configuring memory) can set the depth per type: none, light or detailed. You review them before they take effect.
- A per-call plan.
plan={"extraction": "detailed"}onmemories.create(plan: { extraction: 'detailed' }in TypeScript) overrides everything above for that call.
Provenance
source records where the document came from. Every field is optional.
document_created_at sets the document’s own date, and is used to label passages when no better date exists. For a file that is a conversation, participants maps each speaker label to a user_id, a customer_id or a role. documents.get returns the source and the document date.
Who can read a document
A document is filed at the level your ids name, as memories are:scope names a deeper level of your scope ladder. A user’s fetch reads that user’s documents, their customer’s and the client-wide ones; a customer’s fetch reads the customer’s and the client-wide ones. See Identifiers and scopes. On a B2C Instance, pass user_id alone.
A document belongs to the Instance it was sent to. Instances under the same client read each other’s documents by default; an Instance visibility policy limits that. A reader who is not allowed to see the document gets neither it nor a way to open its original.
Delete and restore
documents.delete hides a document at once: every version, and the memories that came only from it. It stays restorable until the end of the Instance’s deletion period, the same period memories use (0 to 30 days), after which it is purged from every store. documents.restore undoes a delete before then. It fails if a newer document has taken the same document_id, or once the period has passed. permanent=True (permanent: true in TypeScript) removes the document immediately with no undo and needs a management-level key. Both calls need a key that is allowed to delete data.
documents.delete and documents.restore. The soft-delete model is the one described on memories.delete and data.restore.
Next steps
Citations
What each fetch result carries, and how to open the source.
How ingestion works
When a document becomes searchable and when it is fully processed.
Retrieval modes
How documents take part in a fetch.
Query and navigate documents
Let an agent list and read documents, not just fetch.