X Enterprises
fastify-xwhatconverts

leads.get

Fetch a single WhatConverts lead by ID, with optional customer journey data.

leads.get

Fetch a single lead by its WhatConverts ID. Pass customerJourney: true to include the full customer journey (Elite plans only).

Signature

fastify.xwhatconverts.leads.get(
  leadId: string,
  params?: { customerJourney?: boolean }
): Promise<object>

Params

NameTypeRequiredDescription
leadIdstringYesThe WhatConverts lead ID.
params.customerJourneybooleanNoInclude customer journey data. Elite plans only.

Returns

A WhatConverts lead object with full lead details.

Throws

  • [xWhatConverts] leads.get: leadId is required — called without leadId.
  • [xWhatConverts] Network error: <message> — network-level failure.
  • [xWhatConverts] API error: <status> — non-2xx response (e.g. 404 if lead not found).

Examples

Basic — fetch a lead by ID

const lead = await fastify.xwhatconverts.leads.get("123456");
console.log(lead.lead_type);    // "phone_call"
console.log(lead.contact_name); // "Jane Smith"

Realistic — fetch with customer journey for attribution reporting

fastify.get("/leads/:id/attribution", async (request, reply) => {
  try {
    const lead = await fastify.xwhatconverts.leads.get(request.params.id, {
      customerJourney: true,
    });

    return {
      leadId: lead.lead_id,
      source: lead.lead_source,
      medium: lead.lead_medium,
      campaign: lead.lead_campaign,
      journey: lead.customer_journey || [],
    };
  } catch (err) {
    if (err.statusCode === 404) {
      return reply.status(404).send({ error: "Lead not found" });
    }
    throw err;
  }
});

See Also

AI Context

package: "@xenterprises/fastify-xwhatconverts"
method: fastify.xwhatconverts.leads.get(leadId, params?)
use-when: Fetch a single WhatConverts lead by ID; pass customerJourney: true for full attribution path (Elite plans only)
params: leadId (string, required), customerJourney (boolean, optional)
returns: WhatConverts lead object
Copyright © 2026