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

# Send transactional email

> Send a transactional email via the public API. Automatically creates/updates contacts.



## OpenAPI

````yaml openapi.json POST /v1/send
openapi: 3.0.3
info:
  title: MailGlyph API
  description: >-
    Email platform API for transactional emails, campaigns, and marketing
    automation
  version: 1.0.0
  contact:
    name: MailGlyph Support
    url: https://mailglyph.com
servers:
  - url: https://api.mailglyph.com
    description: Production server
security:
  - ApiKeyAuth: []
tags:
  - name: Public API
    description: Public API endpoints for sending emails and tracking events
  - name: Events
    description: Event ingestion and querying
  - name: Contacts
    description: Contact management operations
  - name: Templates
    description: Email template management
  - name: Campaigns
    description: Email campaign management
  - name: Segments
    description: Audience segmentation
  - name: Workflows
    description: Workflow automation
paths:
  /v1/send:
    post:
      tags:
        - Public API
      summary: Send transactional email
      description: >-
        Send a transactional email via the public API. Automatically
        creates/updates contacts.
      operationId: sendEmail
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - to
                - from
              properties:
                to:
                  oneOf:
                    - type: string
                      format: email
                      description: Simple email address
                    - type: object
                      required:
                        - email
                      properties:
                        name:
                          type: string
                          description: Recipient display name
                        email:
                          type: string
                          format: email
                          description: Recipient email address
                      description: Recipient with name and email
                    - type: array
                      maxItems: 50
                      items:
                        oneOf:
                          - type: string
                            format: email
                          - type: object
                            required:
                              - email
                            properties:
                              name:
                                type: string
                                description: Recipient display name
                              email:
                                type: string
                                format: email
                                description: Recipient email address
                      description: >-
                        Array of recipients (strings or objects), maximum 50
                        recipients
                  description: >-
                    Recipient email(s). Can be a string, an object with {name,
                    email}, or an array of either. Maximum 50 recipients per
                    request.
                subject:
                  type: string
                  description: Email subject (required if no template)
                body:
                  type: string
                  description: Email body HTML (required if no template)
                text:
                  type: string
                  description: >-
                    The plain text version of the message.

                    If not provided, the `body` will be used to generate a plain
                    text version. You can opt out of this behavior by setting
                    value to an empty string.
                template:
                  type: string
                  description: >-
                    Template ID to use for this email. When provided, uses the
                    template's subject, body, from, and reply-to settings. You
                    can override these by explicitly providing subject, body,
                    from, or reply fields in the request. Template variables are
                    populated from the data field.
                from:
                  oneOf:
                    - type: string
                      description: >-
                        Sender as plain email or address string (e.g.,
                        "hello@example.com" or "My App
                        &lt;hello@example.com&gt;")
                    - type: object
                      required:
                        - email
                      properties:
                        name:
                          type: string
                          description: Sender display name
                        email:
                          type: string
                          format: email
                          description: Sender email address
                      description: Sender with name and email
                  description: >-
                    Sender email address (requires verified domain). Required
                    unless using a template that has a 'from' address
                    configured. Can be a string (e.g., "hello@example.com" or
                    "My App &lt;hello@example.com&gt;") or an object with {name,
                    email} (e.g., {name: "My App", email: "hello@example.com"}).
                name:
                  type: string
                  description: Sender display name (alternative to using from.name)
                subscribed:
                  type: boolean
                  description: >-
                    Whether recipient is subscribed to marketing emails.
                    Defaults to false for transactional emails.
                  default: false
                data:
                  description: >-
                    Optional template variables. Choose `Empty object` if you do
                    not want to send any example preset keys.
                  oneOf:
                    - type: object
                      title: Example object
                      description: >-
                        Optional common keys. You can still add additional
                        custom key/value pairs.
                      properties:
                        resetLink:
                          type: string
                          description: Reset or action URL used in templates
                          example: https://example.com/reset/abc123
                      example:
                        resetLink: https://example.com/reset/abc123
                      additionalProperties: true
                    - type: object
                      title: Empty object
                      description: >-
                        No preset keys. Add any custom key/value pairs as
                        needed.
                      additionalProperties: true
                headers:
                  type: object
                  additionalProperties:
                    type: string
                  description: Custom email headers
                reply:
                  type: string
                  format: email
                  description: Reply-to address
                attachments:
                  type: array
                  description: Email attachments (max 10 attachments, 10MB total)
                  maxItems: 10
                  items:
                    type: object
                    required:
                      - filename
                      - content
                      - contentType
                    properties:
                      filename:
                        type: string
                        maxLength: 255
                        description: Attachment filename
                      content:
                        type: string
                        description: Base64 encoded file content
                      contentType:
                        type: string
                        maxLength: 255
                        description: MIME type (e.g., application/pdf, image/png)
            examples:
              Simple transactional email:
                summary: Simple transactional email
                value:
                  to: user@example.com
                  from: My Company <hello@mycompany.com>
                  subject: Password Reset Request
                  body: >-
                    <h1>Reset Your Password</h1><p>Click the link to reset:
                    {{resetLink}}</p>
                  data:
                    resetLink: https://example.com/reset/abc123
              Email with recipient and sender names:
                summary: Email with recipient and sender names
                value:
                  to:
                    name: Jane Doe
                    email: jane@example.com
                  from:
                    name: My Company
                    email: hello@mycompany.com
                  subject: Welcome to Our Service
                  body: <h1>Welcome {{name}}!</h1><p>We're glad to have you.</p>
                  data:
                    name: Jane
              Email with sender address string:
                summary: Email with sender address string
                value:
                  to: jane@example.com
                  from: My Company <hello@mycompany.com>
                  subject: Welcome
                  body: <h1>Welcome!</h1><p>Thanks for joining.</p>
              Multiple recipients with names:
                summary: Multiple recipients with names
                value:
                  to:
                    - name: Jane Doe
                      email: jane@example.com
                    - name: John Smith
                      email: john@example.com
                  from:
                    name: Newsletter
                    email: news@mycompany.com
                  subject: Monthly Update
                  body: <h1>Hello {{name}}!</h1>
              Using a template:
                summary: Using a template
                description: >-
                  Send email using a template. Provide the template ID and any
                  data for template variables. The template's subject, body,
                  from address, and reply-to will be used automatically.
                value:
                  to: user@example.com
                  template: clx123abc456
                  data:
                    firstName: John
                    lastName: Doe
                    resetCode:
                      value: ABC123
                      persistent: false
              Using template with overrides:
                summary: Using template with overrides
                description: >-
                  You can override template values by providing subject, body,
                  from, or reply fields. This example overrides the template's
                  subject line.
                value:
                  to: user@example.com
                  template: clx123abc456
                  subject: Custom Subject Override
                  data:
                    firstName: Jane
              'Marketing email (set subscribed: true)':
                summary: 'Marketing email (set subscribed: true)'
                value:
                  to: user@example.com
                  subject: Weekly Newsletter
                  body: <h1>This Week's Updates</h1>
                  subscribed: true
              Email with PDF attachment:
                summary: Email with PDF attachment
                value:
                  to: user@example.com
                  subject: Your Invoice
                  body: >-
                    <h1>Invoice Attached</h1><p>Please find your invoice
                    attached.</p>
                  attachments:
                    - filename: invoice.pdf
                      content: JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL...
                      contentType: application/pdf
      responses:
        '200':
          description: Email queued successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      emails:
                        type: array
                        items:
                          type: object
                          properties:
                            contact:
                              type: object
                              properties:
                                id:
                                  type: string
                                email:
                                  type: string
                            email:
                              type: string
                              description: >-
                                MailGlyph email record ID. Use this to correlate
                                webhook events (included as 'emailId' in event
                                payload data) with your send requests.
                      timestamp:
                        type: string
                        format: date-time
              example:
                success: true
                data:
                  emails:
                    - contact:
                        id: cnt_abc123
                        email: user@example.com
                      email: ac32f08e-c6b9-45d3-9824-a73dff1e3bbf
                  timestamp: '2025-01-15T10:30:00.000Z'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        code:
          type: integer
        error:
          type: string
        message:
          type: string
        time:
          type: integer
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        API Key authentication. **Secret keys (sk_*)** are required for all
        endpoints except `/v1/track`. **Public keys (pk_*)** only work with the
        `/v1/track` endpoint for client-side event tracking. Workspaces can have
        multiple active keys, and sender-domain operations enforce per-key
        domain scope when configured.

````

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