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

# Send with API

> Start sending with the API in minutes

Are you ready to send your first email with Helo? Because we sure are! Here are the 4 easy steps to sending your first email via Helo's API. Want to send via SMTP instead? Follow our [SMTP quickstart guide](/getting-started/quickstart-send-with-smtp).

<Steps>
  <Step title="Set up your sending domain" titleSize="h3">
    Before you can send, you need to add a sending domain.

    Head over to our [domains page](/core/domains) for instructions on how to set up your domain.
  </Step>

  <Step title="Create your first Channel" titleSize="h3">
    [Channels](/core/channels) allow you to segregate your mail. Some common ways you might want to do this:

    * By environment (e.g., production, staging, etc.)
    * By the type of mail you're sending (e.g., newsletters, transactional, etc.)
    * By customer (e.g., customer abc)

    If something goes awry with your sending in one Channel (e.g., high bounce rate, high spam, etc.), this won't impact sending on your other Channels.

    Go ahead and create your first Channel via the `Channels` section in your Helo dashboard.
  </Step>

  <Step title="Create your API credentials" titleSize="h3">
    Create a new [API credential](/core/credentials) — that's the token you'll need to authenticate your requests.

    When you create the credential, make sure it has permissions to send via the Channel you just set up. You can do so by scoping your credential to one particular Channel or by giving it access to send via all Channels. If you're doing the latter, you'll need to pass the `X-Helo-Channel-Id` header in your API request to tell Helo which Channel to send through.
  </Step>

  <Step title="Send your first email" titleSize="h3">
    You're ready for your first send!

    Send via API using an HTTP client or use one of the [Helo SDKs](/getting-started/sdks).

    <Info>
      While your account is in test mode, you can only send to email addresses on domains you have verified in step #1. Select the recipient for your first test send accordingly.
    </Info>

    <CodeGroup>
      ```bash command-line theme={null}
      curl --location "https://api.helohq.com/send/transactional" \
      --header "X-Helo-Channel-Id: $HELO_CHANNEL_ID" \
      --header "Content-Type: application/json" \
      --header "Accept: application/json" \
      --header "Authorization: Bearer $HELO_API_KEY" \
      --data @- <<EOF
      {
        "from": {
          "email": "$FROM_ADDRESS",
          "name": "From Name"
        },
        "to": [
          {
            "email": "recipient@example.com",
            "name": "Recipient Name"
          }
        ],
        "subject": "Hello from Helo",
        "html": "<html><body><h1>Hi there, new friend.</h1><p>This is a test message, delivered with <3 by Helo. </p></body></html>",
        "text": "This is a test message, delivered with <3 by Helo."
      }
      EOF
      ```

      ```csharp C# theme={null}
      using Helo.ApiClient;
      using Helo.ApiClient.Errors;
      using Helo.ApiClient.Sending;
      using Microsoft.Extensions.DependencyInjection;
      using Microsoft.Extensions.Hosting;

      var apiKey = Environment.GetEnvironmentVariable("HELO_API_KEY")
                   ?? throw new Exception("Invalid HELO_API_KEY");
      var channelId = Environment.GetEnvironmentVariable("HELO_CHANNEL_ID")
                      ?? throw new Exception("Invalid HELO_CHANNEL_ID");
      var fromAddress = Environment.GetEnvironmentVariable("FROM_ADDRESS")
                        ?? throw new Exception("Invalid FROM_ADDRESS");

      var builder = Host.CreateApplicationBuilder(args);
      builder.Services.AddHelo(apiKey);

      var host = builder.Build();

      using var scope = host.Services.CreateScope();

      var client = scope.ServiceProvider.GetRequiredService<IHeloApiClient>();

      try
      {
          await client.Sending.Transactional(new SendMessageRequest
          {
              From = new MailAddress { Email = fromAddress, Name = "From Name" },
              To = [new MailAddress { Email = "recipient@example.com", Name = "Recipient Name" }],
              Subject = "Hello from Helo",
              Html = "<html><body><h1>Hi there, new friend.</h1><p>This is a test message, delivered with <3 by Helo. </p></body></html>",
              Text = "This is a test message, delivered with <3 by Helo.",
          }, channelId);
      }
      catch (ApiErrorException ex)
      {
          Console.WriteLine(ex.ErrorResponse.Detail);
      }
      ```

      ```javascript JavaScript theme={null}
      import Helo from "@helo-email/sdk";

      const apiKey = process.env.HELO_API_KEY;
      const channelId = process.env.HELO_CHANNEL_ID;
      const fromAddress = process.env.FROM_ADDRESS;

      const client = new Helo(apiKey);

      await client.sending.transactional(
        {
          from: {
            email: fromAddress,
            name: "From Name",
          },
          to: [
            {
              email: "recipient@example.com",
              name: "Recipient Name",
            },
          ],
          subject: "Hello from Helo",
          html: "<html><body><h1>Hi there, new friend.</h1><p>This is a test message, delivered with <3 by Helo. </p></body></html>",
          text: "This is a test message, delivered with <3 by Helo.",
        },
        { channelId },
      );
      ```

      ```python Python theme={null}
      import sdk_helo_email
      import os

      api_key = os.getenv('HELO_API_KEY')
      channel_id = os.getenv('HELO_CHANNEL_ID')
      from_address = os.getenv('FROM_ADDRESS')

      client = sdk_helo_email.Helo(api_key=api_key)

      response = client.sending.transactional(
          from_={"email": from_address, "name": "From Name"},
          to=[{"email": "recipient@example.com", "name": "Recipient Name"}],
          subject="Hello from Helo",
          html="<html><body><h1>Hi there, new friend.</h1><p>This is a test message, delivered with <3 by Helo. </p></body></html>",
          text="This is a test message, delivered with <3 by Helo.",
          channel_id=channel_id
      )
      print(response.message_id)
      ```

      ```ruby Ruby theme={null}
      require "helo"

      Helo.configure do |config|
        config.api_key = ENV.fetch("HELO_API_KEY")
      end

      channel_id = ENV.fetch("HELO_CHANNEL_ID")
      from_address = ENV.fetch("FROM_ADDRESS")

      request = Helo::SendMessageRequest.new(
        from: Helo::MailAddress.new(email: from_address, name: "From Name"),
        to: [Helo::MailAddress.new(email: "recipient@example.com", name: "Recipient Name")],
        subject: "Hello from Helo",
        html: "<html><body><h1>Hi there, new friend.</h1><p>This is a test message, delivered with <3 by Helo. </p></body></html>",
        text: "This is a test message, delivered with <3 by Helo."
      )

      response = Helo::Sending.transactional(
        request,
        channel_id: channel_id
      )

      puts response.message_id
      ```

      ```go Go theme={null}
      package main

      import (
      	"context"
      	"log"
      	"os"

      	"github.com/helo-email/helo-sdk-go"
      )

      func main() {
      	client := helo.NewHelo(os.Getenv("HELO_API_KEY"))
      	channelId := os.Getenv("HELO_CHANNEL_ID")
      	fromAddress := os.Getenv("FROM_ADDRESS")

      	params := &helo.SendMessageRequest{
      		From:    helo.MailAddress{Email: fromAddress, Name: "From Name"},
      		To:      []helo.MailAddress{{Email: "recipient@example.com", Name: "Recipient Name"}},
      		Subject: "Hello from Helo",
      		Html:    "<html><body><h1>Hi there, new friend.</h1><p>This is a test message, delivered with <3 by Helo. </p></body></html>",
      		Text:    "This is a test message, delivered with <3 by Helo.",
      	}
      	opts := &helo.SendingTransactionalOptions{
      		ChannelID: channelId,
      	}

      	ctx := context.Background()

      	result, err := client.Sending.Transactional(ctx, params, opts)
      	if err != nil {
      		log.Fatal(err)
      		return
      	}

      	log.Printf("%s", result.MessageID)
      }
      ```
    </CodeGroup>
  </Step>
