API conventions
Version prefixes, unified responses, error codes, and auth.
1VEC's API comes in two kinds: internal and public. Internal APIs serve only our own frontends and can change as needed; public APIs are an external contract — versioned and backward-compatible.
Version prefixes / planes
| Prefix | Plane | Consumers | Stability |
|---|---|---|---|
/api/v1/* | internal · studio | studio frontend | may change as needed |
/api/v1/admin/* | internal · console | platform console | may change as needed |
/api/public/v1/* | public · data plane | third parties + MCP | permanently backward-compatible |
/api/public/v1/admin/* | public · admin plane | org provisioning / SSO / billing | permanently backward-compatible |
Breaking changes to public APIs must go through a new version (v2) with a deprecation notice and a transition window — never changed in place.
Unified response
{ "code": 0, "data": { /* ... */ }, "message": "ok" }code: the business error code,0= success; failures use4xxxx, kept separate from the HTTP status code.- Lists return
{ items, page, pageSize, total }, withpageSize ≤ 100. Accept-Languagecontrols the response language, defaulting tozh-CN.
Auth
- Session (frontend): after OIDC sign-in, 1VEC issues its own JWT.
- API key (programs / third parties / MCP):
Authorization: Bearer <key>. A key is scoped to an org + authorized projects + a role (not super).
curl https://<your-host>/api/public/v1/issues \
-H "Authorization: Bearer $ONEVEC_API_KEY"Error code ranges
| Range | Meaning |
|---|---|
40001–40099 | parameters / validation |
40300–40399 | auth / permission / cross-org |
40400–40499 | resource not found |
42200–42299 | business rule conflict (e.g. priority required to leave triage) |
50000+ | server |
The public API and SDK are still being finalized; treat actual responses as authoritative. A full endpoint list will be added once the stable version ships.