Khwan API

Khwan API as documented publicly: 17 operations. Contract generated from the documentation by API Evangelist (2026-11-13); not the provider's own document.

GitHub OpenAPI

Operations 17

GET /cores List the account’s cores (includes the virtual default ). #
POST /cores Create a core. #
DELETE /cores/{slug} Delete a core and its memory. #
GET /cores/{slug} Fetch a single core. #
PATCH /cores/{slug} Update a core’s name or context (the slug is immutable). #
GET /learning How often this brain has had to be told the same thing twice. #
GET /lessons The standing rules synthesis has written for the selected core, newest first. #
DELETE /lessons/{id} Remove a rule the agent should not have learned. Admin only. #
PATCH /lessons/{id} Correct a rule’s wording, keeping its source_link and use history. Admin only. #
GET /memory Returns recent memory entries for the selected core. #
GET /metrics Returns coherence / learning / usage metrics for the selected core. #
POST /prepare Builds the context for one turn (memory + constitution + coherence). Does not call an LLM. #
POST /record Persists your model’s answer and lets Khwan learn from the turn. #
POST /sync Triggers a learning / consolidation pass for the selected core (distilling lessons from recent turns). #
POST /synthesize/prepare Everything synthesis does before a model is needed — handed to you instead. Admin only, and no model is called. #
POST /synthesize/record Store the rules your model distilled, and close the pass. Admin only. #
POST /verify Scores a model’s answer against the brain after it was produced, so a host can block or rewrite a reply before it ships. #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/khwan-ai:khwan-ai-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

khwan-ai-openapi-generated.yml Raw ↑
openapi: 3.1.0
info:
  title: Khwan API
  version: '2026-11-13'
  description: 'GENERATED FROM DOCUMENTATION by API Evangelist on 2026-11-13: 17 operation(s) read from 6 public documentation page(s) (each operation
    names its page in x-source). This is not the provider''s published contract; Khwan has published no machine-readable contract that the pipeline
    could find. Engine: local.'
  x-evidence-tiers:
    code-example: 0
    documentation: 17
    pages-with-code: 0
    pages-read: 6
  x-generated-from: documentation
  x-provenance: generated
  x-authored-by: API Evangelist
  x-generated: '2026-11-13'
  x-generator: generate-contract-from-docs.py
  x-engine: local
  x-sources:
  - https://docs.khwan.ai/api-reference
  - https://docs.khwan.ai/sdk-ts
  - https://docs.khwan.ai/sdk-python
  - https://docs.khwan.ai/crewai
  - https://docs.khwan.ai/connect-your-agent
  - https://docs.khwan.ai/architecture
