Skip to content

docs: document detailed parameters for all server API endpoints - #3155

Merged
sailist merged 2 commits into
MoonshotAI:mainfrom
sailist:feat-059-08-20-server-api-doc-params
Aug 21, 2026
Merged

docs: document detailed parameters for all server API endpoints#3155
sailist merged 2 commits into
MoonshotAI:mainfrom
sailist:feat-059-08-20-server-api-doc-params

Conversation

@sailist

@sailist sailist commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue — internal docs task.

Problem

The Server API reference page (docs/{en,zh}/reference/server-api.md) listed every kap-server endpoint as a one-line summary table only. Readers could not construct a request from the page: query parameters, request body fields, response shapes, and endpoint-specific error codes were not documented. Several endpoints and two whole groups (capabilities, plugins, GUI store, session runtime/title/media, oauth/region, workspace/fs:suggest) were missing from the page entirely.

What changed

Expanded the REST reference so every v1+v2 endpoint (except the unstable /api/v1/debug/* reflection RPC) has a per-endpoint subsection, in both locales:

  • Each resource group keeps its summary table as the map, followed by one subsection per endpoint: prose, a parameter table (path/query/body with required-ness, defaults, constraints), the response data shape, and the endpoint's specific error codes.
  • :{action} dispatcher endpoints are expanded into concrete subsections (session :fork/:compact/:undo/:abort/:btw/:archive/:restore, prompt :steer/:abort, question :dismiss, task :cancel, provider collection actions, plugin :enable/:disable/:remove, all 13 fs:{action} operations, ...).
  • Shared response objects (the session object, the workspace object) are defined once and cross-linked.
  • Added the missing groups Capabilities and plugins and GUI store, and the missing endpoints listed above.
  • The intro now states the page is a curated human-readable reference while /openapi.json / /asyncapi.json remain the normative machine-readable schema.

Parameter facts were extracted from the server's generated OpenAPI document (same zod schemas as runtime validation); semantics were written from the route sources. Where the generated spec and the source disagreed, the page follows the source and says so (e.g. boolean list filters only appear required in the spec due to a zod-preprocess projection; :dismiss answers envelope code 40909 on success; fields accepted by the schema but not applied are marked as such).

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: the issue must have a maintainer's /approve). — N/A, internal docs task.
  • I have added tests that prove my feature works. — N/A, docs-only change.
  • Ran gen-changesets skill, or this PR needs no changeset. — No changeset: docs-only change that never enters the shipped artifact.
  • Ran gen-docs skill, or this PR needs no doc update. — This PR is the doc update.

@changeset-bot

changeset-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4cb6546

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Aug 21, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@4cb6546
npx https://pkg.pr.new/@moonshot-ai/kimi-code@4cb6546

commit: 4cb6546

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 46c96823f4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread docs/en/reference/server-api.md Outdated

#### `POST /api/v1/models/{model_id}:set_default`

Sets the global `default_model` to an existing alias. An alias id contains `/`, so URL-encode it in the path — for example `POST /api/v1/models/my-provider%2Fkimi-for-coding:set_default`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document arbitrary model alias IDs

For configurations that use a bare model-table key such as turbo, this instruction incorrectly says every alias contains / and implies callers should construct a provider_id/model value. The route passes the decoded path ID directly to setDefaultModel, and packages/kap-server/test/modelCatalog.test.ts demonstrates /api/v1/models/turbo:set_default; only aliases created through the provider-management endpoints are forced into the provider_id/model form. Clarify that model_id is the exact configured alias key and encode / only when that key contains one; make the same correction in the Chinese mirror.

AGENTS.md reference: docs/AGENTS.md:L19-L21

Useful? React with 👍 / 👎.

Comment thread docs/en/reference/server-api.md Outdated
| `session_id` | path | string | **Required.** Session id |
| `skill_name` | path | string | **Required.** Name of the skill to activate |
| `args` | body | string | Free-form arguments handed to the skill, like the text after a slash command |
| `attachments` | body | array | Media parts attached to the activation: image, video, or file objects whose `source.kind` is `url` / `base64` / `file` / `session_media` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Separate file attachment fields from media sources

When activating a skill with a type: "file" attachment, this description leads clients to send source.kind, but activateSkillAttachmentSchema uses fileContentSchema, whose required fields are the top-level file_id, name, media_type, and size; only image and video attachments have a source object. Document the two shapes separately (or link to the prompt content-part table) in both locale mirrors so the advertised request can pass validation.

AGENTS.md reference: docs/AGENTS.md:L19-L21

Useful? React with 👍 / 👎.

@sailist
sailist merged commit cd2d910 into MoonshotAI:main Aug 21, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant