> 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.

# Set charger configuration

POST https://host.com/ocpp/commands/configuration
Content-Type: application/json

Send a configuration update command to the selected charger. Apply one or more OCPP configuration key-value pairs and return each key as `Accepted`, `Rejected`, or `RebootRequired`.

Reference: https://docs.ocpplab.com/api-reference/ocpplab-gateway-api/charger-operations/commands/set-configuration

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: OCPPLab SDK
  version: 1.0.0
paths:
  /ocpp/commands/configuration:
    post:
      operationId: set-configuration
      summary: Set charger configuration
      description: >-
        Send a configuration update command to the selected charger. Apply one
        or more OCPP configuration key-value pairs and return each key as
        `Accepted`, `Rejected`, or `RebootRequired`.
      tags:
        - subpackage_commands
      parameters:
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Configuration set
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConfigurationChangeResponse'
        '400':
          description: Invalid request 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/TargetedConfigurationUpdateRequest'
servers:
  - url: https://host.com
    description: Default
components:
  schemas:
    ChargerCommandTarget:
      type: object
      properties:
        charger_id:
          type: string
          description: Target a single charger by deployment ID.
      required:
        - charger_id
      description: >-
        Single-charger target for command endpoints that do not support
        locations.
      title: ChargerCommandTarget
    ConfigurationUpdateEvent:
      type: object
      properties:
        configuration:
          type: object
          additionalProperties:
            type: string
          description: String-to-string OCPP configuration mapping to apply.
      required:
        - configuration
      description: Command payload for configuration mutation.
      title: ConfigurationUpdateEvent
    TargetedConfigurationUpdateRequest:
      type: object
      properties:
        target:
          $ref: '#/components/schemas/ChargerCommandTarget'
        event:
          $ref: '#/components/schemas/ConfigurationUpdateEvent'
      required:
        - target
        - event
      description: Request for configuration mutation command.
      title: TargetedConfigurationUpdateRequest
    ConfigurationChangeResponse:
      type: object
      properties:
        status:
          type: string
        configured:
          type: array
          items:
            type: string
        msg:
          type: string
      required:
        - status
        - configured
        - msg
      description: Response body returned after changing charger configuration.
      title: ConfigurationChangeResponse
    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

### Configuration keys accepted by the charger



**Request**

```json
undefined
```

**Response**

```json
{
  "status": "Accepted",
  "configured": [
    "HeartbeatInterval",
    "MeterValuesSampledInterval"
  ],
  "msg": "Configuration updated for 2 keys"
}
```

**SDK Code**

```python Configuration keys accepted by the charger
import requests

url = "https://host.com/ocpp/commands/configuration"

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

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

print(response.json())
```

```javascript Configuration keys accepted by the charger
const url = 'https://host.com/ocpp/commands/configuration';
const options = {
  method: 'POST',
  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 Configuration keys accepted by the charger
package main

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

func main() {

	url := "https://host.com/ocpp/commands/configuration"

	req, _ := http.NewRequest("POST", 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 Configuration keys accepted by the charger
require 'uri'
require 'net/http'

url = URI("https://host.com/ocpp/commands/configuration")

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

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

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

```java Configuration keys accepted by the charger
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

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

```php Configuration keys accepted by the charger
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

```csharp Configuration keys accepted by the charger
using RestSharp;

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

```swift Configuration keys accepted by the charger
import Foundation

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

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

### Update heartbeat interval



**Request**

```json
{
  "target": {
    "charger_id": "dep-123"
  },
  "event": {
    "configuration": {
      "HeartbeatInterval": "30"
    }
  }
}
```

**Response**

```json
{
  "status": "Accepted",
  "configured": [
    "HeartbeatInterval",
    "MeterValuesSampledInterval"
  ],
  "msg": "Configuration updated for 2 keys"
}
```

**SDK Code**

```python Update heartbeat interval
import requests

url = "https://host.com/ocpp/commands/configuration"

payload = {
    "target": { "charger_id": "dep-123" },
    "event": { "configuration": { "HeartbeatInterval": "30" } }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Update heartbeat interval
const url = 'https://host.com/ocpp/commands/configuration';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"target":{"charger_id":"dep-123"},"event":{"configuration":{"HeartbeatInterval":"30"}}}'
};

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

