> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# Remove a member

DELETE https://%7BYour_Space_Name%7D.signalwire.com/api/space/members/{id}

Removes a member from the space. The owner cannot be removed
(`cannot_remove_the_owner`), and you cannot remove your own membership
(`cannot_remove_yourself`).

#### Permissions

Authenticate with a [Personal access token](/docs/apis/authorization#personal-access-tokens) whose holder is an owner or admin of the space. A project API token is not accepted on this endpoint, and a Personal access token has no scopes: the holder's role in the space is the whole authorization decision.

Reference: https://signalwire.com/docs/apis/rest/space/members/delete-member

## Authentication

- `Authorization` header (basic auth, required) — Personal access token authentication for space-wide administration. Send HTTP Basic auth with an empty username and the Personal access token as the password. A Personal access token carries your own authority rather than a project's: it is created from your user menu in the Dashboard, is prefixed `pat_`, and has no scopes. The holder must be an owner or admin of the space named by the subdomain, and the token acts only on that space. Example: ``` Authorization: Basic base64(:pat_...) ```

## Request

### Path parameters

- `id` (string, required) — The unique identifier of the membership.

## Response

### 204

There is no content to send for this request, but the headers may be useful.

## Errors

### 401 Unauthorized Error

The credential is missing, unknown, or revoked; its holder is not a member of the space in the subdomain; or the member is not an owner or admin. The body is the plain text `Unauthorized`. An unverified space instead receives the JSON body `{"message": "Please validate a phone number to access your account."}` on every endpoint under `/api/space`.

- `message` (string, required) — States that a phone number must be validated for the space before it can use the API.

### 422 Unprocessable Entity Error

The delete targeted the space owner (`cannot_remove_the_owner`) or the calling token holder's own membership (`cannot_remove_yourself`).

- `errors` (list of object, required) — List of validation errors.
  - `type` (string, required) — The category of error.
  - `code` (string, required) — A specific error code.
  - `message` (string, required) — A description of what caused the error.
  - `url` (string, required) — A link to documentation about this error.
  - `attribute` (string, optional, nullable) — The request parameter that caused the error, if applicable.

### 500 Internal Server Error

An internal server error occurred.

- `error` (enum, required)
  - Allowed values: `Internal Server Error`

## Examples

**SDK Code**

```python
import requests

url = "https://{your_space_name}.signalwire.com/api/space/members/id"

response = requests.delete(url, auth=("<username>", "<personal_access_token>"))

print(response.json())
```

```javascript
const url = 'https://{your_space_name}.signalwire.com/api/space/members/id';
const credentials = btoa("<username>:<personal_access_token>");

const options = {
  method: 'DELETE',
  headers: {Authorization: `Basic ${credentials}`}
};

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://{your_space_name}.signalwire.com/api/space/members/id"

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

	req.SetBasicAuth("<username>", "<personal_access_token>")

	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://{your_space_name}.signalwire.com/api/space/members/id")

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

request = Net::HTTP::Delete.new(url)
request.basic_auth("<username>", "<personal_access_token>")

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://{your_space_name}.signalwire.com/api/space/members/id")
  .basicAuth("<username>", "<personal_access_token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://{your_space_name}.signalwire.com/api/space/members/id', [
  'headers' => [
  ],
    'auth' => ['<username>', '<personal_access_token>'],
]);

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

```csharp
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://{your_space_name}.signalwire.com/api/space/members/id");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<personal_access_token>");
var request = new RestRequest(Method.DELETE);

IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let credentials = Data("<username>:<personal_access_token>".utf8).base64EncodedString()

let headers = ["Authorization": "Basic \(credentials)"]

let request = NSMutableURLRequest(url: NSURL(string: "https://{your_space_name}.signalwire.com/api/space/members/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers

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