Quickstart
This walkthrough validates authentication and lead creation in staging. You need credentials for that environment and curl; the examples also use jq to read the token and identifier.
-
Configure the environment
Keep credentials out of your source code:
Terminal window export CREDITAS_AUTH_URL="https://auth-staging.creditas.com.br/api/affiliate_clients/tokens"export AUTO_EQUITY_BASE_URL="https://stg-api.creditas.io/mx/b2b/autoequity"export CREDITAS_CONSUMER_KEY="<consumer-key>"export CREDITAS_CONSUMER_SECRET="<consumer-secret>" -
Generate an access token
Terminal window export CREDITAS_ACCESS_TOKEN="$(curl --fail-with-body --silent --show-error \--request POST "$CREDITAS_AUTH_URL" \--header "Accept: application/json" \--header "Accept-Version: v1" \--header "Content-Type: application/json" \--data "{\"consumer_key\": \"$CREDITAS_CONSUMER_KEY\",\"consumer_secret\": \"$CREDITAS_CONSUMER_SECRET\"}" |jq -er '.access_token')" -
Create a test lead
Terminal window curl --fail-with-body --silent --show-error \--request POST "$AUTO_EQUITY_BASE_URL/api/leads" \--header "Authorization: Bearer $CREDITAS_ACCESS_TOKEN" \--header "Content-Type: application/json" \--data '{"phone": "9128463859","email": "pq-approved@creditas.com","loanAmount": 120000,"term": 24}' |tee lead.jsonA successful response returns
201 Createdand a UUIDid. Keep it for the next operations:Terminal window export AUTO_EQUITY_LEAD_ID="$(jq -er '.id' lead.json)" -
Continue the application
Save the applicant’s personal information, complete the address, financial, and vehicle data, then request the PIN and offer.
Review the flow and statuses to understand the complete lead lifecycle.