Join WhatsApp Channel: Daily Rates & Alerts
Sarafa.pk Logo
Sarafa.pkPakistan Gold Market
HomeLive ARY GoldLIVEGold RatesSilver RatesJewelryJewellersSarafa BazaarProductsPrice ChartsTools

Your most trusted source for real-time gold and silver rates in Pakistan. We provide accurate, up-to-the-minute market data from all major Sarafa Bazars across the country to help you make informed investment decisions.

zubyrbutt@gmail.com
+923471468300
Karachi, Pakistan

Quick Links

  • •Gold Rate Today
  • •Silver Rate Today
  • •Live ARY Gold Rate
  • •Jewelry Marketplace
  • •Jewelers Directory
  • •About Us
  • •Contact Us

Resources

  • •Gold Calculator
  • •Zakat Calculator
  • •Market History
  • •Developers API
  • •Blog
  • •Market Insights
  • •FAQs
  • •Download App

Gold Rates by City

KarachiLahoreIslamabadPeshawarQuettaMultanFaisalabadRawalpindiHyderabadGujranwalaSialkotBahawalpurSargodhaSukkur
View All

Silver Rates by City

KarachiLahoreIslamabadPeshawarQuettaMultanFaisalabadRawalpindiHyderabadGujranwalaSialkotBahawalpurSargodhaSukkur
View All
Sarafa.pk
Sarafa.pk

© 2026 Sarafa.pk. All rights reserved.

Privacy PolicyTerms of ServiceDisclaimerSitemap

Developer Docs

API Access Documentation

This page defines the production API key flow, security rules, endpoint catalog, and testing standards. Production API base URL: https://api.sarafa.pk

Create API KeyDeveloper Home

Loading API access workspace...

Live API Tester

Test your API key with a real request against the production API host (https://api.sarafa.pk) and inspect status, rate-limit headers, and response payload.

Endpoint

https://api.sarafa.pk/api/v1/public-rates/gold/cities/karachi

cURL

curl -X GET "https://api.sarafa.pk/api/v1/public-rates/gold/cities/karachi" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "X-Client-Platform: server"

Access Rules

  • Only authenticated users can create API keys.
  • API keys are valid only for city-wise gold/silver rate endpoints (single-city and multi-city).
  • Every request must include X-API-Key header and use the production API host https://api.sarafa.pk.
  • For web clients, configure allowed website origins and keep web platform enabled.
  • For mobile/server clients, use X-Client-Platform: mobile or server.
  • For multi-city calls, pass comma-separated city slugs in slugs query param (maximum 50).
  • Daily quota is enforced per key (429 on exceed).
  • Raw key is shown only once during creation.

Endpoint Catalog

Production API Base URL: https://api.sarafa.pk

MethodPathAuthPurpose
POST/api/v1/auth/v2/loginNoGet JWT token
POST/api/v1/api-keys/Bearer JWTCreate API key
GET/api/v1/api-keys/Bearer JWTList API keys
PATCH/api/v1/api-keys/{key_id}/accessBearer JWTUpdate domains and platform access
POST/api/v1/api-keys/{key_id}/revokeBearer JWTRevoke key
GET/api/v1/api-keys/{key_id}/usage?days=30Bearer JWTDaily usage report
GET/api/v1/public-rates/gold/cities/{location_slug}X-API-KeySingle-city gold rate
GET/api/v1/public-rates/gold/cities?slugs={karachi,lahore}X-API-KeyMulti-city gold rates
GET/api/v1/public-rates/silver/cities/{location_slug}X-API-KeySingle-city silver rate
GET/api/v1/public-rates/silver/cities?slugs={karachi,lahore}X-API-KeyMulti-city silver rates

Rate Limit Headers

  • X-RateLimit-Limit-Day - Daily quota
  • X-RateLimit-Remaining-Day - Remaining requests today
  • X-RateLimit-Reset - Reset timestamp

Platform & Origin Headers

  • X-Client-Platform: server | mobile | web
  • Web requests are validated against allowed origins using the Origin header.
  • Mobile and server requests should set X-Client-Platform and usually do not send Origin.

cURL Examples

# 1) Login (Get JWT)
curl -X POST "https://api.sarafa.pk/api/v1/auth/v2/login" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "username=03001234567&password=YourPassword"

# 2) Create API key
curl -X POST "https://api.sarafa.pk/api/v1/api-keys/" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Backend Server Key"}'

# 3) Call city gold rate
curl -X GET "https://api.sarafa.pk/api/v1/public-rates/gold/cities/karachi" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "X-Client-Platform: server"

# 4) Call city silver rate
curl -X GET "https://api.sarafa.pk/api/v1/public-rates/silver/cities/lahore" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "X-Client-Platform: server"

# 5) Call multi-city gold rates
curl -X GET "https://api.sarafa.pk/api/v1/public-rates/gold/cities?slugs=karachi,lahore,islamabad" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "X-Client-Platform: mobile"

# 6) Call multi-city silver rates
curl -X GET "https://api.sarafa.pk/api/v1/public-rates/silver/cities?slugs=karachi,lahore,islamabad" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "X-Client-Platform: mobile"

# 7) Web origin-restricted request
curl -X GET "https://api.sarafa.pk/api/v1/public-rates/gold/cities/karachi" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Origin: https://app.example.com"

Error Contract

StatusMeaning
401Missing/invalid auth or API key
403Key revoked/disabled/forbidden
404City or key resource not found
429Daily limit exceeded
{ "detail": "message" }

Testing Checklist (Production QA)

  1. API key creation succeeds after JWT login.
  2. Raw key appears only in create response, never in list endpoint.
  3. Origin allowlist is enforced for web requests.
  4. Platform restrictions block disallowed client types.
  5. Gold/silver city endpoints return 200 with valid key.
  6. Multi-city endpoints return correct requested_count, count, data, and not_found.
  7. Missing/invalid key returns 401.
  8. Revoked key returns 403.
  9. 429 is returned when daily quota is exceeded with reset header.
  10. Usage endpoint reports accurate today hits and remaining quota.
  11. No quota bypass under high concurrency.