Skip to main content
POST
/
integrations
/
files
curl -X POST 'https://api.memchat.io/integrations/files' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -F 'file=@document.pdf' \
  -F 'category=learning' \
  -F 'extract_mode=comprehensive'
{
  "integration_id": "file_int_456def",
  "filename": "research_paper.pdf",
  "file_size": 2458697,
  "status": "completed",
  "extraction_stats": {
    "total_pages": 15,
    "text_length": 45678,
    "chunks_created": 23,
    "memories_extracted": 12,
    "categories_detected": ["learning", "career", "interests"]
  },
  "memories": [
    {
      "memory_id": "mem_789ghi",
      "content": "The study demonstrates that machine learning algorithms can improve medical diagnosis accuracy by 23% when trained on diverse datasets.",
      "category": "learning",
      "importance": 0.87,
      "page_number": 3
    }
  ],
  "created_at": "2024-01-15T16:30:00Z",
  "completed_at": "2024-01-15T16:32:15Z"
}
Upload documents to automatically extract and store memories from their content.
curl -X POST 'https://api.memchat.io/integrations/files' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -F 'file=@document.pdf' \
  -F 'category=learning' \
  -F 'extract_mode=comprehensive'

Request Parameters

file
file
required
Document file to process. Supported formats: PDF, DOCX, TXT, MD, HTML
category
string
Default category for extracted memories. One of: identity, career, interests, relationships, health, finance, learning, travel, productivity, private
extract_mode
string
default:"smart"
Extraction strategy. Options: comprehensive, smart, highlights, summary
chunk_size
number
default:"1000"
Maximum size of text chunks for processing (characters)
overlap
number
default:"200"
Overlap between chunks to maintain context
auto_categorize
boolean
default:"true"
Whether to automatically categorize extracted memories
metadata
object
Additional metadata for the document

Response

integration_id
string
Unique identifier for the file integration
filename
string
Name of the uploaded file
file_size
number
Size of the uploaded file in bytes
status
string
Processing status: uploaded, processing, completed, error
extraction_stats
object
Statistics about the extraction process
memories
array
List of extracted memories (if processing is complete)
created_at
string
ISO 8601 timestamp when upload was initiated
completed_at
string
ISO 8601 timestamp when processing completed
{
  "integration_id": "file_int_456def",
  "filename": "research_paper.pdf",
  "file_size": 2458697,
  "status": "completed",
  "extraction_stats": {
    "total_pages": 15,
    "text_length": 45678,
    "chunks_created": 23,
    "memories_extracted": 12,
    "categories_detected": ["learning", "career", "interests"]
  },
  "memories": [
    {
      "memory_id": "mem_789ghi",
      "content": "The study demonstrates that machine learning algorithms can improve medical diagnosis accuracy by 23% when trained on diverse datasets.",
      "category": "learning",
      "importance": 0.87,
      "page_number": 3
    }
  ],
  "created_at": "2024-01-15T16:30:00Z",
  "completed_at": "2024-01-15T16:32:15Z"
}

Extraction Modes

Extracts memories from all significant text passages, creating detailed memories for each section.
Uses AI to identify the most important passages and concepts, creating focused memories.
Extracts only key insights, findings, and actionable information.
Creates a single comprehensive memory summarizing the entire document.

Supported File Types

  • Text extraction from standard PDFs
  • OCR for scanned documents
  • Preserves page structure and formatting
  • Full text extraction
  • Maintains document structure
  • Extracts embedded content
  • Direct text processing
  • Markdown formatting recognition
  • Fast processing
  • Content extraction from HTML
  • Removes navigation and ads
  • Focuses on main content

Error Responses

400
object
Invalid file or parameters
{
  "error": "Unsupported file type",
  "code": "INVALID_FILE_TYPE",
  "supported_types": ["pdf", "docx", "txt", "md", "html"]
}
413
object
File too large
{
  "error": "File size exceeds limit",
  "code": "FILE_TOO_LARGE",
  "max_size_mb": 50,
  "file_size_mb": 75
}
I