AI Studio API
Authentication and account
Create an API key, authenticate requests, and read account details.
API playground
Send a real request to this site and inspect the HTTP response immediately.
Response
Send a request to view its response here.ส่วนหัวคำขอที่จำเป็น
สร้างคีย์ API หลังจากเข้าสู่ระบบ จากนั้นรวมมันไว้ในคำขอ API ทุกครั้ง
Authorization: Bearer YOUR_API_KEYThe example domain is automatically resolved from NEXT_PUBLIC_SITE_URL. Replace only YOUR_API_KEY with the key generated in your account.
GET
/api/auth/userรับข้อมูลโปรไฟล์บัญชีของคุณ เครดิตคงเหลือ และสรุปการเป็นสมาชิก
ส่วนหัวของคำขอ
Authorization: Bearer YOUR_API_KEYพารามิเตอร์คำขอ
ไม่มีพารามิเตอร์ของคำขอ
คำร้อง
curl -X GET "https://freesoragenerator.com/api/auth/user" \
-H "Authorization: Bearer YOUR_API_KEY"ตัวอย่างการตอบสนอง
{
"success": true,
"data": {
"user": {
"id": "user-id",
"email": "developer@example.com",
"role": "user",
"name": "Developer",
"image": null,
"authType": "apikey"
},
"credits": 120,
"membership": {
"isVip": false,
"level": "none",
"planTitle": null
}
}
}ตัวอย่างข้อผิดพลาด
{
"success": false,
"error": "User not authenticated"
}