Symptom: sends fail or behave oddly, and Email Activity / Event Webhook data points at the X-SMTPAPI header.
1. Copy the exact header value your code produces and run it through a JSON validator. Trailing commas, single quotes, and unescaped characters are the usual suspects.
2. Keep the header small. It is metadata, not a second message body.
3. If you only need per-message settings over SMTP (categories, unique args, send_at, asm groups), prefer the v3 API instead: the JSON body is easier to debug than a header.
4. To turn click tracking off for one SMTP message, the doc shows the filters block: {"filters": {"clicktrack": {"settings": {"enable": 0}}}} in the X-SMTPAPI header.
When the header is valid but behavior is still wrong, check that your SMTP library is not folding or truncating long headers.