Skip to content

Migrate from Salesforce Create Prospect API

This guide walks you through migrating your integration from the legacy TPL Salesforce Create Prospect REST API to the new Marketing Lead Automation Service (MLAS) GraphQL API.

Quick Migration Checklist

Use this checklist to track your migration progress:

  • Obtain new MLAS credentials (Client ID, Client Secret, Tenant ID, Scope) from Alleviate
  • Replace Salesforce OAuth 2.0 token flow with Microsoft Entra ID OAuth 2.0 Client Credentials flow
  • Update your endpoint URL from the Salesforce Apex REST endpoint to the MLAS GraphQL endpoint
  • Reformat your payload from the prospects JSON array to a GraphQL createLead mutation with variables
  • Map your existing fields to the new MLAS field names (see Field Mapping below)
  • Remove fields that are no longer needed (offer_code, trusted_cert, marketing_lead_source, Admintesting, etc.)
  • Test end-to-end in the Sandbox environment
  • Switch to the Production endpoint when ready to go live

What’s Changing

Here is a high-level summary of the key differences between the old and new services.

API Style & Endpoint

Old Service (Salesforce)New Service (MLAS)
ProtocolREST (POST) — Salesforce Apex RESTGraphQL
Sandbox URLN/A (single endpoint, test via Admintesting flag)https://leads-sandbox.alleviate.com/graphql
Production URLhttps://tp12.my.salesforce.com/services/apexrest/nu_dse/Create Prospecthttps://leads.alleviate.com/graphql

Authentication

Old Service (Salesforce)New Service (MLAS)
Auth MethodSalesforce OAuth 2.0 Client Credentials (/services/oauth2/token)Microsoft Entra ID OAuth 2.0 Bearer token
Token Endpointhttps://tpl2.my.salesforce.com/services/oauth2/tokenhttps://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0/token
Auth HeaderAuthorization: Bearer {salesforce_access_token}Authorization: Bearer {entra_access_token}

Payload & Content

Old Service (Salesforce)New Service (MLAS)
Content-Typeapplication/jsonapplication/json
Payload Formatprospects JSON array, mixed-case field namesGraphQL mutation, camelCase variables
Batch SupportMultiple prospects per requestOne lead per createLead mutation

Behavior

Old Service (Salesforce)New Service (MLAS)
Lead FlowPOST creates a Prospect record in Salesforce CRMcreateLead mutation processes, qualifies, and returns completed workflow results
TestingAdmintesting field set to "true" in payloadUse the dedicated Sandbox environment
ResponseReturns Salesforce recordIdReturns id, resultCode, note, partnerLeadId, bidValue

Step 1: Get Your New Credentials

The old service used Salesforce OAuth 2.0 with a client_id and client_secret issued by Salesforce. MLAS uses OAuth 2.0 Client Credentials via Microsoft Entra ID with a different set of credentials.

You will receive the following credentials during onboarding:

