Skip to content

docs(sessions): add POST /api/sessions reference#186

Merged
sweetmantech merged 8 commits intomainfrom
docs/create-session
May 4, 2026
Merged

docs(sessions): add POST /api/sessions reference#186
sweetmantech merged 8 commits intomainfrom
docs/create-session

Conversation

@sweetmantech
Copy link
Copy Markdown
Collaborator

@sweetmantech sweetmantech commented May 4, 2026

Summary

  • Adds OpenAPI spec for POST /api/sessions (create session + initial chat in one transaction)
  • Fills in four Session fields the GET reference was missing: autoCommitPushOverride, autoCreatePrOverride, prNumber, prStatus
  • Adds Chat schema for the initial chat returned alongside the session
  • Error envelope stays as {error} to match open-agents — no status:"error" divergence here, which is a deliberate compatibility choice for the eventual frontend cutover

Provenance

Captured the live response shape from https://sandbox.recoupable.com (open-agents production) so the spec mirrors what downstream clients are already consuming. Cross-referenced with apps/web/lib/db/schema.ts in open-agents for nullability + enum constraints.

Notes for reviewers

This branch was cut from main and includes cherry-picked nav commits (the Phase 1-3 restructure + the GET endpoint reference) so the docs render coherently in isolation. PR #185 (docs/get-session-by-id) carries the same nav commits — whichever lands first, the other will rebase cleanly because the cherry-picked commits are byte-identical.

Test plan

  • npx mintlify@latest dev renders without errors
  • New Create Session page appears under Agents & Sandboxes › Sessions
  • Request body fields, Session, Chat, and Error schemas render correctly in the auto-generated reference

🤖 Generated with Claude Code


Summary by cubic

Adds the API reference for creating sessions via POST /api/sessions, including an OpenAPI 3.1 spec and a docs page. Aligns the Session schema, adds a Chat schema, and updates the nav under Agents & Sandboxes › Sessions.

  • New Features
    • Documents POST /api/sessions that creates a session (starts in provisioning) and an initial empty chat; returns { session, chat }.
    • Optional request fields: title, repoOwner, repoName, branch/isNewBranch, cloneUrl, sandboxType:"vercel", autoCommitPush, autoCreatePr.
    • Auth via x-api-key or Bearer; responses 200/400/401/500 with { status:"error", error }.
    • Session schema adds autoCommitPushOverride, autoCreatePrOverride, prNumber, prStatus; includes new Chat schema.
    • Adds “Create Session” under Agents & Sandboxes › Sessions in docs.json.

Written for commit bdf89d9. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Sessions API endpoint now available for creating new sessions with optional configuration parameters and authentication support.
  • Documentation

    • Complete API specification for Sessions endpoint published.
    • Comprehensive guide for the Create Session operation added.
    • Navigation restructured with new "Agents & Sandboxes" section to better organize related resources.

sweetmantech and others added 6 commits May 4, 2026 15:21
Documents the first endpoint ported in the open-agents -> api migration
(api PR #514). Establishes the reference shape for the Agent Sessions
endpoint family — subsequent ports (list, chats, etc.) will land in
this same group.

Files:
  api-reference/openapi/sessions.json
    New OpenAPI 3.1 spec for the agent-sessions endpoint family.
    Documents GET /api/sessions/{sessionId} with the full Session
    schema (camelCase wire format that mirrors what api returns).
    Auth: x-api-key header or Bearer token.
    Response codes: 200 / 401 / 403 / 404.

  api-reference/sessions/get.mdx
    Frontmatter-only, per repo convention. References the OpenAPI
    spec — Mintlify auto-generates the page from there.

  docs.json
    Adds an "Agent Sessions" group under the API Reference tab,
    immediately after Sandboxes. One entry today; subsequent route
    ports add their pages here.

Naming note in the schema: the Session.userId field is documented
explicitly as "named userId for client compatibility; on the server
side this is account_id". Captures the wire-format-vs-schema name
difference that exists during the cutover window so consumers reading
the docs alongside the database schema do not get confused.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…cture)

