API Reference
Overview
यह page Flashcards में AI agents के लिए current external contract document करती है।
Primary discovery entry point:
GET https://api.flashcards-open-source-app.com/v1/
वही payload GET /v1/agent से भी उपलब्ध है, लेकिन /v1/ primary public entry point है।
Discovery response agent को बताती है कि वह कैसे:
- email OTP login शुरू करे
- OTP को long-lived API key से exchange करे
- account context load करे
- workspace create या select करे
- published SQL surface के जरिए आगे बढ़े
Published Specs
External agent surface की main spec URLs:
https://api.flashcards-open-source-app.com/v1/agent/openapi.jsonhttps://api.flashcards-open-source-app.com/v1/agent/swagger.json
Root aliases:
https://api.flashcards-open-source-app.com/v1/openapi.jsonhttps://api.flashcards-open-source-app.com/v1/swagger.json
Auth Bootstrap
पहला OTP stage auth service पर चलता है:
POST https://auth.flashcards-open-source-app.com/api/agent/send-codePOST https://auth.flashcards-open-source-app.com/api/agent/verify-code
Flow:
GET /v1/चलाएं।- User email को
send-codeपर भेजें। - Response से
otpSessionTokenपढ़ें। - User से latest 8-digit email code मांगें।
verify-codeकोcode,otpSessionToken, औरlabelके साथ call करें।- Returned API key को conversation memory के बाहर store करें।
Suggested environment variable:
export FLASHCARDS_OPEN_SOURCE_API_KEY="fca_ABCDEFGH_0123456789ABCDEFGHJKMNPQRS"
Authenticated requests use:
Authorization: ApiKey <key>
Post-Login Agent Surface
Verification के बाद current surface:
GET /v1/agent/meGET /v1/agent/workspacesPOST /v1/agent/workspacesPOST /v1/agent/workspaces/{workspaceId}/selectPOST /v1/agent/sql
Typical bootstrap:
GET /v1/agent/meGET /v1/agent/workspaces?limit=100- If needed,
POST /v1/agent/workspaceswith{"name":"Personal"} - If needed,
POST /v1/agent/workspaces/{workspaceId}/select - Use
POST /v1/agent/sql
हर API key connection के लिए workspace selection explicit है। Agents को guess करने के बजाय returned instructions और docs.openapiUrl follow करने चाहिए।
SQL Surface
POST /v1/agent/sql external agents के लिए shared read/write surface है।
यह जानबूझकर limited है, full PostgreSQL नहीं।
Current command families:
SHOW TABLESDESCRIBE <resource>SELECTINSERTUPDATEDELETE
Current published logical resources:
workspacecardsdecksreview_events
Notes:
- Default
LIMIT100है और maximum भी100 - Stable pagination चाहिए तो
ORDER BYइस्तेमाल करें - Schema discover करने के लिए
SHOW TABLESयाDESCRIBE cardsइस्तेमाल करें - External contract post-selection workspace-scoped होता है
Example request:
curl -X POST https://api.flashcards-open-source-app.com/v1/agent/sql \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey $FLASHCARDS_OPEN_SOURCE_API_KEY" \
-d '{"sql":"SHOW TABLES"}'
Human And Sync APIs
Flashcards में human clients और offline-first sync के लिए अलग APIs भी शामिल हैं, लेकिन वे external agents के लिए primary contract नहीं हैं:
- Browser flows CSRF protection के साथ shared-domain cookies इस्तेमाल करते हैं
- Offline-first clients
/v1/workspaces/{workspaceId}/sync/pushऔर/v1/workspaces/{workspaceId}/sync/pullके तहत sync routes इस्तेमाल करते हैं - Sync routes जानबूझकर external agent OpenAPI surface से बाहर रखी गई हैं