servers:
- url: https://api.khwan.ai
paths:
  /cores:
    get:
      operationId: get_cores
      tags:
      - Cores
      summary: List the account’s cores (includes the virtual default ).
      x-source: https://docs.khwan.ai/api-reference
      responses:
        '200':
          description: Success (status as documented)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetCoresResponse'
      x-evidence:
        kind: documentation
    post:
      operationId: post_cores
      tags:
      - Cores
      summary: Create a core.
      x-source: https://docs.khwan.ai/api-reference
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostCoresRequest'
      responses:
        '201':
          description: Success (status as documented)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostCoresResponse'
      x-evidence:
        kind: documentation
  /cores/{slug}:
    delete:
      operationId: delete_cores_slug
      tags:
      - Cores
      summary: Delete a core and its memory.
      x-source: https://docs.khwan.ai/api-reference
      parameters:
      - name: slug
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success (status as documented)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteCoresSlugResponse'
      x-evidence:
        kind: documentation
    get:
      operationId: get_cores_slug
      tags:
      - Cores
      summary: Fetch a single core.
      x-source: https://docs.khwan.ai/api-reference
      parameters:
      - name: slug
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success (status as documented)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetCoresSlugResponse'
      x-evidence:
        kind: documentation
    patch:
      operationId: patch_cores_slug
      tags:
      - Cores
      summary: Update a core’s name or context (the slug is immutable).
      x-source: https://docs.khwan.ai/api-reference
      parameters:
      - name: slug
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchCoresSlugRequest'
      responses:
        '200':
          description: Success (status as documented)
      x-evidence:
        kind: documentation
  /learning:
    get:
      operationId: get_learning
      tags:
      - Learning
      summary: How often this brain has had to be told the same thing twice.
      description: GET /learning
      x-source: https://docs.khwan.ai/api-reference
      parameters:
      - name: days
        in: query
        required: false
        schema:
          type: integer
        description: Window in days (1–365, default 30).
      responses:
        '200':
          description: Success (status as documented)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetLearningResponse'
      x-evidence:
        kind: documentation
  /lessons:
    get:
      operationId: get_lessons
      tags:
      - Lessons
      summary: The standing rules synthesis has written for the selected core, newest first.
      description: GET /lessons
      x-source: https://docs.khwan.ai/api-reference
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
        description: Caps the list (default 50).
      responses:
        '200':
          description: Success (status as documented)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetLessonsResponse'
      x-evidence:
        kind: documentation
  /lessons/{id}:
    delete:
      operationId: delete_lessons_id
      tags:
      - Lessons
      summary: Remove a rule the agent should not have learned. Admin only.
      description: DELETE /lessons/{id}
      x-source: https://docs.khwan.ai/api-reference
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Success (status as documented)
      x-evidence:
        kind: documentation
    patch:
      operationId: patch_lessons_id
      tags:
      - Lessons
      summary: Correct a rule’s wording, keeping its source_link and use history. Admin only.
      description: PATCH /lessons/{id}
      x-source: https://docs.khwan.ai/api-reference
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchLessonsIdRequest'
      responses:
        '200':
          description: Success (status as documented)
      x-evidence:
        kind: documentation
  /memory:
    get:
      operationId: get_memory
      tags:
      - Memory
      summary: Returns recent memory entries for the selected core.
      description: GET /memory
      x-source: https://docs.khwan.ai/api-reference
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
        description: Max entries to return (default 20).
      responses:
        '200':
          description: Success (status as documented)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetMemoryResponse'
      x-evidence:
        kind: documentation
  /metrics:
    get:
      operationId: get_metrics
      tags:
      - Metrics
      summary: Returns coherence / learning / usage metrics for the selected core.
      description: GET /metrics
      x-source: https://docs.khwan.ai/api-reference
      responses:
        '200':
          description: Success (status as documented)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetMetricsResponse'
      x-evidence:
        kind: documentation
  /prepare:
    post:
      operationId: post_prepare
      tags:
      - Prepare
      summary: Builds the context for one turn (memory + constitution + coherence). Does not call an LLM.
      description: POST /prepare
      x-source: https://docs.khwan.ai/api-reference
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostPrepareRequest'
      responses:
        '201':
          description: Success (status as documented)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostPrepareResponse'
      x-evidence:
        kind: documentation
  /record:
    post:
      operationId: post_record
      tags:
      - Record
      summary: Persists your model’s answer and lets Khwan learn from the turn.
      description: POST /record
      x-source: https://docs.khwan.ai/api-reference
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostRecordRequest'
      responses:
        '201':
          description: Success (status as documented)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostRecordResponse'
      x-evidence:
        kind: documentation
  /sync:
    post:
      operationId: post_sync
      tags:
      - Sync
      summary: Triggers a learning / consolidation pass for the selected core (distilling lessons from recent turns).
      description: POST /sync
      x-source: https://docs.khwan.ai/api-reference
      responses:
        '201':
          description: Success (status as documented)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostSyncResponse'
      x-evidence:
        kind: documentation
  /synthesize/prepare:
    post:
      operationId: post_synthesize_prepare
      tags:
      - Synthesize
      summary: Everything synthesis does before a model is needed — handed to you instead. Admin only, and no model is called.
      description: POST /synthesize/prepare
      x-source: https://docs.khwan.ai/api-reference
      responses:
        '201':
          description: Success (status as documented)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostSynthesizePrepareResponse'
      x-evidence:
        kind: documentation
  /synthesize/record:
    post:
      operationId: post_synthesize_record
      tags:
      - Synthesize
      summary: Store the rules your model distilled, and close the pass. Admin only.
      description: POST /synthesize/record
      x-source: https://docs.khwan.ai/api-reference
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostSynthesizeRecordRequest'
      responses:
        '201':
          description: Success (status as documented)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostSynthesizeRecordResponse'
      x-evidence:
        kind: documentation
  /verify:
    post:
      operationId: post_verify
      tags:
      - Verify
      summary: Scores a model’s answer against the brain after it was produced, so a host can block or rewrite a reply before it ships.
      description: POST /verify
      x-source: https://docs.khwan.ai/api-reference
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostVerifyRequest'
      responses:
        '201':
          description: Success (status as documented)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostVerifyResponse'
      x-evidence:
        kind: documentation
