{"openapi":"3.1.0","info":{"title":"Muthoot Gold Loan CRM: Lead API","version":"1.0.0","description":"Create leads in the CRM from the website or a partner, and look up branches. Rates and amounts shown to customers are indicative until confirmed at the branch."},"servers":[{"url":"https://console.systems-demo.bluemachines.ai"}],"components":{"securitySchemes":{"partnerKey":{"type":"apiKey","in":"header","name":"x-partner-key","description":"Issued per partner. Keep it on a server: never ship it in browser code."}},"schemas":{"Lead":{"type":"object","required":["phone"],"properties":{"phone":{"type":"string","description":"10-digit Indian mobile number. +91, spaces and dashes are accepted. The only required field.","example":"9876543210"},"name":{"type":"string","maxLength":80,"description":"Defaults to \"New customer\". A different name on a known number is kept as an alias.","example":"Lakshmi"},"source":{"type":"string","enum":["WEBSITE","MARKETING_CAMPAIGN","MARKETING_INBOUND","PARTNER","WALK_IN","FIELD","AI_AMITABH","TOLL_FREE","REFERRAL","WHATSAPP","INTUITION_TOPUP","GPAY","PHONEPE","DIALABANK"],"description":"Where the lead came from. Partner names are stored as PARTNER with a sub-source.","example":"WEBSITE"},"subSource":{"type":"string","maxLength":60,"description":"For example \"hero form\", \"callback\", an ad set, a QR code or a partner name.","example":"hero form"},"campaign":{"type":"string","maxLength":80,"description":"Campaign name. Send the utm_campaign value. Kept with the first touch.","example":"festive-gold"},"pincode":{"type":"string","pattern":"^[1-9][0-9]{5}$","description":"Used to route the lead to a branch. Optional: without it the lead waits in the contact-centre queue.","example":"560034"},"branchCode":{"type":"string","description":"Optional. Sets the branch directly. Use a code from Muthoot's branch list.","example":"86"},"language":{"type":"string","enum":["en","hi","mr","bn","kn","ml","te","ta"],"default":"en","description":"Language for calls and WhatsApp."},"service":{"type":"string","maxLength":40,"description":"Product the customer asked about.","example":"Gold loan"},"amountAsked":{"type":"number","description":"Rupees the customer said they need. Indicative.","example":150000},"grams":{"type":"number","description":"Grams of gold the customer said they have. Indicative.","example":25},"useCase":{"type":"string","enum":["BUSINESS","WEDDING","MEDICAL","EDUCATION","FARMING","PERSONAL","OTHER"],"description":"What the money is for."},"callConsent":{"type":"boolean","default":true,"description":"The customer agreed to be called. Recorded with time and source."},"whatsappConsent":{"type":"boolean","default":true,"description":"The customer agreed to WhatsApp messages. Recorded with time and source."},"contactWindow":{"type":"string","enum":["MORNING","AFTERNOON","EVENING","ANYTIME"],"description":"When the customer prefers to be contacted."}}},"LeadCreated":{"type":"object","properties":{"journeyId":{"type":"string"},"personId":{"type":"string"},"duplicate":{"type":"boolean","description":"true when the mobile number already exists: a touch was added to the existing customer."},"stage":{"type":"string","example":"LEAD"}}},"Error":{"type":"object","properties":{"error":{"type":"string"}}},"Branch":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"pincode":{"type":"string"},"address":{"type":"string"},"city":{"type":"string"},"phone":{"type":"string"},"hours":{"type":"string"}}}}},"paths":{"/leads":{"post":{"summary":"Create a lead","operationId":"createLead","security":[{"partnerKey":[]},{}],"description":"Creates the lead in the CRM and starts the journey. Needs `x-partner-key`. In demo mode a request with `source: \"WEBSITE\"` is accepted without a key (browser use, from an allowed origin). The same mobile number again does not create a second customer.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"},"example":{"phone":"9876543210","name":"Lakshmi","source":"WEBSITE","subSource":"hero form","campaign":"festive-gold","pincode":"560034","language":"kn","grams":25,"amountAsked":150000}}}},"responses":{"200":{"description":"Mobile number already exists: a touch was added (`duplicate: true`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadCreated"}}}},"201":{"description":"New lead created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadCreated"}}}},"400":{"description":"Validation failed. `issues[].path` names each field.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"invalid_request"},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}},"401":{"description":"Missing or wrong x-partner-key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/leads/{id}":{"patch":{"summary":"Add detail to a lead","operationId":"patchLead","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"The `journeyId` returned when the lead was created."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"useCase":{"type":"string","enum":["BUSINESS","WEDDING","MEDICAL","EDUCATION","FARMING","PERSONAL","OTHER"],"description":"What the money is for."},"amountAsked":{"type":"number","description":"Rupees the customer said they need. Indicative.","example":150000},"grams":{"type":"number","description":"Grams of gold the customer said they have. Indicative.","example":25}}}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"journeyId":{"type":"string"}}}}}},"404":{"description":"Unknown lead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/branches":{"get":{"summary":"Branches, optionally near a pincode","operationId":"listBranches","parameters":[{"name":"pincode","in":"query","required":false,"schema":{"type":"string"},"description":"Six digits. Returns the branches in that pincode first, then the same area."}],"responses":{"200":{"description":"Branches.","content":{"application/json":{"schema":{"type":"object","properties":{"pincode":{"type":"string"},"area":{"type":"string"},"exact":{"type":"boolean"},"branches":{"type":"array","items":{"$ref":"#/components/schemas/Branch"}}}}}}}}}},"/config/public":{"get":{"summary":"Indicative gold and interest rates for calculators","operationId":"publicConfig","responses":{"200":{"description":"Indicative values, never a quote.","content":{"application/json":{"schema":{"type":"object","properties":{"goldRatePerGram":{"type":"number"},"interestRatePct":{"type":"number"},"indicative":{"type":"boolean"}}}}}}}}}}}