Skip to main content
A conversation tells Synap what someone said. A document is reference material your agent should be able to look up and quote: a policy, a contract, a help article, an invoice, a report, a ticket. Synap keeps the original file, makes its text searchable, reads it for its main points and the people, organizations and things it mentions, and returns passages from it in a context fetch next to your conversation memories, each with a citation that says where it came from. You send a document with 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

The call returns as soon as Synap has accepted the file. Processing continues in the background; see how a document is processed.

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 a document_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:
  1. The document_id you passed. It is unique within a scope, not across your whole account.
  2. The source item, when you pass source with both system and external_id.
  3. The file’s content, when you pass neither.
Pass a document_id for anything you will update. Without one, a document is identified by its exact content, so an edited file is a new, separate document, not a new version.

Versions and re-uploads

Send a file again with the same document_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, unchanged or stale) is on documents.versions once Synap has read the file. A version whose text turns out identical to the current one is unchanged; one that is older than the current version by the source’s own clock (its revision or modified time) is stale and 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_of reads the version that applied on a date.
  • Every version keeps its original file. documents.original returns the file of any version.

JSON Lines

Exports from other memory and knowledge tools usually ship one record per line. Send the file as a FilePart 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.
Nothing is declared by you; Synap reads each line and picks the first field it finds, in this order: How it behaves:
  • Ids. When the call or the FilePart has a document_id, each record’s id is that id, a slash, then the record’s id, for example notes-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_type you 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.original returns that record’s text, not the whole file.
  • One attachment per document. The result’s attachments lists one entry per document, in line order, each with its own document_key, document_id and version_status. The top-level fields of the result describe the first document only.
In 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:
  1. 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.
  2. 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.
  3. A per-call plan. plan={"extraction": "detailed"} on memories.create (plan: { extraction: 'detailed' } in TypeScript) overrides everything above for that call.
A change reaches documents and versions uploaded after it. Documents already stored are not re-read.

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.
The documents namespace is Python 0.9.0 and later and JavaScript 0.9.0 and later: see 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.