Skip to main content
DELETE
/
users
/
{id}
Delete User
curl --request DELETE \
  --url https://api.petstoreapi.com/v1/users/{id}
import requests

url = "https://api.petstoreapi.com/v1/users/{id}"

response = requests.delete(url)

print(response.text)
const options = {method: 'DELETE'};

fetch('https://api.petstoreapi.com/v1/users/{id}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.petstoreapi.com/v1/users/{id}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

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

func main() {

	url := "https://api.petstoreapi.com/v1/users/{id}"

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

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

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

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.delete("https://api.petstoreapi.com/v1/users/{id}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.petstoreapi.com/v1/users/{id}")

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
{
  "type": "https://petstoreapi.com/errors/bad-request",
  "title": "Bad Request",
  "status": 400,
  "detail": "Invalid value for parameter 'status'. Must be one of: available, pending, sold.",
  "instance": "/pets"
}
{
  "type": "https://petstoreapi.com/errors/not-found",
  "title": "Not Found",
  "status": 404,
  "detail": "The requested pet with ID '123' was not found.",
  "instance": "/pets/123"
}

Headers

X-Tenant-ID
string<uuid>

Optional tenant identifier for data isolation. When provided, all operations will be scoped to this tenant, ensuring data separation between different organizations or users. If omitted, operations will access the shared/public data pool where data may be visible to and modified by other users.

Path Parameters

id
string
required

Unique identifier for the user

Response

Resource deleted successfully