مرجع کامل endpointهای بخش «حساب کاربری» در API کلاینت پافرلند.
مشاهدهی اطلاعات حساب و لاگ فعالیت، مدیریت کلیدهای API و کلیدهای SSH.
تنظیمات حساس حساب شامل ایمیل و رمز عبور از طریق API در دسترس نیستند؛ این موارد را از پروفایل کاربری در پنل مدیریت کنید. اطلاعات حساب کاربری احراز هویتشده را برمیگرداند.
پاسخ
نمونه پاسخ واقعی:
{
"object": "user",
"attributes": {
"id": 676,
"admin": false,
"username": "sepehr",
"email": "sepehradmin@gmail.com",
"first_name": "New",
"last_name": "User",
"language": "en"
}
}
GET/api/client/account/api-keysفهرست تمام کلیدهای API متصل به حساب شما را برمیگرداند.
نمونه پاسخ واقعی:
{
"object": "list",
"data": [
{
"object": "api_key",
"attributes": {
"identifier": "ptlc_Tbd5h3HFdQx",
"description": "test",
"allowed_ips": [],
"last_used_at": "2026-09-16T05:38:44+03:30",
"created_at": "2026-09-16T03:50:39+03:30"
}
}
]
}
POST/api/client/account/api-keysیک کلید API جدید با محدودیت اختیاری IP میسازد.
| فیلد | نوع | الزام | توضیح |
|---|
description | string | ✓ | توضیح یا نام کلید. |
allowed_ips | array | — | لیست IPهای مجاز؛ خالی یعنی بدون محدودیت. |
کلید کامل قابلاستفاده، ترکیب attributes.identifier و meta.secret_token است:
Authorization: Bearer <identifier><secret_token>
secret_token فقط هنگام ساخت و یک بار برمیگردد و در هیچ endpoint دیگری قابل دریافت نیست — بلافاصله آن را ذخیره کنید.
curl -X POST "https://pufferland.ir/api/client/account/api-keys" \
-H "Authorization: Bearer ptlc_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"description": "My Bot", "allowed_ips": []}'
await fetch('https://pufferland.ir/api/client/account/api-keys', {
method: 'POST',
headers: {
Authorization: 'Bearer ptlc_xxxxxxxxxxxxxxxxxxxxxxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({ description: 'My Bot', allowed_ips: [] }),
}).then(r => r.json()).then(key => {
// کلید قابلاستفاده = key.attributes.identifier + key.meta.secret_token
console.log(key.attributes.identifier + key.meta.secret_token);
});
import requests
r = requests.post(
"https://pufferland.ir/api/client/account/api-keys",
json={"description": "My Bot", "allowed_ips": []},
headers={"Authorization": "Bearer ptlc_xxxxxxxxxxxxxxxxxxxxxxxx"},
)
d = r.json()
# کلید قابلاستفاده = identifier + secret_token
print(d["attributes"]["identifier"] + d["meta"]["secret_token"])
curl_post('https://pufferland.ir/api/client/account/api-keys', [
CURLOPT_POSTFIELDS => json_encode(['description' => 'My Bot', 'allowed_ips' => []]),
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ptlc_xxxxxxxxxxxxxxxxxxxxxxxx',
'Content-Type: application/json',
],
]);
نمونه پاسخ واقعی:
{
"object": "api_key",
"attributes": {
"identifier": "ptlc_vDZ2avnZO8n",
"description": "docs-sample",
"allowed_ips": [],
"last_used_at": null,
"created_at": "2026-09-16T05:38:48+03:30"
},
"meta": {
"secret_token": "224gTjtw37Bxi8D3J2FtPYpgh3mgsmNE"
}
}
DELETE/api/client/account/api-keys/{identifier}کلید API مشخصشده با شناسهی identifier را حذف میکند. پاسخ موفق: 204 بدون بدنه. خطای 404 در صورت وجود نداشتن کلید.
curl -X DELETE "https://pufferland.ir/api/client/account/api-keys/ptlc_EJtr5ZsYZR8" \
-H "Authorization: Bearer ptlc_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Accept: application/json"
نمونه پاسخ واقعی:
204 No Content
GET/api/client/account/activityلاگ فعالیتها و رویدادهای اخیر حساب را بهصورت صفحهبندیشده برمیگرداند.
هر آیتم activity_log شامل id (UUID)، event (مانند user:account.email-changed)، ip، description، properties و timestamp است.
curl "https://pufferland.ir/api/client/account/activity" \
-H "Authorization: Bearer ptlc_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Accept: application/json"
نمونه پاسخ واقعی:
{
"object": "list",
"data": [
{
"object": "activity_log",
"attributes": {
"id": "87c7a964ab4229419bf812832b52448f35c4320e",
"batch": null,
"event": "auth:success",
"is_api": false,
"ip": "86.57.15.114",
"description": null,
"properties": {
"ip": "86.57.15.114",
"useragent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36"
},
"has_additional_metadata": false,
"timestamp": "2026-06-20T19:01:25+03:30"
}
},
{
"object": "activity_log",
"attributes": {
"id": "922b39e665a69f20261873c00136d1db4febec58",
"batch": null,
"event": "auth:success",
"is_api": false,
"ip": "86.57.15.114",
"description": null,
"properties": {
"ip": "86.57.15.114",
"useragent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36"
},
"has_additional_metadata": false,
"timestamp": "2026-06-21T01:15:10+03:30"
}
}
],
"meta": {
"pagination": {
"total": 5996,
"count": 25,
"per_page": 25,
"current_page": 1,
"total_pages": 240,
"links": {
"next": "https://panel.pufferland.ir/api/client/account/activity?page=2"
}
}
}
}
GET/api/client/account/ssh-keysفهرست کلیدهای عمومی SSH متصل به حساب را برمیگرداند. هر آیتم شامل name، fingerprint (فرمت SHA256)، public_key و created_at است.
curl "https://pufferland.ir/api/client/account/ssh-keys" \
-H "Authorization: Bearer ptlc_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Accept: application/json"
نمونه پاسخ واقعی:
{
"object": "list",
"data": []
}
POST/api/client/account/ssh-keysیک کلید عمومی SSH جدید به حساب اضافه میکند.
| فیلد | نوع | الزام | توضیح |
|---|
name | string | ✓ | نام توصیفی برای کلید. |
public_key | string | ✓ | محتوای کلید عمومی SSH. |
curl -X POST "https://pufferland.ir/api/client/account/ssh-keys" \
-H "Authorization: Bearer ptlc_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"name": "لپتاپ من", "public_key": "ssh-ed25519 AAAAC3Nza... user@laptop"}'
نمونه پاسخ واقعی:
{
"object": "list",
"data": []
}
POST/api/client/account/ssh-keys/removeیک کلید عمومی SSH را با اثر انگشت (fingerprint) آن حذف میکند. دقت کنید این endpoint با متد POST فراخوانی میشود، نه DELETE. پاسخ موفق: 204.
| فیلد | نوع | الزام | توضیح |
|---|
fingerprint | string | ✓ | اثر انگشت کلیدی که باید حذف شود. |
curl -X POST "https://pufferland.ir/api/client/account/ssh-keys/remove" \
-H "Authorization: Bearer ptlc_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"fingerprint": "SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}'
نمونه پاسخ واقعی:
204 No Content