TunedReach
Developers

TunedReach API

Send contacts into TunedReach from your own app, website or backend, start sequences with a tag, and get events back with signed webhooks. JSON over HTTPS, one API key per integration.

Base URL: https://tunedreach.com/api/v1 · OpenAPI 3.1: /developers/openapi.json · No-code (Zapier and Make) is coming soon.

Quick start

  1. Create a key. In the TunedReach app, open Settings → Integrations & API → Create API key, name it and tick contacts:write. Copy the key: it's shown once.
  2. Store it as a secret. Put it in your server's secret store or an environment variable, e.g. firebase functions:secrets:set TUNEDREACH_API_KEY. Never put it in a mobile app, a web page or a git repository.
  3. Call POST /customers when someone signs up or buys, with their email, a consent_basis and a tag such as signup:website.
  4. Let the tag start a sequence. In the sequence editor, choose Add people automatically → When someone gets this tag and enter signup:website. Everyone you send with that tag is enrolled once, while the sequence is sending.

cURL

curl https://tunedreach.com/api/v1/customers \
  -H "Authorization: Bearer $TUNEDREACH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: signup-user_1001" \
  -d '{"customers":[{"email":"ada@example.com","firstName":"Ada","lastName":"Okafor","consent_basis":"consent","tags_add":["signup:website"],"externalId":"user_1001"}]}'

Node.js

// Node 18+ (built-in fetch). Keep the key in an environment variable or secret.
const res = await fetch("https://tunedreach.com/api/v1/customers", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TUNEDREACH_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": "signup-user_1001",
  },
  body: JSON.stringify({
    customers: [{
      email: "ada@example.com",
      firstName: "Ada",
      consent_basis: "consent",
      tags_add: ["signup:website"],
      externalId: "user_1001",
    }],
  }),
});
const body = await res.json();
if (!res.ok) throw new Error(`TunedReach ${res.status}: ${body.error} (${body.request_id})`);
console.log(body); // { received: 1, created: 1, updated: 0, ... }

Firebase

// A Firebase Cloud Function (2nd gen) that adds every new user to TunedReach.
// First: firebase functions:secrets:set TUNEDREACH_API_KEY
const { onDocumentCreated } = require("firebase-functions/v2/firestore");
const { defineSecret } = require("firebase-functions/params");
const logger = require("firebase-functions/logger");

const TUNEDREACH_API_KEY = defineSecret("TUNEDREACH_API_KEY");

exports.addSignupToTunedReach = onDocumentCreated(
  { document: "users/{uid}", secrets: [TUNEDREACH_API_KEY], retry: true },
  async (event) => {
    const user = event.data?.data();
    if (!user?.email) return;
    const res = await fetch("https://tunedreach.com/api/v1/customers", {
      method: "POST",
      headers: {
        Authorization: `Bearer ${TUNEDREACH_API_KEY.value()}`,
        "Content-Type": "application/json",
        // Same key on a retry, so the contact is never added twice.
        "Idempotency-Key": `signup-${event.params.uid}`,
      },
      body: JSON.stringify({
        customers: [{
          email: user.email,
          firstName: user.firstName || "",
          consent_basis: "consent",
          tags_add: ["signup:app"],
          externalId: event.params.uid,
        }],
      }),
    });
    // 429 and 5xx: throw so Firebase retries (retry: true). Anything else: log it.
    if (res.status === 429 || res.status >= 500) throw new Error(`TunedReach ${res.status}`);
    if (!res.ok) logger.warn("TunedReach rejected the contact", await res.json());
  },
);

PHP

<?php
$payload = json_encode(['customers' => [[
    'email' => 'ada@example.com',
    'firstName' => 'Ada',
    'consent_basis' => 'consent',
    'tags_add' => ['signup:website'],
    'externalId' => 'user_1001',
]]]);
$ch = curl_init('https://tunedreach.com/api/v1/customers');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('TUNEDREACH_API_KEY'),
        'Content-Type: application/json',
        'Idempotency-Key: signup-user_1001',
    ],
    CURLOPT_POSTFIELDS => $payload,
]);
$body = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status !== 200) {
    error_log("TunedReach $status: {$body['error']} ({$body['request_id']})");
}

Python

import os
import requests

