# Quick Start ## What is the Dinie API? The Dinie API allows partners to integrate credit products directly into their platforms. Through a single REST API, you can register customers, present credit offers, originate loans, and track payments -- all without needing to build credit infrastructure from scratch. The API follows a resource-oriented design with predictable URLs, JSON request and response bodies, and standard HTTP methods and status codes. ## Prerequisites Before making your first API call, you need: - **Sandbox credentials** -- a `client_id` and `client_secret` pair provided by your Dinie account manager - An HTTP client (cURL, Postman, or any programming language with HTTP support) - Optionally, one of Dinie's official SDKs (Node.js, Python, or Ruby) > **Info:** Contact your Dinie account manager to request sandbox credentials. Sandbox and production credentials are separate and not interchangeable. ## Base URLs | Environment | Base URL | | --- | --- | | Production | `https://api.dinie.com.br/v3` | | Sandbox | `https://sandbox.api.dinie.com.br/v3` | All examples in this guide use the sandbox URL. Replace it with the production URL when you are ready to go live. ## Your First API Call The example below initializes the client with your credentials and registers a business -- the most common operation to start an integration. The SDKs exchange the credentials for an access token automatically. ```typescript Node.js import Dinie from "dinie"; const dinie = new Dinie({ clientId: process.env.DINIE_CLIENT_ID, clientSecret: process.env.DINIE_CLIENT_SECRET, environment: "sandbox", }); const customer = await dinie.customers.create({ external_partner_id: "user-42", cpf: "123.456.789-00", name: "Joao Silva", email: "joao@example.com", phone: "+5511999999999", cnpj: "12.345.678/0001-90", trading_name: "Loja do Joao", }); console.log(customer.id); // "cust_550e8400..." console.log(customer.status); // "pending_kyc" ``` ```ruby Ruby require "dinie" dinie = Dinie::Client.new( client_id: ENV["DINIE_CLIENT_ID"], client_secret: ENV["DINIE_CLIENT_SECRET"], environment: "sandbox" ) customer = dinie.customers.create( external_partner_id: "user-42", cpf: "123.456.789-00", name: "Joao Silva", email: "joao@example.com", phone: "+5511999999999", cnpj: "12.345.678/0001-90", trading_name: "Loja do Joao" ) puts customer.id # "cust_550e8400..." puts customer.status # "pending_kyc" ``` ```python Python import os from dinie import Dinie dinie = Dinie( client_id=os.environ["DINIE_CLIENT_ID"], client_secret=os.environ["DINIE_CLIENT_SECRET"], environment="sandbox", ) customer = dinie.customers.create( external_partner_id="user-42", cpf="123.456.789-00", name="Joao Silva", email="joao@example.com", phone="+5511999999999", cnpj="12.345.678/0001-90", trading_name="Loja do Joao", ) print(customer.id) # "cust_550e8400..." print(customer.status) # "pending_kyc" ``` ```bash cURL # 1. Get an access token curl -X POST https://sandbox.api.dinie.com.br/v3/auth/token \ -u "$DINIE_CLIENT_ID:$DINIE_CLIENT_SECRET" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=client_credentials" # 2. Register a business with the token curl -X POST https://sandbox.api.dinie.com.br/v3/customers \ -H "Authorization: Bearer dinie_at_..." \ -H "Content-Type: application/json" \ -d '{ "external_partner_id": "user-42", "cpf": "123.456.789-00", "name": "Joao Silva", "email": "joao@example.com", "phone": "+5511999999999", "cnpj": "12.345.678/0001-90", "trading_name": "Loja do Joao" }' ``` The customer is created with status `pending_kyc` and a list of required documents in `customer.kyc`. The next step is to complete the registration and wait for credit offers. ## Next Steps Now that you have made your first API call, follow the integration guides: 1. **[Registration and Offers](/guides/customer-registration)** -- register customers, complete KYC, and receive credit offers 2. **[Simulation and Loan Origination](/guides/credit-workflow)** -- simulate installments, formalize loans, and track through disbursement 3. **[Webhooks](/apis/concepts/webhooks)** -- set up endpoints to receive real-time notifications 4. **[Going to Production](/guides/going-to-production)** -- checklist to launch your integration