API documentation
Quickstart
- Create a free account to get an API key and 10 trial credits (no card), or buy a credit pack on the pricing page.
- Store the key on your server (it is shown once). Manage keys and view usage in the dashboard.
- Send a lookup:
curl https://app.lookuprail.com/api/v1/validate_phone \
-H "Authorization: Bearer $LOOKUPRAIL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone":"+12025550147"}'Request and response
Every endpoint takes a JSON body and returns the same envelope: request and metadata describe the call, and the rest is the product’s result. For quick integrations, data.result holds the flat fields. Values below are illustrative.
curl https://app.lookuprail.com/api/v1/validate_phone \
-H "Authorization: Bearer $LOOKUPRAIL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone":"+12025550147"}'{
"success": true,
"data": {
"request": {
"id": "6f1c2a9e-…",
"type": "validate_phone",
"input": { "phone": "+12025550147" },
"timestamp": "2026-01-15T10:30:00.000Z",
"processing_time_ms": 412
},
"metadata": {
"api_version": "v1",
"schema_version": "1",
"credits_used": 1,
"credits_remaining": 9,
"cache_hit": false,
"data_sources": ["telnyx"]
},
"classification": {
"valid": true,
"line_type": "mobile",
"carrier": "Example Wireless",
"country_code": "US",
"ported": false
},
"risk_assessment": {
"risk_level": "LOW",
"risk_factors": [],
"confidence_level": 0.9,
"fraud_score": 10
},
"insights": {
"e164": "+12025550147",
"national_format": "(202) 555-0147",
"lrn": null,
"ocn": null,
"city": null,
"state": null
},
"recommendations": {
"primary_action": "APPROVE",
"secondary_actions": ["Proceed — number is valid and reachable"],
"user_message": "+12025550147 is a valid mobile number on Example Wireless."
},
"result": {
"valid": true,
"e164": "+12025550147",
"national_format": "(202) 555-0147",
"country_code": "US",
"line_type": "mobile",
"carrier": "Example Wireless",
"ported": false
}
}
}Authentication
Pass your key as Authorization: Bearer sk_live_… on every request. Never expose it in browser or mobile code.
Credits and caching
Each fresh lookup costs the product’s credit price. Identical lookups within 7 days are served from cache for 0 credits; send "bypass_cache": true to force a fresh result. Requests that fail with a 4xx error are never charged. Every response includes metadata.credits_used and metadata.credits_remaining, and an X-Request-Id header.
Check your balance any time with GET /api/v1/account.
Rate limits
Each API key can send 60 lookups per minute, counted over a sliding window. REST and MCP calls share the same limit. Past it, requests fail with 429 RATE_LIMIT_EXCEEDED and a Retry-After header giving the seconds to wait. Rate-limited requests are not charged. Need more throughput? Email office@madrank.com.
Errors
Errors use { "success": false, "error": { "code", "message", "hint" } }. The hint says what to do next.
| Status | Code | What to do |
|---|---|---|
| 400 | INVALID_REQUEST / INVALID_INPUT | Fix the request body; nothing is charged. |
| 401 | UNAUTHORIZED | Missing, malformed, or revoked API key. |
| 402 | INSUFFICIENT_CREDITS | Top up at /pricing, then retry. |
| 404 | NOT_FOUND | Unknown product slug. |
| 429 | RATE_LIMIT_EXCEEDED | Wait for the Retry-After header, then retry. |
| 503 | SERVICE_UNAVAILABLE | Upstream provider issue; retry with backoff. |
MCP server
AI agents can call the same products as MCP tools at https://app.lookuprail.com/api/mcp (streamable HTTP), authenticated with the same API key and billed from the same balance. Tools: validate_phone get_account confirm_connection.
claude mcp add --transport http lookuprail https://app.lookuprail.com/api/mcp \ --header "Authorization: Bearer $LOOKUPRAIL_API_KEY"
Endpoints
POST /api/v1/validate_phone · 1 credit
Validate and enrich a phone number via carrier-grade lookup. Returns validity, line type, carrier, ported status and a risk verdict.
| Field | Type | Required |
|---|---|---|
phone | string | yes |
country_hint | string | no |