res = requests.post(
    "https://tunedreach.com/api/v1/customers",
    headers={
        "Authorization": f"Bearer {os.environ['TUNEDREACH_API_KEY']}",
        "Idempotency-Key": "signup-user_1001",
    },
    json={"customers": [{
        "email": "ada@example.com",
        "firstName": "Ada",
        "consent_basis": "consent",
        "tags_add": ["signup:website"],
        "externalId": "user_1001",
    }]},
    timeout=30,
)
body = res.json()
if not res.ok:
    raise RuntimeError(f"TunedReach {res.status_code}: {body['error']} ({body['request_id']})")
print(body)

Dart

// Server-side Dart only (never ship the key in a Flutter app). Uses package:http.
import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart' as http;

Future<void> main() async {
  final res = await http.post(
    Uri.parse('https://tunedreach.com/api/v1/customers'),
    headers: {
      'Authorization': 'Bearer ${Platform.environment['TUNEDREACH_API_KEY']}',
      'Content-Type': 'application/json',
      'Idempotency-Key': 'signup-user_1001',
    },
    body: jsonEncode({
      'customers': [
        {
          'email': 'ada@example.com',
          'firstName': 'Ada',
          'consent_basis': 'consent',
          'tags_add': ['signup:website'],
          'externalId': 'user_1001',
        }
      ],
    }),
  );
  final body = jsonDecode(res.body) as Map<String, dynamic>;
  if (res.statusCode != 200) {
    throw Exception('TunedReach ${res.statusCode}: ${body['error']} (${body['request_id']})');
  }
  print(body);
}

Authentication and scopes

Send the key in every request: Authorization: Bearer trk_live_…. Keys belong to one workspace. We store only a hash, so a lost key can't be shown again: create a new one and revoke the old one. Only workspace owners and admins can create or revoke keys.

ScopeAllows
contacts:writePOST /customers: add and update contacts, opt people out
contacts:readGET /contacts: look up one contact or list them
suppressions:readGET /suppressions: unsubscribes, bounces and complaints
audience:readGET /audience: how many contacts with a tag can be emailed
webhooksGET/POST /webhooks, DELETE /webhooks/{id}

A request without the scope gets 403 insufficient_scope. GET /key works with any key and tells you its workspace, scopes and rate limit.

Every contact needs a lawful basis, sent as consent_basis:

  • consent: they signed up or opted in to hear from you.
  • existing_customer: they bought from you (soft opt-in); give them a way to opt out at checkout.
  • prospect: a business contact you haven't dealt with yet (legitimate interest).

Prospects are never emailed through TunedReach Mail or a Google sign-in (Gmail) mailbox, only from mailboxes you connect for outreach. A contact is never downgraded (an existing consent stays). Send marketing_opt_in: false for anyone who declined marketing: they're added to your suppression list and never emailed. A later true doesn't undo an unsubscribe, bounce or complaint.

POST /customers

POST/api/v1/customers

Adds or updates up to 500 contacts per request (upsert by email). Scope contacts:write. One bad contact doesn't fail the rest: it's counted in invalid with its reason in errors.

FieldTypeNotes
emailstringRequired.
consent_basisstringRequired: consent, existing_customer or prospect.
firstName, lastNamestringOr name, split on the first space. Names fill in only if empty.
phonestringSaved as the {{phone}} field.
externalIdstringYour id for the person (up to 100 characters).
marketing_opt_inbooleanfalse suppresses the address.
tags_add, tags_removestring[]Up to 10 each; 1–40 characters of a-z 0-9 : _ . -, starting with a letter or digit.
attributesobjectstage, plan, country (ISO 2), industry; usable as merge tags.
lastPurchaseAt, firstPurchaseAtISO 8601Used by automatic win-back.
totalSpent, orderCount, currencynumber, integer, stringCurrency as ISO 4217, e.g. GBP.

Request

{
  "customers": [
    {
      "email": "ada@example.com",
      "firstName": "Ada",
      "lastName": "Okafor",
      "consent_basis": "consent",
      "tags_add": [
        "signup:website"
      ],
      "externalId": "user_1001"
    },
    {
      "email": "lead@acme.example",
      "name": "Sam Lee",
      "consent_basis": "prospect",
      "tags_add": [
        "outreach:q1"
      ]
    }
  ]
}

Response 200

{
  "received": 2,
  "created": 2,
  "updated": 0,
  "optedOut": 0,
  "suppressed": 0,
  "invalid": 0,
  "errors": []
}

suppressed counts people already on your suppression list (not changed). Contacts from an API key are tagged api, plus customer for existing customers.

GET /contacts

GET/api/v1/contacts?email=ada@example.com

