{
  "components": {
    "schemas": {
      "AssessmentReport": {
        "description": "The person's report of one assessment, as the platform recorded it.",
        "properties": {
          "assessment_id": {
            "description": "The assessment the report belongs to.",
            "format": "uuid",
            "title": "Assessment Id",
            "type": "string"
          },
          "completed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the results, this report included, were ready.",
            "title": "Completed At"
          },
          "locale": {
            "description": "The language the report is written in: the language the assessment ran in.",
            "title": "Locale",
            "type": "string"
          },
          "schema_version": {
            "description": "The version of the `user_report` object's shape. Fields are only added within a version; a removed or renamed field comes with a new version.",
            "title": "Schema Version",
            "type": "integer"
          },
          "user_report": {
            "additionalProperties": true,
            "description": "The report exactly as recorded: an executive summary, a profile summary, one section per competency (pattern, strength, growth area, tactics, resources, a monthly challenge), development axes and recommendations. Every text field is markdown, except the quotes (`*_quote` and `quote` in the `strengths` and `growth_areas` lists), which are the candidate's words copied exactly and are plain text. The Wiselook portal renders this same object.",
            "title": "User Report",
            "type": "object"
          }
        },
        "required": [
          "assessment_id",
          "locale",
          "completed_at",
          "schema_version",
          "user_report"
        ],
        "title": "AssessmentReport",
        "type": "object"
      },
      "ChatMessageRequest": {
        "description": "One message in an assessment's conversation. Send\n`methodology_id` with the first message of an assessment; it is\nignored after that.",
        "properties": {
          "content": {
            "title": "Content",
            "type": "string"
          },
          "evaluation_id": {
            "title": "Evaluation Id",
            "type": "string"
          },
          "methodology_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Methodology Id"
          }
        },
        "required": [
          "evaluation_id",
          "content"
        ],
        "title": "ChatMessageRequest",
        "type": "object"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "title": "Detail",
            "type": "array"
          }
        },
        "title": "HTTPValidationError",
        "type": "object"
      },
      "MemberChatMessageRequest": {
        "additionalProperties": false,
        "description": "One message in a member's assessment conversation. The assessment\ncomes from the URL, so the body carries only the message; any other\nfield is refused.",
        "properties": {
          "content": {
            "description": "The person's message for this turn.",
            "title": "Content",
            "type": "string"
          }
        },
        "required": [
          "content"
        ],
        "title": "MemberChatMessageRequest",
        "type": "object"
      },
      "Message": {
        "description": "A single turn in a conversation.",
        "properties": {
          "content": {
            "title": "Content",
            "type": "string"
          },
          "eco_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Eco Id"
          },
          "message_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Message Id"
          },
          "practice": {
            "default": false,
            "title": "Practice",
            "type": "boolean"
          },
          "role": {
            "enum": [
              "user",
              "assistant",
              "system"
            ],
            "title": "Role",
            "type": "string"
          },
          "sent_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sent At"
          }
        },
        "required": [
          "role",
          "content"
        ],
        "title": "Message",
        "type": "object"
      },
      "Transcript": {
        "description": "An assessment's full conversation, as a list of messages.",
        "properties": {
          "messages": {
            "items": {
              "$ref": "#/components/schemas/Message"
            },
            "title": "Messages",
            "type": "array"
          },
          "ref": {
            "title": "Ref",
            "type": "string"
          }
        },
        "required": [
          "ref",
          "messages"
        ],
        "title": "Transcript",
        "type": "object"
      },
      "ValidationError": {
        "properties": {
          "ctx": {
            "title": "Context",
            "type": "object"
          },
          "input": {
            "title": "Input"
          },
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "title": "Location",
            "type": "array"
          },
          "msg": {
            "title": "Message",
            "type": "string"
          },
          "type": {
            "title": "Error Type",
            "type": "string"
          }
        },
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError",
        "type": "object"
      },
      "VoiceSessionRequest": {
        "description": "The assessment to start a voice session for.",
        "properties": {
          "evaluation_id": {
            "description": "The assessment this voice session belongs to. It must be the caller's.",
            "title": "Evaluation Id",
            "type": "string"
          },
          "methodology_id": {
            "anyOf": [
              {
                "format": "uuid",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Required the first time a voice session starts for an assessment; ignored after that.",
            "title": "Methodology Id"
          },
          "peer_identity": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional identifier that ties the join token to one participant. When the caller's token already identifies the participant, this field is ignored.",
            "title": "Peer Identity"
          }
        },
        "required": [
          "evaluation_id"
        ],
        "title": "VoiceSessionRequest",
        "type": "object"
      },
      "VoiceSessionResponse": {
        "description": "The descriptor the browser uses to join the transport.",
        "properties": {
          "connect_url": {
            "description": "The URL the browser connects to for the voice session (`wss://...`).",
            "title": "Connect Url",
            "type": "string"
          },
          "ice_servers": {
            "description": "ICE servers the browser uses to connect through NAT and firewalls.",
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Ice Servers",
            "type": "array"
          },
          "join_token": {
            "description": "Short-lived token that lets this participant join this assessment's voice session.",
            "title": "Join Token",
            "type": "string"
          },
          "transport_ref": {
            "description": "Identifies the voice session; pass it to end the session.",
            "title": "Transport Ref",
            "type": "string"
          }
        },
        "required": [
          "transport_ref",
          "join_token",
          "connect_url"
        ],
        "title": "VoiceSessionResponse",
        "type": "object"
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "bearerFormat": "JWT",
        "description": "OAuth2 access token: a client-credentials token for your backend, or the visitor session token for the widget. See Authentication.",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "title": "Wiselook AI Service",
    "version": "0.1.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/v1/chat/messages": {
      "post": {
        "description": "Sends one message in an assessment's conversation and streams the reply as server-sent events. Include `methodology_id` with the first message of an assessment; it is ignored after that.\n\nEvents: `message_start`, `message_delta`, `message_complete`, `progress_update`, `assessment_complete`, `error` and `stream_end`. An `error` event can arrive inside a successful (200) stream, so check for it. A message for an assessment that has ended answers 409 `assessment_ended`.",
        "operationId": "post_chat_message_v1_chat_messages_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatMessageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Send message",
        "tags": [
          "Chat"
        ]
      }
    },
    "/v1/chat/voice/sessions": {
      "post": {
        "description": "Starts a voice session for an assessment and returns what the browser needs to join it: the connection URL, a short-lived join token and the ICE servers. Include `methodology_id` the first time; it is ignored after that. An assessment that has ended answers 409 `assessment_ended`.",
        "operationId": "post_voice_session_v1_chat_voice_sessions_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoiceSessionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoiceSessionResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Start voice session",
        "tags": [
          "Chat"
        ]
      }
    },
    "/v1/chat/voice/sessions/{transport_ref}": {
      "delete": {
        "description": "Ends a voice session, identified by the `transport_ref` returned when it started. Answers 204.",
        "operationId": "delete_voice_session_v1_chat_voice_sessions__transport_ref__delete",
        "parameters": [
          {
            "in": "path",
            "name": "transport_ref",
            "required": true,
            "schema": {
              "title": "Transport Ref",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "End voice session",
        "tags": [
          "Chat"
        ]
      }
    },
    "/v1/members/{tenant_user_id}/assessments/{evaluation_id}/chat/messages": {
      "post": {
        "description": "Sends one message in the conversation and streams the assistant's reply as server-sent events.\n\nAuthenticate with the same API-client token used to start the assessment. The assessment must belong to your organisation.\n\nEvents: `message_start`, `message_delta`, `message_complete`, `progress_update`, `assessment_complete`, `error` and `stream_end`. An `error` event can arrive inside a successful (200) stream, so check for it. A message for an assessment that has ended answers 409 `assessment_ended`.",
        "operationId": "post_member_chat_message_v1_members__tenant_user_id__assessments__evaluation_id__chat_messages_post",
        "parameters": [
          {
            "in": "path",
            "name": "tenant_user_id",
            "required": true,
            "schema": {
              "title": "Tenant User Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "evaluation_id",
            "required": true,
            "schema": {
              "title": "Evaluation Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MemberChatMessageRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Send message for a member",
        "tags": [
          "Chat"
        ]
      }
    },
    "/v1/transcripts/{evaluation_id}": {
      "get": {
        "description": "Returns an assessment's conversation as a list of messages. An assessment the caller cannot see answers 404.",
        "operationId": "get_transcript_v1_transcripts__evaluation_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "evaluation_id",
            "required": true,
            "schema": {
              "title": "Evaluation Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transcript"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Get transcript",
        "tags": [
          "Transcripts"
        ]
      }
    }
  },
  "servers": [
    {
      "url": "https://api.wiselook.com",
      "description": "Wiselook public API"
    }
  ]
}
