Harvey’s Assistant API enables powerful legal reasoning over your documents and data. With a single endpoint, you can embed natural language queries, document analysis, and grounded legal insights directly into your applications and workflows.

POST /api/v2/completion

Overview

The Assistant API provides AI-powered responses to complex legal questions, document analysis, and specialized tasks. Use it to build intelligent legal applications that deliver accurate, context-aware results to your users.

Key Capabilities

  • Natural Language Processing: Process complex legal queries with nuanced understanding
  • Document Analysis: Extract insights from contracts and legal documents
  • Knowledge Grounding: Upload relevant documents to provide context
  • Content Generation: Create professional drafts for emails and responses

Use Cases

Use Case 1: Internal Knowledge Chatbot

Challenge: Attorneys often need quick access to firm policies, past contract negotiations, case law, or regulatory updates. Searching through internal databases or asking colleagues takes time and disrupts workflows. By integrating Harvey’s AI into internal chatbots, firms empower attorneys to instantly retrieve relevant legal insights, improving efficiency without sacrificing accuracy.

Solution: Integrate the Assistant API into a secure internal chatbot to return policy guidance, research, and previous work product on demand.

{
  "prompt": "Summarize our indemnity position in past vendor contracts.",
  "stream": false
}

Challenge: Business teams frequently need input on policies, contracts, compliance, and other complex topics. Waiting for expert review slows down workflows and creates bottlenecks.

Solution: Embed the Assistant API in internal tools to offer reliable, policy-grounded answers instantly.

{
  "prompt": "Can I sign this NDA or does it need legal review?",
  "stream": false
}

Challenge: Drafting accurate and professional responses for routine legal questions is repetitive and time-consuming.

Solution: Use the Assistant API to generate draft replies to client or internal questions directly within email tools.

{
  "prompt": "Draft a response to this client email about contract renewal timing: 'Hi, our agreement is coming up for renewal next month. Can you please advise on our options and the timeline we should follow?'",
  "mode": "draft",
  "stream": false
}

Use Case 4: Document Ingestion in ETL Pipelines

Challenge: Manually ingesting and analyzing documents from diverse sources slows down workflows.

Solution: Automate document classification and summarization as part of backend ingestion systems.

{
  "prompt": "Extract key clauses and obligations from the attached contract.",
  "stream": false
}

Use Case 5: AI-Powered Document Review in Third-Party Platforms

Challenge: Assessing vendor documents for compliance with regulations or internal policies is repetitive and resource-intensive.

Solution: Integrate Harvey with vendor management tools to automatically review documents against internal playbooks.

{
  "prompt": "Does this MSA comply with our internal data security standards?",
  "stream": false
}

Best Practices

Optimize Prompts

  • Avoid: “Review this contract”
  • Use: “Identify and summarize indemnity clauses in this vendor MSA and flag any deviations from our standard policy.”

Stay Within Prompt Limits

If you’re uploading a file, limit the prompt to 4,000 characters. Without a file, prompts can be up to 20,000 characters.

Stream vs. Non-Stream

Set stream: true if you want to receive partial results as they are generated. Default is false.

Error Handling

The Assistant API uses standard HTTP status codes. Always check and handle error responses appropriately.

Status CodeDescriptionExample Error Message
200SuccessN/A
400Bad Request – Invalid parameters{ "error": "Missing prompt parameter" }
401Unauthorized – Invalid API key{ "error": "Invalid API key provided" }
429Too Many Requests – Rate limit exceeded{ "error": "Rate limit exceeded" }
500Internal Server Error{ "error": "An internal error occurred" }

Need help getting started? Contact your Harvey Customer Success Manager for more information.