API key → create campaign → write LMX → preview → send
By the end, you’ll have a draft campaign with real email content that you can open in Loops, preview, choose an audience for, and send.
Each step includes examples for the Loops CLI, curl, and the JavaScript SDK.
The CLI is especially useful for creating emails inside coding agents. Check out Loops’ Agent skills for more information.
Prerequisites
Before you start, make sure you have:- A Loops account with a verified sending domain
- At least one contact in your audience (or a mailing list to send to later)
- An API key from Settings → API
- For SDK examples:
npm install loops(JavaScript SDK)
loops auth login; curl and SDK examples use the LOOPS_API_KEY environment variable.
What you’ll build
You’ll create a product update campaign named March product update with a short LMX body, then open it in the Loops dashboard to preview and send.Step 1: Create a draft campaign
Creating a campaign also creates an empty email message. Save the IDs from the response. You’ll need them in the next steps.Step 2: Write LMX content
LMX (Loops Markup Language) is how you define email body content for the API. Create a file calledemail.lmx:
Step 3: Update the email message
Push your LMX content and sending settings to the email message created in step 1.fromEmail is the username only (the part before @). Loops appends your team’s sending domain automatically.
Step 4: Preview in the dashboard
Open your campaign in Loops:Step 5: Choose an audience and send
Back in the dashboard, click Next to choose who receives the campaign. Pick a mailing list, segment, or your full audience. On the final step, send now or schedule for later. You can also set the audience and scheduling preference on the draft via the API or CLI with Update a campaign. Open the campaign in the dashboard to publish and send. Useloops lists list -o json to find a mailing list ID:

