跳至主要内容
版本:PrivStation 4.0.0
Markdown 原文

取得所有提示詞列表

取得所有提示詞列表​

此 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​

KeyValue
Request MethodGET
acceptapplication/json
AuthorizationBearer $PRIVAI_API_KEY

Query Parameters​

FieldTypeNoteRequired
limitint1 - 10000,預設為 10000false
orderstring依 created_at 排序,asc 或 desc,預設為 descfalse
afterstring (uuid)分頁游標,取得指定 Prompt ID 之後的資料;不可與 before 同時使用false
beforestring (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

FieldDetail
object固定為 list
data[]Prompt 清單,欄位請參考「提示詞物件」章節(不含 value)
first_id本頁第一個提示詞的 ID;無資料時為 null
last_id本頁最後一個提示詞的 ID;無資料時為 null
has_more是否還有更多的提示詞

可能的錯誤​

Error CodeHTTP Status情境
AUTH_001、AUTH_002、AUTH_003401 / 403缺少 Authorization header、API Key 無效或已過期,見 「錯誤代碼說明-身份驗證類」
VAL_001422同時提供 before 與 after,見 「錯誤代碼說明-傳遞參數驗證類」
VAL_002404before 或 after 指定的 Prompt ID 不存在,見 「錯誤代碼說明-傳遞參數驗證類」