---
title: Authenticate via email
slug: docs/demo/authenticate-via-email
description: Learn how to authenticate your account with this helpful code example using the powerful curl command. This document provides step-by-step instructions, including the essential headers and data that need to be included in your authentication request. Enha
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "62GoV46jTYjrESDZ7pBBW",
  "data": {
    "url": "https://api.fictive.com/REST/api/accounts/authenticate",
    "name": "Authenticate via email",
    "method": "POST",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "kind": "optional",
          "name": "X-TokenId",
          "type": "string",
          "description": "The eSuite Token Id"
        },
        {
          "kind": "optional",
          "name": "X-SessionId",
          "type": "string",
          "description": "The eSuite Session Id"
        },
        {
          "kind": "required",
          "name": "X-Version",
          "type": "string",
          "description": "The eSuite Version"
        },
        {
          "kind": "optional",
          "name": "Origin",
          "type": "string",
          "description": "The eSuite Origin"
        }
      ],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "loginDetails",
          "type": "object",
          "schema": [
            {
              "kind": "optional",
              "name": "email",
              "type": "string",
              "example": "",
              "description": "Account email"
            },
            {
              "kind": "optional",
              "name": "password",
              "type": "string",
              "example": "",
              "description": "Account password"
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.LoginDetails",
          "customType": "FictiveGlobal.Api.Rest.Dtos.v1.LoginDetails",
          "isExpanded": true,
          "description": "Login details"
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "kind": "optional",
                "name": "accountReference",
                "type": "string",
                "example": "",
                "description": "Account reference"
              },
              {
                "kind": "optional",
                "name": "status",
                "type": "string<None | Active | Suspended | Closed | MWalletInactive>",
                "example": "",
                "description": "Status of account"
              },
              {
                "kind": "optional",
                "name": "verified",
                "type": "boolean",
                "example": "",
                "description": "Flag that marks if the account has been verified"
              },
              {
                "kind": "optional",
                "name": "email",
                "type": "string",
                "example": "",
                "description": "Email of account"
              },
              {
                "kind": "optional",
                "name": "clientUserId",
                "type": "string",
                "example": "",
                "description": "Client Id of the user"
              },
              {
                "kind": "optional",
                "name": "salutation",
                "type": "string",
                "example": ""
              },
              {
                "kind": "optional",
                "name": "firstName",
                "type": "string",
                "example": "",
                "description": "Account first name"
              },
              {
                "kind": "optional",
                "name": "lastName",
                "type": "string",
                "example": "",
                "description": "Account last name"
              },
              {
                "kind": "optional",
                "name": "phoneNumber",
                "type": "string",
                "example": "",
                "description": "Account phone number"
              },
              {
                "kind": "optional",
                "name": "mobileNumber",
                "type": "string",
                "example": "",
                "description": "Account mobile number"
              },
              {
                "kind": "optional",
                "name": "dateOfBirth",
                "type": "string<date-time>",
                "example": "2021-09-21T05:33:11.8071496",
                "description": "Date of birth of the Account"
              },
              {
                "kind": "optional",
                "name": "gender",
                "type": "string<NotKnown | Female | Male>",
                "example": "",
                "description": "Gender"
              },
              {
                "kind": "optional",
                "name": "addresses",
                "type": "array",
                "schema": [
                  {
                    "kind": "optional",
                    "name": "addressType",
                    "type": "string<Home | Billing | Invoice>",
                    "example": "",
                    "description": "Address type"
                  },
                  {
                    "kind": "optional",
                    "name": "houseName",
                    "type": "string",
                    "example": "",
                    "description": "House name"
                  },
                  {
                    "kind": "optional",
                    "name": "houseNumber",
                    "type": "string",
                    "example": "",
                    "description": "House number"
                  },
                  {
                    "kind": "optional",
                    "name": "street",
                    "type": "string",
                    "example": "",
                    "description": "Street name"
                  },
                  {
                    "kind": "optional",
                    "name": "townCity",
                    "type": "string",
                    "example": "",
                    "description": "Name of town city"
                  },
                  {
                    "kind": "optional",
                    "name": "district",
                    "type": "string",
                    "example": "",
                    "description": "Name of district"
                  },
                  {
                    "kind": "optional",
                    "name": "state",
                    "type": "string",
                    "example": "",
                    "description": "State"
                  },
                  {
                    "kind": "optional",
                    "name": "county",
                    "type": "string",
                    "example": "",
                    "description": "County"
                  },
                  {
                    "kind": "optional",
                    "name": "postCode",
                    "type": "string",
                    "example": "",
                    "description": "Post code"
                  },
                  {
                    "kind": "optional",
                    "name": "country",
                    "type": "string",
                    "example": "",
                    "description": "Country"
                  },
                  {
                    "kind": "optional",
                    "name": "isDefault",
                    "type": "boolean",
                    "example": "",
                    "description": "Is default"
                  }
                ],
                "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.Address",
                "customType": "FictiveGlobal.Api.Rest.Dtos.v1.Address[]",
                "description": "Addresses of Account"
              },
              {
                "kind": "optional",
                "name": "customParameters",
                "type": "object",
                "schema": [],
                "example": {},
                "description": "Custom parameters"
              },
              {
                "kind": "optional",
                "name": "sessionToken",
                "type": "string",
                "example": "",
                "description": "The session token"
              },
              {
                "kind": "optional",
                "name": "marketingAllowed",
                "type": "boolean",
                "example": "",
                "description": "Marketing Allowed"
              }
            ],
            "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v3.AccountResult",
            "customType": "FictiveGlobal.Api.Rest.Dtos.v3.AccountResult",
            "isExpanded": true,
            "description": "Account"
          }
        ],
        "isExpanded": true,
        "statusCode": "200",
        "description": "OK",
        "jsonExample": "{\n  \"accountReference\": \"accRef\",\n  \"status\": \"Active\",\n  \"verified\": true,\n  \"email\": \"Email\",\n  \"clientUserId\": \"ClientUserId\",\n  \"salutation\": \"Salutation\",\n  \"firstName\": \"FirstName\",\n  \"lastName\": \"LastName\",\n  \"phoneNumber\": \"PhoneNumber\",\n  \"mobileNumber\": \"MobileNumber\",\n  \"dateOfBirth\": \"2021-09-21T05:33:12.3852824\",\n  \"gender\": \"NotKnown\",\n  \"addresses\": [\n    {\n      \"addressType\": \"Home\",\n      \"houseName\": \"HouseName\",\n      \"houseNumber\": \"HouseNumber\",\n      \"street\": \"Street\",\n      \"townCity\": \"TownCity\",\n      \"district\": \"District\",\n      \"state\": \"State\",\n      \"county\": \"County\",\n      \"postCode\": \"PostCode\",\n      \"country\": \"Country\"\n    }\n  ],\n  \"customParameters\": {\n    \"ParameterName\": \"ParameterValue\"\n  },\n  \"sessionToken\": \"03cb4c8d08d049548557b28302f24bcf\",\n  \"marketingAllowed\": true\n}"
      },
      {
        "isExpanded": true,
        "statusCode": "400",
        "description": "Unable to authenticate using the provided session",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "401",
        "description": "Not Authorized",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "404",
        "description": "Not Found",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "500",
        "description": "Internal Server Error",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "This endpoint provides the ability to authenticate an account using email address and password.\r\n            Upon successful authentication, the account profile will be returned alongside a valid session token.",
    "examples": {
      "languages": [
        {
          "id": "8GcGSb_LFaJiOkRzEoBLI",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.fictive.com/REST/api/accounts/authenticate \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "jWMp6O0670VHKspcqI4xI",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"x-version\", \"string\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.fictive.com/REST/api/accounts/authenticate\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "v91Itr_1tK0sS1cGHubCD",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/accounts/authenticate\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest[\"x-version\"] = \"string\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "eRN4eXR9eQQkrhheo-qna",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/accounts/authenticate\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'x-version': 'string'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "8GcGSb_LFaJiOkRzEoBLI"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "{\n  \"accountReference\": \"accRef\",\n  \"status\": \"Active\",\n  \"verified\": true,\n  \"email\": \"Email\",\n  \"clientUserId\": \"ClientUserId\",\n  \"salutation\": \"Salutation\",\n  \"firstName\": \"FirstName\",\n  \"lastName\": \"LastName\",\n  \"phoneNumber\": \"PhoneNumber\",\n  \"mobileNumber\": \"MobileNumber\",\n  \"dateOfBirth\": \"2021-09-21T05:33:12.3852824\",\n  \"gender\": \"NotKnown\",\n  \"addresses\": [\n    {\n      \"addressType\": \"Home\",\n      \"houseName\": \"HouseName\",\n      \"houseNumber\": \"HouseNumber\",\n      \"street\": \"Street\",\n      \"townCity\": \"TownCity\",\n      \"district\": \"District\",\n      \"state\": \"State\",\n      \"county\": \"County\",\n      \"postCode\": \"PostCode\",\n      \"country\": \"Country\"\n    }\n  ],\n  \"customParameters\": {\n    \"ParameterName\": \"ParameterValue\"\n  },\n  \"sessionToken\": \"03cb4c8d08d049548557b28302f24bcf\",\n  \"marketingAllowed\": true\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Unable to authenticate using the provided session\n"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Not Authorized\n"
        },
        {
          "id": "response-3-404",
          "language": "404",
          "code": "// Not Found\n"
        },
        {
          "id": "response-4-500",
          "language": "500",
          "code": "// Internal Server Error\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}