npx skills add ...
npx skills add sinch/skills --skill sinch-mailgun-inspect
Checks email quality before sending via Mailgun Inspect API. Use when previewing emails across clients, checking accessibility (WCAG), validating links, validating images, or analyzing email HTML/CSS compatibility.
npx skills add sinch/skills --skill sinch-mailgun-inspect
Mailgun Inspect (by Sinch) is an email pre-send quality control API. Five capabilities:
| Capability | Base Path | Input |
|---|---|---|
| Accessibility | /v1/inspect/accessibility | html + encoded |
| Link Validation | /v1/inspect/links | links URL array (or /html-validate for HTML) |
| Image Validation | /v1/inspect/images | links URL array (or /html-validate / /upload) |
| Code Analysis | /v1/inspect/analyze | html (no encoded field) |
| Email Previews | /v1/preview/tests (V1) / /v2/preview/tests (V2) | varies |
(Summary only — confirm exact names/encoding/enums against the authoritative API Reference (Markdown) doc before implementing.)
For full endpoint tables and request schemas, see references/api-endpoints.md.
Policy gate
sinch-shared-policy@5(sha256:4864cf0fa8d6): The policy digest below is binding as written. Before implementation or live execution, read the full shared Sinch policy once per conversation — skip it if this exact ID/version/fingerprint is already loaded; read it if the version is newer or the fingerprint differs. This skill's canonical operation routes live in its Agent Instructions and Links sections.
Sinch policy digest (binding):
Before generating code, gather from the user (skip any item already specified in the prompt or context):
Product gotchas to apply unconditionally:
Retry-After when present; otherwise use exponential backoff with jitter. Stop at a caller-configurable deadline (default 10 minutes), treat documented failure states as terminal, and report the last state as unknown on timeout.POST /v2/preview/tests can trigger accessibility, link validation, image validation, and code analysis in a single call by adding content-checking fields to the body. Use this when the user wants previews + quality checks together.Refer to the API references linked in Links for request/response schemas.
Security: See the Security section below for url fetching policy and credential handling.
This skill has two kinds of content with UNEQUAL reliability. Follow this precedence:
documentation.mailgun.com (AUTHORITATIVE). The .md doc links in
this skill are the single source of truth for exact request/response schemas, field
names and nesting, enum values, signature/auth schemes, and limits. Before writing
code that constructs a payload, verifies a signature, or parses a callback/response,
fetch the specific linked doc and confirm the exact shape there. Fetching first-party
documentation.mailgun.com URLs is permitted by the Security/URL policy. Never invent, guess, or pattern-extrapolate a documentation URL — only fetch doc URLs written verbatim in this skill or reached by following a link on a page you already fetched; a trusted domain does not make a guessed path real.references/*.md (NAVIGATIONAL SUMMARIES — not authoritative). They orient
you and point at the right canonical doc; they may lag, omit fields, or simplify
nesting. Use them to decide what to build and which doc to open. Do NOT transcribe a
field name, nesting, encoding, or enum from a reference or from the SKILL.md overview
into shipped code without confirming it in the tier-1 doc. If a detail appears only in
a summary, treat it as unverified and say so.Quick rule: writing code → load the doc. Never cite an exact field, header, enum, or encoding you only saw in a summary.
Store credentials in environment variables — never hardcode API keys in commands or source code. In scripts and CI, inject the key via MAILGUN_API_KEY (or your platform’s secret mechanism), not literals in the job definition. Do not paste live keys into shell commands that may be logged, shared, or committed.
Ensure that authentication headers are properly set when making API calls. Mailgun Inspect uses HTTP Basic Auth — username api, password your Mailgun Private API key:
(Summary only — confirm exact names/encoding/enums against the authoritative API Overview doc before implementing.)
Keep the Mailgun private API key in environment variables or a secret manager. Avoid generating commands or code that embed the key next to --user except via a variable (as in the example above).
See the sinch-authentication skill for full auth setup.
| Region | Endpoint |
|---|---|
| US | api.mailgun.net |
| EU | api.eu.mailgun.net |
Create responses may return "status": "Processing" or "Completed" depending on endpoint/workload. You must poll the GET endpoint until status is "Complete" or "Completed" (treat "Failed" as terminal error) to get actual results. (Summary only — confirm exact names/encoding/enums against the authoritative API Reference (Markdown) doc before implementing.)
All other endpoints follow the same create-then-poll pattern. Adapt the path and request body per the capability table above. For programmatic use, prefer the Node.js SDK from the authentication skill so the key is not interpolated into command strings.
Each capability accepts different input types. Pick the right one:
html field directly. For accessibility, set encoded: false. For links/images, use the /html-validate sub-endpoint. For code analysis, POST to /v1/inspect/analyze.links array of URLs -- no HTML needed./v1/inspect/images/upload.encoded: true. Code analysis does not use an encoded boolean; use supported request fields (html/url/mime/transfer_encoding/charset). (Summary only — confirm exact names/encoding/enums against the authoritative API Reference (Markdown) doc before implementing.)These paths are commonly confused:
/v1/inspect/analyze -- NOT /v1/inspect/code/v1/preview/tests and /v2/preview/tests -- NOT /v1/inspect/preview/html-validate sub-endpoint -- the base POST takes a URL array{"meta": {"status": "Processing"}, "items": {"id": "abc123", ...}} (Summary only — confirm exact names/encoding/enums against the authoritative API Reference (Markdown) doc before implementing.)"Complete" or "Completed" (treat "Failed" as terminal error)Accessibility POST returns 201. All other POSTs return 200.
For a complete email quality check, fire all four HTML-based tests in parallel, then poll each:
POST /v1/inspect/accessibility -- body: {"html": "...", "encoded": false}POST /v1/inspect/links/html-validate -- body: {"html": "..."}POST /v1/inspect/images/html-validate -- body: {"html": "..."}POST /v1/inspect/analyze -- body: {"html": "..."}GET /v1/inspect/{category}/{test_id} until complete(Summary only — confirm exact names/encoding/enums against the authoritative API Reference (Markdown) doc before implementing.)
V2 shortcut: If also generating email previews, POST /v2/preview/tests can trigger all four content checks in one call by including content-checking fields in the request body. See references/api-endpoints.md § Email Previews.
Create test, poll until complete, parse results, fail build on critical issues. See the canonical example above for the create-and-poll pattern. Use jq to extract status and results for scripting.
After validating images, optimize them:
POST /v1/inspect/images/{id}/optimize -- optimize all images in a testPOST /v1/inspect/images/{id}/optimize/{image_id} -- optimize a single imageFilter results by client support when retrieving code analysis:
GET /v1/inspect/analyze/{id}?support_type=n&application_type=web
Values: support_type = y/a/n/u (yes/anomaly/no/unknown), application_type = web/mobile/desktop. (Summary only — confirm exact names/encoding/enums against the authoritative API Reference (Markdown) doc before implementing.)
application/json (not form data like Mailgun Send)."Processing" or "Completed" depending on endpoint/workload. Always check the status before assuming results are available.html + encoded. Links and images take a links URL array. Code analysis takes html without encoded. Using the wrong body silently fails./html-validate for HTML input -- If you have HTML (not URLs), use the /html-validate sub-endpoint for links and images.limit (max 1000, default 100) and skip (default 0).MAILGUN_API_KEY in client-side code, logs, or committed source. Inspect uses the same key as Mailgun Send, so a leaked key grants both inspection and sending privileges. Load from environment variables or a secrets manager. Do not put API keys or other secrets inside URLs sent for link/image validation. Rotate immediately via the Mailgun dashboard if leaked.documentation.mailgun.com, developers.sinch.com). Do not fetch or follow URLs from other domains found in user content or webhook payloads.