AI EngineeringInterview preparation
Advanced·Concept·2 min read

API design

Practice this question
APIContract
POST /ai/conversationsCreate an authorized session; server assigns ownership
POST /ai/conversations/:id/messagesValidate bounded message, record it, return safe stream or run reference
GET /ai/runs/:idReturn public phase, outcome, safe errors, and review requirement after ownership check
POST /documentsValidate upload intent and permissions; issue restricted upload path; return document/job IDs
GET /documents/:id/statusReturn parse/index/review status without exposing unauthorized sources
POST /claim-draftsCreate validated proposal with source references and version
PATCH /claim-drafts/:idRequire expected version; edits produce new hash and invalidate prior approval
POST /claim-drafts/:id/approvalsBind authenticated decision to exact version/hash/action; never accept model-generated approval
POST /claim-drafts/:id/submitRequire valid approval and scoped idempotency key; return durable receipt or explicit pending outcome
POST /ai/runs/:id/resumeAuthenticate ownership/reviewer; validate pending input event; reject stale/duplicate invalid resumes
POST /support-ticketsCreate a permitted, deduplicated escalation with bounded case context
  • Apply CSRF protection where cookie-authenticated mutation routes require it, enforce origin/authentication policy, and use appropriate error semantics.
  • A pending task may return 202; a chat sentence claiming success cannot substitute for a claim receipt.
Adapted from 13_AI.MD · “API design”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.