> ## 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 a user profile

> Deletes a user profile.

The response includes a date and time when the user profile can safely be considered deleted.

**Required ACL:** `recommendation`


## OpenAPI

````yaml specs/personalization.yml delete /1/profiles/{userToken}
openapi: 3.1.0
info:
  title: Personalization API
  summary: >-
    The Personalization API lets you access user profiles built from the
    personalization strategy
  description: >
    ## Base URLs


    Base URLs for the Personalization API:


    - `https://personalization.us.algolia.com`

    - `https://personalization.eu.algolia.com`


    Use the URL that matches your [analytics
    region](https://dashboard.algolia.com/account/infrastructure/analytics).


    **All requests must use HTTPS.**


    ## Authentication


    Add these headers to authenticate requests:


    - `x-algolia-application-id`. Your Algolia application ID.

    - `x-algolia-api-key`. An API key with the necessary permissions to make the
    request.
      The required access control list (ACL) to make a request is listed in each endpoint's reference.

    You can find your application ID and API key in the [Algolia
    dashboard](https://dashboard.algolia.com/account/api-keys).


    ## Request format


    Request bodies must be JSON objects.


    ## Response status and errors


    The Personalization API returns JSON responses.

    Since JSON doesn't guarantee any specific ordering, don't rely on the order
    of attributes in the API response.


    Successful responses return `2xx` statuses. Client errors return `4xx`
    statuses. Server errors return `5xx` statuses.

    Error responses have a `message` property with more information.


    ## Rate limiting


    When making requests to the Personalization API, you are limited to 40 API
    calls per second per application.


    The following headers provide information about your current limit:


    - `x-ratelimit-limit`: The number of requests allowed every second.

    - `x-ratelimit-remaining`: The number of requests remaining in the current

    second period.

    - `x-ratelimit-reset`: Timestamp when the next time period starts, measured
    in seconds since the Unix epoch.


    ## Version


    The current version of the Personalization API is version 1, indicated by
    the `/1/` in each endpoint's URL.
  version: 1.0.0
servers:
  - url: https://personalization.{region}.algolia.com
    variables:
      region:
        description: The region where your Algolia application is hosted.
        enum:
          - us
          - eu
        default: us
security:
  - appId: []
    apiKey: []
tags:
  - name: profiles
    x-displayName: Profiles
    description: >
      User profiles represent the affinities each user profile has for the
      different facets in your index.

      The more a user viewed and clicked search results with a specific facet,

      the higher the affinity for that facet.
  - name: strategies
    x-displayName: Strategies
    description: >
      The personalization strategy defines how personalization should affect the
      search results,

      and how much each facet and event type impact the personalization.
externalDocs:
  url: https://www.algolia.com/doc/guides/personalization/what-is-personalization
  description: Algolia Personalization.
paths:
  /1/profiles/{userToken}:
    delete:
      tags:
        - profiles
      summary: Delete a user profile
      description: >
        Deletes a user profile.


        The response includes a date and time when the user profile can safely
        be considered deleted.
      operationId: deleteUserProfile
      parameters:
        - $ref: '#/components/parameters/UserToken'
      responses:
        '200':
          description: OK
          headers:
            x-ratelimit-limit:
              $ref: '#/components/headers/x-ratelimit-limit'
            x-ratelimit-remaining:
              $ref: '#/components/headers/x-ratelimit-remaining'
            x-ratelimit-reset:
              $ref: '#/components/headers/x-ratelimit-reset'
          content:
            application/json:
              schema:
                title: deleteUserProfileResponse
                type: object
                additionalProperties: false
                required:
                  - userToken
                  - deletedUntil
                properties:
                  deletedUntil:
                    type: string
                    description: >
                      Date and time when the user profile can be safely
                      considered to be deleted.

                      Any events received after the `deletedUntil` date start a
                      new user profile.
                  userToken:
                    $ref: '#/components/schemas/userToken'
        '400':
          $ref: '#/components/responses/BadRequest'
        '402':
          $ref: '#/components/responses/FeatureNotEnabled'
        '403':
          $ref: '#/components/responses/MethodNotAllowed'
        '404':
          $ref: '#/components/responses/IndexNotFound'
      x-codeSamples:
        - lang: csharp
          label: C#
          source: |-
            // Initialize the client
            var client = new PersonalizationClient(
              new PersonalizationConfig(
                "ALGOLIA_APPLICATION_ID",
                "ALGOLIA_API_KEY",
                "ALGOLIA_APPLICATION_REGION"
              )
            );

            // Call the API
            var response = await client.DeleteUserProfileAsync("UserToken");

            // print the response
            Console.WriteLine(response);
        - lang: go
          label: Go
          source: >-
            // Initialize the client with your application region, eg.
            personalization.ALGOLIA_APPLICATION_REGION

            client, err := personalization.NewClient("ALGOLIA_APPLICATION_ID",
            "ALGOLIA_API_KEY", personalization.US)

            if err != nil {
              // The client can fail to initialize if you pass an invalid parameter.
              panic(err)
            }


            // Call the API

            response, err :=
            client.DeleteUserProfile(client.NewApiDeleteUserProfileRequest(
              "UserToken"))
            if err != nil {
              // handle the eventual error
              panic(err)
            }



            // print the response

            print(response)
        - lang: java
          label: Java
          source: >-
            // Initialize the client

            PersonalizationClient client = new
            PersonalizationClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY",
            "ALGOLIA_APPLICATION_REGION");


            // Call the API

            DeleteUserProfileResponse response =
            client.deleteUserProfile("UserToken");


            // print the response

            System.out.println(response);
        - lang: javascript
          label: JavaScript
          source: >-
            // Initialize the client

            // Replace 'us' with your Algolia Application Region

            const client = algoliasearch('ALGOLIA_APPLICATION_ID',
            'ALGOLIA_API_KEY').initPersonalization({ region: 'us' });


            // Call the API

            const response = await client.deleteUserProfile({ userToken:
            'UserToken' });



            // print the response

            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: |-
            // Initialize the client
            val client =
              PersonalizationClient(
                appId = "ALGOLIA_APPLICATION_ID",
                apiKey = "ALGOLIA_API_KEY",
                region = "ALGOLIA_APPLICATION_REGION",
              )

            // Call the API
            var response = client.deleteUserProfile(userToken = "UserToken")


            // print the response
            println(response)
        - lang: php
          label: PHP
          source: >-
            // Initialize the client

            $client = PersonalizationClient::create('ALGOLIA_APPLICATION_ID',
            'ALGOLIA_API_KEY', 'ALGOLIA_APPLICATION_REGION');


            // Call the API

            $response = $client->deleteUserProfile(
                'UserToken',
            );



            // print the response

            var_dump($response);
        - lang: python
          label: Python
          source: >-
            # Initialize the client

            # In an asynchronous context, you can use PersonalizationClient
            instead, which exposes the exact same methods.

            client = PersonalizationClientSync(
                "ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION"
            )


            # Call the API

            response = client.delete_user_profile(
                user_token="UserToken",
            )



            # print the response

            print(response)
        - lang: ruby
          label: Ruby
          source: |-
            # Initialize the client
            client = Algolia::PersonalizationClient.create(
              "ALGOLIA_APPLICATION_ID",
              "ALGOLIA_API_KEY",
              "ALGOLIA_APPLICATION_REGION"
            )

            # Call the API
            response = client.delete_user_profile("UserToken")


            # print the response
            puts(response)
        - lang: scala
          label: Scala
          source: |-
            // Initialize the client
            val client = PersonalizationClient(
              appId = "ALGOLIA_APPLICATION_ID",
              apiKey = "ALGOLIA_API_KEY",
              region = "ALGOLIA_APPLICATION_REGION"
            )

            // Call the API
            val response = Await.result(
              client.deleteUserProfile(
                userToken = "UserToken"
              ),
              Duration(100, "sec")
            )

            // print the response
            println(response)
        - lang: swift
          label: Swift
          source: >-
            // Initialize the client

            let client = try PersonalizationClient(appID:
            "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY", region: .us)


            // Call the API

            let response = try await client.deleteUserProfile(userToken:
            "UserToken")


            // print the response

            print(response)
        - lang: cURL
          label: curl
          source: |-
            curl --request DELETE \
              --url https://personalization.us.algolia.com/1/profiles/test-user-123 \
              --header 'accept: application/json' \
              --header 'x-algolia-api-key: ALGOLIA_API_KEY' \
              --header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID'
components:
  parameters:
    UserToken:
      name: userToken
      in: path
      required: true
      description: >-
        Unique identifier representing a user for which to fetch the
        personalization profile.
      schema:
        $ref: '#/components/schemas/userToken'
  headers:
    x-ratelimit-limit:
      description: Number of allowed requests per one minute.
      example: 100
      schema:
        type: integer
    x-ratelimit-remaining:
      description: Number of remaining requests in the current period.
      example: 99
      schema:
        type: integer
    x-ratelimit-reset:
      description: >-
        Timestamp when the rate limit will reset, measured in seconds since the
        Unix epoch.
      example: 1710682486
      schema:
        type: integer
  schemas:
    userToken:
      type: string
      description: >
        Unique pseudonymous or anonymous user identifier.


        This helps with analytics and click and conversion events.

        For more information, see [user
        token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken).
      example: test-user-123
      x-categories:
        - Personalization
    ErrorBase:
      description: Error.
      type: object
      x-keep-model: true
      additionalProperties: true
      properties:
        message:
          type: string
          example: Invalid Application-Id or API-Key
  responses:
    BadRequest:
      description: Bad request or request arguments.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
    FeatureNotEnabled:
      description: This feature is not enabled on your Algolia account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
    MethodNotAllowed:
      description: Method not allowed with this API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
    IndexNotFound:
      description: Index not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBase'
  securitySchemes:
    appId:
      type: apiKey
      in: header
      name: x-algolia-application-id
      description: Your Algolia application ID.
    apiKey:
      type: apiKey
      in: header
      name: x-algolia-api-key
      description: >
        Your Algolia API key with the necessary permissions to make the request.

        Permissions are controlled through access control lists (ACL) and access
        restrictions.

        The required ACL to make a request is listed in each endpoint's
        reference.

````