Quickstart
3. Make Your First API Call

ทำ API Call แรก

เมื่อมี M2M API key แล้ว ทดสอบว่าทุกอย่างใช้งานได้

ดึงข้อมูล user / app identity ที่ authenticated

export PIP_API_KEY="pip_live_xxxxxxxx"
 
curl https://pip.pcampus.co/identity/me \
  -H "Authorization: Bearer $PIP_API_KEY"

Response ที่คาดหวัง

{
  "id": "usr_xxxxxxxxxxxx",
  "email": "you@example.com",
  "displayName": "Your Name",
  "organizationId": "org_xxxxxxxxxxxx",
  "createdAt": "2026-01-01T00:00:00.000Z"
}

ถ้าเห็น JSON response พร้อม user หรือ application details แสดงว่าพร้อมแล้ว

แก้ไขปัญหา

Statusสาเหตุวิธีแก้
401 UnauthorizedKey หายหรือรูปแบบผิดตรวจสอบ header Authorization: Bearer pip_…
403 ForbiddenKey ถูกยกเลิกหรือ scope ไม่พอสร้าง key ใหม่ใน Console
404 Not FoundPath ของ endpoint ผิดตรวจสอบ API Reference

ขั้นตอนถัดไป

Make Your First API Call

With your M2M API key in hand, verify everything works.

Get the authenticated user / app identity

export PIP_API_KEY="pip_live_xxxxxxxx"
 
curl https://pip.pcampus.co/identity/me \
  -H "Authorization: Bearer $PIP_API_KEY"

Expected response

{
  "id": "usr_xxxxxxxxxxxx",
  "email": "you@example.com",
  "displayName": "Your Name",
  "organizationId": "org_xxxxxxxxxxxx",
  "createdAt": "2026-01-01T00:00:00.000Z"
}

If you see a JSON response with your user or application details, you're all set.

Troubleshooting

StatusCauseFix
401 UnauthorizedKey missing or malformedCheck Authorization: Bearer pip_… header
403 ForbiddenKey revoked or insufficient scopeRegenerate key in Console
404 Not FoundWrong endpoint pathCheck the API Reference

What's next?