Skip to main content

Module dto

Module dto 

Source
Expand description

Data Transfer Objects (DTOs) for the cognee HTTP server.

Each file corresponds to one router family.

§Wire-convention contract (Decision 10, polarity-corrected 2026-04-29)

Every request/response DTO whose Python counterpart inherits cognee.api.DTO.InDTO or OutDTO uses #[serde(rename_all = "camelCase")] because Python’s alias_generator=to_camel emits camelCase on the wire. Request DTOs additionally apply #[serde(alias = "<snake_form>")] per multi-word field for input compatibility with Python’s populate_by_name=True.

The rule does not apply to:

  • Plain-dict response bodies built via JSONResponse(content={...}) or returned as raw dict[str, Any] from a handler (e.g. the forget response variants, RememberResultDTO, the permissions response DTOs, pipeline_run info dicts, auth user/token responses). Their wire shape is the literal Python key names — usually snake_case — because FastAPI’s jsonable_encoder does not synthesize aliases for plain dicts.
  • Bare BaseModel subclasses (no alias_generator applied) such as the responses module helpers (Function, ToolCall, ChatUsage, …), the notebooks NotebookCell, the pipelines.PipelineRunInfo family, etc. These keep snake_case literal field names on the wire.
  • Third-party Pydantic models from fastapi-users (BaseUser, BaseUserUpdate, BearerResponse, …): they have no alias_generator and emit snake_case literal field names.
  • Query parameters declared at the FastAPI function signature — FastAPI does not apply alias_generator here. Wire name equals the Python parameter name.
  • Multipart form fields declared at the function signature — wire name equals the literal Python parameter name (Python intentionally mixes camelCase and snake_case for these).
  • HTTP headers and URL path parameters — always literal.

The convention is enforced by the workspace test crates/http-server/tests/test_openapi_camelcase.rs, which walks every component schema in the generated OpenAPI document and asserts each property name is camelCase. The whitelist there enumerates every exception above.

Modules§

activity
DTOs for the GET /api/v1/activity/* family.
add
DTOs for POST /api/v1/add.
api_keys
DTOs for the api-keys router.
auth
DTOs for the auth router (login / logout / me).
auth_register
DTOs for the auth register router.
auth_reset_password
DTOs for the reset-password router.
auth_verify
DTOs for the verify router.
checks
DTOs for the /api/v1/checks family.
cognify
DTOs for POST /api/v1/cognify and GET /api/v1/cognify/subscribe/{id}.
configuration
DTOs for /api/v1/configuration/* per routers/configuration.md §4.
datasets
DTOs for /api/v1/datasets/*.
delete
DTOs for DELETE /api/v1/delete (deprecated endpoint).
forget
DTOs for POST /api/v1/forget.
improve
DTOs for POST /api/v1/improve.
llm
DTOs for /api/v1/llm.
memify
DTOs for POST /api/v1/memify.
notebooks
DTOs for the /api/v1/notebooks router.
ontologies
DTOs for /api/v1/ontologies.
permissions
DTOs for /api/v1/permissions/* per routers/permissions.md §4.
pipeline_run
Shared PipelineRunInfoDTO and wire-string helpers used by all four pipeline routers (cognify, memify, remember, improve).
recall
DTOs for /api/v1/recall.
remember
DTOs for POST /api/v1/remember.
remember_entry
Request DTO for POST /api/v1/remember/entry (E-02).
responses
DTOs for the /api/v1/responses router.
search
DTOs for /api/v1/search (and shared with /api/v1/recall).
sessions
DTOs for /api/v1/sessions/* (E-09 owns the list endpoint).
settings
DTOs for /api/v1/settings/* per routers/settings.md §4.
sync
DTOs for /api/v1/sync and /api/v1/sync/status.
update
DTOs for PATCH /api/v1/update.
users
Shared user DTOs (UserReadDTO, UserUpdatePayloadDTO, InvalidPasswordDetailDTO). Used by auth_register, users, and users_by_email routers.
users_by_email
DTOs for the users-by-email router.
util
Shared deserializer utilities re-used across multiple pipeline-router DTOs.
visualize
DTOs for /api/v1/visualize.