GET/api/v1/contacts?tag=signup:website&limit=50&cursor=…

Scope contacts:read. With email: one contact, or 404 resource_not_found. Otherwise a page of up to limit (1–100, default 50) contacts, optionally with one tag. Pass next_cursor back as cursor while has_more is true.

{
  "contacts": [
    {
      "id": "3f2a9c0b7d1e4a5b6c7d8e9f",
      "email": "ada@example.com",
      "first_name": "Ada",
      "last_name": "Okafor",
      "company": "",
      "tags": [
        "api",
        "signup:website"
      ],
      "status": "active",
      "consent_basis": "consent",
      "source": "api",
      "fields": {},
      "created_at": "2026-12-04T10:15:00.000Z",
      "updated_at": "2026-12-04T10:15:00.000Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}

GET /suppressions

GET/api/v1/suppressions?since=2026-11-01T00:00:00Z&limit=500

Scope suppressions:read. Addresses you must not email, suppressed at or after since, oldest first. limit 1–1000 (default 500). Keep calling with the same since and the returned cursor while has_more is true; store the last row's at as the next run's since (rows are safe to see twice). reason is unsubscribed, bounced, complained, opted_out, manual or a reason a user typed.

{
  "suppressions": [
    {
      "email": "ada@example.com",
      "reason": "unsubscribed",
      "at": "2026-11-10T08:00:00.000Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}

GET /audience

GET/api/v1/audience?tag=stage:at_risk

Scope audience:read. How many contacts with the tag can be emailed now (a count only, no addresses).

{
  "tag": "stage:at_risk",
  "emailable": 128
}

Webhooks endpoints

GET/api/v1/webhooks

POST/api/v1/webhooks

DELETE/api/v1/webhooks/{id}

Scope webhooks. You can also manage webhooks in the app. At most 5 per workspace; the URL must be public https://. The signing secret is returned once, when you create the webhook.

Request

{
  "url": "https://example.com/tunedreach-webhook",
  "events": [
    "contact.unsubscribed",
    "reply.received"
  ],
  "include_reply_body": false,
  "description": "CRM sync"
}

Response 201

{
  "webhook": {
    "id": "Hk3d9QyTt0aLwP2xV1sZ",
    "url": "https://example.com/tunedreach-webhook",
    "events": [
      "contact.unsubscribed",
      "reply.received"
    ],
    "include_reply_body": false,
    "description": "CRM sync",
    "active": true,
    "secret_preview": "whsec_AbCd…9xYz",
    "failures": 0,
    "last_status": null,
    "last_error": null,
    "last_delivery_at": null,
    "created_at": "2026-12-04T10:15:00.000Z",
    "created_by": null
  },
  "secret": "whsec_…"
}

GET /key

GET/api/v1/key

{
  "workspace_id": "3i7l8sDx05kknaWADE7l",
  "integration_id": "Qn7Tli2IvYTNkFY9QdIj",
  "kind": "custom",
  "scopes": [
    "contacts:write"
  ],
  "rate_limit_per_minute": 120
}

Idempotency

Send an Idempotency-Key header (1–255 visible ASCII characters, e.g. order-8812) on any POST. If the same key comes again within 24 hours with the same body, we return the first answer with Idempotent-Replayed: true and change nothing. The same key with a different body gets 422 idempotency_key_reused; a retry while the first is still running gets 409 idempotency_in_progress. A 5xx answer isn't stored, so retrying with the same key is safe. Keys are per API key.

Errors

Errors are JSON with a machine-readable error code, a message for people and a request_id (also in the X-Request-Id header; quote it if you contact us).

{
  "error": "insufficient_scope",
  "message": "This key doesn't have the scope this endpoint needs.",
  "request_id": "req_Yt4mQ0p2LkR9",
  "required_scope": "contacts:write",
  "key_scopes": [
    "contacts:read"
  ]
}
StatuserrorMeaning
400invalid_bodyThe JSON body isn't what the endpoint expects.
400invalid_parameterA query parameter is missing or wrong (see param).
400idempotency_key_invalidIdempotency-Key must be 1–255 visible ASCII characters.
401missing_or_malformed_keyNo Authorization: Bearer trk_live_… header.
401invalid_or_revoked_keyThe key doesn't exist or was revoked.
403insufficient_scopeThe key lacks the scope (see required_scope).
404not_foundNo such endpoint.
404unsupported_versionOnly /api/v1 exists.
404resource_not_foundNo contact or webhook with that id or email.
405method_not_allowedWrong HTTP method (see the Allow header).
409idempotency_in_progressThe same Idempotency-Key is still being processed. Retry shortly.
413too_many_customersMore than 500 customers in one request.
415unsupported_media_typePOST bodies must be Content-Type: application/json.
422idempotency_key_reusedThe Idempotency-Key was used for a different request.
429rate_limitedToo many requests this minute. Wait Retry-After seconds.
500internal_errorOur fault. Retry with the same Idempotency-Key.

Rate limits

Per key, per minute, by your workspace's plan. Every answer carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (Unix seconds); a 429 also has Retry-After (seconds). Batch up to 500 contacts per request instead of one call each.

PlanRequests per minute
Free60
Starter120
Growth300
Team600

Webhooks

Add an endpoint in Settings → Integrations & API → Webhooks (or with the API), pick events, and copy the signing secret. We send a POST with a JSON body for each event. Answer with any 2xx within 10 seconds; anything else (or a timeout) is retried with backoff (30 seconds, doubling up to hourly) for 24 hours. Redirects aren't followed. Every delivery, its attempts and status codes are in the app's delivery log, and Send test event sends a test event right away.

EventWhen
contact.createdA contact was added (API, import, form, prospect finder or the app).
contact.unsubscribedA contact unsubscribed or was opted out.
contact.bouncedAn email to the contact bounced; they won't be emailed again.
contact.complainedThe contact marked an email as spam.
reply.receivedA contact replied. Includes the AI label when there is one; the reply text only if you opt in.
sequence.completedA contact received the last email of a sequence.

Headers: TunedReach-Event, TunedReach-Delivery (unique per delivery), TunedReach-Signature. Every body has the same envelope:

{
  "id": "evt_Qm2yV8kP0aZ1Lr4tXw9c",
  "type": "contact.unsubscribed",
  "created": "2026-12-04T10:20:00.000Z",
  "workspace_id": "3i7l8sDx05kknaWADE7l",
  "data": {
    "contact": {
      "id": "3f2a9c0b7d1e4a5b6c7d8e9f",
      "email": "ada@example.com",
      "first_name": "Ada",
      "last_name": "Okafor",
      "company": "",
      "tags": [
        "api",
        "signup:website"
      ],
      "status": "unsubscribed",
      "consent_basis": "consent",
      "source": "api",
      "fields": {},
      "created_at": "2026-12-04T10:15:00.000Z",
      "updated_at": "2026-12-04T10:15:00.000Z"
    }
  }
}

reply.received

The reply text is not included unless you turn on Include the reply text for that endpoint. label is the AI (or rules) label when there is one: interested, question, not_interested, out_of_office, unsubscribe, bounce or other.

{
  "id": "evt_8xR…",
  "type": "reply.received",
  "created": "2026-12-04T10:21:00.000Z",
  "workspace_id": "3i7l8sDx05kknaWADE7l",
  "data": {
    "reply": {
      "id": "rp_123",
      "contact_id": "3f2a9c0b7d1e4a5b6c7d8e9f",
      "email": "ada@example.com",
      "from_name": "Ada Okafor",
      "subject": "Re: Quick question",
      "received_at": "2026-12-04T10:20:41.000Z",
      "sequence_id": "seq_9",
      "label": "interested",
      "label_source": "ai"
    }
  }
}

sequence.completed

{
  "id": "evt_7Tq…",
  "type": "sequence.completed",
  "created": "2026-12-04T10:22:00.000Z",
  "workspace_id": "3i7l8sDx05kknaWADE7l",
  "data": {
    "sequence": {
      "id": "seq_9",
      "name": "Welcome"
    },
    "contact": {
      "id": "3f2a9c0b7d1e4a5b6c7d8e9f",
      "email": "ada@example.com"
    },
    "enrollment_id": "seq_9_3f2a9c0b7d1e4a5b6c7d8e9f",
    "steps_sent": 3,
    "completed_at": "2026-12-04T10:22:00.000Z"
  }
}

Deliveries can arrive more than once and out of order: use the event id to process each event once.

Verifying signatures

TunedReach-Signature: t=1764843600,v1=5f3c…. v1 is the hex HMAC-SHA256 of <t>.<raw body> using your endpoint's secret. Check it against the raw bytes (before parsing JSON), compare in constant time, and reject timestamps more than 5 minutes old.

Node.js

const crypto = require("node:crypto");

/// rawBody: the exact bytes we sent (not re-serialised JSON).
function verifyTunedReach(rawBody, header, secret, toleranceSec = 300) {
  const parts = Object.fromEntries(String(header || "").split(",").map((p) => p.trim().split("=")));
  const t = Number(parts.t);
  if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false;
  const expected = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  const got = String(parts.v1 || "");
  return got.length === expected.length && crypto.timingSafeEqual(Buffer.from(got), Buffer.from(expected));
}

Firebase

// A Firebase function that receives TunedReach webhooks.
// First: firebase functions:secrets:set TUNEDREACH_WEBHOOK_SECRET
const crypto = require("node:crypto");
const { onRequest } = require("firebase-functions/v2/https");
const { defineSecret } = require("firebase-functions/params");

const TUNEDREACH_WEBHOOK_SECRET = defineSecret("TUNEDREACH_WEBHOOK_SECRET");

exports.tunedreachWebhook = onRequest({ secrets: [TUNEDREACH_WEBHOOK_SECRET] }, async (req, res) => {
  const raw = req.rawBody.toString("utf8");
  const parts = Object.fromEntries(String(req.get("TunedReach-Signature") || "").split(",").map((p) => p.trim().split("=")));
  const t = Number(parts.t);
  const expected = crypto.createHmac("sha256", TUNEDREACH_WEBHOOK_SECRET.value()).update(`${t}.${raw}`).digest("hex");
  const got = String(parts.v1 || "");
  const fresh = t && Math.abs(Date.now() / 1000 - t) <= 300;
  if (!fresh || got.length !== expected.length || !crypto.timingSafeEqual(Buffer.from(got), Buffer.from(expected))) {
    res.status(400).send("bad signature");
    return;
  }
  const event = JSON.parse(raw);
  // Deliveries can repeat: use event.id to do each event once.
  console.log(event.type, event.id);
  res.status(200).send("ok");
});

PHP

<?php
$raw = file_get_contents('php://input');
$header = $_SERVER['HTTP_TUNEDREACH_SIGNATURE'] ?? '';
$parts = [];
foreach (explode(',', $header) as $p) {
    [$k, $v] = array_pad(explode('=', trim($p), 2), 2, '');
    $parts[$k] = $v;
}
$t = (int)($parts['t'] ?? 0);
$expected = hash_hmac('sha256', $t . '.' . $raw, getenv('TUNEDREACH_WEBHOOK_SECRET'));
if (!$t || abs(time() - $t) > 300 || !hash_equals($expected, $parts['v1'] ?? '')) {
    http_response_code(400);
    exit('bad signature');
}
$event = json_decode($raw, true);
// Deliveries can repeat: use $event['id'] to do each event once.
http_response_code(200);

Python

import hashlib
import hmac
import time

def verify_tunedreach(raw: bytes, header: str, secret: str, tolerance: int = 300) -> bool:
    parts = dict(p.strip().split("=", 1) for p in (header or "").split(",") if "=" in p)
    try:
        t = int(parts.get("t", "0"))
    except ValueError:
        return False
    if not t or abs(time.time() - t) > tolerance:
        return False
    expected = hmac.new(secret.encode(), f"{t}.".encode() + raw, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, parts.get("v1", ""))

# Flask: verify_tunedreach(request.get_data(), request.headers.get("TunedReach-Signature", ""), SECRET)

Dart

// Uses package:crypto.
import 'dart:convert';
import 'package:crypto/crypto.dart';

bool verifyTunedReach(String rawBody, String header, String secret, {int toleranceSec = 300}) {
  final parts = <String, String>{};
  for (final p in header.split(',')) {
    final i = p.indexOf('=');
    if (i > 0) parts[p.substring(0, i).trim()] = p.substring(i + 1).trim();
  }
  final t = int.tryParse(parts['t'] ?? '') ?? 0;
  final now = DateTime.now().millisecondsSinceEpoch ~/ 1000;
  if (t == 0 || (now - t).abs() > toleranceSec) return false;
  final expected = Hmac(sha256, utf8.encode(secret)).convert(utf8.encode('$t.$rawBody')).toString();
  final got = parts['v1'] ?? '';
  if (got.length != expected.length) return false;
  var diff = 0;
  for (var i = 0; i < got.length; i++) {
    diff |= got.codeUnitAt(i) ^ expected.codeUnitAt(i);
  }
  return diff == 0;
}

Help

TunedBooks connects with its own key type (Create TunedBooks key); everything above applies to it too. Questions: hello@tunedreach.com (include the request_id).