</Steps>

## Need help sending your first email?

If you're stuck or need a hand sending your first email, just send us a quick note (or join us on [discord](https://discord.gg/suQD9T3nDN)!). We're here to help.

<Card title="Contact us" icon="heart" href="mailto:support@helohq.com" horizontal>
  Human (!) support whenever you need it.
</Card>

## Next steps

Now that your first email is out the door, explore these key features:

<Columns cols={2}>
  <Card title="Sending transactional" icon="mail" href="/core/sending-transactional">
    Send transactional mail like password resets or notifcations.
  </Card>

  <Card title="Sending broadcasts" icon="mails" href="/core/sending-broadcasts">
    Send the same message to multiple recipients.
  </Card>

  <Card title="Domains" icon="globe" href="/core/domains">
    Set up your domains for sending mail.
  </Card>

  <Card title="Channels" icon="chart-no-axes-gantt" href="/core/channels">
    Isolate your sending with Channels.
  </Card>

  <Card title="Activity" icon="newspaper" href="/core/activity">
    Understand how your email sending is performing.
  </Card>

  <Card title="Suppressions" icon="mail-x" href="/core/suppressions">
    Manage suppressions to improve deliverability.
  </Card>

  <Card title="Webhooks" icon="computer" href="/core/webhooks">
    Receive webhooks for events.
  </Card>
</Columns>