CredentialDescription
Tenant IDAlleviate’s Azure AD tenant identifier
Client IDYour application’s unique identifier
Client SecretYour application’s secret key
Debt Core App IDUsed to construct the API scope (api://{DEBT_CORE_APP_ID}/.default)

Environment-Specific Values

The Tenant ID is the same across all environments. The Debt Core App ID differs per environment:

ValueSandboxProduction
Tenant ID8797fa3f-ba90-4187-97fb-6ab892ea90358797fa3f-ba90-4187-97fb-6ab892ea9035
Debt Core App IDaba793eb-f395-4f86-be59-7a7d0c1bfdb09060a1d0-da3b-4676-ad64-ff64465cce41

For full authentication setup details, see the Authentication page.


Step 2: Update Your Endpoint URL

Replace the old Salesforce Apex REST endpoint with the MLAS GraphQL endpoint.

EnvironmentURL
Sandboxhttps://leads-sandbox.alleviate.com/graphql
Productionhttps://leads.alleviate.com/graphql

For more details on environments, see the Environments page.


Step 3: Update Authentication

The old service required two steps: first obtain a Salesforce access token, then use it in the Create Prospect request:

Old Authentication (Salesforce OAuth 2.0)
# Step 1: Get a Salesforce access token
curl -X POST "https://tpl2.my.salesforce.com/services/oauth2/token\
?grant_type=client_credentials\
&client_id=YOUR_SF_CLIENT_ID\
&client_secret=YOUR_SF_CLIENT_SECRET"
# Step 2: Use the token in your API request
curl -X POST "https://tp12.my.salesforce.com/services/apexrest/nu_dse/Create Prospect" \
-H "Authorization: Bearer {salesforce_access_token}" \
-H "Content-Type: application/json" \
-d '{ "prospects": [ { ... } ] }'

MLAS uses a standard OAuth 2.0 Bearer token from Microsoft Entra ID in the Authorization header. The flow is similar (obtain a token, then call the API), but the token endpoint and parameters differ:

Use the same authentication flow across languages: request an Entra ID token, then pass it as Bearer in the GraphQL request.

Step 1: Get an access token
curl -X POST "https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id={CLIENT_ID}" \
-d "client_secret={CLIENT_SECRET}" \
-d "scope=api://{DEBT_CORE_APP_ID}/.default"
Step 2: Use the token in your GraphQL request
curl -X POST "https://leads-sandbox.alleviate.com/graphql" \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{ "query": "...", "variables": { ... } }'

Step 4: Update Your Payload

The biggest change is moving from a Salesforce prospects JSON array to a GraphQL mutation with typed variables.

Old Payload (Salesforce Create Prospect)

Python - Old Salesforce Create Prospect request
import requests
import json
url = "https://tp12.my.salesforce.com/services/apexrest/nu_dse/Create Prospect"
payload = json.dumps({
"prospects": [
{
"offer_code": "abc12346",
"trusted_cert": "abc12346",
"first_name": "Lisa",
"last name": "Test",
"address": "345 S Meridian Ave",
"city": "Irvine",
"state": "CA",
"zip_code": "62385",
"home_phone": "7144834295",
"cell_phone": "9495661083",
"email": "lisa.test@example.com",
"loan amount": "12456",
"lead_source": "Personal Loan",
"dob": "1985-03-15",
"ssn": "123-45-6789",
"unsecured debt": "5000",
"Admintesting": "true",
"pay_frequency": "Bi-Weekly",
"monthly_gross income": "5000",
"marketing_lead_source": "Static Value Provided by TPL",
"Sub_ID_1_c": "tracking-value-1",
"Sub_ID_2c": "tracking-value-2",
"Sub_ID_3_c": "tracking-value-3"
}
]
})
headers = {
"Authorization": f"Bearer {salesforce_access_token}",
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers, data=payload)
print(response.json())

New Payload (GraphQL)

Use the same GraphQL mutation payload across languages. Only the HTTP client syntax changes. Note that the full list of available fields can be found on the API reference page.

New MLAS request (cURL)
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": "Lisa",
"lastName": "Test",
"dateOfBirth": "1985-03-15",
"email": "lisa.test@example.com",
"homePhone": "7144834295",
"cellPhone": "9495661083",
"address1": "345 S Meridian Ave",
"city": "Irvine",
"state": "CA",
"zipCode": "62385",
"loanAmount": 12456,
"socialSecurityNumber": "123456789",
"grossAnnualIncome": 60000,
"leadId": "tracking-value-1",
"trustedformCertificateID": "abc12346"
}
}
}'

Field Mapping

Use this table to map your existing Salesforce Create Prospect fields to the new MLAS GraphQL input fields.

Direct Field Mappings

These fields exist in both services. Note the change from mixed-case field names (some with spaces) to consistent camelCase naming.

