Your API key is the front door to your account. This guide covers domain binding (so your key only works from your domains), IP allowlisting for server-to-server calls, key rotation when keys leak, and other security best practices.
API keys are the keys to the kingdom — anyone with your key can spend your monthly quota, hit your rate limits, and (if you have enterprise endpoints enabled) make calls that cost real money. This guide walks through the security features the Satta Matka API provides and the practices you should follow on your end.
Before any security feature makes sense, you need to know what you are defending against. The realistic threats to a matka API key are:
.env.The good news: every one of these is mitigated by features the API already provides.
The single most important rule: your API key should never appear in client-side code. Not in a <script> tag, not in a fetch call, not in an environment variable that gets inlined into the bundle.
The correct pattern is to proxy all API calls through your own server. Your server holds the key in an environment variable, adds the auth header, and forwards the response.
// app/api/results/route.ts — Next.js route handler
export async function GET() {
const res = await fetch('https://sattamatkaapi.live/api/results/live', {
headers: { Authorization: `Bearer ${process.env.MATKA_API_KEY}` }
})
return new Response(res.body, {
headers: { 'Content-Type': 'application/json', 'Cache-Control': 's-maxage=30' }
})
}
If you absolutely must call the API directly from the browser (e.g. a static site on GitHub Pages), use a key with strict domain binding (see below) — but treat this as a last resort.
Domain binding tells the API "this key is only allowed to be used from these specific origins". When a request comes in, the API checks the Origin header — if it doesn't match the allowed list, the request is rejected with 403 Origin not allowed.
Configure this in your dashboard: API Keys → Edit → Allowed Domains. Add your production domain(s):
yourdomain.comwww.yourdomain.comapp.yourdomain.comYou can also configure it via the API:
curl -X PATCH https://sattamatkaapi.live/api/keys/{id} \
-H "Authorization: Bearer $MATKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"allowedOrigins": ["yourdomain.com", "www.yourdomain.com"]
}'
Once set, requests from evil.com (or localhost if you forgot to add it) will be rejected. This single feature neutralizes the "stole the key from frontend JS" attack — even if someone reads your key, they cannot use it from their own domain.
For server-to-server calls (no browser, no Origin header), domain binding does not apply — the request has no origin. For these, use IP allowlisting:
curl -X PATCH https://sattamatkaapi.live/api/keys/{id} \
-H "Authorization: Bearer $MATKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"allowedIps": ["203.0.113.42", "203.0.113.43"]
}'
Only requests from these IPs will be accepted. This is the right call for backend cron jobs, webhook receivers, and any non-browser client.
If your backend uses dynamic IPs (e.g. serverless functions on Vercel), do not use IP allowlisting — use a "trusted" key instead, which disables the origin check entirely. Trusted keys should ONLY be used on backends you control; never mark a browser key as trusted.
If you suspect a key has been compromised — leaked to a public repo, exfiltrated by a former employee, or just been in use too long — rotate it. Rotation generates a new key string and revokes the old one immediately.
curl -X POST https://sattamatkaapi.live/api/keys/{id}/rotate \
-H "Authorization: Bearer $MATKA_API_KEY"
The response returns the new key:
{
"ok": true,
"key": "smk_live_newkey...",
"keyPrefix": "smk_live_newk",
"rotatedAt": "2026-08-14T12:00:00Z"
}
Update your environment variables, redeploy, and the old key is dead. Rotation preserves the key's settings (allowedOrigins, allowedIps, plan, quota) — only the secret changes.
Even if you have no reason to suspect compromise, rotate keys every 90 days as a hygiene measure. This limits the blast radius of any leak you don't know about.
Automate the rotation:
// scripts/rotate-key.js
const KEY_AGE_DAYS = 90
const lastRotatedAt = new Date(process.env.KEY_ROTATED_AT)
if (Date.now() - lastRotatedAt.getTime() > KEY_AGE_DAYS * 86400000) {
const newKey = await rotateKey(process.env.MATKA_KEY_ID)
await updateEnvFile('MATKA_API_KEY', newKey.key)
await updateEnvFile('KEY_ROTATED_AT', new Date().toISOString())
await deploy()
console.log('Key rotated successfully')
}
Run this as a quarterly cron job.
Don't use a single key for everything. Issue separate keys for:
Each key has its own quota counter and rate limit — if one key gets rate-limited, the others continue to work.
For trial keys, contractor keys, and any temporary access, set an expiry date. The key automatically stops working after that date — you don't need to remember to revoke it.
curl -X POST https://sattamatkaapi.live/api/keys \
-H "Authorization: Bearer $MATKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"label": "Contractor — 7-day access",
"expiresAt": "2026-08-21T00:00:00Z",
"allowedOrigins": ["contractor-workspace.example.com"]
}'
The dashboard shows per-key request counts and last-used timestamps. Review these weekly — if a key you thought was unused has 5000 requests yesterday, you have a problem.
You can also pull usage via API:
curl -H "Authorization: Bearer $MATKA_API_KEY" \
https://sattamatkaapi.live/api/keys/{id}/usage
Returns daily request counts for the last 30 days, broken down by status code. Hook this into your alerting — if a key's daily usage spikes 5x above its 30-day average, fire an alert.
If you see unusual activity and you are not sure whether the key is compromised, revoke it. Revocation is instant and irreversible — the key stops working immediately.
curl -X POST https://sattamatkaapi.live/api/keys/{id}/revoke \
-H "Authorization: Bearer $MATKA_API_KEY"
After revoking, issue a new key, update your environment, redeploy, and rotate any dependent keys (e.g. webhook secrets).
If you can tick all of these, your API key security posture is in the top 1% of integrations. The remaining 99% of risk is on the API provider's side — and that is what we are here for.
Get 2 days of full access to every endpoint — live results, history, charts, webhooks. No credit card required.
View pricing & start trial