15  Debug

8 operations.

15.0.1 debugCreateTestOrganization

GET /api/debug/create-organization-test

Developer test of the organization-creation flow.

Why it exists. † Create an organisation for the caller if they have none, as a way of exercising that path by hand. A development aid that writes.

Tests organization creation process for the current user (debug purposes only). Development only — the handler calls debugGuard() and returns 404 when NODE_ENV=production, so this operation does not exist in a deployed environment.

Authentication: CookieAuth

Uses a service-role client (row-level security bypassed).

Returns — success · hasOrganization · memberships · message · organization

Field names as the handler returns them; the source states no types for them.

Effect — writes (insert) organization_members · organizations

Responses

Status Meaning Body
200 Either the caller already had an organization (message only, no write), or a test organization was created and the caller made its admin. Organization
401 Not authenticated. Error
500 Server error creating the test organization. Error

15.0.2 debugFixOrganization

GET /api/debug/fix-organization

Developer repair tool for broken organization memberships.

Why it exists. † Repair the caller’s membership by creating the organisation they should have had, for recovering an account stuck without one. A development aid that writes.

Attempts to resolve organization-related issues for the current user by creating or fixing memberships. Development only — the handler calls debugGuard() and returns 404 when NODE_ENV=production, so this operation does not exist in a deployed environment.

Authentication: CookieAuth

Uses a service-role client (row-level security bypassed).

Returns — success · hasOrganization · memberships · message · organization

Field names as the handler returns them; the source states no types for them.

Effect — writes (delete, insert) organization_members · organizations

Responses

Status Meaning Body
200 Either the caller already had an organization (message only, no write), or one was created and the caller made its admin. Organization
401 Not authenticated. Error
500 Server error checking, creating, or joining the organization. Error

15.0.3 debugGetOrganizationStatus

GET /api/debug/organization-status

Developer check of a user’s organization membership state.

Why it exists. † Show the caller’s identity, membership and the organisations that exist, for diagnosing a user who has landed without a workspace. A development aid.

Checks the current user’s organization status and membership details (for debugging purposes). Development only — the handler calls debugGuard() and returns 404 when NODE_ENV=production, so this operation does not exist in a deployed environment.

Authentication: CookieAuth

Uses a service-role client (row-level security bypassed).

Returns — user · hasOrganization · memberships · organizations · allOrganizations · allMembers · timestamp

Field names as the handler returns them; the source states no types for them.

Effect — reads organization_members · organizations

Responses

Status Meaning Body
200 Organization status information. Organization
401 Not authenticated. Error
500 Server error. Error

15.0.4 debugListUserOrganizationDetails

GET /api/debug/organizations

Developer dump of a user’s organization details.

Why it exists. † Show the caller’s organisations alongside all organisations in the system, for diagnosing membership problems. A development aid.

Retrieves detailed organization information for the current user including memberships and all organizations (for debugging purposes). Development only — the handler calls debugGuard() and returns 404 when NODE_ENV=production, so this operation does not exist in a deployed environment.

Authentication: CookieAuth

Returns — user · userMemberships · allOrganizations · allMembers

Field names as the handler returns them; the source states no types for them.

Effect — reads organization_members · organizations

Responses

Status Meaning Body
200 Organization debug information. Organization
401 Not authenticated. Error
500 Server error. Error

15.0.5 debugGetOrganizationsData

GET /api/debug/organizations-data

Developer dump of detailed organization data.

Why it exists. † Show organisation and membership rows read past row-level security, for diagnosing why a user cannot see what they should. A development aid.

Retrieves detailed organization data for debugging purposes, reading past row-level security with a service-role client. Development only — the handler calls debugGuard() and returns 404 when NODE_ENV=production, so this operation does not exist in a deployed environment.

Authentication: CookieAuth

Uses a service-role client (row-level security bypassed).

Returns — user · memberships · allOrganizations · allMembers

Field names as the handler returns them; the source states no types for them.

Effect — reads organization_members · organizations

Responses

Status Meaning Body
200 Detailed organization data. Organization
401 Not authenticated. Error
500 Server error. Error

15.0.6 debugGetUserOrganization

GET /api/debug/user-organization

Developer dump of combined user and organization information.

Why it exists. † Show one user’s details and their organisation membership, for diagnosing an individual account. A development aid.

Retrieves comprehensive user and organization information for debugging purposes. Development only — the handler calls debugGuard() and returns 404 when NODE_ENV=production, so this operation does not exist in a deployed environment.

Authentication: CookieAuth

Uses a service-role client (row-level security bypassed).

Returns — user · userDetails · hasOrganization · organizations · timestamp

Field names as the handler returns them; the source states no types for them.

Effect — reads organization_members · organizations

Responses

Status Meaning Body
200 User and organization debug information. Organization
401 Not authenticated. Error
500 Server error. Error

15.0.7 getTestImageEvent

GET /api/test-image-visualization

Developer harness that generates a sample chat image event (no login, development only).

Why it exists. † Exercise the image-in-chat rendering path against real images from the database and return the events it would emit, for checking the surface end to end without driving the interface.

Unauthenticated developer test harness — fetches sample images and returns a ready-to-paste AG-UI event payload for exercising the chat gallery/single-image UI.

Authentication: none

Returns — success · message · suggestion · test_type · image_data · ag_ui_event · instructions · found_images · total_available · sample_images

Field names as the handler returns them; the source states no types for them.

Parameters

Name In Required Type Notes
type query no string — one of gallery, single

Responses

Status Meaning Body
200 Test payload (shape varies by type; success false when no images exist).
500 Test harness failure. Error

15.0.8 simulateImageAnalysisEvents

POST /api/test-image-visualization

Developer harness that simulates a chat image-analysis sequence (no login, development only).

Why it exists. † Exercise the batch image-analysis path against given image ids and return the sequence of events it would emit, for checking the tool-call surface end to end.

Unauthenticated developer test harness — runs a batch request against /images and returns a simulated AG-UI tool-call event sequence.

Authentication: none

Returns — success · test_type · batch_result · ag_ui_events · instructions

Field names as the handler returns them; the source states no types for them.

Request body

Field Type Required
image_ids array of string yes
test_analysis boolean no

Responses

Status Meaning Body
200 Simulated workflow payload.
400 image_ids is required and must be an array; test_analysis, if present, must be a boolean. Error
500 Test harness failure. Error