Old Field (Salesforce)New Field (MLAS LeadInput)Type ChangeNotes
first_namefirstNameString → StringNo change in type
last namelastNameString → StringOld field had a space instead of underscore
addressaddress1String → StringRenamed; MLAS also supports address2 for apt/suite
citycityString → StringNo change
statestateString → StringTwo-letter code (e.g., "CA")
zip_codezipCodeString → StringFive-digit format
home_phonehomePhoneString → String10-digit format, no country code
cell_phonecellPhoneString → String10-digit format, no country code
emailemailString → StringNo change
loan amountloanAmountString → IntNow an integer in whole dollars (e.g., 12456 not "12456")
dobdateOfBirthString → StringSame YYYY-MM-DD format; field renamed
ssnsocialSecurityNumberString → String9 digits, no dashes (e.g., "123456789" not "123-45-6789")
unsecured debtestimatedDebtString → IntNow an integer in whole dollars (e.g., 5000 not "5000")
monthly_gross incomemonthlyIncomeString → IntNow an integer in whole dollars (e.g., 5000 not "5000")
trusted_certtrustedformCertificateIDString → StringTrustedForm certificate UUID or URL

New Required Fields

These fields are required in MLAS but may have been handled differently in the old service:

New FieldTypeDescriptionOld Equivalent
dateOfBirthString!Applicant’s date of birth in YYYY-MM-DD format (e.g., "1985-03-15")dob (if provided)

Removed / Internally Handled Fields

These old Salesforce fields are no longer part of your request. MLAS handles them automatically or they are no longer applicable:

Old FieldWhat Happens in MLAS
offer_codeNo longer needed. Tracking is handled via leadId, ref, and authenticated partner identity.
trusted_certReplaced by trustedformCertificateID. Pass the TrustedForm certificate UUID or full URL.
marketing_lead_sourceAutomatically determined from your authenticated application credentials.
lead_sourceReplaced by leadSourceId, which is automatically set from your authenticated app identity.
AdmintestingNot applicable. Use the Sandbox environment for testing instead of a flag in the payload.
pay_frequencyNot currently a field in the MLAS LeadInput. Contact Alleviate if this data is needed.

Tracking / Sub-ID Mappings

Old FieldSuggested MLAS EquivalentNotes
Sub_ID_1_c through Sub_ID_3_cleadId, refUse leadId for your primary external tracking ID and ref for a secondary reference. These values are returned in responses as partnerLeadId.

Additional Fields Available in MLAS

MLAS supports many more fields than the old service for enhanced lead qualification. See the full Lead Input Schema for details. Key optional additions include:

FieldTypeDescription
socialSecurityNumberStringRequired for credit pull and qualification (9 digits, no dashes)
grossAnnualIncomeIntGross annual income in whole dollars
monthlyIncomeIntMonthly income in whole dollars
residenceTypeIdIntHome Owner (1), Rent (2), Living with Family (3), Other (4)
incomeSourceIdIntEmployed (1), Social Security (2), Pension (3), etc.
loanPurposeIdIntDebt Consolidation (1), Home Improvement (2), etc.
termsConsentBooleanMust be true for lead to be processed
coApplicantBooleanSet to true and populate co-applicant fields if applicable

Step 5: Understand the New Lead Flow

Old Flow

POST /services/oauth2/token → Get Salesforce access token
POST /services/apexrest/nu_dse/Create Prospect → Prospect record created in Salesforce → Response with recordId

New Flow

POST /oauth2/v2.0/token → Get Entra ID access token
POST /graphql (createLead mutation) → Lead is processed and qualified → Response with final result

createLead handles deduplication, credit pull, and qualification, then returns the completed result.

CRM submission behavior is partner-configuration based:

  • Some partners have automatic CRM submission for qualified leads.
  • Others use manual submitLead for qualified leads (1013-1017).

Here is a complete example:

Complete MLAS lead submission
import requests
BASE_URL = "https://leads-sandbox.alleviate.com/graphql"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
response = requests.post(BASE_URL, json={
"query": """
mutation CreateLead($input: LeadInput!) {
createLead(input: $input) {
id
resultCode
note
partnerLeadId
bidValue
}
}
""",
"variables": {
"input": {
"firstName": "Lisa",
"lastName": "Test",
"dateOfBirth": "1985-03-15",
"email": "lisa.test@example.com",
"homePhone": "7144834295",
"cellPhone": "9495661083",
"address1": "345 S Meridian Ave",
"city": "Irvine",
"state": "CA",
"zipCode": "62385",
"loanAmount": 12456,
"socialSecurityNumber": "123456789",
"grossAnnualIncome": 60000,
"leadId": "your-tracking-id-123",
"trustedformCertificateID": "https://cert.trustedform.com/abcd1234"
}
}
}, headers=headers)
result = response.json()
lead = result["data"]["createLead"]
print(f"Lead ID: {lead['id']}")
print(f"Result Code: {lead['resultCode']}")
print(f"Note: {lead['note']}")
print(f"Partner Lead ID: {lead['partnerLeadId']}")
print(f"Bid Value: {lead['bidValue']}")

