> ## Documentation Index
> Fetch the complete documentation index at: https://developer.suki.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Submit User Feedback

> Submit quantitative and qualitative feedback on AI-generated ambient content with submitFeedback in the Mobile SDK

Submit user feedback lets you add a feature where providers can rate generated notes and leave optional comments so Suki can improve future note quality for your integration.

## How to submit user feedback

To submit feedback, call `submitFeedback(_:for:onCompletion:)` after a provider reviews a generated note. The API captures how well the note matched the encounter, helping Suki improve future note quality.

You can use it with a rating control, such as stars or thumbs up/down, and an optional comment field. A single submission can include both **quantitative feedback** (a rating) and **qualitative feedback** (comments).

#### Function signature

The method takes a `FeedbackSubmission`, the `sessionId` for the session you are rating, and a completion handler. On success, the handler returns a unique `feedbackId`; on failure, it returns an error.

<CodeGroup>
  ```swift Swift theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
  public func submitFeedback(
      _ submission: FeedbackSubmission,
      for sessionId: SessionId,
      onCompletion completionHandler: @escaping ((Result<String, Error>) -> Void)
  )
  public typealias SessionId = String
  ```
</CodeGroup>

#### Required data structures

To submit feedback, construct a `FeedbackSubmission`. It combines a `FeedbackEntity` (what the feedback is about), a `QuantitativeFeedback` (the rating and its scale), and an optional `comments` string for free-text feedback.

<CodeGroup>
  ```swift Swift theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
  public struct FeedbackSubmission {
      public let entity: FeedbackEntity
      public let quantitative: QuantitativeFeedback
      public let comments: String?

      public init(entity: FeedbackEntity,
                  quantitative: QuantitativeFeedback,
                  comments: String? = nil)
  }

  public enum FeedbackEntity: String {
      case content = "content"
  }

  public struct QuantitativeFeedback {
      public let minRating: Int
      public let maxRating: Int
      public let rating: Int

      public init(minRating: Int, maxRating: Int, rating: Int)
  }
  ```
</CodeGroup>

#### Implementation example

To submit feedback, you first create the `FeedbackSubmission` object and then pass it to the `submitFeedback` method along with the `sessionId`.

The method is **asynchronous**. The completion handler returns a `Result` containing either a success message with the unique feedbackId or an error if the submission failed.

<CodeGroup>
  ```swift Swift theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
  // 1. Create the quantitative feedback object.
  let quantitativeFeedback = QuantitativeFeedback(minRating: 1, maxRating: 5, rating: 4)

  // 2. Create the full feedback submission object.
  let submission = FeedbackSubmission(
      entity: .content,
      quantitative: quantitativeFeedback,
      comments: "The patient's history was captured accurately."
  )

  // 3. Call the submit method with the submission object and session ID.
  SukiAmbientCoreManager.shared.submitFeedback(submission, for: sessionId) { result in
      switch result {
      case .success(let feedbackId):
          print("Feedback submitted successfully with ID: \(feedbackId)")
      case .failure(let error):
          print("Error submitting feedback: \(error)")
      }
  }
  ```
</CodeGroup>

<Warning>
  * Provide feedback for each entity type **once per session** only.

  * At present feedback submissions are only supported for the `.content` entity. This may be expanded in the future.

  * Submitting feedback for the same entity type a second time in the same session will be considered invalid.
</Warning>

#### Rating system

* The `maxRating` must be greater than the `minRating`.

* The rating must be within the inclusive range of `minRating` and `maxRating`.

* The `comments` string is optional and has a maximum length of **2000** characters.

<Note>
  - Configure any integer rating scale. For example, create a 1 to 5 scale by setting `minRating` to 1 and `maxRating` to 5, or a binary scale by setting the values to 0 and 1.

  - Suki recommends using a scale of 1 to 5 for ratings.
</Note>

## Next steps

<Icon icon="file-lines" iconType="solid" /> **[Session status and content retrieval](/mobile-sdk/ambient-guides/session-status-and-content-retrieval)** - overview of all retrieval workflows.

<Icon icon="file-lines" iconType="solid" /> **[Check status and retrieve content](/mobile-sdk/ambient-guides/check-status-and-retrieve-content)** - Confirm processing is complete before collecting feedback.

<Icon icon="file-lines" iconType="solid" /> **[Clear session](/mobile-sdk/ambient-guides/clearing-sessions)** - Clear local session state after retrieve.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.