# Authenticate anonymously

- Operation ID: `LogInAnonymouslyV2`
- HTTP method: `POST`
- Path: `/sauth/v2/auth/login/client/anonymous`
- [Human-readable API reference](https://hub.synerise.com/api-reference/authorization#tag/Authorization-(deprecated)/operation/LogInAnonymouslyV2)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /sauth/v2/auth/login/client/anonymous:
    post:
      deprecated: true
      tags:
        - Authorization (deprecated)
      summary: Authenticate anonymously
      description: |
        This method is deprecated. Use [the v3 method](#operation/LogInAnonymouslyV3) instead.

        Obtain a new JWT for an anonymous Profile. The token can be used and refreshed in the same way
        as tokens of registered Profiles.


        ---

        **Authentication:** Not required
      operationId: LogInAnonymouslyV2
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                apiKey:
                  type: string
                  description: Profile (formerly "Client") API key
                deviceId:
                  type: string
                  description: |
                    Unique Android or iOS device ID.

                    We recommend sending this attribute every time, to assign a web push registration to the device.

                    Required when any form of [unknown device control](https://hub.synerise.com/docs/settings/tool/iam-for-apps/access/#unknown-device-control) is enabled.
                uuid:
                  type: string
                  description: UUID of the Profile
                  example: 07243772-008a-42e1-ba37-c3807cebde8f
        required: true
      responses:
        "200":
          description: Anonymous authorization token
          content:
            application/json:
              schema:
                type: object
                properties:
                  token:
                    type: string
                    description: "[JWT](https://jwt.io/) token"
              example:
                token: eyJhbGciOiJSUzUxMiJ9.eyJzdinvalidwYmZkM2FkNDg2ZjQ3ZGRiMjE5MSIsImF1ZCI6IkFQSSIsInJsbSI6ImFub255bW91c19jbGllbnQiLCJjdGQiOjE1NTMwMDQxNTkxNTEsImVtbCI6IjYyMjM3NmY4LTAwMDAtMjIyMi1kN2Y5LTA3MGZhOTU2ZTk2M0Bhbm9ueW1vdXMuaW52YWxpZCIsImF1dGgiOiJINHNJQUFBQUFBQUFBSXVPQlFBcHUwd05BZ0FBQUE9PSIsImlzcyI6IlN5bmVyaXNlIiwiYnBpIjo0OCwiY2xJZCI6NDMzMjMwMjg4LCJleHAiOjE1NTMwMDcxNTksImFwayI6IjVBRUFBM0Q1LUUxNDctQzdFQi1ENTlFLUJDRjUwMTA5QTNEMSJ9.QOmSqrneR4mJFv4JdxTYsw_wGcDawDsVQuB-GVTcPPwijiP7lQ_Jzqq2Mypg1BS6WFlfGB8fzqCY9iMF_TdtjmoB4xBrY95ylU8L9qto-9Cw5x5TURkfxq31eryiHe2IteRAEtoVzYg2_s9QhlH6ANVcFOVp8dMno0V9bfMYfeSQa3FkjEbxFsseHkMOiADmp9-tOGtLXO942Ir-2W_Hz3Utlpt4erz0dVJBw8a-mFavPA8EEDWR7ACJNocrVHFkS3wFISh3LqLn6KkXiowaynKlJOEHGctuahzKmF3ZOJ1BvGgKohxF9OXvQs9IdmCfWhYsLr5Q2p04TJJ-MyvTipuggKVioh8mHmOFdfnN-Zused6tXzhZtKPUWTmM8cBKoAOBHExxcMQ8SVSjxnw_7_eLKm7S2wNpu0V-tiPZPCH4wYZXtWBYjmfy0V9ydjXnNunXfgxKixLeFNnONUXxEuqPLvM_xAuonQBXVN4nYrgJv8p8U6_ZlGMPjJq1szfcuBZnzI34LSEWx_nSof0XC5Czm8iG_ihG8naivNWS8h-Q-qKMP_3PPFsLSH4Egh03pH93EJUuNAeSO4RGfUX1wzMvrv1nBC1SM660uFMbq-wkplFBbKnHKMYe-qRs1-lZPG5PwPWJJdpGqOUzbnoMOJYmiq06OHHVQyJSkcEHLCk
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Summary of the error
                  message:
                    type: string
                    description: Description of the problem
                  errors:
                    type: array
                    description: An array of detailed error messages, if applicable
                    items:
                      type: object
                      properties:
                        code:
                          type: integer
                          description: Error code
                        field:
                          type: string
                          description: Name of the field that did not pass validation
                        message:
                          type: string
                          description: Details of the problem
                        rejectedValue:
                          description: The value that did not pass validation
                          anyOf:
                            - type: string
                            - type: number
                            - type: integer
                            - type: boolean
                            - type: array
                              items: {}
                            - type: object
                  status:
                    type: integer
                    format: int32
                    description: Status code
                  timestamp:
                    type: string
                    description: Time when the message was sent
                  path:
                    type: string
                    description: URL of the requested resource
                  traceId:
                    type: string
                    description: ID for debugging
              example:
                timestamp: 2019-03-19T14:03:35.413+00:00
                status: 401
                error: Unauthorized
                message: Could not fetch ApiKey
                path: /v2/auth/login/client/anonymous
      x-snr-doc-urls:
        - /api-reference/authorization#tag/Authorization-(deprecated)/operation/LogInAnonymouslyV2
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request POST \
              --url https://api.synerise.com/sauth/v2/auth/login/client/anonymous \
              --header 'content-type: application/json' \
              --data '{"apiKey":"string","deviceId":"string","uuid":"07243772-008a-42e1-ba37-c3807cebde8f"}'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            payload = "{\"apiKey\":\"string\",\"deviceId\":\"string\",\"uuid\":\"07243772-008a-42e1-ba37-c3807cebde8f\"}"

            headers = { 'content-type': "application/json" }

            conn.request("POST", "/sauth/v2/auth/login/client/anonymous", payload, headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify({
              "apiKey": "string",
              "deviceId": "string",
              "uuid": "07243772-008a-42e1-ba37-c3807cebde8f"
            });

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("POST", "https://api.synerise.com/sauth/v2/auth/login/client/anonymous");
            xhr.setRequestHeader("content-type", "application/json");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "POST",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/sauth/v2/auth/login/client/anonymous",
              "headers": {
                "content-type": "application/json"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.write(JSON.stringify({
              apiKey: 'string',
              deviceId: 'string',
              uuid: '07243772-008a-42e1-ba37-c3807cebde8f'
            }));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/sauth/v2/auth/login/client/anonymous');
            $request->setMethod(HTTP_METH_POST);

            $request->setHeaders([
              'content-type' => 'application/json'
            ]);

            $request->setBody('{"apiKey":"string","deviceId":"string","uuid":"07243772-008a-42e1-ba37-c3807cebde8f"}');

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.post("https://api.synerise.com/sauth/v2/auth/login/client/anonymous")
              .header("content-type", "application/json")
              .body("{\"apiKey\":\"string\",\"deviceId\":\"string\",\"uuid\":\"07243772-008a-42e1-ba37-c3807cebde8f\"}")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: Authorization (deprecated)
```
