Files
digital-psychology/.ai/api.md
T
jackyu66gitandCursor 2fb1dfee14 chore: seal Design Vision v1 and monorepo scaffold
Archive the differentiated YuXinGu product docs, AI engineering system,
design contract, and Go/Vue scaffold. Next execution prioritizes Cece-parity
over early innovation (see .ai/product/STRATEGY.md).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 16:00:44 +08:00

994 B

API — Golden Rules

Style

  • REST only for public HTTP.
  • Never use POST for pure queries (use GET).
  • Verbs: GET / POST / PUT / DELETE.
  • Prefix: /api/v1.

Envelope (mandatory — never invent alternatives)

Success:

{ "code": 0, "message": "success", "data": {} }

Error:

{ "code": 10001, "message": "user not found" }

Forbidden shapes: { success: true }, { ok: true }, bare arrays as root.

Error codes

  • Start business codes at 10000.
  • 0 = success.
  • Ranges: 1xxxx general/auth, 2xxxx profile, 3xxxx report/scale, 4xxxx order/membership, 5xxxx AI/companion.

Pagination

Query: page, page_size
Data:

{ "list": [], "total": 0, "page": 1, "page_size": 20 }

Auth

  • Bearer token in Authorization header when required.
  • Resource ownership checked in service layer.

Docs

  • Public route changes update proto/openapi.yaml in the same change set.
  • Do not invent endpoints that are not in OpenAPI / task spec.