---
title: Search 2FA Status
slug: single-connect-api-3-2-0/search-2fa-status
description: Learn how to use the curl command to make a POST request with JSON content and a username field included. This document provides a helpful code example for sending a POST request to a specific URL, with detailed instructions on setting headers to accept a
docTags: 
createdAt: 2022-11-10T14:24:52.000Z
---

{
  "id": "qIUENvub9WlIYQvdeWlvH",
  "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": "znRZaya29LKUVGTxkFsaf",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/twofactorauth-ui/rest/tfa/otpStatus \\\n     --header 'accept: application/json'"
        },
        {
          "id": "5ZnTRJPQYaC7Ug0RZmcTE",
          "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": "kmDoMVyE9rCGPd_-kCZvQ",
          "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": "L0MGb5Morv-Qdqny-j0V2",
          "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": "znRZaya29LKUVGTxkFsaf"
    },
    "results": {
      "languages": [
        {
          "id": "bmHoz-Fd1vpXr0Iu9AKRo",
          "language": "200",
          "code": "false"
        }
      ],
      "selectedLanguageId": "bmHoz-Fd1vpXr0Iu9AKRo"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}