> ## Documentation Index
> Fetch the complete documentation index at: https://docs.storerocket.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete a location

> Remove a location from a project.

Requires `location:delete` and project API access. The location must belong to the project in the URL.

<Warning>This request deletes a real location. Run the cURL, JavaScript or PHP example only with a location you created for testing.</Warning>

<ParamField path="project_id" type="string" required>The public project ID.</ParamField>
<ParamField path="location_id" type="string" required>The public location ID.</ParamField>

JavaScript examples run in Node.js 22 or later; PHP examples require PHP 8.2 or later with cURL. Both read `STOREROCKET_TOKEN` from your environment. See the [quickstart](/api/quickstart) for setup.

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE 'https://storerocket.io/api/v2/projects/PROJECT_ID/locations/LOCATION_ID' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Accept: application/json'
  ```

  ```javascript JavaScript theme={null}
  const token = process.env.STOREROCKET_TOKEN;
  if (!token) throw new Error("Set STOREROCKET_TOKEN first.");
  const projectId = "PROJECT_ID";
  const locationId = "LOCATION_ID";

  const url = new URL(`https://storerocket.io/api/v2/projects/${encodeURIComponent(projectId)}/locations/${encodeURIComponent(locationId)}`);
  const response = await fetch(url, {
    method: "DELETE",
    headers: {
      Authorization: `Bearer ${token}`,
      Accept: "application/json",
    },
    signal: AbortSignal.timeout(30_000),
  });

  const text = await response.text();
  if (!response.ok) throw new Error(`HTTP ${response.status}: ${text}`);
  console.log(JSON.parse(text));
  ```

  ```php PHP theme={null}
  <?php

  $token = getenv("STOREROCKET_TOKEN") ?: throw new RuntimeException("Set STOREROCKET_TOKEN first.");
  $projectId = "PROJECT_ID";
  $locationId = "LOCATION_ID";

  $url = 'https://storerocket.io/api/v2/projects/' . rawurlencode($projectId) . '/locations/' . rawurlencode($locationId);

  $curl = curl_init($url);
  curl_setopt_array($curl, [
      CURLOPT_CUSTOMREQUEST => "DELETE",
      CURLOPT_HTTPHEADER => [
          "Authorization: Bearer $token",
          "Accept: application/json",
      ],
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CONNECTTIMEOUT => 5,
      CURLOPT_TIMEOUT => 30,
  ]);

  $text = curl_exec($curl);
  $error = curl_error($curl);
  $status = (int) curl_getinfo($curl, CURLINFO_HTTP_CODE);
  curl_close($curl);

  if ($text === false) {
      throw new RuntimeException("Request failed: $error");
  }
  if ($status < 200 || $status >= 300) {
      throw new RuntimeException("HTTP $status: $text");
  }
  $data = json_decode($text, false, 512, JSON_THROW_ON_ERROR);
  echo json_encode($data, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR), PHP_EOL;
  ```
</RequestExample>

<ResponseExample>
  ```json Example response theme={null}
  {"success":true}
  ```
</ResponseExample>

A successful deletion returns `200`. The location is removed from the project and its widget results.
Errors: `401` authentication, `403` access/permission, `404` inaccessible project or location, `429` rate limit. See [errors](/api/errors).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.