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

# Cap charging power

> Limit how much power an EV charger draws with the max_charge_rate setting, including for a grid event.

Charging power is a setting, not a command: write `max_charge_rate` once and the charger keeps it across sessions until you change it. See [Settings](/guides/capabilities/settings) for how settings differ from commands.

## 1. Check the device supports it

```bash theme={null}
curl https://api.amps.ai/ev-charger/device_abc123 \
  -H "x-api-key: $AMPS_API_KEY"
```

```json theme={null}
{
  "success": true,
  "data": {
    "id": "device_abc123",
    "state": { "status": "charging", "currentPower": 11, "powerRateLimit": 11 },
    "settings": {
      "max_charge_rate": { "value": 11, "unit": "kw", "min": 0, "max": 50, "step": 0.1 },
      "max_charge_current": { "value": 32, "unit": "amps", "min": 6, "max": 32, "step": 1 }
    }
  }
}
```

If `settings.max_charge_rate` is missing, the charger doesn't expose a power cap in kW. Stay inside its `min` and `max`, on a multiple of `step`.

## 2. Write the setting

Send only the settings you want to change.

```bash theme={null}
curl -X POST https://api.amps.ai/ev-charger/device_abc123/settings \
  -H "x-api-key: $AMPS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "max_charge_rate": { "value": 7.4, "unit": "kw" } }'
```

```json theme={null}
{
  "success": true,
  "data": {
    "deviceId": "device_abc123",
    "updated": ["max_charge_rate"]
  }
}
```

Settings return `200`, not `202`, and don't create an action. A value outside the bounds or off the `step` grid returns `422 SETTING_OUT_OF_RANGE`. `max_charge_rate` and `max_charge_current` are the same cap in two units: send one, or you get `422 UNSUPPORTED_SETTING_COMBINATION`.

## 3. Confirm

Read the device again: `settings.max_charge_rate.value` shows `7.4`. See [Pull](/guides/pull) for how fresh a read is.

To cap a single session instead, send `power` or `current` on the `charge` command. See [Start and stop a session](/cookbooks/ev-charger/start-stop-session).

## Cap for a grid event, then restore

A grid operator may require a lower limit for a few hours, such as 4.2 kW. Amps keeps no record of the previous value, so save `settings.max_charge_rate.value` before you write the cap, and write it back when the event ends.

```bash theme={null}
# Event starts: you saved 11 from the read in step 1
curl -X POST https://api.amps.ai/ev-charger/device_abc123/settings \
  -H "x-api-key: $AMPS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "max_charge_rate": { "value": 4.2, "unit": "kw" } }'

# Event ends: restore the saved value
curl -X POST https://api.amps.ai/ev-charger/device_abc123/settings \
  -H "x-api-key: $AMPS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "max_charge_rate": { "value": 11, "unit": "kw" } }'
```

The cap also applies to sessions that start during the event. Some cars only slow down after a pause in the session, so if the limit is a hard obligation, push `idle` for the event instead. The restore overwrites any change someone else made meanwhile: read the device first if that matters.

## Next steps

<CardGroup cols={2}>
  <Card title="Start and stop a session" icon="plug" href="/cookbooks/ev-charger/start-stop-session">
    Charge now, pause, or charge inside a time window.
  </Card>

  <Card title="Settings" icon="sliders" href="/guides/capabilities/settings">
    Every setting code and how writes work.
  </Card>
</CardGroup>


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