TagMangoTagMango Docs
Account

Create or find user

POST
/api/v1/external/users

Overview

This endpoint creates a new user on the customhost or returns an existing user if a match is found by email or phone. At least one of email or phone is required.

AuthorizationBearer <token>

In: header

Header Parameters

x-whitelabel-host*string

Host name of the dashboard, ex: mydomain.tagmango.com

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://api-prod-new.tagmango.com/api/v1/external/users" \  -H "x-whitelabel-host: string" \  -H "Content-Type: application/json" \  -d '{    "email": "user@example.com",    "phone": 9876543210,    "name": "John Doe",    "country": "IN"  }'
{
  "_id": "6659ca9e5f2acb7abfdcd8fd",
  "name": "John Doe",
  "email": "john.doe@example.com",
  "phone": 1234567890,
  "country": "India",
  "dialCode": "+91",
  "currency": "USD",
  "isNew": true
}
{
  "code": 400,
  "type": "Bad request",
  "statusMessage": "BAD_REQUEST",
  "message": "Invalid request",
  "success": false
}
{
  "code": 401,
  "type": "Unauthorized",
  "statusMessage": "UNAUTHORIZED",
  "message": "Invalid token",
  "success": false
}

Configure automation email POST

Configure the email that fires for a registered automation event. Supports three payload shapes: - **Toggle** — `{ event, active }` enables/disables the automation. On a creator-global save (no `mango`) it cascades the flag to every per-mango row for the event. - **Content save** — `{ event, subject, template }` (plus optional `mango` / `active`) writes template content. Omit `mango` to set the creator-global template; provide `mango` to set a per-mango override. - **Per-mango override** — any save containing `mango` auto-enables the creator-global row (so a per-mango override always has a backing enabled event). Callers do not need to pre-toggle the event separately. **Partial updates**: `subject`, `template`, and `active` are all optional. Fields absent from the body are preserved on the stored record. At least one of `active`, `template`, or `subject` must be present. **Processing**: 1. HTML sanitization — `<script>`, `<iframe>`, event handlers (`onclick`/`onerror`/…), and `javascript:` URLs are rejected. Full HTML documents (`<html>`/`<head>`/`<body>` wrappers) are accepted; wrappers are stripped and any `<head><style>` blocks are preserved. 2. Handlebars compile-test — template is compiled against the event's allowed variable catalogue; unknown variables are rejected. 3. Unlayer design synthesis — a minimal visual-editor design is generated from the HTML so the template remains editable in the dashboard editor. 4. Cascade writes — creator-global saves cascade `active` to per-mango rows; per-mango saves auto-enable the creator-global row.

Get User By Email or Phone GET

## Overview This endpoint can be used to look up a user by email or phone number. At least one of email or phone must be provided. If both are provided, the lookup requires both to match the same user, else it will respond with not found.