components:
  schemas:
    GetCoresResponse:
      type: object
      properties:
        items:
          type: array
          description: Array of core objects.
    PostCoresRequest:
      type: object
      properties:
        slug:
          type: string
          description: Matches ^[a-z0-9][a-z0-9-]{0,38}$. Immutable once created.
        name:
          type: string
          description: Human-readable label.
        context:
          type: string
          description: Seed context / description for the core.
      required:
      - slug
      - name
    PostCoresResponse:
      type: object
      properties:
        slug:
          type: string
        name:
          type: string
        context:
          type: string
    DeleteCoresSlugResponse:
      type: object
      properties:
        ok:
          type: boolean
    GetCoresSlugResponse:
      type: object
      properties:
        slug:
          type: string
        name:
          type: string
        context:
          type: string
    PatchCoresSlugRequest:
      type: object
      properties:
        name:
          type: string
          description: Human-readable label.
        context:
          type: string
          description: Seed context / description for the core.
    GetLearningResponse:
      type: object
      properties:
        window_days:
          type: integer
        rate:
          type: number
        previous:
          type: number
        blamed_retrievals:
          type: integer
        lessons_retrieved:
          type: integer
        worst:
          type: array
          description: Most frequently corrected lessons.
    GetLessonsResponse:
      type: object
      properties:
        user_id:
          type: string
        core:
          type: string
        lessons:
          type: array
          description: Array of lesson objects.
    PatchLessonsIdRequest:
      type: object
      properties:
        text:
          type: string
          description: New lesson text.
      required:
      - text
    GetMemoryResponse:
      type: object
      properties:
        items:
          type: array
          description: Memory entry objects.
    GetMetricsResponse:
      type: object
      properties:
        turns:
          type: integer
        avg_coherence:
          type: number
        memory_size:
          type: integer
        lessons:
          type: integer
    PostPrepareRequest:
      type: object
      properties:
        input:
          type: string
          description: The end user’s message.
        model:
          type: string
          description: Session model hint; may be overridden by dashboard settings.
        constitution:
          type: string
          description: Named constitution profile to apply.
      required:
      - input
    PostPrepareResponse:
      type: object
      properties:
        messages:
          type: array
          description: System and user messages to feed to the model.
        coherence:
          type: number
          description: Coherence score.
        sources:
          type: array
          description: Retrieved memory sources.
        allowed:
          type: boolean
          description: Whether generation is allowed.
        reason:
          type: string
          description: Reason if not allowed.
        turn_token:
          type: string
          description: Token to send back to /record.
    PostRecordRequest:
      type: object
      properties:
        turn_token:
          type: string
          description: The token from the matching /prepare.
        answer:
          type: string
          description: The text your model produced.
      required:
      - turn_token
      - answer
    PostRecordResponse:
      type: object
      properties:
        ok:
          type: boolean
          description: Acknowledgement.
    PostSyncResponse:
      type: object
      properties:
        ok:
          type: boolean
        learned:
          type: integer
    PostSynthesizePrepareResponse:
      type: object
      properties:
        synthesis_token:
          type: string
        system:
          type: string
        packets_scanned:
          type: integer
        clusters:
          type: array
          description: Cluster objects to distill.
    PostSynthesizeRecordRequest:
      type: object
      properties:
        synthesis_token:
          type: string
          description: Token from /synthesize/prepare.
        lessons:
          type: array
          description: Array of distilled lessons.
      required:
      - synthesis_token
      - lessons
    PostSynthesizeRecordResponse:
      type: object
      properties:
        lessons_created:
          type: integer
        skipped:
          type: integer
        packets_scanned:
          type: integer
        status:
          type: string
        write_failed:
          type: integer
        error:
          type: string
    PostVerifyRequest:
      type: object
      properties:
        answer:
          type: string
          description: The text your model produced.
        turn_token:
          type: string
          description: Ties the check to a prepared turn. Omit to score against the core alone.
      required:
      - answer
    PostVerifyResponse:
      type: object
      properties:
        ok:
          type: boolean
          description: Whether the answer is acceptable.
        reason:
          type: string
          description: Reason for rejection if any.
        coherence:
          type: number
          description: Coherence score of the answer.
        contradiction:
          type: boolean
          description: Indicates a contradiction.
tags:
- name: Cores
- name: Learning
- name: Lessons
- name: Memory
- name: Metrics
- name: Prepare
- name: Record
- name: Sync
- name: Synthesize
- name: Verify