---
title: Search 2FA Status
slug: single-connect-api-3-0-3/search-2fa-status
description: Learn how to make a POST request to a specific endpoint using the cURL command, with this comprehensive code example and step-by-step guide. Discover the different options and headers you can use to enhance your request, along with a handy form field for 
docTags: 
createdAt: 2022-11-10T14:21:49.000Z
---

{
  "id": "A8-xn3tHDeNPZNA1_XsdX",
  "data": {
    "url": "{{url}}/twofactorauth-ui/rest/tfa/otpStatus",
    "method": "POST",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "name": "Content-Type",
          "type": "string",
          "example": "application/x-www-form-urlencoded",
          "description": ""
        },
        {
          "name": "X-XSRF-TOKEN",
          "type": "string",
          "example": "{{csrftoken}}",
          "description": ""
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": [
        {
          "name": "username",
          "type": "string",
          "example": "admin",
          "description": ""
        }
      ]
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Search 2FA Status",
        "jsonExample": "false"
      }
    ],
    "contentType": "application/json",
    "description": "<p>This method is used to learn whether 2FA (2-Factor Authentication) status is enabled or not for a user.\nIf the user's 2FA is enabled the response is true.</p>\n<p>'username' is mandatory field in the request body and should be sent as URL Encoded.</p>",
    "examples": {
      "languages": [
        {
          "id": "VYvx7T2sxi0JRuYWly7sf",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/twofactorauth-ui/rest/tfa/otpStatus \\\n     --header 'accept: application/json'"
        },
        {
          "id": "t4kxBnFeJhSs5GpNKKuap",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"{{url}}/twofactorauth-ui/rest/tfa/otpStatus\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "QqiPiOBRfEpaKZ-Z-kWVU",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/twofactorauth-ui/rest/tfa/otpStatus\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "z7YqRqLfpPtqktigDJbRG",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/twofactorauth-ui/rest/tfa/otpStatus\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "VYvx7T2sxi0JRuYWly7sf"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "false"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}