# Authenticate as Profile (conditional)

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

## 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/conditional:
    post:
      deprecated: true
      summary: Authenticate as Profile (conditional)
      description: |
        This method is deprecated. Use [the v3 method](#operation/authenticateConditionalUsingPOSTv3) instead.      


        Obtain a new JWT token for a Profile.

        - If the account does not exist, an account is not created.
        - If any additional conditions are required for logging in, the response is HTTP200 and lists the conditions.
        - Note that using this endpoint requires authenticating as an anonymous Profile first.


        ---

        **Authentication:** Not required
      security:
        - JWT: []
      tags:
        - Authorization (deprecated)
      operationId: authenticateConditionalUsingPOST
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - apiKey
                - identityProvider
              properties:
                apiKey:
                  type: string
                  description: Profile (formerly "Client") API key
                identityProvider:
                  type: string
                  description: The identity provider.
                  enum:
                    - SYNERISE
                    - FACEBOOK
                    - OAUTH
                    - APPLE
                    - GOOGLE
                    - UNKNOWN
                identityProviderToken:
                  type: string
                  description: Third-party authentication token used to authenticate with the Identity Provider. Required if `identityProvider` is different than `SYNERISE`.
                email:
                  type: string
                  description: Profile email. Required if `identityProvider` is `SYNERISE` and email is the unique identifier (default setting).
                customId:
                  description: Profile customId. Required if `identityProvider` is `SYNERISE` and customId is the unique identifier (see https://hub.synerise.com/docs/settings/configuration/non-unique-emails/).
                password:
                  type: string
                  description: Profile password. Required if `identityProvider` is `SYNERISE`.
                uuid:
                  type: string
                  description: Profile UUID. Required if `identityProvider` is `SYNERISE`.
                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.
                agreements:
                  description: |-
                    Marketing agreements of the Profile.

                    You can also pass the values as strings (`"true"`;`"TRUE"`;`"True"`/`"false"`;`"FALSE"`;`"False"`) or integers (`1` for true and `0` for false).
                  type: object
                  properties:
                    email:
                      type: boolean
                      description: Permission to receive marketing information by email
                      default: true
                    sms:
                      type: boolean
                      description: Permission to receive marketing information by SMS
                      default: true
                    push:
                      type: boolean
                      description: Permission to receive push notifications
                      default: true
                    bluetooth:
                      type: boolean
                      deprecated: true
                      description: This field is ignored.
                      default: false
                    rfid:
                      type: boolean
                      deprecated: true
                      description: This field is ignored.
                      default: false
                    wifi:
                      type: boolean
                      deprecated: true
                      description: This field is ignored.
                      default: false
                    whatsApp:
                      type: boolean
                      description: Permission to receive WhatsApp messages
                      default: false
                  example:
                    email: true
                    sms: true
                    push: true
                    bluetooth: false
                    rfid: false
                    wifi: false
                attributes:
                  type: object
                  description: |
                    Custom attributes (with any names)

                    <strong><span style="color:red">WARNING<span></strong>: Some attributes cannot be sent in this object and will be ignored. Some of these are reserved for system use, and others must be sent as properties of the profile in the root object of the request body instead of inside the `attributes` object.

                    <details><summary><span style="background:red;color:white">Click to expand the list of reserved attributes</span></summary>
                    <code>email</code><br><code>id</code><br><code>clientId</code><br><code>phone</code><br><code>customId</code><br><code>uuid</code><br><code>firstName</code><br><code>lastName</code><br>
                    <code>displayName</code><br><code>company</code><br><code>address</code><br><code>city</code><br><code>province</code><br><code>zipCode</code><br><code>countryCode</code><br>
                    <code>birthDate</code><br><code>sex</code><br><code>avatarUrl</code><br><code>anonymous</code><br><code>agreements</code><br><code>tags</code><br><code>businessProfileId</code><br>
                    <code>time</code><br><code>ip</code><br><code>source</code><br><code>newsletter_agreement</code><br><code>custom_identify</code><br><code>firstname</code><br>
                    <code>lastname</code><br><code>created</code><br><code>updated</code><br><code>last_activity_date</code><br><code>birthdate</code><br><code>external_avatar_url</code><br>
                    <code>displayname</code><br><code>receive_smses</code><br><code>receive_push_messages</code><br><code>receive_webpush_messages</code><br>
                    <code>receive_btooth_messages</code><br><code>receive_rfid_messages</code><br><code>receive_wifi_messages</code><br><code>receive_whatsapp_messages</code><br><code>whatsapp_id</code><br>
                    <code>zipCode</code><br><code>anonymous_type</code><br><code>country_id</code><br><code>geo_loc_country</code><br><code>geo_loc_isp</code><br>
                    <code>geo_loc_lat</code><br><code>geo_loc_lon</code><br><code>club_card_id</code><br><code>type</code><br><code>confirmed</code><br><code>facebookId</code><br><code>deletedAt</code><br><code>deleted_unique</code><br><code>status</code><br><code>recognized</code><br><code>previous_clients</code><br><code>testProfile</code><br>
                    <code>apikey</code><br><code>apiKey</code><br><code>ApiKey</code><br><code>Apikey</code><br><code>tracker</code><br><code>snr_sdk_version</code><br>
                    <code>eventCreateTime</code><br><code>correlationId</code>
                    </details>
                  additionalProperties:
                    description: Can be numbers, strings, or booleans.
                tags:
                  type: array
                  description: Tags can be used to group Profile accounts.
                  items:
                    type: string
              title: AuthenticationRequestV2_and_3
      responses:
        "200":
          description: Details of the login operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  conditions:
                    type: array
                    description: Reserved for future use.
                    items:
                      type: string
                  status:
                    type: string
                    description: Login status. Currently, only `SUCCESS` is used.
                    enum:
                      - SUCCESS
                      - UNAUTHORIZED
                      - ACTIVATION_REQUIRED
                      - REGISTRATION_REQUIRED
                      - APPROVAL_REQUIRED
                      - TERMS_ACCEPTANCE_REQUIRED
                      - MFA_REQUIRED
                  token:
                    type: string
                    description: "[JWT](https://jwt.io/) token"
                title: ConditionalAuthenticationResponse
        "400":
          description: Request failed, see error message for details
          content:
            application/json:
              schema:
                allOf:
                  - 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
                  - type: object
                    properties:
                      errorCode:
                        type: string
                        description: |
                          Error code, if applicable.
                          - `SAU-601`: Device ID is required and missing
        "401":
          description: See error message for details
          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
        "403":
          description: Authentication failed, see error message for details
          content:
            application/json:
              schema:
                allOf:
                  - 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
                  - type: object
                    properties:
                      errorCode:
                        type: string
                        description: |
                          Error code, if applicable.
                            - `SAU-302`: Email confirmation by hash code (activation link) required
                            - `SAU-303`: Email confirmation by PIN code required
        "404":
          description: Profile not found
          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: 2018-06-07T07:17:41.734+00:00
                status: 404
                error: Not Found
                message: Account does not exist
                path: /v2/auth/login/client/conditional
                traceId: 61b4aa7c0cb1167a
        "406":
          description: Account is locked, password reset required
          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: 2021-09-15T10:01:16.203120Z
                status: 406
                error: Banned
                message: Log in has been blocked
                path: /v2/auth/login/client
                traceId: 61b4aa7c0cb1167a
        "423":
          description: Device control is enabled, device must be authorized (link sent by email)
          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: 2021-09-15T10:01:16.203120Z
                status: 423
                error: Locked
                message: Device login blocked
                path: /v2/auth/login/client
                traceId: 61b4aa7c0cb1167a
      x-snr-doc-urls:
        - /api-reference/authorization#tag/Authorization-(deprecated)/operation/authenticateConditionalUsingPOST
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request POST \
              --url https://api.synerise.com/sauth/v2/auth/login/client/conditional \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"apiKey":"string","identityProvider":"SYNERISE","identityProviderToken":"string","email":"string","customId":null,"password":"string","uuid":"string","deviceId":"string","agreements":{"email":true,"sms":true,"push":true,"bluetooth":false,"rfid":false,"wifi":false},"attributes":{"property1":null,"property2":null},"tags":["string"]}'
        - lang: Python
          label: Python
          source: |-
            import http.client

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

            payload = "{\"apiKey\":\"string\",\"identityProvider\":\"SYNERISE\",\"identityProviderToken\":\"string\",\"email\":\"string\",\"customId\":null,\"password\":\"string\",\"uuid\":\"string\",\"deviceId\":\"string\",\"agreements\":{\"email\":true,\"sms\":true,\"push\":true,\"bluetooth\":false,\"rfid\":false,\"wifi\":false},\"attributes\":{\"property1\":null,\"property2\":null},\"tags\":[\"string\"]}"

            headers = {
                'Authorization': "Bearer REPLACE_BEARER_TOKEN",
                'content-type': "application/json"
                }

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

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

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify({
              "apiKey": "string",
              "identityProvider": "SYNERISE",
              "identityProviderToken": "string",
              "email": "string",
              "customId": null,
              "password": "string",
              "uuid": "string",
              "deviceId": "string",
              "agreements": {
                "email": true,
                "sms": true,
                "push": true,
                "bluetooth": false,
                "rfid": false,
                "wifi": false
              },
              "attributes": {
                "property1": null,
                "property2": null
              },
              "tags": [
                "string"
              ]
            });

            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/conditional");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");
            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/conditional",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN",
                "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',
              identityProvider: 'SYNERISE',
              identityProviderToken: 'string',
              email: 'string',
              customId: null,
              password: 'string',
              uuid: 'string',
              deviceId: 'string',
              agreements: {email: true, sms: true, push: true, bluetooth: false, rfid: false, wifi: false},
              attributes: {property1: null, property2: null},
              tags: ['string']
            }));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

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

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

            $request->setBody('{"apiKey":"string","identityProvider":"SYNERISE","identityProviderToken":"string","email":"string","customId":null,"password":"string","uuid":"string","deviceId":"string","agreements":{"email":true,"sms":true,"push":true,"bluetooth":false,"rfid":false,"wifi":false},"attributes":{"property1":null,"property2":null},"tags":["string"]}');

            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/conditional")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .header("content-type", "application/json")
              .body("{\"apiKey\":\"string\",\"identityProvider\":\"SYNERISE\",\"identityProviderToken\":\"string\",\"email\":\"string\",\"customId\":null,\"password\":\"string\",\"uuid\":\"string\",\"deviceId\":\"string\",\"agreements\":{\"email\":true,\"sms\":true,\"push\":true,\"bluetooth\":false,\"rfid\":false,\"wifi\":false},\"attributes\":{\"property1\":null,\"property2\":null},\"tags\":[\"string\"]}")
              .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)
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

        Remember to include the space between 'Bearer' and the token.

        Generate a token via the **Authorization** endpoints.
```
