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

# Delete Data By User Token

> Permanently deletes all messages for the given user token.

<Callout icon="flask-conical" color="#14b8a6">
  This is a **beta feature** according to [Algolia's Terms of Service ("Beta Services")](https://www.algolia.com/policies/terms/).
</Callout>

**Required ACL:** `logs`

Does not delete conversations.

## Usage

<CodeGroup>
  ```cs C# theme={"system"}
  // Initialize the client
  var client = new AgentStudioClient(
    new AgentStudioConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")
  );

  // Call the API
  await client.DeleteUserDataAsync("test-user-token");
  ```

  ```dart Dart theme={"system"}
  // Initialize the client
  final client = AgentStudioClient(
      appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY');

  // Call the API
  await client.deleteUserData(
    userToken: "test-user-token",
  );
  ```

  ```go Go theme={"system"}
  // Initialize the client
  client, err := agentStudio.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")
  if err != nil {
    // The client can fail to initialize if you pass an invalid parameter.
    panic(err)
  }

  // Call the API
  err = client.DeleteUserData(client.NewApiDeleteUserDataRequest(
    "test-user-token"))
  if err != nil {
    // handle the eventual error
    panic(err)
  }
  ```

  ```java Java theme={"system"}
  // Initialize the client
  AgentStudioClient client = new AgentStudioClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");

  // Call the API
  client.deleteUserData("test-user-token");
  ```

  ```js JavaScript theme={"system"}
  // Initialize the client
  const client = agentStudioClient('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY');

  // Call the API
  await client.deleteUserData({ userToken: 'test-user-token' });
  ```

  ```kotlin Kotlin theme={"system"}
  // Initialize the client
  val client = AgentStudioClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY")

  // Call the API
  client.deleteUserData(userToken = "test-user-token")
  ```

  ```php PHP theme={"system"}
  // Initialize the client
  $client = AgentStudioClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY');

  // Call the API
  $client->deleteUserData(
      'test-user-token',
  );
  ```

  ```python Python theme={"system"}
  # Initialize the client
  # In an asynchronous context, you can use AgentStudioClient instead, which exposes the exact same methods.
  client = AgentStudioClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")

  # Call the API
  client.delete_user_data(
      user_token="test-user-token",
  )
  ```

  ```ruby Ruby theme={"system"}
  # Initialize the client
  client = Algolia::AgentStudioClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")

  # Call the API
  client.delete_user_data("test-user-token")
  ```

  ```scala Scala theme={"system"}
  // Initialize the client
  val client = AgentStudioClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY")

  // Call the API
  Await.result(
    client.deleteUserData(
      userToken = "test-user-token"
    ),
    Duration(100, "sec")
  )
  ```

  ```swift Swift theme={"system"}
  // Initialize the client
  let client = try AgentStudioClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY")

  // Call the API
  try await client.deleteUserData(userToken: "test-user-token")
  ```
</CodeGroup>

<Card icon="folder-code" horizontal="true" title="See the full API reference" arrow="true" href="/doc/rest-api/agent-studio/delete-user-data">
  For more details about input parameters
  and response fields.
</Card>
