Register customers, upload documentation, complete biometrics, and receive credit offers.
Two processes happen in parallel: the credit analysis (starts automatically upon registration) and KYC verification (the customer completes at their own pace).
| Status | Description |
|---|---|
pending_kyc | Customer created, awaiting documentation and biometrics |
under_review | Documents submitted, analysis in progress |
active | Verified and eligible for credit offers |
Register the business with Dinie. The external_id field is the internal reference from your system that you will use to identify the customer.
const customer = await client.customers.create({
externalId: "partner-ref-123", // Your internal ID
cpf: "123.456.789-00", // Partner's CPF
name: "Joao Silva",
email: "joao@example.com",
phone: "+5511999999999",
cnpj: "12.345.678/0001-90",
tradingName: "Loja do Joao",
});
console.log(customer.status); // "pending_kyc"
console.log(customer.kyc); // Pending verification itemsInfo: If you create a customer with the same CPF/CNPJ and
external_id, the API returns the existing customer (idempotent). A409error only occurs when theexternal_iddiffers for the same CPF/CNPJ.
Upload the documents listed in the customer.kyc array right after registration to speed up the analysis:
import fs from "fs";
await client.customers.uploadDocument(customer.id, {
type: "ccmei",
file: fs.createReadStream("/path/to/ccmei.pdf"),
});
await client.customers.uploadDocument(customer.id, {
type: "selfie",
file: fs.createReadStream("/path/to/selfie.jpg"),
});Supported formats: PDF, JPEG, PNG. Only upload the types listed in the kyc array -- unrecognized types return a 422 error.
The credit analysis starts automatically upon registration. When Dinie generates an offer, you receive the credit_offer.available webhook:
app.post("/webhooks/dinie", express.raw({ type: "application/json" }), (req, res) => {
const event = client.webhooks.unwrap(req.body.toString(), req.headers);
if (event.type === "credit_offer.available") {
const externalId = event.data.external_id;
const amount = event.data.approved_amount;
notifyCustomer(externalId, `Credit offer of R$ ${amount} available`);
}
res.sendStatus(200);
});When the customer has active status and an available offer, they are ready to proceed. Continue to the Simulation and Loan Origination guide.