> ## Documentation Index
> Fetch the complete documentation index at: https://docs.outreign.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate an AI email draft for a lead

> Generate a draft, not a sent email. Send a lead object plus tone and goal; leadId alone is not accepted by the generator. Supply your own sender/business context. Inspect JSON error even on HTTP 200.



## OpenAPI

````yaml /public/openapi.json post /email/generate
openapi: 3.1.0
info:
  title: OutReign API
  version: 1.0.0
  summary: B2B lead intelligence and outbound sales API
  description: >-
    REST API for OutReign saved leads, deals, activities, contacts and AI email
    generation. Authenticate with X-API-Key from Settings → API Keys. MCP OAuth
    and webhook contracts are documented separately at https://docs.outreign.io.
  contact:
    name: OutReign support
    email: support@bdotindustries.com
    url: https://outreign.io/connect
  termsOfService: https://outreign.io/terms
servers:
  - url: https://api.outreign.io/rest-api
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Leads
  - name: Deals
  - name: Activities
  - name: Contacts
  - name: Outreach
externalDocs:
  description: Human API documentation
  url: https://docs.outreign.io
paths:
  /email/generate:
    post:
      tags:
        - Outreach
      summary: Generate an AI email draft for a lead
      description: >-
        Generate a draft, not a sent email. Send a lead object plus tone and
        goal; leadId alone is not accepted by the generator. Supply your own
        sender/business context. Inspect JSON error even on HTTP 200.
      operationId: generateEmail
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - lead
                - tone
                - goal
              properties:
                lead:
                  type: object
                  required:
                    - id
                  properties:
                    id:
                      type: string
                      format: uuid
                    contact_name:
                      type: string
                    contact_email:
                      type: string
                    company_name:
                      type: string
                    job_title:
                      type: string
                    company_website:
                      type: string
                    industry:
                      type: string
                  additionalProperties: true
                tone:
                  type: string
                  enum:
                    - professional
                    - friendly
                    - casual
                    - formal
                goal:
                  type: string
                  enum:
                    - introduction
                    - follow-up
                    - meeting
                    - demo
                    - proposal
                    - subject_only
                    - custom
                    - trigger_context
                    - social_proof
                    - 4ts
                    - elusive
                    - proximity
                    - 4ps_followup
                    - 4ps_elusive_followup
                senderName:
                  type: string
                senderEmail:
                  type: string
                senderCompany:
                  type: string
                businessDescription:
                  type: string
                triggerContext:
                  type: string
                subjectLine:
                  type: string
                socialProof:
                  type: string
                customInstruction:
                  type: string
                templateDescription:
                  type: string
                templateValue:
                  type: string
                templateGoal:
                  type: string
                openerWord:
                  type: string
                strict_mode:
                  type: boolean
                variantNum:
                  type: integer
                use4SentenceFramework:
                  type: boolean
                avoidSubjects:
                  type: array
                  items:
                    type: string
                thread:
                  type: object
      responses:
        '200':
          description: Draft
          content:
            application/json:
              schema:
                type: object
                properties:
                  email:
                    type: string
                  rubric:
                    type: object
                  quality_weak:
                    type: boolean
                  research:
                    type:
                      - object
                      - 'null'
                  skills_used:
                    type: array
                    items:
                      type: string
                  error:
                    type: string
                  error_code:
                    type: string
        '401':
          description: Missing, invalid, inactive or expired API key
        '403':
          description: Account plan or access restriction
        '429':
          description: Rate limit exceeded; inspect resetAt and rate-limit headers
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Create keys in OutReign → Settings → API Keys.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.