openapi: 3.0.2
info:
  title: Personalization API
  description: >
    The Personalization API lets you access user profiles built from the
    personalization strategy.


    ## Base URLs


    The base URLs for requests to the Personalization API are:


    - `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


    To authenticate your API requests, add these headers:


    - `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).


    ## 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 a `2xx` status. Client errors return a `4xx`
    status. Server errors are indicated by a `5xx` status.

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


    ## Version


    The current version of the Personalization API is version 1, as indicated by
    the `/1/` in each endpoint's URL.
  version: 1.0.0
servers:
  - url: https://personalization.{region}.algolia.com
    variables:
      region:
        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: |
    Related guide: Algolia Personalization.
paths:
  /{path}:
    get:
      operationId: customGet
      summary: Send requests to the Algolia REST API
      description: This method allow you to send requests to the Algolia REST API.
      parameters:
        - $ref: '#/components/parameters/PathInPath'
        - $ref: '#/components/parameters/Parameters'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
        '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("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.CustomGetAsync("test/minimal");
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            personalization.YOUR_APP_ID_REGION

            client, err := personalization.NewClient("YOUR_APP_ID",
            "YOUR_API_KEY", personalization.US)

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


            // Call the API

            resp, err := client.CustomGet(client.NewApiCustomGetRequest(
              "test/minimal",
            ))

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

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

            PersonalizationClient client = new
            PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION");


            // Call the API

            client.customGet("test/minimal");
        - lang: javascript
          label: JavaScript
          source: |
            // Initialize the client
            const client = personalizationClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );

            // Call the API
            const response = await client.customGet({ path: 'test/minimal' });

            // use typed response
            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.customGet(
              path = "test/minimal",
            )


            // Use the response

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

            $client =
            Algolia\AlgoliaSearch\Api\PersonalizationClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

            $response = $client->customGet(
                'test/minimal',
            );


            // play with the response

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

            _client = PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.custom_get(
                path="test/minimal",
            )


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: |
            # Initialize the client
            client = Algolia::PersonalizationClient.create(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            )

            # Call the API
            resp = client.custom_get("test/minimal")

            # use the class directly
            puts resp

            # print the JSON response
            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            val res = client.customGet[JObject](
              path = "test/minimal"
            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try PersonalizationClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.customGet(path: "test/minimal")
    post:
      operationId: customPost
      requestBody:
        description: Parameters to send with the custom request.
        content:
          application/json:
            schema:
              type: object
      summary: Send requests to the Algolia REST API
      description: This method allow you to send requests to the Algolia REST API.
      parameters:
        - $ref: '#/components/parameters/PathInPath'
        - $ref: '#/components/parameters/Parameters'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
        '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("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.CustomPostAsync("test/minimal");
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            personalization.YOUR_APP_ID_REGION

            client, err := personalization.NewClient("YOUR_APP_ID",
            "YOUR_API_KEY", personalization.US)

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


            // Call the API

            resp, err := client.CustomPost(client.NewApiCustomPostRequest(
              "test/minimal",
            ))

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

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

            PersonalizationClient client = new
            PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION");


            // Call the API

            client.customPost("test/minimal");
        - lang: javascript
          label: JavaScript
          source: |
            // Initialize the client
            const client = personalizationClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );

            // Call the API
            const response = await client.customPost({ path: 'test/minimal' });

            // use typed response
            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.customPost(
              path = "test/minimal",
            )


            // Use the response

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

            $client =
            Algolia\AlgoliaSearch\Api\PersonalizationClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

            $response = $client->customPost(
                'test/minimal',
            );


            // play with the response

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

            _client = PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.custom_post(
                path="test/minimal",
            )


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: |
            # Initialize the client
            client = Algolia::PersonalizationClient.create(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            )

            # Call the API
            resp = client.custom_post("test/minimal")

            # use the class directly
            puts resp

            # print the JSON response
            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            val res = client.customPost[JObject](
              path = "test/minimal"
            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try PersonalizationClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.customPost(path: "test/minimal")
    put:
      operationId: customPut
      requestBody:
        description: Parameters to send with the custom request.
        content:
          application/json:
            schema:
              type: object
      summary: Send requests to the Algolia REST API
      description: This method allow you to send requests to the Algolia REST API.
      parameters:
        - $ref: '#/components/parameters/PathInPath'
        - $ref: '#/components/parameters/Parameters'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
        '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("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.CustomPutAsync("test/minimal");
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            personalization.YOUR_APP_ID_REGION

            client, err := personalization.NewClient("YOUR_APP_ID",
            "YOUR_API_KEY", personalization.US)

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


            // Call the API

            resp, err := client.CustomPut(client.NewApiCustomPutRequest(
              "test/minimal",
            ))

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

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

            PersonalizationClient client = new
            PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION");


            // Call the API

            client.customPut("test/minimal");
        - lang: javascript
          label: JavaScript
          source: |
            // Initialize the client
            const client = personalizationClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );

            // Call the API
            const response = await client.customPut({ path: 'test/minimal' });

            // use typed response
            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.customPut(
              path = "test/minimal",
            )


            // Use the response

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

            $client =
            Algolia\AlgoliaSearch\Api\PersonalizationClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

            $response = $client->customPut(
                'test/minimal',
            );


            // play with the response

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

            _client = PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.custom_put(
                path="test/minimal",
            )


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: |
            # Initialize the client
            client = Algolia::PersonalizationClient.create(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            )

            # Call the API
            resp = client.custom_put("test/minimal")

            # use the class directly
            puts resp

            # print the JSON response
            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            val res = client.customPut[JObject](
              path = "test/minimal"
            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try PersonalizationClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.customPut(path: "test/minimal")
    delete:
      operationId: customDelete
      summary: Send requests to the Algolia REST API
      description: This method allow you to send requests to the Algolia REST API.
      parameters:
        - $ref: '#/components/parameters/PathInPath'
        - $ref: '#/components/parameters/Parameters'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
        '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("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.CustomDeleteAsync("test/minimal");
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            personalization.YOUR_APP_ID_REGION

            client, err := personalization.NewClient("YOUR_APP_ID",
            "YOUR_API_KEY", personalization.US)

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


            // Call the API

            resp, err := client.CustomDelete(client.NewApiCustomDeleteRequest(
              "test/minimal",
            ))

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

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

            PersonalizationClient client = new
            PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION");


            // Call the API

            client.customDelete("test/minimal");
        - lang: javascript
          label: JavaScript
          source: >
            // Initialize the client

            const client = personalizationClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );


            // Call the API

            const response = await client.customDelete({ path: 'test/minimal'
            });


            // use typed response

            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.customDelete(
              path = "test/minimal",
            )


            // Use the response

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

            $client =
            Algolia\AlgoliaSearch\Api\PersonalizationClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

            $response = $client->customDelete(
                'test/minimal',
            );


            // play with the response

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

            _client = PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.custom_delete(
                path="test/minimal",
            )


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: |
            # Initialize the client
            client = Algolia::PersonalizationClient.create(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            )

            # Call the API
            resp = client.custom_delete("test/minimal")

            # use the class directly
            puts resp

            # print the JSON response
            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            val res = client.customDelete[JObject](
              path = "test/minimal"
            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try PersonalizationClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.customDelete(path: "test/minimal")
  /1/profiles/personalization/{userToken}:
    get:
      tags:
        - profiles
      operationId: getUserTokenProfile
      x-acl:
        - recommendation
      summary: Retrieve a user profile
      description: Retrieves a user profile and their affinities for different facets.
      parameters:
        - $ref: '#/components/parameters/UserToken'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: getUserTokenResponse
                type: object
                additionalProperties: false
                required:
                  - userToken
                  - scores
                  - lastEventAt
                properties:
                  userToken:
                    $ref: '#/components/schemas/userToken'
                  lastEventAt:
                    type: string
                    description: >-
                      Date and time of the last event from this user, in RFC
                      3339 format.
                  scores:
                    type: object
                    description: >
                      Scores for different facet values.


                      Scores represent the user affinity for a user profile
                      towards specific facet values,

                      given the personalization strategy and past events.
        '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("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.GetUserTokenProfileAsync("UserToken");
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            personalization.YOUR_APP_ID_REGION

            client, err := personalization.NewClient("YOUR_APP_ID",
            "YOUR_API_KEY", personalization.US)

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


            // Call the API

            resp, err :=
            client.GetUserTokenProfile(client.NewApiGetUserTokenProfileRequest(
              "UserToken",
            ))

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

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

            PersonalizationClient client = new
            PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION");


            // Call the API

            client.getUserTokenProfile("UserToken");
        - lang: javascript
          label: JavaScript
          source: >
            // Initialize the client

            const client = personalizationClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );


            // Call the API

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


            // use typed response

            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.getUserTokenProfile(
              userToken = "UserToken",
            )


            // Use the response

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

            $client =
            Algolia\AlgoliaSearch\Api\PersonalizationClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

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


            // play with the response

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

            _client = PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.get_user_token_profile(
                user_token="UserToken",
            )


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: |
            # Initialize the client
            client = Algolia::PersonalizationClient.create(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            )

            # Call the API
            resp = client.get_user_token_profile("UserToken")

            # use the class directly
            puts resp

            # print the JSON response
            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            val res = client.getUserTokenProfile(
              userToken = "UserToken"
            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try PersonalizationClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.getUserTokenProfile(userToken: "UserToken")
  /1/profiles/{userToken}:
    delete:
      tags:
        - profiles
      operationId: deleteUserProfile
      x-acl:
        - recommendation
      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.
      parameters:
        - $ref: '#/components/parameters/UserToken'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: deleteUserProfileResponse
                type: object
                additionalProperties: false
                required:
                  - userToken
                  - deletedUntil
                properties:
                  userToken:
                    $ref: '#/components/schemas/userToken'
                  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.
        '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("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.DeleteUserProfileAsync("UserToken");
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            personalization.YOUR_APP_ID_REGION

            client, err := personalization.NewClient("YOUR_APP_ID",
            "YOUR_API_KEY", personalization.US)

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


            // Call the API

            resp, err :=
            client.DeleteUserProfile(client.NewApiDeleteUserProfileRequest(
              "UserToken",
            ))

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

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

            PersonalizationClient client = new
            PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION");


            // Call the API

            client.deleteUserProfile("UserToken");
        - lang: javascript
          label: JavaScript
          source: >
            // Initialize the client

            const client = personalizationClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );


            // Call the API

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


            // use typed response

            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.deleteUserProfile(
              userToken = "UserToken",
            )


            // Use the response

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

            $client =
            Algolia\AlgoliaSearch\Api\PersonalizationClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

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


            // play with the response

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

            _client = PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.delete_user_profile(
                user_token="UserToken",
            )


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: |
            # Initialize the client
            client = Algolia::PersonalizationClient.create(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            )

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

            # use the class directly
            puts resp

            # print the JSON response
            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            val res = client.deleteUserProfile(
              userToken = "UserToken"
            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try PersonalizationClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.deleteUserProfile(userToken: "UserToken")
  /1/strategies/personalization:
    get:
      tags:
        - strategies
      operationId: getPersonalizationStrategy
      x-acl:
        - recommendation
      summary: Retrieve the personalization strategy
      description: Retrieves the current personalization strategy.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/personalizationStrategyParams'
        '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("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.GetPersonalizationStrategyAsync();
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            personalization.YOUR_APP_ID_REGION

            client, err := personalization.NewClient("YOUR_APP_ID",
            "YOUR_API_KEY", personalization.US)

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


            // Call the API

            resp, err := client.GetPersonalizationStrategy()

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

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

            PersonalizationClient client = new
            PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION");


            // Call the API

            client.getPersonalizationStrategy();
        - lang: javascript
          label: JavaScript
          source: |
            // Initialize the client
            const client = personalizationClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );

            // Call the API
            const response = await client.getPersonalizationStrategy();

            // use typed response
            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.getPersonalizationStrategy()


            // Use the response

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

            $client =
            Algolia\AlgoliaSearch\Api\PersonalizationClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

            $response = $client->getPersonalizationStrategy();


            // play with the response

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

            _client = PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.get_personalization_strategy()


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: |
            # Initialize the client
            client = Algolia::PersonalizationClient.create(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            )

            # Call the API
            resp = client.get_personalization_strategy

            # use the class directly
            puts resp

            # print the JSON response
            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            val res = client.getPersonalizationStrategy(

            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try PersonalizationClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await client.getPersonalizationStrategy()
    post:
      tags:
        - strategies
      operationId: setPersonalizationStrategy
      x-acl:
        - recommendation
      summary: Define the personalization strategy
      description: Creates a new personalization strategy.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/personalizationStrategyParams'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                title: setPersonalizationStrategyResponse
                type: object
                additionalProperties: false
                required:
                  - message
                properties:
                  message:
                    type: string
                    description: A message confirming the strategy update.
                    example: Strategy was successfully updated.
        '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("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
            );

            // Call the API
            var response = await client.SetPersonalizationStrategyAsync(
              new PersonalizationStrategyParams
              {
                EventScoring = new List<EventScoring>
                {
                  new EventScoring
                  {
                    Score = 42,
                    EventName = "Algolia",
                    EventType = Enum.Parse<EventType>("Click"),
                  }
                },
                FacetScoring = new List<FacetScoring>
                {
                  new FacetScoring { Score = 42, FacetName = "Event", }
                },
                PersonalizationImpact = 42,
              }
            );
        - lang: go
          label: Go
          source: >
            // Initialize the client with your application region, eg.
            personalization.YOUR_APP_ID_REGION

            client, err := personalization.NewClient("YOUR_APP_ID",
            "YOUR_API_KEY", personalization.US)

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


            // Call the API

            resp, err :=
            client.SetPersonalizationStrategy(client.NewApiSetPersonalizationStrategyRequest(

              personalization.NewEmptyPersonalizationStrategyParams().SetEventScoring(
                []personalization.EventScoring{*personalization.NewEmptyEventScoring().SetScore(42).SetEventName("Algolia").SetEventType(personalization.EventType("click"))}).SetFacetScoring(
                []personalization.FacetScoring{*personalization.NewEmptyFacetScoring().SetScore(42).SetFacetName("Event")}).SetPersonalizationImpact(42),
            ))

            if err != nil {
              // handle the eventual error
              panic(err)
            }


            // use the model directly

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

            PersonalizationClient client = new
            PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION");


            // Call the API

            client.setPersonalizationStrategy(
              new PersonalizationStrategyParams()
                .setEventScoring(List.of(new EventScoring().setScore(42).setEventName("Algolia").setEventType(EventType.fromValue("click"))))
                .setFacetScoring(List.of(new FacetScoring().setScore(42).setFacetName("Event")))
                .setPersonalizationImpact(42)
            );
        - lang: javascript
          label: JavaScript
          source: |
            // Initialize the client
            const client = personalizationClient(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            );

            // Call the API
            const response = await client.setPersonalizationStrategy({
              eventScoring: [{ score: 42, eventName: 'Algolia', eventType: 'click' }],
              facetScoring: [{ score: 42, facetName: 'Event' }],
              personalizationImpact: 42,
            });

            // use typed response
            console.log(response);
        - lang: kotlin
          label: Kotlin
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            var response = client.setPersonalizationStrategy(
              personalizationStrategyParams = PersonalizationStrategyParams(
                eventScoring = listOf(
                  EventScoring(
                    score = 42,
                    eventName = "Algolia",
                    eventType = EventType.entries.first { it.value == "click" },
                  ),
                ),
                facetScoring = listOf(
                  FacetScoring(
                    score = 42,
                    facetName = "Event",
                  ),
                ),
                personalizationImpact = 42,
              ),
            )


            // Use the response

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

            $client =
            Algolia\AlgoliaSearch\Api\PersonalizationClient::create('<YOUR_APP_ID>',
            '<YOUR_API_KEY>', 'YOUR_APP_ID_REGION');


            // Call the API

            $response = $client->setPersonalizationStrategy(
                ['eventScoring' => [
                    ['score' => 42,
                        'eventName' => 'Algolia',
                        'eventType' => 'click',
                    ],
                ],
                    'facetScoring' => [
                        ['score' => 42,
                            'facetName' => 'Event',
                        ],
                    ],
                    'personalizationImpact' => 42,
                ],
            );


            // play with the response

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

            _client = PersonalizationClient("YOUR_APP_ID", "YOUR_API_KEY",
            "YOUR_APP_ID_REGION")


            # Call the API

            resp = await _client.set_personalization_strategy(
                personalization_strategy_params={
                    "eventScoring": [
                        {
                            "score": 42,
                            "eventName": "Algolia",
                            "eventType": "click",
                        },
                    ],
                    "facetScoring": [
                        {
                            "score": 42,
                            "facetName": "Event",
                        },
                    ],
                    "personalizationImpact": 42,
                },
            )


            # use the class directly

            print(resp)


            # print the JSON response

            print(resp.to_json())
        - lang: ruby
          label: Ruby
          source: |
            # Initialize the client
            client = Algolia::PersonalizationClient.create(
              'YOUR_APP_ID',
              'YOUR_API_KEY',
              'YOUR_APP_ID_REGION'
            )

            # Call the API
            resp = client.set_personalization_strategy(
              PersonalizationStrategyParams.new(
                event_scoring: [EventScoring.new(
                  score: 42,
                  event_name: "Algolia",
                  event_type: 'click'
                )],
                facet_scoring: [FacetScoring.new(score: 42, facet_name: "Event")],
                personalization_impact: 42
              )
            )

            # use the class directly
            puts resp

            # print the JSON response
            puts resp.to_json
        - lang: scala
          label: Scala
          source: >
            // Initialize the client

            val client = PersonalizationClient(appId = "YOUR_APP_ID", apiKey =
            "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")


            // Call the API

            val res = client.setPersonalizationStrategy(
              personalizationStrategyParams = PersonalizationStrategyParams(
                eventScoring = Seq(
                  EventScoring(
                    score = 42,
                    eventName = "Algolia",
                    eventType = EventType.withName("click")
                  )
                ),
                facetScoring = Seq(
                  FacetScoring(
                    score = 42,
                    facetName = "Event"
                  )
                ),
                personalizationImpact = 42
              )
            )


            // Use the response

            val value = Await.result(res, Duration(100, "sec"))
        - lang: swift
          label: Swift
          source: >
            // Initialize the client

            let client = try PersonalizationClient(appID: "YOUR_APP_ID", apiKey:
            "YOUR_API_KEY", region: .us)


            // Call the API

            _ = try await
            client.setPersonalizationStrategy(personalizationStrategyParams:
            PersonalizationStrategyParams(
                eventScoring: [EventScoring(score: 42, eventName: "Algolia", eventType: PersonalizationEventType.click)],
                facetScoring: [FacetScoring(score: 42, facetName: "Event")],
                personalizationImpact: 42
            ))
