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

# Delete chargers in location

DELETE https://host.com/ocpp/locations/{location_id}/chargers

Delete multiple charger deployments under the selected location.

Reference: https://docs.ocpplab.com/api-reference/ocpplab-gateway-api/location-operations/location-chargers/delete

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: OCPPLab SDK
  version: 1.0.0
paths:
  /ocpp/locations/{location_id}/chargers:
    delete:
      operationId: delete
      summary: Delete chargers in location
      description: Delete multiple charger deployments under the selected location.
      tags:
        - subpackage_locationChargers
      parameters:
        - name: location_id
          in: path
          description: Internal location identifier returned by the location CRUD API.
          required: true
          schema:
            type: string
        - name: charger_ids
          in: query
          description: >-
            Internal charger deployment ids to delete from the selected
            location. Repeat the query parameter to target multiple chargers.
          required: true
          schema:
            type: array
            items:
              type: string
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Location chargers deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteLocationChargersResponse'
        '401':
          description: Missing or invalid bearer token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorResponse'
        '403':
          description: Insufficient permissions or missing required claims
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorResponse'
        '404':
          description: Location or charger not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorResponse'
servers:
  - url: https://host.com
    description: Default
components:
  schemas:
    LocationDeleteChargerFailure:
      type: object
      properties:
        charger_id:
          type:
            - string
            - 'null'
        error:
          type: string
      required:
        - error
      description: Failure item returned when one location-scoped delete fails.
      title: LocationDeleteChargerFailure
    DeleteLocationChargersResponse:
      type: object
      properties:
        deleted_count:
          type: integer
        failed_count:
          type: integer
        deleted:
          type: array
          items:
            type: string
        failed:
          type: array
          items:
            $ref: '#/components/schemas/LocationDeleteChargerFailure'
      required:
        - deleted_count
        - failed_count
        - deleted
        - failed
      description: Response body returned by location-scoped multi-delete endpoints.
      title: DeleteLocationChargersResponse
    HttpErrorResponse:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message returned by the API.
      required:
        - detail
      description: Standard HTTP error payload returned by the API.
      title: HttpErrorResponse
    ValidationErrorLocItems:
      oneOf:
        - type: string
        - type: integer
      title: ValidationErrorLocItems
    ValidationErrorCtx:
      type: object
      properties: {}
      title: ValidationErrorCtx
    ValidationError:
      type: object
      properties:
        loc:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorLocItems'
        msg:
          type: string
        type:
          type: string
        input:
          description: Any type
        ctx:
          $ref: '#/components/schemas/ValidationErrorCtx'
      required:
        - loc
        - msg
        - type
      title: ValidationError
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
      title: HTTPValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

```

## Examples



**Request**

```json
{}
```

**Response**

```json
{
  "deleted_count": 1,
  "failed_count": 1,
  "deleted": [
    "dep-789"
  ],
  "failed": [
    {
      "error": "Charger not found",
      "charger_id": "dep-999"
    }
  ]
}
```

**SDK Code**

```python One charger was deleted and one id failed
import requests

url = "https://host.com/ocpp/locations/4090477f-a416-4515-a302-97aa344a0a2a/chargers"

querystring = {"charger_ids":"[\"dep-789\",\"dep-790\"]"}

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.delete(url, json=payload, headers=headers, params=querystring)

print(response.json())
```

```javascript One charger was deleted and one id failed
const url = 'https://host.com/ocpp/locations/4090477f-a416-4515-a302-97aa344a0a2a/chargers?charger_ids=%5B%22dep-789%22%2C%22dep-790%22%5D';
const options = {
  method: 'DELETE',
  headers: {Authorization: 'Bearer <token>', '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 One charger was deleted and one id failed
package main

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

func main() {

	url := "https://host.com/ocpp/locations/4090477f-a416-4515-a302-97aa344a0a2a/chargers?charger_ids=%5B%22dep-789%22%2C%22dep-790%22%5D"

	payload := strings.NewReader("{}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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 One charger was deleted and one id failed
require 'uri'
require 'net/http'

url = URI("https://host.com/ocpp/locations/4090477f-a416-4515-a302-97aa344a0a2a/chargers?charger_ids=%5B%22dep-789%22%2C%22dep-790%22%5D")

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

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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

```java One charger was deleted and one id failed
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://host.com/ocpp/locations/4090477f-a416-4515-a302-97aa344a0a2a/chargers?charger_ids=%5B%22dep-789%22%2C%22dep-790%22%5D")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php One charger was deleted and one id failed
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://host.com/ocpp/locations/4090477f-a416-4515-a302-97aa344a0a2a/chargers?charger_ids=%5B%22dep-789%22%2C%22dep-790%22%5D', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp One charger was deleted and one id failed
using RestSharp;

var client = new RestClient("https://host.com/ocpp/locations/4090477f-a416-4515-a302-97aa344a0a2a/chargers?charger_ids=%5B%22dep-789%22%2C%22dep-790%22%5D");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift One charger was deleted and one id failed
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://host.com/ocpp/locations/4090477f-a416-4515-a302-97aa344a0a2a/chargers?charger_ids=%5B%22dep-789%22%2C%22dep-790%22%5D")! 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()
```