> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://es.megaport.ferndocs.com/es/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://es.megaport.ferndocs.com/es/_mcp/server.

# Restablecer Autenticación Multifactor de Persona

PUT https://api.megaport.com/v2/employee/{employeeId}/mfa
Content-Type: application/json

Restablece la Autenticación de Múltiples Factores (MFA) para un usuario.

Esto es equivalente a restablecer MFA para un usuario desde la opción de Perfil de Usuario bajo el nombre del usuario en el Portal de Megaport. Para obtener más información, consulte [Administrar su Perfil de Usuario](https://docs.megaport.com/setting-up/manage-profile/).

Puede encontrar el ID de empleado (`personId`) utilizando el punto final GET Lista de Usuarios de la Empresa `/v2/employment`.

Cuando MFA está habilitado para un usuario, puede restablecerse para inscribir un nuevo dispositivo móvil. Puede restablecer MFA para un usuario independientemente de la configuración global de MFA para su empresa. Es decir, ya sea que MFA haya sido establecido como obligatorio u opcional por un Administrador de la Empresa.

**Nota:**

- El usuario permanecerá conectado al Portal de Megaport al restablecer MFA.
- Restablecer MFA no deshabilita MFA para la cuenta de usuario.
- El Soporte de Megaport no puede restablecer o regenerar códigos QR para los clientes. Un Administrador de la Empresa debe realizar esta tarea en el Portal de Megaport.

Los cambios se definen en el Cuerpo de la solicitud. Los atributos tienen estos valores.

- `totpSecret` - (Obligatorio - cadena) Un secreto devuelto al llamar al punto final `/v2/totp/qrcode`. Tiene una longitud de 16 caracteres y contiene solo letras mayúsculas y dígitos.
- `totpCode` - (Obligatorio - cadena) Un número de 6 dígitos generado en base a totpSecret. El usuario puede escanear el código QR con aplicaciones como Google Authenticator y esa aplicación generará el código para el usuario.

Para obtener más información, consulte [Aplicación de Autenticación de Múltiples Factores](https://docs.megaport.com/setting-up/enforcing-mfa/).

Reference: https://es.megaport.ferndocs.com/es/api-reference/user-authentication/reset-person-multi-factor-authentication

## Servers

- `https://api.megaport.com` (Entorno de producción, default)
- `https://api-staging.megaport.com` (Entorno de pruebas (solo pruebas, se restablece cada 24 horas))

## Request

### Path parameters

- `employeeId` (string, required)

### Body (application/json)

This endpoint expects an object.

- `totpCode` (string, optional)
- `totpSecret` (string, optional)

## Response

### 200

Restablecer la autenticación multifactor de la persona - Éxito / Restablecer la autenticación multifactor de la persona - Éxito

- `message` (string, optional)
- `terms` (string, optional)

## Errors

### 400 Bad Request Error

Restablecer Autenticación Multifactor de Persona - OTP Faltante o Inválido / Restablecer Autenticación Multifactor de Persona - OTP Faltante o Inválido

- `message` (string, optional)
- `terms` (string, optional)

### 401 Unauthorized Error

Restablecer Autenticación Multifactor de Persona - Problema de Token / Restablecer Autenticación Multifactor de Persona - Problema de Token

- `message` (string, optional)
- `terms` (string, optional)

### 403 Forbidden Error

Restablecer Autenticación Multifactor de Persona - Nuevo Secreto OTP Idéntico / Restablecer Autenticación Multifactor de Persona - Nuevo Secreto OTP Idéntico

- `message` (string, optional)
- `terms` (string, optional)

### 404 Not Found Error

Restablecer Autenticación Multifactor de Persona - Usuario No Encontrado / Restablecer Autenticación Multifactor de Persona - Usuario No Encontrado

- `message` (string, optional)
- `terms` (string, optional)

## Examples

### Reset Person Multi-Factor Authentication - Success

**Response**

```json
{
  "message": "Su MFA se ha restablecido correctamente",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python Reset Person Multi-Factor Authentication - Success
import requests

url = "https://api.megaport.com/v2/employee/employeeId/mfa"

response = requests.put(url)

print(response.json())
```

```javascript Reset Person Multi-Factor Authentication - Success
const url = 'https://api.megaport.com/v2/employee/employeeId/mfa';
const options = {method: 'PUT'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Reset Person Multi-Factor Authentication - Success
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.megaport.com/v2/employee/employeeId/mfa"

	req, _ := http.NewRequest("PUT", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Reset Person Multi-Factor Authentication - Success
require 'uri'
require 'net/http'

url = URI("https://api.megaport.com/v2/employee/employeeId/mfa")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
```

```java Reset Person Multi-Factor Authentication - Success
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.megaport.com/v2/employee/employeeId/mfa")
  .asString();
```

```php Reset Person Multi-Factor Authentication - Success
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.megaport.com/v2/employee/employeeId/mfa');

echo $response->getBody();
```

```csharp Reset Person Multi-Factor Authentication - Success
using RestSharp;

var client = new RestClient("https://api.megaport.com/v2/employee/employeeId/mfa");
var request = new RestRequest(Method.PUT);
IRestResponse response = client.Execute(request);
```

```swift Reset Person Multi-Factor Authentication - Success
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.megaport.com/v2/employee/employeeId/mfa")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Reset Person Multi-Factor Authentication

**Request**

```json
{
  "totpCode": "123456",
  "totpSecret": "G4C3S6MBH2HSF2EV"
}
```

**Response**

```json
{
  "message": "Su MFA se ha restablecido correctamente",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python Reset Person Multi-Factor Authentication
import requests

url = "https://api.megaport.com/v2/employee/employeeId/mfa"

payload = {
    "totpCode": "123456",
    "totpSecret": "G4C3S6MBH2HSF2EV"
}
headers = {"Content-Type": "application/json"}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript Reset Person Multi-Factor Authentication
const url = 'https://api.megaport.com/v2/employee/employeeId/mfa';
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/json'},
  body: '{"totpCode":"123456","totpSecret":"G4C3S6MBH2HSF2EV"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Reset Person Multi-Factor Authentication
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.megaport.com/v2/employee/employeeId/mfa"

	payload := strings.NewReader("{\n  \"totpCode\": \"123456\",\n  \"totpSecret\": \"G4C3S6MBH2HSF2EV\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Reset Person Multi-Factor Authentication
require 'uri'
require 'net/http'

url = URI("https://api.megaport.com/v2/employee/employeeId/mfa")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"totpCode\": \"123456\",\n  \"totpSecret\": \"G4C3S6MBH2HSF2EV\"\n}"

response = http.request(request)
puts response.read_body
```

```java Reset Person Multi-Factor Authentication
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.megaport.com/v2/employee/employeeId/mfa")
  .header("Content-Type", "application/json")
  .body("{\n  \"totpCode\": \"123456\",\n  \"totpSecret\": \"G4C3S6MBH2HSF2EV\"\n}")
  .asString();
```

```php Reset Person Multi-Factor Authentication
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.megaport.com/v2/employee/employeeId/mfa', [
  'body' => '{
  "totpCode": "123456",
  "totpSecret": "G4C3S6MBH2HSF2EV"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Reset Person Multi-Factor Authentication
using RestSharp;

var client = new RestClient("https://api.megaport.com/v2/employee/employeeId/mfa");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"totpCode\": \"123456\",\n  \"totpSecret\": \"G4C3S6MBH2HSF2EV\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Reset Person Multi-Factor Authentication
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "totpCode": "123456",
  "totpSecret": "G4C3S6MBH2HSF2EV"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.megaport.com/v2/employee/employeeId/mfa")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```