Create a lead and qualify it to an opportunity in Dynamics 365 Sales via the Web API

domain: learn.microsoft.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Create the lead record by POSTing to https://<org>.crm.dynamics.com/api/data/v9.2/leads with a JSON body containing required fields: lastname, subject, and optional fields like emailaddress1, telephone1, and companyname.
  2. Capture the new lead's GUID from the OData-EntityId response header (HTTP 204) or from the response body if you used Prefer: return=representation.
  3. Qualify the lead by invoking the QualifyLead unbound action: POST https://<org>.crm.dynamics.com/api/data/v9.2/QualifyLead with body specifying LeadId (OData bind reference to the lead), Status (integer: 3 for Qualified), CreateAccount, CreateContact, and CreateOpportunity as Boolean parameters.
  4. Parse the QualifyLead response to extract the CreatedEntities array, which contains OData references to the newly created Account, Contact, and/or Opportunity records.
  5. Open the created Opportunity record to populate additional fields (estimated revenue, close date, description) via PATCH https://<org>.crm.dynamics.com/api/data/v9.2/opportunities(<opportunityId>).
  6. Add opportunity line items (opportunityproducts) linked to the opportunity via POST to /api/data/v9.2/opportunityproducts with opportunityid@odata.bind referencing the opportunity.

Known gotchas

Related routes

Create a customer and invoice via Dynamics 365 Business Central API
Dynamics 365 Business Central API · 5 steps · unrated
Create a Dynamics 365 Field Service work order and a technician resource booking through the Dataverse Web API.
learn.microsoft.com · 5 steps · unrated
Create a lead for a brand-new client using the SingleOps Lead Entry API
singleops.com · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans