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

# Send a test email

> Sends one of a workflow's email steps (workflowId, and optionally step), or a subject and body, through the environment's email integration, to you or another address, without creating a subscriber or a run. Your details are the sample subscriber unless you pass data. Subject lines are prefixed with [Test], and test emails don't count towards analytics or usage.



## OpenAPI

````yaml /openapi.json post /emails/test
openapi: 3.1.0
info:
  title: subscriber.dev API
  description: >-
    Trigger workflows, manage subscribers and send broadcasts. Authenticate with
    an API key in the X-API-Key header: the key decides the environment. Docs:
    https://docs.subscriber.dev
  version: '1.0'
  contact: {}
servers:
  - url: https://api.subscriber.dev
    description: Cloud
security: []
tags: []
paths:
  /emails/test:
    post:
      tags:
        - Emails
      summary: Send a test email
      description: >-
        Sends one of a workflow's email steps (workflowId, and optionally step),
        or a subject and body, through the environment's email integration, to
        you or another address, without creating a subscriber or a run. Your
        details are the sample subscriber unless you pass data. Subject lines
        are prefixed with [Test], and test emails don't count towards analytics
        or usage.
      operationId: sendTestEmail
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestEmailRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestEmailResponse'
        '400':
          description: >-
            No such email step, no email integration, or the email couldn't be
            sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Workflow not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limited. Wait a second and retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearer: []
        - api-key:
            - emails:test
components:
  schemas:
    TestEmailRequest:
      type: object
      properties:
        subject:
          type: string
          maxLength: 500
        body:
          type: string
        layout:
          default: default
          type: string
          enum:
            - default
            - none
        previewText:
          description: >-
            Short summary inboxes show next to the subject. Supports Liquid.
            Only used with the default layout.
          type: string
          maxLength: 255
        fromName:
          description: >-
            Sender name for every email in this workflow, e.g. "Jane from Acme".
            Defaults to the email integration's fromName. The from address
            always comes from the integration.
          type: string
          maxLength: 255
        replyTo:
          description: >-
            Where replies to this workflow's emails go. Defaults to the email
            integration's replyTo, or the from address.
          type: string
          format: email
          pattern: >-
            ^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
        workflowId:
          description: >-
            Send one of this workflow's email steps, as it stands now, instead
            of a subject and body.
          type: string
        step:
          description: >-
            Which of the workflow's steps to send, counting from 1. Defaults to
            its first email step.
          type: integer
          minimum: 1
          maximum: 9007199254740991
        to:
          description: Who to send it to. Defaults to your own address.
          type: string
          format: email
          pattern: >-
            ^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
        data:
          description: >-
            Sample data for the template, like a trigger payload: {"plan":
            "pro"} is {{ plan }}. Put subscriber fields under "subscriber", e.g.
            {"subscriber": {"firstName": "Ada"}}. Defaults to your own details
            as the subscriber.
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
    TestEmailResponse:
      type: object
      properties:
        to:
          type: string
        subject:
          type: string
      required:
        - to
        - subject
    ErrorResponse:
      type: object
      properties:
        statusCode:
          type: integer
          example: 404
        message:
          type: string
          example: Workflow not found
        error:
          type: string
          example: Not Found
        errors:
          description: Which fields failed validation, on a 400.
          type: array
          items:
            type: object
            properties:
              path:
                type: array
                items:
                  anyOf:
                    - type: string
                    - type: number
              message:
                type: string
              code:
                type: string
            required:
              - path
              - message
      required:
        - statusCode
        - message
  securitySchemes:
    bearer:
      scheme: bearer
      type: http
      description: >-
        A session token from `subscriber login`, used by subscriber.dev's own
        apps. Requests about an environment also need its ID in the
        `x-environment-id` header. From your own code, use an API key.
    api-key:
      type: apiKey
      in: header
      name: X-API-Key
      description: An environment API key. Keep it on your server.

````

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