Quickstart
Quickstart
Từ zero đến report trong bốn API call.
1
Mint access token
Đổi API key tenant lấy JWT 1 giờ.
curl -X POST https://api.psyforge.dev/api/v1/auth/token \ -H "Authorization: Bearer $PSYFORGE_API_KEY"
2
Tạo assessment session
Chọn framework + locale. Idempotency-Key ngừa double-click sinh session trùng.
curl -X POST https://api.psyforge.dev/api/v1/sessions \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"frameworkCode":"big-five","locale":"en"}'3
Duyệt items
GET next-item + POST responses. CAT chọn item thông tin nhất sau mỗi response.
curl https://api.psyforge.dev/api/v1/sessions/$SID/next-item \
-H "Authorization: Bearer $JWT"
curl -X POST https://api.psyforge.dev/api/v1/sessions/$SID/responses \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d '{"itemId":"$ITEM","value":5}'4
Submit và lấy report
Submit đóng session; enqueue report trả về report id để poll.
curl -X POST https://api.psyforge.dev/api/v1/sessions/$SID/submit \ -H "Authorization: Bearer $JWT" curl -X POST https://api.psyforge.dev/api/v1/sessions/$SID/reports \ -H "Authorization: Bearer $JWT"