Getting Started
API Reference
- GETPing Health
- GETGet Available Models
- POSTRetrieve Chunks
- POSTRetrieve Chunks Grouped
- POSTRetrieve Documents
- POSTBatch Get Documents
- POSTBatch Get Chunks
- POSTQuery Completion
- GETGet Chat History
- GETGet Available Models For Selection
- POSTAgent Query
- GETGet Usage Stats
- GETGet Recent Usage
- POSTGenerate Local Uri
- POSTGenerate Cloud Uri
- DELDelete Cloud App
- GETList Chat Conversations
- PATCHUpdate Chat Title
Documents
Folders
Workflows
model-config
Logs
Graph
Getting Started
Getting Started with Morphik API
Quick guide to start using the Morphik API
Get Your Credentials
From the Morphik dashboard:
- Python SDK: Click “Copy URI”
- TypeScript/API: Click “Copy Token”
Installation
Copy
Ask AI
npm install morphik
Copy
Ask AI
npm install morphik
Copy
Ask AI
pip install morphik
Ingest a Document
Copy
Ask AI
from morphik import Morphik
# Initialize with your URI
client = Morphik("YOUR_COPIED_URI")
# Ingest a file
with open('document.pdf', 'rb') as f:
doc = client.ingest_file(f)
print(f"Document ID: {doc.id}")
Copy
Ask AI
from morphik import Morphik
# Initialize with your URI
client = Morphik("YOUR_COPIED_URI")
# Ingest a file
with open('document.pdf', 'rb') as f:
doc = client.ingest_file(f)
print(f"Document ID: {doc.id}")
Copy
Ask AI
import Morphik from 'morphik';
import * as fs from 'fs';
// Initialize with your token
const client = new Morphik({
apiKey: 'YOUR_COPIED_TOKEN'
});
// Ingest a file
const file = fs.createReadStream('document.pdf');
const doc = await client.ingest.ingestFile({ file });
console.log('Document ID:', doc.external_id);
Copy
Ask AI
curl -X POST https://api.morphik.ai/ingest/file \
-H "Authorization: Bearer YOUR_COPIED_TOKEN" \
-H "Content-Type: multipart/form-data" \
-F "file=@document.pdf"
Query Your Documents
Copy
Ask AI
from morphik import Morphik
# Initialize with your URI
client = Morphik("YOUR_COPIED_URI")
# Query with RAG
response = client.query(
"What are the key points in this document?",
k=5,
use_colpali=True
)
print(response.answer)
Copy
Ask AI
from morphik import Morphik
# Initialize with your URI
client = Morphik("YOUR_COPIED_URI")
# Query with RAG
response = client.query(
"What are the key points in this document?",
k=5,
use_colpali=True
)
print(response.answer)
Copy
Ask AI
import Morphik from 'morphik';
const client = new Morphik({
apiKey: 'YOUR_COPIED_TOKEN'
});
// Query with RAG
const response = await client.query.generateCompletion({
query: 'What are the key points in this document?',
k: 5,
use_colpali: true
});
console.log(response.completion);
Copy
Ask AI
curl -X POST https://api.morphik.ai/query \
-H "Authorization: Bearer YOUR_COPIED_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "What are the key points in this document?",
"k": 5,
"use_colpali": true
}'
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.