Skip to content

S3 Connector

Connect Amazon S3 or S3-compatible storage to sync files into your Supermemory knowledge base

Connect Amazon S3 buckets or S3-compatible storage services (MinIO, DigitalOcean Spaces, Cloudflare R2) to sync files into your Supermemory knowledge base.

INFO

The S3 connector requires a Scale Plan or higher. You can also create S3 connections directly from the Supermemory Console.

Quick Setup

TypeScript: ```typescript import Supermemory from 'supermemory';

const client = new Supermemory({
  apiKey: process.env.SUPERMEMORY_API_KEY!
});

const connection = await client.connections.create('s3', {
  metadata: {
    accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
    secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
    bucket: 'my-documents-bucket',
    region: 'us-east-1'
  },
  containerTags: ['org-123']
});
```

Python: ```python from supermemory import Supermemory import os

client = Supermemory(api_key=os.environ["SUPERMEMORY_API_KEY"])

connection = client.connections.create(
    's3',
    metadata={
        'accessKeyId': os.environ["AWS_ACCESS_KEY_ID"],
        'secretAccessKey': os.environ["AWS_SECRET_ACCESS_KEY"],
        'bucket': 'my-documents-bucket',
        'region': 'us-east-1'
    },
    container_tags=['org-123', 's3-sync']
)
```

cURL:bash curl -X POST " \ -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "metadata": { "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", "bucket": "my-documents-bucket", "region": "us-east-1" }, "containerTags": ["org-123"] }'

Configuration Options

For S3, provider-specific connection fields are passed inside the top-level metadata object. General connection options stay top-level.

ParameterLocationRequiredDescription
accessKeyIdmetadata.accessKeyIdYesAWS access key ID or S3-compatible service key
secretAccessKeymetadata.secretAccessKeyYesAWS secret access key
bucketmetadata.bucketYesS3 bucket name
regionmetadata.regionYesAWS region (e.g., us-east-1). Use auto for Cloudflare R2.
endpointmetadata.endpointNoCustom endpoint for S3-compatible services
prefixmetadata.prefixNoKey prefix filter (e.g., documents/)
containerTagRegexmetadata.containerTagRegexNoRegex to extract container tags from file paths
containerTagstop-levelNoTags for organizing connections
documentLimittop-levelNoMaximum documents to sync (default: 10,000)

INFO

In the Python SDK, use container_tags for the top-level option, but keep S3 metadata keys in camelCase: accessKeyId, secretAccessKey, and containerTagRegex.

S3-Compatible Services

Use metadata.endpoint to connect to S3-compatible storage:

typescript
// MinIO
const connection = await client.connections.create('s3', {
  metadata: {
    accessKeyId: 'minio-key',
    secretAccessKey: 'minio-secret',
    bucket: 'my-bucket',
    region: 'us-east-1',
    endpoint: '
  },
  containerTags: ['minio-sync']
});

Common S3-compatible endpoint values:

Servicemetadata.endpointmetadata.region
DigitalOcean Spaceshttps://nyc3.digitaloceanspaces.comnyc3
Cloudflare R2https://<account-id>.r2.cloudflarestorage.comauto

Cloudflare R2 example:

typescript
const connection = await client.connections.create('s3', {
  metadata: {
    accessKeyId: process.env.R2_ACCESS_KEY_ID!,
    secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!,
    bucket: 'my-bucket',
    region: 'auto',
    endpoint: '
  },
  containerTags: ['r2-sync']
});

INFO

For S3-compatible services, metadata.endpoint is the base S3 endpoint. Do not include the bucket name in the endpoint URL; pass the bucket separately as metadata.bucket.

Prefix Filtering

Sync only files within a specific path:

typescript
const connection = await client.connections.create('s3', {
  metadata: {
    accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
    secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
    bucket: 'company-data',
    region: 'us-east-1',
    prefix: 'documents/engineering/' // Only syncs files under this path
  },
  containerTags: ['engineering-docs']
});

Dynamic Container Tags

Extract container tags from S3 key paths for multi-tenant setups:

typescript
const connection = await client.connections.create('s3', {
  metadata: {
    accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
    secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
    bucket: 'user-files',
    region: 'us-east-1',
    containerTagRegex: 'users/(?<userId>[^/]+)/'
  },
  containerTags: ['user-files']
});

// File: users/user-123/documents/notes.md → container tag: user-123
// File: users/user-456/reports/q4.pdf → container tag: user-456

WARNING

The regex must contain a named capture group (?<userId>...) and be less than 200 characters.

Connection Management

Delete Connection

TypeScript:typescript await client.connections.deleteByID('conn_s3_abc123');

cURL:bash curl -X DELETE " \ -H "Authorization: Bearer $SUPERMEMORY_API_KEY"

WARNING

By default, deleting a connection removes all synced documents from Supermemory. To keep documents, pass deleteDocuments=false as a query parameter: DELETE /v3/connections/:id?deleteDocuments=false

Manual Sync

TypeScript:typescript await client.connections.import('s3', { containerTags: ['org-123'] });

cURL:bash curl -X POST " \ -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"containerTags": ["org-123"]}'

Sync Behavior

FeatureBehavior
Initial syncFetches all files matching prefix filter
Incremental syncOnly files modified since last sync
Sync scheduleEvery 4 hours + manual triggers
Document limit10,000 files per connection (default)

IAM Permissions

Minimum required permissions:

json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["s3:GetObject", "s3:ListBucket"],
      "Resource": [
        "arn:aws:s3:::your-bucket-name",
        "arn:aws:s3:::your-bucket-name/*"
      ]
    }
  ]
}

Error Codes

CodeMessageSolution
401Authentication failedVerify access key and secret
403Access deniedCheck IAM permissions and bucket policy
404Bucket not foundVerify bucket name and region

Built as an internal reference companion.