API 參考
本章整理目前公開端點(/api/v1)。
https://api.codeer.ai/api/v1
驗證
每個請求都需要 API Key:
x-api-key: YOUR_API_KEY
回應格式
所有 API 都使用同一層 response envelope(data / message / error_code / pagination)。
Chat 端點
| Method | Endpoint |
|---|---|
| GET | /chats/published-agents |
| POST | /chats |
| GET | /chats |
| PUT | /chats/{chat_id} |
| GET | /chats/{chat_id}/messages |
| POST | /chats/{chat_id}/messages |
| POST | /chats/{chat_id}/regenerate |
| POST | /chats/{chat_id}/form-requests/{form_request_id}/submit |
| POST | /chats/upload-file |
| POST | /chats/{chat_id}/messages/{message_id}/feedbacks |
Batch 端點
| Method | Endpoint |
|---|---|
| POST | /batches |
| GET | /batches |
| GET | /batches/{batch_id} |
| GET | /batches/{batch_id}/results |
| POST | /batches/{batch_id}/cancel |
詳細請看 Batch API。
external_user_id 說明
- 某些 workspace 會啟用 whitelist mode。
- whitelist mode 下,未允許的 user 會收到
403、error_code=14103。 - 建議 API key 整合固定傳遞
external_user_id,避免資料混用。
常見錯誤碼
| HTTP | error_code | 說明 |
|---|---|---|
| 400 | 10006 |
請求格式錯誤 |
| 403 | 10001 |
權限不足 |
| 403 | 14103 |
Client user 不允許 |
| 404 | 10003 |
資源不存在 |
| 500 | 10005 |
伺服器錯誤 |