> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://apidocs.polytomic.com/2023-04-25/api-reference/users/delete/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://apidocs.polytomic.com/_mcp/server. # Remove User DELETE https://app.polytomic.com/api/organizations/{org_id}/users/{id} Deletes a user from the specified organization. > 🚧 Requires partner key > > User endpoints are only accessible using [partner keys](../../../../../guides/obtaining-api-keys#partner-keys). Reference: https://apidocs.polytomic.com/api-reference/users/delete ## Authentication - `Authorization` header (basic auth, required) — This is the Polytomic deployment key (on-premises only) - `Authorization` header (bearer token, required) — This is the Polytomic API key ## Request ### Path parameters - `id` (string, required) — Unique identifier of the user. - `org_id` (string, required) — Unique identifier of the organization the user belongs to. ## Response ### 200 OK - `data` (V2User, optional) ## Errors ### 401 Unauthorized Error Unauthorized - `code` (integer, optional) — Application-specific error code. - `context` (map from string to any, optional) — Application context. - `error` (string, optional) — Error message. - `status` (string, optional) — Status text. ### 403 Forbidden Error Forbidden - `key` (string, optional) - `message` (string, optional) - `metadata` (map from string to any, optional) - `status` (integer, optional) ### 404 Not Found Error Not Found - `key` (string, optional) - `message` (string, optional) - `metadata` (map from string to any, optional) - `status` (integer, optional) ### 500 Internal Server Error Internal Server Error - `key` (string, optional) - `message` (string, optional) - `metadata` (map from string to any, optional) - `status` (integer, optional) ## Types ### V2User - `email` (string, optional) — Email address used to sign in and receive notifications. - `id` (string, optional) — Unique identifier of the user. - `organization_id` (string, optional) — Unique identifier of the organization the user belongs to. - `role_ids` (list of string, optional, nullable) — Identifiers of the permissions roles assigned to the user. - `role` (string, optional, deprecated) — Deprecated legacy role name. Use role_ids instead. ## Examples **Request** ```json {} ``` **Response** ```json { "data": { "email": "jane.doe@acmecorp.com", "id": "9f8b7c6d-1234-4a56-b789-0a1b2c3d4e5f", "organization_id": "3a2b1c4d-5678-4e90-8f12-3456789abcde", "role_ids": [ "248df4b7-aa70-47b8-a036-33ac447e668d" ], "role": "admin" } } ``` **SDK Code** ```python import requests url = "https://app.polytomic.com/api/organizations/248df4b7-aa70-47b8-a036-33ac447e668d/users/248df4b7-aa70-47b8-a036-33ac447e668d" payload = {} headers = { "X-Polytomic-Version": "X-Polytomic-Version" "Content-Type": "application/json" } response = requests.delete(url, json=payload, headers=headers, auth=("", "")) print(response.json()) ``` ```javascript const url = 'https://app.polytomic.com/api/organizations/248df4b7-aa70-47b8-a036-33ac447e668d/users/248df4b7-aa70-47b8-a036-33ac447e668d'; const credentials = btoa(":"); const options = { method: 'DELETE', headers: { 'X-Polytomic-Version': 'X-Polytomic-Version', Authorization: `Basic ${credentials}`, 'Content-Type': 'application/json' }, body: '{}' }; 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" "strings" "net/http" "io" ) func main() { url := "https://app.polytomic.com/api/organizations/248df4b7-aa70-47b8-a036-33ac447e668d/users/248df4b7-aa70-47b8-a036-33ac447e668d" payload := strings.NewReader("{}") req, _ := http.NewRequest("DELETE", url, payload) req.Header.Add("X-Polytomic-Version", "X-Polytomic-Version") req.SetBasicAuth("", "") 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 require 'uri' require 'net/http' url = URI("https://app.polytomic.com/api/organizations/248df4b7-aa70-47b8-a036-33ac447e668d/users/248df4b7-aa70-47b8-a036-33ac447e668d") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Delete.new(url) request["X-Polytomic-Version"] = 'X-Polytomic-Version' request.basic_auth("", "") request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.delete("https://app.polytomic.com/api/organizations/248df4b7-aa70-47b8-a036-33ac447e668d/users/248df4b7-aa70-47b8-a036-33ac447e668d") .header("X-Polytomic-Version", "X-Polytomic-Version") .basicAuth("", "") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('DELETE', 'https://app.polytomic.com/api/organizations/248df4b7-aa70-47b8-a036-33ac447e668d/users/248df4b7-aa70-47b8-a036-33ac447e668d', [ 'body' => '{}', 'headers' => [ 'Content-Type' => 'application/json', 'X-Polytomic-Version' => 'X-Polytomic-Version', ], 'auth' => ['', ''], ]); echo $response->getBody(); ``` ```csharp using RestSharp; using RestSharp.Authenticators; var client = new RestClient("https://app.polytomic.com/api/organizations/248df4b7-aa70-47b8-a036-33ac447e668d/users/248df4b7-aa70-47b8-a036-33ac447e668d"); client.Authenticator = new HttpBasicAuthenticator("", ""); var request = new RestRequest(Method.DELETE); request.AddHeader("X-Polytomic-Version", "X-Polytomic-Version"); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let credentials = Data(":".utf8).base64EncodedString() let headers = [ "X-Polytomic-Version": "X-Polytomic-Version", "Authorization": "Basic \(credentials)", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://app.polytomic.com/api/organizations/248df4b7-aa70-47b8-a036-33ac447e668d/users/248df4b7-aa70-47b8-a036-33ac447e668d")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "DELETE" 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() ```