Hoists agent + sandbox concepts out of three different tabs into a
single dedicated top-level. Addresses the structural problem where
"Content" had become a junk drawer for anything sandbox- or
agent-shaped, and agent concepts were scattered across five locations
(Quickstart > Agents, Artists > Tasks, Content > Sandboxes,
Content > Agent Sessions, Content > Content Agent, Accounts > Agent
Onboarding).

Moves into new "Agents & Sandboxes" tab (in this order — onboarding
first, primitives last):
  Agent Onboarding   ← was Accounts > Agent Onboarding
  Agents             ← was Quickstart > Agents (intro pages)
  Tasks              ← was Artists > Tasks
  Content Agent      ← was Content > Content Agent
  Sandboxes          ← was Content > Sandboxes
  Agent Sessions     ← stayed under Content (added in this PR)

Tab placement: between Social Media and Accounts. The workflow tabs
(Artists, Research, Releases, Content, Social Media) stay together;
Agents & Sandboxes sits as the platform's differentiated capability
just before the platform-mechanics tab (Accounts).

Net effect on each existing tab:
  Quickstart    Agents group removed → just "Getting started" now
  Artists       Tasks group removed (background-job concept lives
                with the agents that drive it)
  Content       Three groups removed (Content Agent, Sandboxes,
                Agent Sessions). Content is now coherent: creation,
                posts/comments, image, transcribe.
  Accounts      Agent Onboarding removed (moved to its true home)

No MDX file paths change — all moves are within docs.json. External
deep links to specific pages stay valid; only tab/group anchors
change.

This is Phase 1 of a four-phase restructure outlined in PR
discussion. Phases 2-4 (rationalize Content remainder, split Accounts
into Platform + Tools & Reference, rebalance Releases) are deferred
to follow-up PRs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Phase 2 — Content tab: fold the single-page Image and Transcribe groups
into Content Creation. They are content-creation utilities; one-page
groups under Content were over-segmentation that made the tab look
fuller than it is. Image generation and audio transcription now sit
alongside the other generate-* / transcribe-* endpoints they belong
with.

Phase 3 — extract Tools & Reference: pull Connectors and AI (model
catalog) out of the Accounts tab into a new top-level "Tools &
Reference" tab. Both are dev-reference content, not account
mechanics. Accounts is now coherent: account-mechanics only (Accounts,
Organizations, Workspaces, Subscriptions, Admins, Pulses,
Notifications).

Phase 4 (rebalance Releases) intentionally skipped: Releases is
sparsely populated (1 group, ~8 pages) but architecturally fine.
Folding it into Artists or artificially growing it is cosmetic.
Will fill in as more endpoints land.

Final structure (9 tabs):
  Quickstart           Getting started
  Artists              Workflows · Artists · Fans
  Research             8 groups (unchanged)
  Releases             Songs & Catalogs
  Content              Content Creation · Posts & Comments  ← Phase 2
  Social Media         Social · Spotify · Apify
  Agents & Sandboxes   6 groups (added in Phase 1)
  Accounts             7 groups, account mechanics only      ← Phase 3
  Tools & Reference    Connectors · AI                       ← Phase 3 (NEW)

No MDX file paths change — all moves are within docs.json. External
deep links to specific pages stay valid; only tab/group anchors change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The "Agent" prefix was redundant. Every other artifact for this surface
already uses the bare term:
- URL: /api/sessions/{sessionId}
- OpenAPI file: sessions.json
- Folder: api-reference/sessions/
- MDX title: "Get Session"
- Schema type: Session

The "Agents & Sandboxes" tab already establishes context, so "Sessions"
under that tab reads naturally and unambiguously. Only places the old
label appeared:
  docs.json (group label)
  api-reference/openapi/sessions.json (title + description)

