API cookbook
Get a quote with cURL
The simplest possible pricing request, with idempotency, RFC 7807 error handling, and the trace.
beginnercURL · Bash
Set RATESTACK_KEY to your API key and run:
#!/usr/bin/env bash
set -euo pipefail
KEY="$RATESTACK_KEY"
IDEM=$(uuidgen)
curl -fsS -X POST https://api.ratestack.com/v1/pricing/explain \
-H "X-API-Key: $KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $IDEM" \
-d '{
"borrowers": [{ "fico": 752 }],
"loan": { "loanAmount": 425000, "loanType": "CONFORMING", "amortizationType": "FIXED" },
"property": { "attachmentType": "DETACHED", "constructionMethod": "SITE_BUILT", "projectLegalStructureType": "NONE", "projectClassificationIdentifier": "NA", "pudIndicator": false, "financedNumberOfUnits": 1, "propertyEstateType": "FEE_SIMPLE", "occupancy": "PRIMARY", "state": "CA", "appraisedValue": 532000 },
"transaction":{ "type": "PURCHASE" },
"execution": { "lockPeriodDays": 30 }
}' | jq .The response includes quotes[] with the per-rule trace. The-f flag makes cURL exit non-zero on HTTP errors so your script handles failures correctly. RFC 7807 problem details are returned on errors; the correlationId field is your support ticket key.