SafeDine API Documentation
Access restaurant safety scores, inspection data, and nearby restaurant information programmatically. Built for developers and businesses.
OpenAPI Specification
Full machine-readable API spec for use with Swagger UI, Postman, or code generators.
View openapi.jsonAuthentication
All API requests require a Bearer token in the Authorization header. API keys use the prefix sk_live_.
curl -H "Authorization: Bearer sk_live_your_key_here" \
https://safedine.ai/api/v1/restaurants?state=FL&limit=5Create API keys from your account dashboard. A Pro subscription is required to generate keys. Key management endpoints (/api/v1/keys) use Supabase session authentication instead of API keys.
Endpoints
/api/v1/restaurantsSearch and filter restaurants by name, location, cuisine, and safety score.
search — Free-text search
state — Two-letter state code
city — City name
cuisine — Cuisine type
minScore, maxScore — Score range (0-100)
limit — Results per page (max 100, default 20)
curl -H "Authorization: Bearer sk_live_..." \
"https://safedine.ai/api/v1/restaurants?state=NY&cuisine=Italian&minScore=80"/api/v1/restaurants/{id}Get a single restaurant with full inspection history and violation details.
curl -H "Authorization: Bearer sk_live_..." \
https://safedine.ai/api/v1/restaurants/nyc-40365147/api/v1/restaurants/nearbyFind restaurants near a geographic coordinate, sorted by distance.
lat, lng — Coordinates (required)
radius — Miles (max 25, default 5)
limit — Results (max 50, default 20)
curl -H "Authorization: Bearer sk_live_..." \
"https://safedine.ai/api/v1/restaurants/nearby?lat=40.7128&lng=-74.0060&radius=2"/api/v1/keysCreate a new API key (requires Pro subscription, session auth).
/api/v1/keysList all your API keys (session auth).
/api/v1/keys/{id}Revoke and delete an API key (session auth).
Rate Limiting
Rate limits are enforced per API key based on your plan tier. Every response includes headers showing your current usage:
X-RateLimit-Limit — Maximum requests per day
X-RateLimit-Remaining — Requests remaining today
X-RateLimit-Reset — Unix timestamp when the limit resets
When you exceed your daily limit, you receive a 429 response. Overage requests are billed at $0.005/request beyond your daily limit.
Error Handling
All errors return a consistent JSON format:
{
"error": "Human-readable error message",
"code": "MACHINE_READABLE_CODE"
}UNAUTHORIZED — Missing or invalid API key
RATE_LIMITED — Daily request limit exceeded
NOT_FOUND — Resource does not exist
VALIDATION_ERROR — Invalid request parameters
INTERNAL_ERROR — Unexpected server error
API Pricing
| Tier | Daily Limit | Price |
|---|---|---|
| Free | 50 requests | Free |
| Starter | 1,000 requests | $99/mo |
| Business | 10,000 requests | $499/mo |
| Enterprise | Unlimited | Contact sales |
All paid tiers include $0.005/request overage beyond the daily limit.
Ready to get started?
Create an account and generate your API key in minutes.