Skip to main content

REST API

The Nitrosend REST API works with any HTTP client. Use it to integrate email marketing into your app, connect to automation platforms like Zapier or n8n, or build custom tools in any programming language.

Base URL

https://api.nitrosend.com/v1/my
All endpoints are prefixed with /v1/my and scoped to your account.

Authentication

Every request requires a Bearer token in the Authorization header:
Authorization: Bearer nskey_live_your_key_here
Get your API key from Settings > API Keys in the Nitrosend dashboard.

Quick examples

Send an email

curl -X POST https://api.nitrosend.com/v1/my/messages \
  -H "Authorization: Bearer $NITROSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "email",
    "to": "user@example.com",
    "subject": "Welcome to our platform",
    "body": "<h1>Welcome!</h1><p>Thanks for signing up.</p>"
  }'

List campaigns

curl https://api.nitrosend.com/v1/my/campaigns \
  -H "Authorization: Bearer $NITROSEND_API_KEY"

Create a contact

curl -X POST https://api.nitrosend.com/v1/my/contacts \
  -H "Authorization: Bearer $NITROSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "jane@example.com",
    "first_name": "Jane",
    "last_name": "Doe",
    "opt_in": true
  }'

Get account status

curl https://api.nitrosend.com/v1/my/account \
  -H "Authorization: Bearer $NITROSEND_API_KEY"

Language examples

Python

import requests

API_KEY = "nskey_live_your_key_here"
BASE_URL = "https://api.nitrosend.com/v1/my"
HEADERS = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

# Send an email
response = requests.post(f"{BASE_URL}/messages", headers=HEADERS, json={
    "channel": "email",
    "to": "user@example.com",
    "subject": "Hello from Python",
    "body": "<h1>Hi!</h1>"
})
print(response.json())

# List campaigns
campaigns = requests.get(f"{BASE_URL}/campaigns", headers=HEADERS)
print(campaigns.json())

JavaScript / Node.js

const API_KEY = "nskey_live_your_key_here";
const BASE_URL = "https://api.nitrosend.com/v1/my";
const headers = {
  Authorization: `Bearer ${API_KEY}`,
  "Content-Type": "application/json",
};

// Send an email
const response = await fetch(`${BASE_URL}/messages`, {
  method: "POST",
  headers,
  body: JSON.stringify({
    channel: "email",
    to: "user@example.com",
    subject: "Hello from Node.js",
    body: "<h1>Hi!</h1>",
  }),
});
console.log(await response.json());

// List campaigns
const campaigns = await fetch(`${BASE_URL}/campaigns`, { headers });
console.log(await campaigns.json());

Ruby

require "net/http"
require "json"

API_KEY = "nskey_live_your_key_here"
BASE_URL = "https://api.nitrosend.com/v1/my"

def nitrosend_request(method, path, body = nil)
  uri = URI("#{BASE_URL}#{path}")
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true

  request = case method
            when :get then Net::HTTP::Get.new(uri)
            when :post then Net::HTTP::Post.new(uri)
            end

  request["Authorization"] = "Bearer #{API_KEY}"
  request["Content-Type"] = "application/json"
  request.body = body.to_json if body

  JSON.parse(http.request(request).body)
end

# Send an email
result = nitrosend_request(:post, "/messages", {
  channel: "email",
  to: "user@example.com",
  subject: "Hello from Ruby",
  body: "<h1>Hi!</h1>"
})
puts result

Endpoint reference

ActionMethodEndpoint
Messages
Send a messagePOST/messages
List messagesGET/messages
Campaigns
List campaignsGET/campaigns
Create campaignPOST/campaigns
Get campaignGET/campaigns/{id}
Update campaignPATCH/campaigns/{id}
Send campaignPOST/campaigns/{id}/send
Contacts
List contactsGET/contacts
Create contactPOST/contacts
Search contactsGET/contacts/search?q=...
Lists
List contact listsGET/lists
Create listPOST/lists
Templates
List templatesGET/templates
Create templatePOST/templates
Get templateGET/templates/{id}
Update templatePATCH/templates/{id}
Send test emailPOST/templates/{id}/send_test
Flows
List flowsGET/flows
Create flowPOST/flows
Segments
List segmentsGET/segments
Account
Get account infoGET/account
See the full API Reference for detailed request/response schemas.

Pagination

List endpoints return paginated results. Pagination headers are included in the response:
HeaderDescription
X-Total-CountTotal number of records
X-Total-PagesTotal number of pages
X-Page-NumberCurrent page number
Use ?page=2&per_page=25 query parameters to navigate pages.

Error handling

Errors return JSON with a consistent structure:
{
  "error": true,
  "code": "validation_error",
  "message": "Email is required",
  "validation_errors": {
    "email": ["can't be blank"]
  }
}
Status codeMeaning
200Success
201Created
401Invalid or missing API key
404Resource not found
422Validation error
429Rate limited

OpenAPI spec

The full API specification is available as OpenAPI 3.1 YAML:
https://api.nitrosend.com/openapi.yaml
Import this into any tool that supports OpenAPI — Postman, Insomnia, Swagger UI, or API clients in any language.