Skip to content

API Reference

Base URL’lar

MaqsadURL
Authorize (brauzer redirect)https://id.sfere.pro/oauth
APIhttps://api.id.sfere.pro

Authorize

Foydalanuvchini yo’naltirish uchun brauzer manzili (server endpoint emas).

GET https://id.sfere.pro/oauth
ParametrMajburiyTavsif
client_idClient ID
redirect_uriRo’yxatdan o’tgan callback (URL-encoded)
response_typeHar doim code

Muvaffaqiyatda ProID redirect_uriga qaytadi:

{redirect_uri}?code=AUTHORIZATION_CODE

code — bir martalik, ~10 daqiqa amal qiladi.


Token almashinuvi

POST https://api.id.sfere.pro/api/v2/oauth/token
Content-Type: application/x-www-form-urlencoded

Request body:

ParametrTypeMajburiyTavsif
grant_typestringauthorization_code
client_idstringClient ID
client_secretstringClient Secret (maxfiy)
redirect_uristringAuthorize’dagi bilan aynan bir xil
codestringAuthorize’dan olingan kod

Javob 200 OK:

{
"token_type": "Bearer",
"expires_in": 864000,
"access_token": "42|Xr8kQ...token..."
}

expires_in — soniyalarda (864000 = ~10 kun).


Foydalanuvchi ma’lumoti

GET https://api.id.sfere.pro/api/user
Authorization: Bearer ACCESS_TOKEN

Javob 200 OK:

{
"id": 128,
"name": "Ali",
"surname": "Valiyev",
"phone_number": "998991234567",
"email": "ali@example.com",
"avatar_full_url": "https://api.id.sfere.pro/storage/avatars/abc.png",
"date_of_birth": "1998-05-12",
"gender": "male",
"avatar": "https://api.id.sfere.pro/storage/avatars/abc.png",
"is_admin": 0
}
MaydonTypeIzoh
idintegerFoydalanuvchi ID
name / surnamestringIsm / familiya
phone_numberstring998XXXXXXXXX formatida
emailstring | nullEmail (bo’lmasligi mumkin)
avatar_full_urlstring | nullAvatar to’liq URL
date_of_birthstring | nullYYYY-MM-DD
genderstring | nullmale / female
is_admininteger1 — admin, 0 — oddiy

Rate limit

Auth va OAuth endpointlari cheklangan. Limitdan oshsa 429 Too Many Requests.

EndpointLimit
POST /api/v2/oauth/token120 / daqiqa (client_id bo’yicha)
Authorize / login oqimi30 / daqiqa (IP bo’yicha)
OTP yuborish3 / daqiqa (telefon bo’yicha)