Amazon S3 integration
Index documents from the S3 bucket paths an administrator approves, including S3-compatible stores such as Cloudflare R2, MinIO, Wasabi, and Backblaze B2. Retrieve the contents of documents held in object storage, with the bucket, key, and a link back to the object.
What becomes retrievable
Retrieve the contents of documents held in object storage, with the bucket, key, and a link back to the object.
Plain text, Markdown, CSV, JSON, and other text formats.
PDF, Word, PowerPoint, and Excel files, with text extracted.
AWS S3 plus S3-compatible endpoints via a custom endpoint URL.
Connecting with IAM credentials
S3 is storage, not an identity provider, so there is no sign-in redirect. An administrator creates a read-only IAM user for the bucket and enters its access key. MemorySync proves the key can both locate the bucket and list its contents before the connection is saved, so an over-narrow policy fails on the connect screen rather than as a sync that quietly returns nothing.
- An S3 bucket, or a bucket on an S3-compatible service, holding documents worth retrieving.
- A read-only IAM user with s3:ListBucket on the bucket and s3:GetObject on its contents. Add kms:Decrypt if the bucket uses SSE-KMS.
- A MemorySync project for the imported documents.
Choose path scope
What is downloaded, and what is only listed
Every exclusion is decided from the listing entry alone — key, size, storage class, and ETag — before any object is fetched. That ordering is deliberate: S3 bills requests and egress to your account, so an object that will not be indexed costs nothing but the listing it already appeared in.
| Decision | Made from | Cost |
|---|---|---|
| Excluded by pattern | The key | No download |
| Unsupported type | The key’s extension | No download |
| In Glacier or Deep Archive | The storage class | No download |
| Over the size limit | The reported size | No download |
| Unchanged since last sync | The ETag | No download |
| Indexed | All gates passed | One read |
S3-compatible services
Anything speaking the S3 API works by supplying a custom endpoint on the connect screen: Cloudflare R2, MinIO, Wasabi, Backblaze B2, and others. Non-AWS endpoints use path-style addressing automatically, which is what most compatible services expect.
Guided first connection checklist
Check items for your own planning. Nothing here changes a live connection.
0 of 4 planning steps complete
Initial and incremental ingestion
- 1Add IAM credentials
An administrator enters a read-only access key, which is verified against the bucket before it is saved.
- 2Approve paths
They select each path to index; approving a path covers everything beneath it.
- 3Index readable files
MemorySync lists each approved path and downloads only files it can read.
- 4Sync on a schedule
Later runs compare each object’s ETag, so unchanged files are never downloaded again.
Verify with a real document question
Query a distinctive phrase from a document you know sits under an approved path. Confirm the result names the right bucket and key before widening path access.
Troubleshooting and related sources
Why were the credentials rejected?
MemorySync checks both that the bucket exists and that its contents can be listed. A key that can list but not read will connect and then index nothing, so confirm the policy grants s3:GetObject on the bucket’s contents as well as s3:ListBucket on the bucket itself.
Why did only a few files index out of thousands?
That is usually correct. Buckets are full of things that are not documents, and each approved path reports what it skipped and why: unsupported types, archived storage classes, oversized files, and keys matched by an exclusion pattern.
Why does listing work but every download fail with access denied?
The bucket is almost certainly encrypted with SSE-KMS and the IAM policy is missing kms:Decrypt. S3 reports this as a plain access denial on GetObject, which makes it look like an S3 permission problem rather than a key policy one.
Why is a deleted file still retrievable?
S3 sends no deletion notifications, so removals are detected by comparing a fresh listing against what is stored. That happens on a periodic reconciliation rather than immediately.
Does connecting a bucket cost anything on my AWS account?
Listing and reading objects are billed to you as requests and egress. MemorySync is built to keep that small: every exclusion is decided from the listing entry, so a file that will not be indexed is never downloaded, and unchanged files are skipped by ETag comparison rather than re-read.
Operations on this page
| Operation | Method and path | Python | Node.js |
|---|---|---|---|
| List selectable prefixes | GET …/{connection_id}/s3/available-prefixes | connections.s3.available_prefixes | connections.s3.availablePrefixes |
| List selected prefixes | GET …/{connection_id}/s3/prefixes | connections.s3.prefixes | connections.s3.prefixes |
| Select prefixes | POST …/{connection_id}/s3/prefixes | connections.s3.add_prefixes | connections.s3.addPrefixes |
| Revoke one prefix | DELETE …/{connection_id}/s3/prefixes | connections.s3.remove_prefix | connections.s3.removePrefix |
| Read the exclusion policy | GET …/{connection_id}/s3/exclusion-policy | connections.s3.exclusion_policy | connections.s3.exclusionPolicy |
| Replace the exclusion policy | PUT …/{connection_id}/s3/exclusion-policy | connections.s3.set_exclusion_policy | connections.s3.setExclusionPolicy |
| Read effective settings | GET …/{connection_id}/s3/settings | connections.s3.settings | connections.s3.settings |
Authentication and scope
| Requirement | Contract |
|---|---|
| Credential | An API key sent as X-API-Key. Connector operations are not end-user scoped. |
| Read scope | integrations:read for every GET. |
| Write scope | integrations:write for every POST, PUT, PATCH and DELETE. |
| Tenant | Derived from the authenticated key. There is no tenant parameter to pass or to get wrong. |
X-End-User-ID | Not used. A connection belongs to the organization, not to one end user. |
Before you start
S3 is the credential-based connector: create it with create_with_credentials on Connection Lifecycle, passing access_key_id, secret_access_key, region and bucket. There is no OAuth flow.
1. See what the credentials can reach
Lists prefixes visible in the bound bucket, annotated with whether each is already approved.
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",)available = client.connections.s3.available_prefixes("conn_8f21a4")print(available["bucket"], available["total"])for entry in available["prefixes"]:print(entry["prefix"] or "(root)", entry["kind"], entry["approved"])
| Response field | Meaning |
|---|---|
bucket | The bucket this connection is bound to. |
prefixes | Each with prefix, kind, and approved. |
total | How many were found. |
2. Approve the prefixes to read
Bare strings are accepted for the common case, and objects when you want to carry a label. Approving a prefix starts the first sync straight away if the connection is healthy.
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",)result = client.connections.s3.add_prefixes("conn_8f21a4",["handbook/", "policies/2026/"],)print(result["sync_triggered"])for approved in result["approved"]:print(approved["prefix"], approved["state"])for rejected in result["rejected"]:print("rejected:", rejected)
| Request field | Contract |
|---|---|
prefixes | Required. A list of objects, each with prefix, and optionally bucket and label. Both SDKs widen a bare string to {"prefix": "…"} for you. |
| Response field | Meaning |
|---|---|
approved | The prefix records that were stored. |
rejected | Entries that were refused, each with a prefix and a reason. Show these — a silent partial success is how half a bucket goes missing. |
sync_triggered | Whether approving started a sync immediately. It does when the connection is already connected. |
3. Read back what is approved
Another of the bare-array responses: iterate the result itself rather than looking for a prefixes key.
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",)for row in client.connections.s3.prefixes("conn_8f21a4"):print(row["prefix"] or "(root)", row["state"], row["is_active"])print(" synced:", row["objects_synced"], "indexed:", row["objects_indexed"])print(" skipped:", row["skipped"])
| Field | Meaning |
|---|---|
id | The prefix approval record. |
bucket, prefix, label | What is approved. |
state, state_detail | Approval state and why. |
is_active | Whether future syncs read it. |
objects_synced | Lifetime tally of keys read across every run. |
objects_indexed | Distinct objects currently stored. This is the one that answers "how much is in there". |
skipped | A map of reason to count — the first place to look when a prefix produced less than expected. |
last_modified_at, last_synced_at, authorized_at | Timestamps. |
4. Block keys by pattern
The exclusion policy is a list of glob patterns matched against keys. A pattern blocks matching keys inside every approved prefix, which is how you keep a useful prefix without importing its build artifacts or backups.
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",)client.connections.s3.set_exclusion_policy("conn_8f21a4",tenant_patterns=["*.log", "backups/*", "*/tmp/*"],)policy = client.connections.s3.exclusion_policy("conn_8f21a4")print(policy["effective_patterns"])print("removed:", policy["purged_objects"], "objects,", policy["purged_memories"], "memories")
| Field | Meaning |
|---|---|
tenant_patterns | Request and response. The patterns you set — the only field PUT reads, and the only list it replaces. |
deployment_patterns | Response only. The operator-set floor, which you cannot remove here. |
effective_patterns | Response only. Both lists combined, deduped — what actually applies. |
purged_objects, purged_memories | Response only. How much already-indexed content the new policy removed. |
5. Read the limits that decide what is parsed
Effective settings, including the ceilings that quietly exclude objects. An object over the size limit or with an unlisted extension produces no memories and no error, so this is the endpoint that explains an unexpectedly empty prefix.
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",)settings = client.connections.s3.settings("conn_8f21a4")print(settings["bucket"], settings["region"], settings["endpoint"])print("max object MB:", settings["max_object_mb"])print("max objects per sync:", settings["max_objects_per_sync"])print("allowed extensions:", settings["allowed_extensions"])
| Field | Meaning |
|---|---|
bucket, region, endpoint | What the connection points at. endpoint is set for S3-compatible storage. |
prefix | A connection-level prefix, when one was configured with the credentials. |
max_object_mb | Objects larger than this are skipped. |
max_objects_per_sync | The ceiling on one run. A prefix larger than this needs several syncs. |
allowed_extensions | Only these are parsed. Anything else is skipped without an error. |
6. Revoke one prefix
Removes a single approval. The prefix travels as a query parameter, not in the body and not as a path segment, because prefixes contain slashes.
import osfrom memorysync import MemorySyncClientclient = MemorySyncClient(api_key=os.environ["MEMORYSYNC_API_KEY"],base_url="https://api.memorysync.io",)# Stop reading it, keep what it already produced.client.connections.s3.remove_prefix("conn_8f21a4", "policies/2026/")# Stop reading it and delete the memories it produced.client.connections.s3.remove_prefix("conn_8f21a4", "policies/2026/", purge=True)
| Parameter | Contract |
|---|---|
prefix | The approved prefix. Defaults to "", which is the bucket root — so omitting it targets the root, not "all prefixes". |
bucket | Optional. Defaults to the bucket the connection is bound to. |
purge | Optional, default false. When true, also deletes the memories already derived from the prefix. |
Errors and next action
| Status | Meaning | Next action |
|---|---|---|
401 | Missing, malformed or inactive API key. | Check server configuration without printing the key. |
403 | The key lacks integrations:read or integrations:write. | Grant the scope on the key, or use a key that has it. |
404 | The connection, object or job is not visible to this tenant. | Confirm the identifier belongs to this organization. |
409 | The connection is in a state that forbids the operation. | Read the connection status first and act on it. |
429 | Rate limited, either by MemorySync or by the upstream provider. | Back off; do not tighten a polling loop in response. |
5xx | Service failure. | Treat a write outcome as uncertain and reconcile by reading the connection back. |