Integrations

Integration Patterns

OCR + Semantic Search (with Vault)

# 1. Process document with OCR
JOB_ID=$(curl -X POST https://api.case.dev/ocr/v1/process \
  -H "Authorization: Bearer sk_case_..." \
  -H "Content-Type: application/json" \
  -d '{"document_url":"s3://docs/case-file.pdf","document_id":"case-file"}' \
  | jq -r '.id')

# 2. Wait for completion
while [ "$(curl -s https://api.case.dev/ocr/v1/$JOB_ID -H "Authorization: Bearer sk_case_..." | jq -r '.status')" != "completed" ]; do
  sleep 30
done

# 3. Get extracted text
TEXT=$(curl -s https://api.case.dev/ocr/v1/$JOB_ID \
  -H "Authorization: Bearer sk_case_..." | jq -r '.text')

# 4. Upload text to vault for semantic search
echo "$TEXT" > temp-text.txt

# Get upload URL from vault
UPLOAD=$(curl -X POST https://api.case.dev/vault/your-vault-id/upload \
  -H "Authorization: Bearer sk_case_..." \
  -H "Content-Type: application/json" \
  -d '{"filename":"case-file-extracted.txt","contentType":"text/plain"}')

UPLOAD_URL=$(echo $UPLOAD | jq -r '.uploadUrl')

# Upload the text
curl -X PUT "$UPLOAD_URL" \
  -H "Content-Type: text/plain" \
  --data-binary "@temp-text.txt"

rm temp-text.txt

echo "Document now searchable in vault!"

OCR + LLM Analysis

# 1. Get OCR results
TEXT=$(curl -s https://api.case.dev/ocr/v1/$JOB_ID \
  -H "Authorization: Bearer sk_case_..." | jq -r '.text')

# 2. Analyze with LLM
curl -X POST https://api.case.dev/llm/v1/chat/completions \
  -H "Authorization: Bearer sk_case_..." \
  -H "Content-Type: application/json" \
  -d "{
    \"model\": \"anthropic/claude-sonnet-4.5\",
    \"messages\": [
      {
        \"role\": \"system\",
        \"content\": \"Extract key dates, parties, and legal issues from this scanned document.\"
      },
      {
        \"role\": \"user\",
        \"content\": \"$TEXT\"
      }
    ],
    \"max_tokens\": 2000
  }"