Response Format Changes

Old Response (Salesforce — Success)

{
"prospects": [
{
"recordId": "aexa7000001Vv1UAAS"
}
]
}

New Response (createLead — Success)

{
"data": {
"createLead": {
"id": "d5faed99-51c3-4181-959e-5557d1eef042",
"resultCode": 1020,
"note": "Lead processing complete",
"partnerLeadId": "your-tracking-id-123",
"bidValue": "$25.00"
}
}
}

Key Response Fields

FieldDescription
idUnique internal MLAS lead identifier (replaces Salesforce recordId)
resultCodeFinal processing status code (see Result Codes)
noteHuman-readable description of the result
partnerLeadIdYour leadId echoed back for correlation
bidValueCalculated bid amount for qualified leads (null if not qualified)

Error Handling Changes

Old Error Responses

The Salesforce API returned errors in various formats depending on the failure point (OAuth, Apex REST, or field validation). Common patterns included Salesforce-specific exception messages and HTTP status codes.

New Error Responses

MLAS returns standard GraphQL error responses:

{
"errors": [
{
"message": "Unauthorized",
"extensions": {
"code": "UNAUTHENTICATED"
}
}
]
}

Frequently Asked Questions

Do I still need to set Admintesting for test leads?

No. Use the Sandbox environment (https://leads-sandbox.alleviate.com/graphql) for all testing. The sandbox is completely isolated from production. There is no need for a test flag in the payload.

What happened to marketing_lead_source?

This is now automatically determined from your authenticated application credentials. When you authenticate with your Client ID, MLAS knows your partner identity and assigns the correct lead source. You no longer need the static value provided by TPL.

What happened to offer_code and trusted_cert?

offer_code is no longer needed — tracking is handled via leadId and ref. trusted_cert has been replaced by trustedformCertificateID, which accepts the TrustedForm certificate UUID or full URL.

How do I handle the loan amount type change?

The old service accepted loan amount as a string (e.g., "12456"). MLAS expects loanAmount as an integer (e.g., 12456). Remove any string wrapping and pass the numeric value directly.

How do I handle the SSN format change?

The old service accepted ssn with dashes (e.g., "123-45-6789"). MLAS expects socialSecurityNumber as 9 digits with no dashes (e.g., "123456789"). Strip the dashes before sending.

What happened to dob?

The field has been renamed to dateOfBirth and uses the same YYYY-MM-DD format. It is a required field in MLAS.

What about pay_frequency?

This field is not currently part of the MLAS LeadInput schema. If your integration requires pay frequency data, contact the Alleviate engineering team.

How do I handle monthly_gross income and unsecured debt?

monthly_gross income maps to monthlyIncome (integer, whole dollars). unsecured debt maps to estimatedDebt (integer, whole dollars). Both change from strings to integers — remove string wrapping and pass numeric values.

The old API supported multiple prospects per request. Does MLAS?

No. MLAS processes one lead per createLead mutation. If you previously batched multiple prospects in a single request, you will need to send each as a separate GraphQL mutation.

How do I map my Sub_ID values?

Use leadId for your primary external tracking identifier (returned as partnerLeadId in responses) and ref for a secondary reference. If you need additional tracking parameters, contact Alleviate engineering.

Do I need to implement polling?

No. createLead now waits for workflow completion and returns the completed result.

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


Need Help?

If you run into issues during migration, contact the Alleviate engineering team. Be sure to include:

  • Your Partner/Client ID
  • The environment you’re testing against (Sandbox or Production)
  • The full request and response (with sensitive data redacted)
  • Any error messages you’re receiving

Next Steps