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

# Ask User

The ask APIs prompt the user for input. Depending on the API, the user input can be a string, a file, pick an action or fill a form.

Until the user provides an input, both the UI and your code will be blocked.

<Frame caption="Ask File example">
  <img src="https://mintcdn.com/chainlit-43/b2WeFP1vh0enOZXn/images/ask-file.png?fit=max&auto=format&n=b2WeFP1vh0enOZXn&q=85&s=9ae3c8db47342c38a2aa06500696e93f" width="2880" height="860" data-path="images/ask-file.png" />
</Frame>

## Available Ask APIs

<CardGroup cols={2}>
  <Card title="Text Input" icon="text" color="#ea5a0c" href="/api-reference/ask/ask-for-input">
    Ask the user for a string input.
  </Card>

  <Card title="File" icon="file" color="#0285c7" href="/api-reference/ask/ask-for-file">
    Ask the user to upload a file.
  </Card>

  <Card title="Action" icon="bolt" color="#16a34a" href="/api-reference/ask/ask-for-action">
    Ask the user to pick an action.
  </Card>

  <Card title="Element" icon="square-check" color="#9333ea" href="/api-reference/ask/ask-for-element">
    Ask the user to complete a custom form.
  </Card>
</CardGroup>

## Interactive Consent-Gated Forms

The `AskElementMessage` API enables agents to send interactive, consent-gated UI components to users. This feature is particularly useful for:

* **Compliance workflows** where explicit user consent is required
* **Data review** scenarios where users need to review and modify AI-generated data
* **Form completion** with pre-filled values for user confirmation
* **Audit trails** for sensitive operations

The flow works as follows:

1. **Agent** calls a consent-gated tool (e.g., expense logging API)
2. Backend sends a **CustomElement** to the frontend with editable fields and timeout
3. **User** modifies or confirms the pre-filled values and submits
4. Backend receives the **updated props** and proceeds with the tool call using user-approved data

This pattern blocks further chat interactions until user input is received, preventing ambiguous or unauthorized actions.

<Frame caption="Ask Element example">
  <img src="https://mintcdn.com/chainlit-43/b2WeFP1vh0enOZXn/images/ask-element.png?fit=max&auto=format&n=b2WeFP1vh0enOZXn&q=85&s=b6c62293af6a74dcb51234de3a2dec86" width="870" height="923" data-path="images/ask-element.png" />
</Frame>
