---
title: Update password via email token
slug: docs/demo/update-password-via-email-token
description: Learn how to make a PATCH request using the curl command with this code example. This document walks you through a fictive API endpoint where you can update a user's password. It includes helpful headers for accepting and sending JSON data. The provided r
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "WUPdDqDxUxacUzLyZShkF",
  "data": {
    "url": "https://api.fictive.com/REST/api/accounts/update-password",
    "name": "Update password via email token",
    "method": "PATCH",
    "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": "accountPasswordResetRequest",
          "type": "object",
          "schema": [
            {
              "kind": "optional",
              "name": "password",
              "type": "string",
              "example": "",
              "description": "The new password changed."
            },
            {
              "kind": "optional",
              "name": "login",
              "type": "boolean",
              "example": "",
              "description": "The value that indicates if user is logged in."
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.AccountPasswordReset",
          "customType": "FictiveGlobal.Api.Rest.Dtos.v1.AccountPasswordReset",
          "isExpanded": true,
          "description": "Account password reset dto."
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "kind": "optional",
                "name": "resourceReference",
                "type": "string",
                "example": "",
                "description": "Resource reference"
              },
              {
                "kind": "optional",
                "name": "sessionToken",
                "type": "string",
                "example": "",
                "description": "The session token"
              }
            ],
            "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v2.AccountSessionSummary",
            "customType": "FictiveGlobal.Api.Rest.Dtos.v2.AccountSessionSummary",
            "isExpanded": true,
            "description": "Account session summary"
          }
        ],
        "isExpanded": true,
        "statusCode": "200",
        "description": "OK",
        "jsonExample": "{\n  \"resourceReference\": \"ResourceReference\",\n  \"sessionToken\": \"E9E2E9604EF64FEDA7F3DC2949945364\"\n}"
      },
      {
        "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 will provide the ability to complete  a forgotten password flow. The token provided in the forgotten password email will be provided as part of this request",
    "examples": {
      "languages": [
        {
          "id": "LKKO-SSmWav0YMEiyre2v",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request PATCH \\\n     --url https://api.fictive.com/REST/api/accounts/update-password \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "xCmudvuZsTDLqh_5UpwHJ",
          "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: 'PATCH',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.fictive.com/REST/api/accounts/update-password\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "xoRBauDhaI5SgoyIIcrFz",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/accounts/update-password\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Patch.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": "oO9-vTqWI3W4mCxeWRXEG",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/accounts/update-password\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'x-version': 'string'\n}\n\nresponse = requests.request(\"PATCH\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "LKKO-SSmWav0YMEiyre2v"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "{\n  \"resourceReference\": \"ResourceReference\",\n  \"sessionToken\": \"E9E2E9604EF64FEDA7F3DC2949945364\"\n}"
        },
        {
          "id": "response-1-401",
          "language": "401",
          "code": "// Not Authorized\n"
        },
        {
          "id": "response-2-404",
          "language": "404",
          "code": "// Not Found\n"
        },
        {
          "id": "response-3-500",
          "language": "500",
          "code": "// Internal Server Error\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}