The Stripe checkout-session endpoints under Accounts > Subscriptions
remain at their distinct path (/api/subscriptions/sessions), so there
is no nav-level collision.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The 403 ownership detail is already documented in the responses
section ("Forbidden - the authenticated account does not own this
session") — restating it in the description was redundant prose.
Description is now one sentence.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
api PR #514 returns {status:"error", error:"..."} for all error
responses (401/404/403). The OpenAPI Error schema only documented
{error}. Add the status discriminator so the docs match what the
endpoint actually emits.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

📝 Walkthrough

Walkthrough

Adds comprehensive OpenAPI v3.1 documentation and navigation integration for a Sessions API endpoint, including security schemes, request/response schemas, error definitions, and a new MDX documentation page with updated site navigation structure.

Changes

Sessions API Documentation & Navigation Integration

Layer / File(s) Summary
Data Schema
api-reference/openapi/sessions.json
OpenAPI spec introduces component schemas: CreateSessionRequest (session config), CreateSessionResponse (session + chat), Session (lifecycle, repository, sandbox, PR/snapshot fields), Chat (metadata and timestamps), and Error (status and message).
API Endpoint & Security
api-reference/openapi/sessions.json
Defines POST /api/sessions with optional JSON body, success (200) and error (400, 401, 500) responses; declares dual auth schemes: ApiKeyAuth (via x-api-key header) and BearerAuth (HTTP bearer).
Documentation Page
api-reference/sessions/create.mdx
New MDX page titled "Create Session" with frontmatter linking to POST /api/sessions in the OpenAPI spec.
Navigation Structure
docs.json
Inserts new "Agents & Sandboxes" tab containing Agents, Tasks, Content Agent, Sandboxes, and Sessions groups; moves Connectors into new "Tools & Reference" tab; updates Content Creation group with additional endpoint pages.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • recoupable/docs#102: Modifies the same docs.json navigation structure with related tab and group reorganization.

Poem

🐰 A sessions endpoint hops into view,
With schemas and security shining anew,
The navigation's been shuffled just right,
Now APIs and docs dance in the light! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the primary change: adding OpenAPI documentation and a reference page for the POST /api/sessions endpoint.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/create-session

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="api-reference/openapi/sessions.json">

<violation number="1" location="api-reference/openapi/sessions.json:1">
P2: Custom agent: **Enforce Clear Code Style and Maintainability Practices**

This new file exceeds the 100-line maximum by a large margin (469 lines).</violation>

<violation number="2" location="api-reference/openapi/sessions.json:256">
P2: This spec mixes OpenAPI 3.1 with 3.0 `nullable` fields. Convert nullable schemas to `type` arrays including `"null"` (or switch the document to OpenAPI 3.0.x).</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

},
"activeStreamId": {
"type": "string",
"nullable": true,
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: This spec mixes OpenAPI 3.1 with 3.0 nullable fields. Convert nullable schemas to type arrays including "null" (or switch the document to OpenAPI 3.0.x).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At api-reference/openapi/sessions.json, line 256:

<comment>This spec mixes OpenAPI 3.1 with 3.0 `nullable` fields. Convert nullable schemas to `type` arrays including `"null"` (or switch the document to OpenAPI 3.0.x).</comment>

<file context>
@@ -0,0 +1,469 @@
+          },
+          "activeStreamId": {
+            "type": "string",
+            "nullable": true,
+            "description": "Id of an in-flight assistant stream, if one is active."
+          },
</file context>