components:
  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.
  parameters:
    PathInPath:
      name: path
      in: path
      description: Path of the endpoint, anything after "/1" must be specified.
      required: true
      schema:
        type: string
        example: /keys
    Parameters:
      name: parameters
      in: query
      description: Query parameters to apply to the current query.
      schema:
        type: object
        additionalProperties: true
    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'
  schemas:
    ErrorBase:
      description: Error.
      type: object
      additionalProperties: true
      properties:
        message:
          type: string
          example: Invalid Application-Id or API-Key
    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
    score:
      type: integer
      description: Event score.
    EventType:
      title: eventType
      type: string
      description: Event type.
      enum:
        - click
        - conversion
        - view
    eventScoring:
      type: object
      additionalProperties: false
      required:
        - score
        - eventName
        - eventType
      properties:
        score:
          $ref: '#/components/schemas/score'
        eventName:
          type: string
          description: Event name.
        eventType:
          $ref: '#/components/schemas/EventType'
    facetScoring:
      type: object
      additionalProperties: false
      required:
        - score
        - facetName
      properties:
        score:
          $ref: '#/components/schemas/score'
        facetName:
          type: string
          description: Facet attribute name.
    personalizationStrategyParams:
      type: object
      additionalProperties: false
      required:
        - eventScoring
        - facetScoring
        - personalizationImpact
      properties:
        eventScoring:
          type: array
          description: >
            Scores associated with each event.


            The higher the scores, the higher the impact of those events on the
            personalization of search results.
          items:
            $ref: '#/components/schemas/eventScoring'
        facetScoring:
          type: array
          description: >
            Scores associated with each facet.


            The higher the scores, the higher the impact of those events on the
            personalization of search results.
          items:
            $ref: '#/components/schemas/facetScoring'
        personalizationImpact:
          type: integer
          minimum: 0
          maximum: 100
          description: |
            Impact of personalization on the search results.

            If set to 0, personalization has no impact on the search results.
  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'
x-tagGroups:
  - name: General
    tags:
      - profiles
      - strategies
