> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prismgateway.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> วิธีสร้าง ส่ง หมุนเวียน และ revoke Prism API key

# Authentication

Customer endpoints ที่ต้องยืนยันตัวตนรับ Prism API key ผ่าน Bearer token:

```http theme={null}
Authorization: Bearer sk-prism-...
```

Prism ไม่รองรับ `X-API-Key` สำหรับ customer authentication ตัวอย่างและ
integration ใหม่ต้องใช้ `Authorization: Bearer` เท่านั้น

## วงจรชีวิตของ key

1. สร้าง key ใน developer console
2. เก็บ full secret ทันที เพราะระบบแสดงเพียงครั้งเดียว
3. ส่ง key จาก trusted server environment เท่านั้น
4. สร้าง key ใหม่และ deploy ก่อนหมุนเวียน key ที่ใช้งานอยู่
5. Revoke key เก่าหลัง integration เปลี่ยนเสร็จ

Prism เก็บ one-way hash และ lookup prefix ไม่สามารถกู้ full secret จาก console
หรือ database ได้

## Policy ของ key

การใช้งาน key อาจถูกจำกัดด้วย route scope, model allowlist, rate limit,
organization budget, เครดิตคงเหลือ และ trial policy

`GET /v1/models` จะแสดงเฉพาะโมเดลที่ key มองเห็น แต่ administrator อาจเปลี่ยน
policy ภายหลังได้

<Warning>
  ตอนนี้ self-service organization offboarding ยังไม่ invalidate key เดิม
  อัตโนมัติ ผู้ดูแลต้อง revoke key ของพนักงานที่ออกเอง
</Warning>

Prism คืน `401` เมื่อ Bearer token หาย รูปแบบผิด ไม่รู้จัก หรือถูก revoke อย่า
retry `401` ด้วย key เดิม

[English version](/authentication)
