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

# Delete Invited User

DELETE https://api.megaport.com/v2/employee/{employeeId}

Deletes a user who has been invited to your company but has not yet logged in.

If a new user has previously been invited to your company, but now you want to cancel the invite before the user logs in, you can use this endpoint. You might want to do this, for example, if the wrong user has been sent the email invite, or there was a mistake made when entering the email address.

The email address of a user that has been created cannot be modified, therefore you can use this endpoint to delete the new user and later recreate it with the correct details.

**Note:** Users cannot be deleted if they have logged in. In this case, they need to be made inactive instead of being deleted. The **Update User Details** endpoint can be used to make a user inactive.

#### Status Code 400

The user cannot be deleted when this status code is returned. This can happen in these situations:

- invitationPending is not True () (The user has already logged in)
- Idpid is null or empty

Reference: https://en.megaport.ferndocs.com/api-reference/user-authentication/delete-invited-user

## Servers

- `https://api.megaport.com` (Production environment, default)
- `https://api-staging.megaport.com` (Staging environment (test only, reset every 24 hours))

## Request

### Path parameters

- `employeeId` (string, required)

## Response

### 200

Delete Invited User - Success / Delete Invited User - Success

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

## Errors

### 400 Bad Request Error

Delete Invited User - Cannot Delete User / Delete Invited User - Cannot Delete User

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

### 401 Unauthorized Error

Delete Invited User - Token Issue / Delete Invited User - Token Issue

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

### 403 Forbidden Error

Delete Invited User - Unauthorized / Delete Invited User - Unauthorized

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

### 404 Not Found Error

Delete Invited User - User Not Found / Delete Invited User - User Not Found

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

### 500 Internal Server Error

Delete Invited User - Internal Server Error / Delete Invited User - Internal Server Error

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

## Examples

**Response**

```json
{
  "message": "Employee with ID: 45115 has been deleted from system.",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python
import requests

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

response = requests.delete(url)

print(response.json())
```

```javascript
const url = 'https://api.megaport.com/v2/employee/employeeId';
const options = {method: 'DELETE'};

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

```go
package main

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

func main() {

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

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

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

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

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

}
```

```ruby
require 'uri'
require 'net/http'

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

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

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

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

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

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

```csharp
using RestSharp;

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

```swift
import Foundation

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

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()
```