API Reference
The Deepheem API lets you run AI-powered investigations programmatically from your own applications, scripts, and workflows.
Overview
The API exposes a single endpoint — POST /api/investigate — that covers the full investigation lifecycle through a stage-based flow:
API access is available exclusively on the Business Plan. Generate your API key from Settings → API Keys.
Authentication
Pass your API key in the x-api-key header on every request.
POST https://deepheem.com/api/investigate
Content-Type: application/json
x-api-key: dph_your_key_hereBase URL
https://deepheem.com/api/investigateAll requests are POST with a JSON body. The response is always JSON.
POST /api/investigate
/api/investigateThe investigation endpoint accepts a stage parameter that controls which part of the workflow is executed.
Common parameters
stagerequiredmodulerequiredbriefrequiredStage: "questions"
Submit your brief and receive 4 tailored clarifying questions. Use the answers to refine the investigation in the next stage.
Request body
stagerequiredmodulerequiredbriefrequiredExample request
curl -X POST https://deepheem.com/api/investigate \
-H "Content-Type: application/json" \
-H "x-api-key: dph_your_key_here" \
-d '{
"stage": "questions",
"module": "business",
"brief": "Investigate the financial health of Acme Corp"
}'Response
{
"questions": [
"What specific financial metrics are most important to you (revenue, profit margins, debt)?",
"What time period should this investigation cover?",
"Are there specific markets or regions you want to focus on?",
"What will you use these findings for (investment, due diligence, competitive research)?"
]
}Stage: "investigate"
Submit the original brief alongside the clarifying questions and your answers. Returns a complete investigation report.
Request body
stagerequiredmodulerequiredbriefrequiredquestionsrequiredanswersrequiredExample request
curl -X POST https://deepheem.com/api/investigate \
-H "Content-Type: application/json" \
-H "x-api-key: dph_your_key_here" \
-d '{
"stage": "investigate",
"module": "business",
"brief": "Investigate the financial health of Acme Corp",
"questions": [
"What specific financial metrics are most important to you?",
"What time period should this investigation cover?",
"Are there specific markets or regions you want to focus on?",
"What will you use these findings for?"
],
"answers": [
"Revenue growth, profit margins, and debt levels",
"The last 3 years (2022–2025)",
"UK and European markets",
"Investment due diligence"
]
}'Response
{
"verdict": "Acme Corp has shown consistent revenue growth of 12% year-on-year but carries significant debt obligations that may constrain future expansion.",
"verdict_evidence_incomplete": false,
"findings": [
{
"text": "Revenue grew from £42m to £53m between 2022 and 2024.",
"evidence_status": "supported",
"source": "Companies House filings"
},
{
"text": "Gross profit margin declined from 38% to 31% over the same period.",
"evidence_status": "supported",
"source": "Annual report 2024"
},
{
"text": "The company holds £18m in long-term debt, up from £9m in 2022.",
"evidence_status": "partially_supported",
"source": "Bloomberg Business"
},
{
"text": "Rumoured acquisition talks with a US private equity firm in Q1 2025.",
"evidence_status": "unsupported",
"source": "Financial Times"
}
],
"sources": [
{
"name": "Companies House",
"url": "https://companieshouse.gov.uk",
"source_class": "government",
"type": "Official website"
},
{
"name": "Bloomberg Business",
"url": "https://bloomberg.com/business",
"source_class": "authoritative",
"type": "News article"
},
{
"name": "Financial Times",
"url": "https://ft.com",
"source_class": "authoritative",
"type": "News article"
}
]
}Response fields
verdictverdict_evidence_incompletefindingsfindings[].textfindings[].evidence_statusfindings[].sourcesourcessources[].namesources[].urlsources[].source_classsources[].typeStage: "followup"
Ask a follow-up question based on the findings of a completed investigation. Does not consume an additional investigation from your allowance.
Request body
stagerequiredbriefrequiredverdictrequiredfindingsrequiredfollowUpQuestionrequiredExample request
curl -X POST https://deepheem.com/api/investigate \
-H "Content-Type: application/json" \
-H "x-api-key: dph_your_key_here" \
-d '{
"stage": "followup",
"brief": "Investigate the financial health of Acme Corp",
"verdict": "Acme Corp has shown consistent revenue growth...",
"findings": [
{ "text": "Revenue grew from £42m to £53m...", "confidence": "confirmed", "source": "Companies House" }
],
"followUpQuestion": "How does their debt level compare to industry average?"
}'Response
{
"answer": "Acme Corp's debt-to-revenue ratio of 34% is above the UK mid-market average of approximately 22%, suggesting the company is more leveraged than its peers. This may limit its ability to raise further capital without equity dilution."
}Error codes
| Status | Code | Meaning |
|---|---|---|
| 401 | Unauthorized | Missing or invalid API key. |
| 403 | No active subscription | Your subscription is not active. Check your billing. |
| 403 | Investigation limit reached | You have reached your monthly investigation limit. Business plan has unlimited investigations. |
| 400 | Invalid stage | The stage parameter is missing or not one of: questions, investigate, followup. |
| 500 | API error | An internal error occurred. Retry the request. If it persists, contact support. |
All error responses follow this shape:
{ "error": "Description of what went wrong" }Full examples
const API_KEY = 'dph_your_key_here'
const BASE = 'https://deepheem.com/api/investigate'
async function runInvestigation(brief, module = 'business') {
// Step 1 — get clarifying questions
const q = await fetch(BASE, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'x-api-key': API_KEY },
body: JSON.stringify({ stage: 'questions', module, brief })
}).then(r => r.json())
const questions = q.questions
// In your app, present these questions to the user.
// For this example we provide placeholder answers:
const answers = questions.map(() => 'Not specified')
// Step 2 — run the investigation
const result = await fetch(BASE, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'x-api-key': API_KEY },
body: JSON.stringify({ stage: 'investigate', module, brief, questions, answers })
}).then(r => r.json())
console.log('Verdict:', result.verdict)
console.log('Confidence:', result.confidence)
console.log('Findings:', result.findings)
console.log('Sources:', result.sources)
return result
}
runInvestigation('Investigate the financial health of Acme Corp')import requests
API_KEY = 'dph_your_key_here'
BASE = 'https://deepheem.com/api/investigate'
HEADERS = {'Content-Type': 'application/json', 'x-api-key': API_KEY}
brief = 'Investigate the financial health of Acme Corp'
module = 'business'
# Step 1 — questions
q = requests.post(BASE, json={'stage': 'questions', 'module': module, 'brief': brief}, headers=HEADERS)
questions = q.json()['questions']
# Provide answers (in your app, collect these from the user)
answers = ['Not specified'] * len(questions)
# Step 2 — investigate
result = requests.post(BASE, json={
'stage': 'investigate',
'module': module,
'brief': brief,
'questions': questions,
'answers': answers
}, headers=HEADERS).json()
print('Verdict:', result['verdict'])
print('Confidence:', result['confidence'])
for f in result['findings']:
print(f"- [{f['confidence']}] {f['text']} ({f['source']})")# Step 1: Get questions
curl -X POST https://deepheem.com/api/investigate \
-H "Content-Type: application/json" \
-H "x-api-key: dph_your_key_here" \
-d '{"stage":"questions","module":"business","brief":"Investigate Acme Corp finances"}'
# Step 2: Run investigation (using the questions from step 1)
curl -X POST https://deepheem.com/api/investigate \
-H "Content-Type: application/json" \
-H "x-api-key: dph_your_key_here" \
-d '{
"stage": "investigate",
"module": "business",
"brief": "Investigate Acme Corp finances",
"questions": ["Question 1?","Question 2?","Question 3?","Question 4?"],
"answers": ["Answer 1","Answer 2","Answer 3","Answer 4"]
}'Questions about the API?
support@deepheem.com