@@ -0,0 +1,469 @@
{
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: Custom agent: Enforce Clear Code Style and Maintainability Practices

This new file exceeds the 100-line maximum by a large margin (469 lines).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At api-reference/openapi/sessions.json, line 1:

<comment>This new file exceeds the 100-line maximum by a large margin (469 lines).</comment>

<file context>
@@ -0,0 +1,469 @@
+{
+  "openapi": "3.1.0",
+  "info": {
</file context>

Comment thread api-reference/openapi/sessions.json Outdated
Comment thread api-reference/sessions/get.mdx Outdated
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Shouldn't only the POST be in this PR?

Documents the create-session endpoint: optional body fields for repo
binding + commit/push overrides, transactional return of `{session, chat}`,
and 200/400/401/500 error envelope.

Also fills in four Session fields the GET reference was missing
(autoCommitPushOverride, autoCreatePrOverride, prNumber, prStatus) and
adds the new Chat schema for the initial chat row created alongside
the session. Captured the live shape from sandbox.recoupable.com so
the spec mirrors the open-agents response that downstream clients
will eventually cut over from.

Error envelope stays as `{error}` to match open-agents (no
status:error divergence here — that's a deliberate compatibility
choice for frontend cutover).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sweetmantech sweetmantech force-pushed the docs/create-session branch from 72325c3 to 15fb54b Compare May 4, 2026 21:29
@sweetmantech sweetmantech changed the base branch from main to docs/get-session-by-id May 4, 2026 21:29
@sweetmantech
Copy link
Copy Markdown
Collaborator Author

Restacked to address the scope feedback:

Re: the two automated comments —

  1. nullable: true mixed into a 3.1 spec — valid catch, but pre-existing in PR docs(sessions): add GET /api/sessions/{sessionId} reference #185's GET schema. Filing as a separate cleanup PR rather than fixing only the POST half (which would leave the file inconsistent).
  2. 469-line file vs 100-line max — false positive on auto-generated/OpenAPI JSON. Not actioning.

@sweetmantech
Copy link
Copy Markdown
Collaborator Author

Live capture from open-agents (https://sandbox.recoupable.com)

Captured today against the open-agents production deployment to verify the spec matches reality.

POST /api/sessions — 200

Request:

POST /api/sessions
Content-Type: application/json

{"title":"DDD probe — docs PR #186"}

Response (200 OK):

{
  "session": {
    "id": "DIk2zX6Sk5WDzo4G0emSg",
    "userId": "1WynZUAgzeNuOrxq7J7ot",
    "title": "DDD probe — docs PR #186",
    "status": "running",
    "repoOwner": null,
    "repoName": null,
    "branch": null,
    "cloneUrl": null,
    "isNewBranch": false,
    "autoCommitPushOverride": false,
    "autoCreatePrOverride": false,
    "globalSkillRefs": [],
    "sandboxState": { "type": "vercel" },
    "lifecycleState": "provisioning",
    "lifecycleVersion": 0,
    "lastActivityAt": null,
    "sandboxExpiresAt": null,
    "hibernateAfter": null,
    "lifecycleRunId": null,
    "lifecycleError": null,
    "linesAdded": 0,
    "linesRemoved": 0,
    "prNumber": null,
    "prStatus": null,
    "snapshotUrl": null,
    "snapshotCreatedAt": null,
    "snapshotSizeBytes": null,
    "cachedDiff": null,
    "cachedDiffUpdatedAt": null,
    "createdAt": "2026-05-04T21:33:43.417Z",
    "updatedAt": "2026-05-04T21:33:43.417Z"
  },
  "chat": {
    "id": "yO8Q8i-vvsrtBY5SksFQW",
    "sessionId": "DIk2zX6Sk5WDzo4G0emSg",
    "title": "New chat",
    "modelId": "openai/gpt-5.4",
    "activeStreamId": null,
    "lastAssistantMessageAt": null,
    "createdAt": "2026-05-04T21:33:43.417Z",
    "updatedAt": "2026-05-04T21:33:43.417Z"
  }
}

POST /api/sessions — 401 (unauthenticated)

HTTP/2 401
content-type: application/json

{"error":"Not authenticated"}

Spec coverage check

Every field in the 200 response is described by the Session / Chat schemas in this PR. The 401 envelope ({error} only — no status:"error" field) matches the Error schema on this PR's base.

Probe session cleaned up via DELETE /api/sessions/DIk2zX6Sk5WDzo4G0emSg{"success":true}.

@sweetmantech
Copy link
Copy Markdown
Collaborator Author

Spec ↔ live response — actual diff

Re-running the comparison properly. My earlier comment said "every field is covered" — that's true at the presence level but masks several real divergences.

Where the spec disagrees with open-agents

# Spec says open-agents returns Status
1 userId is format: uuid "1WynZUAgzeNuOrxq7J7ot" (nanoid) divergence — open-agents user ids are nanoids, not UUIDs. The spec's UUID format describes the eventual api.recoupable.com shape (where the field maps from a UUID account_id column). For the open-agents endpoint this captures, format would be string with no constraint.
2 security: [ApiKeyAuth, BearerAuth] (x-api-key or Bearer) Only Better Auth session cookie divergence by design — open-agents doesn't accept x-api-key/Bearer. The spec describes the future api.recoupable.com auth contract, so I had to authenticate via cookie to capture this response at all.
3 Error is {error} only (no status field) Matches: {"error":"…"} matches open-agents — but diverges from current api behavior where validateAuthContext returns {status:"error", error:"…"}. When api implements POST, either the handler strips status or this spec gains it. Open question.
4 401 description: "invalid or missing API key / Bearer token" "Not authenticated" (no cookie) wording mismatch — covers both auth modes generically, but the current open-agents reality is cookie-based.

Error states actually returned (not in spec)

Trigger open-agents response
No body at all (with Content-Type: application/json) 400 {"error":"Invalid JSON body"}
Malformed JSON 400 {"error":"Invalid JSON body"}
Empty {} 200 (spec correctly says this is valid)
sandboxType: "wrong" 400 {"error":"Invalid sandbox type"}
repoOwner: "bad@@@owner" 400 {"error":"Invalid repository owner"}
repoName: "spaces in name" 400 {"error":"Invalid repository name"}
autoCommitPush: "yes" 400 {"error":"Invalid autoCommitPush value"}
autoCreatePr: 1 400 {"error":"Invalid autoCreatePr value"}
Unauthenticated 401 {"error":"Not authenticated"}
500 not reproduced — couldn't trigger naturally

The spec's 400 description ("malformed JSON or field failed validation") is broadly accurate. None of the specific messages above are documented. Probably fine — clients should treat 400 as a class, not match on error strings. But worth deciding: do we want enumerated 400 reasons in the docs?

Empty / no-response cases

  • 200 always returns a JSON body with both session and chat. No empty-body success case.
  • 204 No Content is never returned by this endpoint.
  • DELETE /api/sessions/{id} returns 200 {"success":true} (different envelope, not described by Error schema — it's a success envelope, distinct shape).

Verdict

Spec is field-complete for the 200 success path against open-agents. The divergences above are mostly about the spec targeting api.recoupable.com (the future) while my probe targets sandbox.recoupable.com (the current). The two real things to decide before merging:

  1. Should userId keep format: uuid (api's shape) or drop it (so it covers both)?
  2. Should the Error schema add status: "error" to match api's validateAuthContext, or should api strip status to match this spec?

@sweetmantech
Copy link
Copy Markdown
Collaborator Author

Closing the loop on the previous comparison comment — re-read against the api codebase rather than the open-agents probe:

  1. userId format=uuid → correct for api (accounts.account_id is UUID).
  2. x-api-key + Bearer auth → correct for api (validateAuthContext).
  3. Error envelope → already {status, error} on this branch (inherited from PR docs(sessions): add GET /api/sessions/{sessionId} reference #185); matches api's actual 401 response. I missed that in the prior comment.
  4. Specific 400 messages → not enumerating; 400 is a class.
  5. No 204 / 500 reproduction → noted, no action.

Net: spec is consistent with the api codebase. The divergences from the open-agents probe are all "spec targets api.recoupable.com, probe targeted sandbox.recoupable.com" — by design, not bugs.

@sweetmantech sweetmantech changed the base branch from docs/get-session-by-id to main May 4, 2026 21:45
Per PR feedback: this PR is scoped to POST only. Removes the GET
endpoint page, OpenAPI path, GetSessionResponse schema, and the
nav reference to it. The GET docs ship in PR #185.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (5)
api-reference/openapi/sessions.json (3)

26-81: ⚡ Quick win

Add an operationId to the POST operation.

Without an operationId, Mintlify generates an anchor ID from the method + path, SDK generators emit unpredictable function names, and any future x-mint metadata overrides have no stable target.

✏️ Suggested addition
  "post": {
    "summary": "Create session",
+   "operationId": "createSession",
    "description": "Creates a new agent session..."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api-reference/openapi/sessions.json` around lines 26 - 81, Add a stable
operationId to the POST /sessions operation so SDKs and Mintlify anchors have a
predictable target; update the POST operation object (the "Create session"
endpoint) by adding an "operationId" field (e.g., "createSession" or
"createSessionWithInitialChat") that uniquely identifies this operation and
matches your naming conventions so future x-mint overrides and code generators
produce consistent function names.

272-278: 💤 Low value

Static analysis: globalSkillRefs array is missing maxItems.

Checkov rule CKV_OPENAPI_21 flags arrays without a maxItems constraint. For a documentation spec this is likely a false positive (there's no business-driven maximum), but if the real API enforces a limit, adding maxItems here would improve spec accuracy and prevent client libraries from generating unbounded arrays.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api-reference/openapi/sessions.json` around lines 272 - 278, The array schema
for "globalSkillRefs" is missing a maxItems constraint; update the
"globalSkillRefs" schema in the OpenAPI document to include a suitable
"maxItems" value that reflects the API's real limit (or a conservative
documented maximum) so clients and linters won't treat the array as unbounded,
e.g., add "maxItems": <number> to the array definition for globalSkillRefs.

2-2: 🏗️ Heavy lift

nullable: true is not valid in OpenAPI 3.1 — use type arrays instead.

nullable: true was removed in OpenAPI v3.1 in favor of type arrays with the value "null". The spec declares "openapi": "3.1.0" at line 2, so every nullable: true occurrence throughout Chat and Session is non-conformant and will be silently ignored by strict OAS 3.1 validators and code-generators.

The correct 3.1 pattern is:

- "type": "string",
- "nullable": true
+ "type": ["string", "null"]

Nullable + enum is especially broken. lifecycleState (lines 287–299) and prStatus (lines 343–350) combine nullable: true with an enum that does not contain null. With OpenAPI 3.1, null is not handled as valid for such a field — generators throw IllegalArgumentException on null values instead of returning null. When a schema is marked nullable and also defines an enum, the enum must explicitly contain a null value.

The correct 3.1 pattern for nullable enums:

  "lifecycleState": {
-   "type": "string",
-   "nullable": true,
+   "type": ["string", "null"],
    "enum": [
      "provisioning", "active", "hibernating",
      "hibernated", "restoring", "archived", "failed",
+     null
    ]
  }

(Applies identically to prStatus.)

Also applies to: 184-203, 240-383

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api-reference/openapi/sessions.json` at line 2, The OpenAPI file declares
"openapi": "3.1.0" so all uses of nullable: true are invalid; update the Chat
and Session schemas (and any other schemas between the noted ranges) to replace
nullable: true with type arrays that include "null" (e.g., change "type":
"string", "nullable": true to "type": ["string","null"]) and for enum fields
like lifecycleState and prStatus ensure the enum explicitly includes null (or
change the type to ["string","null"] and add null to the enum values) so the
schema is valid under OpenAPI 3.1; locate schemas by their names Chat, Session
and the properties lifecycleState and prStatus to apply these changes
consistently.
api-reference/sessions/create.mdx (2)

1-4: 💤 Low value

Missing description in frontmatter.

The **/*.mdx guideline calls for "clear, self-documenting titles and descriptions." A description field improves SEO metadata and navigation tooltips in Mintlify.

 ---
 title: "Create Session"
+description: "Create a new agent session and an initial chat in a single transaction."
 openapi: "/api-reference/openapi/sessions.json POST /api/sessions"
 ---
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api-reference/sessions/create.mdx` around lines 1 - 4, Add a description key
to the MDX frontmatter so the page has SEO and tooltip metadata; update the
frontmatter block that currently contains title: "Create Session" and openapi:
"/api-reference/openapi/sessions.json POST /api/sessions" by adding a
descriptive string (e.g., description: "Create a new API session for
authentication and token management") directly under the title line, preserving
YAML syntax and quoting, so the page follows the **/*.mdx guideline for clear
titles and descriptions.

3-3: 💤 Low value

Consider registering the spec in docs.json instead of inlining the path here.

The coding guideline specifies openapi: 'METHOD /path' (without a spec file path). Mintlify supports setting a default OpenAPI spec for a navigation group via "openapi": "/path/to/spec.json" at the group level, then referencing endpoints as "GET /path" in the pages array or openapi: "POST /api/sessions" in MDX frontmatter.

Registering the spec once in docs.json under the Sessions group keeps the MDX files path-agnostic and the spec location in a single authoritative place:

// docs.json — Sessions group
  {
    "group": "Sessions",
+   "openapi": "/api-reference/openapi/sessions.json",
    "pages": [
-     "api-reference/sessions/create"
+     "POST /api/sessions"
    ]
  }
// api-reference/sessions/create.mdx
 openapi: "/api-reference/openapi/sessions.json POST /api/sessions"
+openapi: "POST /api/sessions"

As per coding guidelines, api-reference/**/*.mdx pages should use the format openapi: 'METHOD /path'.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api-reference/sessions/create.mdx` at line 3, The frontmatter in create.mdx
currently inlines the spec file path with the method ("openapi:
\"/api-reference/openapi/sessions.json POST /api/sessions\""); change it to the
guideline format "openapi: 'POST /api/sessions'" and instead register the spec
file once in docs.json under the Sessions navigation group (set the group's
"openapi" to "/api-reference/openapi/sessions.json") so pages remain
path-agnostic; update create.mdx's openapi value and ensure other
api-reference/*.mdx pages follow the same "METHOD /path" format.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@api-reference/openapi/sessions.json`:
- Around line 26-81: Add a stable operationId to the POST /sessions operation so
SDKs and Mintlify anchors have a predictable target; update the POST operation
object (the "Create session" endpoint) by adding an "operationId" field (e.g.,
"createSession" or "createSessionWithInitialChat") that uniquely identifies this
operation and matches your naming conventions so future x-mint overrides and
code generators produce consistent function names.
- Around line 272-278: The array schema for "globalSkillRefs" is missing a
maxItems constraint; update the "globalSkillRefs" schema in the OpenAPI document
to include a suitable "maxItems" value that reflects the API's real limit (or a
conservative documented maximum) so clients and linters won't treat the array as
unbounded, e.g., add "maxItems": <number> to the array definition for
globalSkillRefs.
- Line 2: The OpenAPI file declares "openapi": "3.1.0" so all uses of nullable:
true are invalid; update the Chat and Session schemas (and any other schemas
between the noted ranges) to replace nullable: true with type arrays that
include "null" (e.g., change "type": "string", "nullable": true to "type":
["string","null"]) and for enum fields like lifecycleState and prStatus ensure
the enum explicitly includes null (or change the type to ["string","null"] and
add null to the enum values) so the schema is valid under OpenAPI 3.1; locate
schemas by their names Chat, Session and the properties lifecycleState and
prStatus to apply these changes consistently.

In `@api-reference/sessions/create.mdx`:
- Around line 1-4: Add a description key to the MDX frontmatter so the page has
SEO and tooltip metadata; update the frontmatter block that currently contains
title: "Create Session" and openapi: "/api-reference/openapi/sessions.json POST
/api/sessions" by adding a descriptive string (e.g., description: "Create a new
API session for authentication and token management") directly under the title
line, preserving YAML syntax and quoting, so the page follows the **/*.mdx
guideline for clear titles and descriptions.
- Line 3: The frontmatter in create.mdx currently inlines the spec file path
with the method ("openapi: \"/api-reference/openapi/sessions.json POST
/api/sessions\""); change it to the guideline format "openapi: 'POST
/api/sessions'" and instead register the spec file once in docs.json under the
Sessions navigation group (set the group's "openapi" to
"/api-reference/openapi/sessions.json") so pages remain path-agnostic; update
create.mdx's openapi value and ensure other api-reference/*.mdx pages follow the
same "METHOD /path" format.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a7dcccf3-5ef6-4359-98dd-f765f0c31587

📥 Commits

Reviewing files that changed from the base of the PR and between c42337a and bdf89d9.

📒 Files selected for processing (3)
  • api-reference/openapi/sessions.json
  • api-reference/sessions/create.mdx
  • docs.json

@sweetmantech sweetmantech merged commit 6bb436f into main May 4, 2026
3 checks passed
@sweetmantech sweetmantech deleted the docs/create-session branch May 4, 2026 21:58
sidneyswift added a commit that referenced this pull request May 6, 2026
PR #174's nav structure was written Apr 27, before three pages were
added to main:

- api-reference/ai/models       (added by #177 on May 1)
- api-reference/sessions/create (added by #186 on May 3)
- api-reference/sessions/get    (added by #185 on May 4)

These pages exist on disk but had no nav entry in the combined PR,
which would orphan them once #189 lands. Adding them in:

- Accounts tab → new "Sessions" group placed after "Sandboxes"
  (matches main's grouping of sessions with sandboxes)
- Chat tab → new "Models" group at the end
  (closest semantic fit; main grouped this under "Tools & Reference"
  which doesn't exist in our restructured 9-tab layout)

Co-authored-by: Cursor <cursoragent@cursor.com>
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