```go Update heartbeat interval
package main

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

func main() {

	url := "https://host.com/ocpp/commands/configuration"

	payload := strings.NewReader("{\n  \"target\": {\n    \"charger_id\": \"dep-123\"\n  },\n  \"event\": {\n    \"configuration\": {\n      \"HeartbeatInterval\": \"30\"\n    }\n  }\n}")

	req, _ := http.NewRequest("POST", 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 Update heartbeat interval
require 'uri'
require 'net/http'

url = URI("https://host.com/ocpp/commands/configuration")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"target\": {\n    \"charger_id\": \"dep-123\"\n  },\n  \"event\": {\n    \"configuration\": {\n      \"HeartbeatInterval\": \"30\"\n    }\n  }\n}"

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

```java Update heartbeat interval
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://host.com/ocpp/commands/configuration")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"target\": {\n    \"charger_id\": \"dep-123\"\n  },\n  \"event\": {\n    \"configuration\": {\n      \"HeartbeatInterval\": \"30\"\n    }\n  }\n}")
  .asString();
```

```php Update heartbeat interval
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://host.com/ocpp/commands/configuration', [
  'body' => '{
  "target": {
    "charger_id": "dep-123"
  },
  "event": {
    "configuration": {
      "HeartbeatInterval": "30"
    }
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Update heartbeat interval
using RestSharp;

var client = new RestClient("https://host.com/ocpp/commands/configuration");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"target\": {\n    \"charger_id\": \"dep-123\"\n  },\n  \"event\": {\n    \"configuration\": {\n      \"HeartbeatInterval\": \"30\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Update heartbeat interval
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "target": ["charger_id": "dep-123"],
  "event": ["configuration": ["HeartbeatInterval": "30"]]
] as [String : Any]

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

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

### Update several configuration keys



**Request**

```json
{
  "target": {
    "charger_id": "dep-123"
  },
  "event": {
    "configuration": {
      "HeartbeatInterval": "30",
      "MeterValuesSampledInterval": "15"
    }
  }
}
```

**Response**

```json
{
  "status": "Accepted",
  "configured": [
    "HeartbeatInterval",
    "MeterValuesSampledInterval"
  ],
  "msg": "Configuration updated for 2 keys"
}
```

**SDK Code**

```python Update several configuration keys
import requests

url = "https://host.com/ocpp/commands/configuration"

payload = {
    "target": { "charger_id": "dep-123" },
    "event": { "configuration": {
            "HeartbeatInterval": "30",
            "MeterValuesSampledInterval": "15"
        } }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Update several configuration keys
const url = 'https://host.com/ocpp/commands/configuration';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"target":{"charger_id":"dep-123"},"event":{"configuration":{"HeartbeatInterval":"30","MeterValuesSampledInterval":"15"}}}'
};

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

```go Update several configuration keys
package main

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

func main() {

	url := "https://host.com/ocpp/commands/configuration"

	payload := strings.NewReader("{\n  \"target\": {\n    \"charger_id\": \"dep-123\"\n  },\n  \"event\": {\n    \"configuration\": {\n      \"HeartbeatInterval\": \"30\",\n      \"MeterValuesSampledInterval\": \"15\"\n    }\n  }\n}")

	req, _ := http.NewRequest("POST", 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 Update several configuration keys
require 'uri'
require 'net/http'

url = URI("https://host.com/ocpp/commands/configuration")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"target\": {\n    \"charger_id\": \"dep-123\"\n  },\n  \"event\": {\n    \"configuration\": {\n      \"HeartbeatInterval\": \"30\",\n      \"MeterValuesSampledInterval\": \"15\"\n    }\n  }\n}"

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

```java Update several configuration keys
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://host.com/ocpp/commands/configuration")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"target\": {\n    \"charger_id\": \"dep-123\"\n  },\n  \"event\": {\n    \"configuration\": {\n      \"HeartbeatInterval\": \"30\",\n      \"MeterValuesSampledInterval\": \"15\"\n    }\n  }\n}")
  .asString();
```

```php Update several configuration keys
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://host.com/ocpp/commands/configuration', [
  'body' => '{
  "target": {
    "charger_id": "dep-123"
  },
  "event": {
    "configuration": {
      "HeartbeatInterval": "30",
      "MeterValuesSampledInterval": "15"
    }
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Update several configuration keys
using RestSharp;

var client = new RestClient("https://host.com/ocpp/commands/configuration");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"target\": {\n    \"charger_id\": \"dep-123\"\n  },\n  \"event\": {\n    \"configuration\": {\n      \"HeartbeatInterval\": \"30\",\n      \"MeterValuesSampledInterval\": \"15\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Update several configuration keys
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "target": ["charger_id": "dep-123"],
  "event": ["configuration": [
      "HeartbeatInterval": "30",
      "MeterValuesSampledInterval": "15"
    ]]
] as [String : Any]

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

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