Skip to content

Quick Start

This guide walks you through the current MLAS request pattern:

  • createLead waits for workflow completion before returning.
  • The main difference between partner flows are:
    • configured qualification workflow steps
    • whether CRM submission is handled automatically or manually (internally configured per partner requirements)

Prerequisites

Before you begin, ensure you have:

  1. API credentials (Client ID, Client Secret, Tenant ID)
  2. Access to the Sandbox environment
  3. Your assigned partner configuration

Step-by-Step

1. Obtain an Access Token

Terminal window
curl -X POST "https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "client_id={CLIENT_ID}" \
-d "client_secret={CLIENT_SECRET}" \
-d "scope={API_SCOPE}/.default" \
-d "grant_type=client_credentials"

2. Submit a Lead

Terminal window
curl -X POST "https://leads-sandbox.alleviate.com/graphql" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"query": "mutation CreateLead($input: LeadInput!) { createLead(input: $input) { id resultCode note partnerLeadId bidValue } }",
"variables": {
"input": {
"firstName": "John",
"lastName": "Test",
"email": "john.doe@gmail.com",
"homePhone": "8166999999",
"address1": "1230 Public Lane 456",
"city": "Dallas",
"state": "OH",
"zipCode": "65542",
"dateOfBirth": "1970-01-26",
"socialSecurityNumber": "123456789",
"incomeSourceId": 1,
"residenceTypeId": 2,
"payFrequencyId": 1,
"monthlyIncome": 4000,
"loanAmount": 5000,
"loanPurposeId": 1,
"siteURL": "yoursite.com",
"clientIP": "107.77.220.32",
"affiliateAppID": "YOUR-AFFILIATE-APP-ID",
"leadId": "YOUR-EXTERNAL-LEAD-ID"
}
}
}'

3. Read the Completed Result

createLead returns after workflow completion:

{
"data": {
"createLead": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"resultCode": 1015,
"note": "Lead processing complete",
"partnerLeadId": "YOUR-EXTERNAL-LEAD-ID",
"bidValue": "125.00"
}
}
}

4. Submit to CRM (When Needed)

If your partner configuration uses manual CRM submission, call submitLead for qualified leads (1013-1017):

Terminal window
curl -X POST "https://leads-sandbox.alleviate.com/graphql" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"query": "mutation SubmitLead($input: SubmitLeadInput!) { submitLead(input: $input) { leadId statusCode crmRecordId crm } }",
"variables": {
"input": {
"leadId": "550e8400-e29b-41d4-a716-446655440000"
}
}
}'

CRM Behavior by Mode

ModecreateLead behaviorCRM submission path
Manual CRM submissionReturns completed workflow resultPartner calls submitLead for qualified results (1013-1017)
Automatic CRM submissionReturns completed workflow resultQualified leads are automatically submitted during processing

TypeScript Example (Axios)

import axios from 'axios';
const API_URL = 'https://leads-sandbox.alleviate.com/graphql';
interface LeadInput {
firstName: string;
lastName: string;
email: string;
homePhone: string;
address1: string;
city: string;
state: string;
zipCode: string;
dateOfBirth?: string;
socialSecurityNumber?: string;
incomeSourceId?: number;
residenceTypeId?: number;
payFrequencyId?: number;
monthlyIncome?: number;
loanAmount?: number;
loanPurposeId?: number;
siteURL?: string;
clientIP?: string;
affiliateAppID?: string;
leadId?: string;
}
interface CreateLeadResponse {
id: string;
resultCode: number;
note: string;
partnerLeadId: string | null;
bidValue: string | null;
}
interface GraphQLResponse<T> {
data: T;
errors?: Array<{ message: string }>;
}
async function createLead(
accessToken: string,
input: LeadInput
): Promise<CreateLeadResponse> {
const mutation = ` mutation CreateLead($input: LeadInput!) {
createLead(input: $input) {
id
resultCode
note
partnerLeadId
bidValue
}
}
`;
const response = await axios.post<GraphQLResponse<{ createLead: CreateLeadResponse }>>(
API_URL,
{ query: mutation, variables: { input } },
{
headers: {
Authorization: `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
}
);
if (response.data.errors?.length) {
throw new Error(response.data.errors[0].message);
}
return response.data.data.createLead;
}

Optional getLeadStatus Usage

Use getLeadStatus for status lookups, reconciliation, and troubleshooting by lead ID. It is not required in the standard createLead request path.

What’s Next?

  1. Use Sandbox Test Archetypes to test every result code with deterministic, repeatable outcomes.
  2. Review Result Codes for outcome handling.
  3. Review Lead Input Schema for field details.