取得所有提示詞列表

取得所有提示詞列表
此 API 用於取得目前 API Key 可存取的所有 Prompt 清單,支援 cursor-based 分頁。
列表中每筆 Prompt 包含 id、name、metadata 與 created_at;列表不回傳 value(Prompt 內容),如需內容請改用「取得單一提示詞資訊」API。
curl -X 'GET' \
'http://127.0.0.1:8000/v1/prompts?limit=20&order=desc' \
-H 'accept: application/json' \
-H "Authorization: Bearer $PRIVAI_API_KEY"
Request Headers
| Key | Value |
|---|---|
| Request Method | GET |
| accept | application/json |
| Authorization | Bearer $PRIVAI_API_KEY |
Query Parameters
| Field | Type | Note | Required |
|---|---|---|---|
| limit | int | 1 - 10000,預設為 10000 | false |
| order | string | 依 created_at 排序,asc 或 desc,預設為 desc | false |
| after | string (uuid) | 分頁游標,取得指定 Prompt ID 之後的資料;不可與 before 同時使用 | false |
| before | string (uuid) | 分頁游標,取得指定 Prompt ID 之前的資料;不可與 after 同時使用 | false |
Response Body
{
"object": "list",
"data": [
{
"id": "9efad107-c9af-4cb2-9c79-7e926bc5d07e",
"name": "Antibiotics Explanation",
"metadata": {
"title": "Antibiotics Explanation",
"derived_from": "a1db95a9-1d40-44ee-9cba-69dcc82e0ec6"
},
"created_at": "2025-01-01T00:10:00.000Z"
}
],
"first_id": "9efad107-c9af-4cb2-9c79-7e926bc5d07e",
"last_id": "29519a8a-8561-4451-9083-9cc6c21de04a",
"has_more": true
}
Field Explanation
| Field | Detail |
|---|---|
| object | 固定為 list |
| data[] | Prompt 清單,欄位請參考「提示詞物件」章節(不含 value) |
| first_id | 本頁第一個提示詞的 ID;無資料時為 null |
| last_id | 本頁最後一個提示詞的 ID;無資料時為 null |
| has_more | 是否還有更多的提示詞 |
可能的錯誤
| Error Code | HTTP Status | 情境 |
|---|---|---|
AUTH_001、AUTH_002、AUTH_003 | 401 / 403 | 缺少 Authorization header、API Key 無效或已過期,見 「錯誤代碼說明-身份驗證類」 |
VAL_001 | 422 | 同時提供 before 與 after,見 「錯誤代碼說明-傳遞參數驗證類」 |
VAL_002 | 404 | before 或 after 指定的 Prompt ID 不存在,見 「錯誤代碼說明-傳遞參數驗證類」 |