> 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 full documentation content, see https://docs.ocpplab.com/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ocpplab.com/_mcp/server.

# Update charger

PUT https://host.com/ocpp/chargers/{charger_id}
Content-Type: application/json

Update one charger deployment using a partial payload. Only provided fields are modified.

Reference: https://docs.ocpplab.com/api-reference/ocpplab-gateway-api/core-resources/chargers/update

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: OCPPLab SDK
  version: 1.0.0
paths:
  /ocpp/chargers/{charger_id}:
    put:
      operationId: update
      summary: Update charger
      description: >-
        Update one charger deployment using a partial payload. Only provided
        fields are modified.
      tags:
        - subpackage_chargers
      parameters:
        - name: charger_id
          in: path
          description: >-
            Internal charger deployment identifier returned by charger CRUD
            endpoints. Use charger identity for simulator and control endpoints.
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Charger updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChargerResponse'
        '400':
          description: Invalid charger data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorResponse'
        '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: 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'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateChargerRequest'
servers:
  - url: https://host.com
components:
  schemas:
    UpdateChargerRequest:
      type: object
      properties:
        name:
          type:
            - string
            - 'null'
        charge_point_name:
          type:
            - string
            - 'null'
        connector_type:
          type:
            - string
            - 'null'
        ocpp_version:
          type:
            - string
            - 'null'
        ws_url:
          type:
            - string
            - 'null'
        location_id:
          type:
            - string
            - 'null'
        location_name:
          type:
            - string
            - 'null'
      description: Partial request body used to update one charger deployment.
      title: UpdateChargerRequest
    ChargerResponse:
      type: object
      properties:
        id:
          type: string
        identity:
          type: string
        name:
          type:
            - string
            - 'null'
        vendor_name:
          type:
            - string
            - 'null'
        model:
          type:
            - string
            - 'null'
        image_url:
          type:
            - string
            - 'null'
        ocpp_version:
          type:
            - string
            - 'null'
        number_of_connectors:
          type:
            - integer
            - 'null'
        max_charging_power:
          type:
            - integer
            - 'null'
        connector_type:
          type:
            - string
            - 'null'
        location_id:
          type:
            - string
            - 'null'
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - identity
      description: Charger deployment payload returned by the CRUD endpoints.
      title: ChargerResponse
    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

```

## SDK Code Examples

```python Charger moved and connector type changed
import requests

url = "https://host.com/ocpp/chargers/dep-123"

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

response = requests.put(url, headers=headers)

print(response.json())
```

```javascript Charger moved and connector type changed
const url = 'https://host.com/ocpp/chargers/dep-123';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: undefined
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Charger moved and connector type changed
package main

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

func main() {

	url := "https://host.com/ocpp/chargers/dep-123"

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

	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 Charger moved and connector type changed
require 'uri'
require 'net/http'

url = URI("https://host.com/ocpp/chargers/dep-123")

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

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

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

```java Charger moved and connector type changed
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://host.com/ocpp/chargers/dep-123")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .asString();
```

```php Charger moved and connector type changed
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://host.com/ocpp/chargers/dep-123', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Charger moved and connector type changed
using RestSharp;

var client = new RestClient("https://host.com/ocpp/chargers/dep-123");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Charger moved and connector type changed
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://host.com/ocpp/chargers/dep-123")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```

```python Move charger and update connector type
import requests

url = "https://host.com/ocpp/chargers/dep-123"

payload = {
    "charge_point_name": "Bay A02",
    "connector_type": "CCS2",
    "location_id": "5d4e8d84-6f1c-49a7-9e0d-5e6d65f0f4a2"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript Move charger and update connector type
const url = 'https://host.com/ocpp/chargers/dep-123';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"charge_point_name":"Bay A02","connector_type":"CCS2","location_id":"5d4e8d84-6f1c-49a7-9e0d-5e6d65f0f4a2"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Move charger and update connector type
package main

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

func main() {

	url := "https://host.com/ocpp/chargers/dep-123"

	payload := strings.NewReader("{\n  \"charge_point_name\": \"Bay A02\",\n  \"connector_type\": \"CCS2\",\n  \"location_id\": \"5d4e8d84-6f1c-49a7-9e0d-5e6d65f0f4a2\"\n}")

	req, _ := http.NewRequest("PUT", 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 Move charger and update connector type
require 'uri'
require 'net/http'

url = URI("https://host.com/ocpp/chargers/dep-123")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"charge_point_name\": \"Bay A02\",\n  \"connector_type\": \"CCS2\",\n  \"location_id\": \"5d4e8d84-6f1c-49a7-9e0d-5e6d65f0f4a2\"\n}"

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

```java Move charger and update connector type
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://host.com/ocpp/chargers/dep-123")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"charge_point_name\": \"Bay A02\",\n  \"connector_type\": \"CCS2\",\n  \"location_id\": \"5d4e8d84-6f1c-49a7-9e0d-5e6d65f0f4a2\"\n}")
  .asString();
```

```php Move charger and update connector type
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://host.com/ocpp/chargers/dep-123', [
  'body' => '{
  "charge_point_name": "Bay A02",
  "connector_type": "CCS2",
  "location_id": "5d4e8d84-6f1c-49a7-9e0d-5e6d65f0f4a2"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Move charger and update connector type
using RestSharp;

var client = new RestClient("https://host.com/ocpp/chargers/dep-123");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"charge_point_name\": \"Bay A02\",\n  \"connector_type\": \"CCS2\",\n  \"location_id\": \"5d4e8d84-6f1c-49a7-9e0d-5e6d65f0f4a2\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Move charger and update connector type
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "charge_point_name": "Bay A02",
  "connector_type": "CCS2",
  "location_id": "5d4e8d84-6f1c-49a7-9e0d-5e6d65f0f4a2"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://host.com/ocpp/chargers/dep-123")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```

```python Rename the charger only
import requests

url = "https://host.com/ocpp/chargers/dep-123"

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

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript Rename the charger only
const url = 'https://host.com/ocpp/chargers/dep-123';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"charge_point_name":"Bay B01"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Rename the charger only
package main

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

func main() {

	url := "https://host.com/ocpp/chargers/dep-123"

	payload := strings.NewReader("{\n  \"charge_point_name\": \"Bay B01\"\n}")

	req, _ := http.NewRequest("PUT", 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 Rename the charger only
require 'uri'
require 'net/http'

url = URI("https://host.com/ocpp/chargers/dep-123")

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

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

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

```java Rename the charger only
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://host.com/ocpp/chargers/dep-123")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"charge_point_name\": \"Bay B01\"\n}")
  .asString();
```

```php Rename the charger only
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://host.com/ocpp/chargers/dep-123', [
  'body' => '{
  "charge_point_name": "Bay B01"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Rename the charger only
using RestSharp;

var client = new RestClient("https://host.com/ocpp/chargers/dep-123");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"charge_point_name\": \"Bay B01\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Rename the charger only
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://host.com/ocpp/chargers/dep-123")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```