---
title: "[beta] Create an electric purchase transaction."
method: POST
path: "/electric-purchase"
tags: ["Beta APIs"]
---

# \[beta\] Create an electric purchase transaction.

`POST /electric-purchase`

## Request

- Base URL: `https://api.samsara.com`
- URL: `https://api.samsara.com/electric-purchase`
- Auth: HTTP bearer

Create an electric charging purchase transaction, measured in kilowatt hours.

 <b>Rate limit:</b> 100 requests/min (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).

To use this endpoint, select **Write Fuel Purchase** under the Fuel & Energy category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
 

 **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

## Request body

- FuelPurchasePostElectricPurchaseRequestBody: Request payload for creating a new electric charging purchase transaction.
  - `discount` PostElectricPurchaseRequestBodyDiscountRequestBody: The amount of money discounted from the gross price of the charging transaction in the currency of the country where the transaction occurred.
    - `amount` string, required: The money amount.
    - `currency` 'usd' | 'gbp' | 'cad' | 'eur' | 'chf' | 'mxn', required: The currency of money. This is a 3-letter ISO 4217 currency code. Valid values: `usd`, `gbp`, `cad`, `eur`, `chf`, `mxn`
  - `driverId` string: Samsara ID of the driver.
  - `energyKilowattHours` string, required: The amount of energy delivered in kilowatt hours, as a decimal string greater than 0.
  - `merchantName` string: Name of the charging network or operator. For example: ChargePoint, Electrify America.
  - `source` string: The integration provider. For example: Customer, ChargePoint Integration
  - `transactionLocation` string, required: The full street address of the charger, as it might be recognized by Google Maps (example: 1 De Haro St, San Francisco, CA 94107, United States). Alternatively, exact latitude/longitude can be provided (example: 40.748441, -73.985664).
  - `transactionPrice` PostElectricPurchaseRequestBodyPriceRequestBody, required: The gross price of the charging transaction in the currency of the country where the transaction occurred.
    - `amount` string, required: The money amount.
    - `currency` 'usd' | 'gbp' | 'cad' | 'eur' | 'chf' | 'mxn', required: The currency of money. This is a 3-letter ISO 4217 currency code. Valid values: `usd`, `gbp`, `cad`, `eur`, `chf`, `mxn`
  - `transactionReference` string, required: The charging transaction reference. This is the transaction identifier, such as the receipt or charging session number.
  - `transactionTime` string, required: The time of the charging transaction in RFC 3339 format. Timezone must be specified. For example, 2022-07-13T14:20:50.52-07:00 is a time in Pacific Daylight Time.
  - `vehicleId` string: Samsara ID of the vehicle that was charged.

## Response `200`

OK response.

- FuelPurchasePostElectricPurchaseResponseBody
  - `data` PostElectricPurchaseResponseBodyResponseBody, required: The electric charging purchase transaction that was created.
    - `discount` PostElectricPurchaseResponseBodyDiscountResponseBody: The amount of money discounted from the gross price of the charging transaction.
      - `amount` string, required: The money amount.
      - `currency` 'usd' | 'gbp' | 'cad' | 'eur' | 'chf' | 'mxn', required: The currency of money. This is a 3-letter ISO 4217 currency code. Valid values: `usd`, `gbp`, `cad`, `eur`, `chf`, `mxn`
    - `driverId` string: Samsara ID of the driver.
    - `energyKilowattHours` string, required: The amount of energy delivered in kilowatt hours.
    - `id` string, required: Unique identifier for the electric purchase.
    - `merchantName` string: Name of the charging network or operator.
    - `source` string: The integration provider.
    - `transactionLocation` string, required: The street address or latitude/longitude of the charger.
    - `transactionPrice` PostElectricPurchaseResponseBodyPriceResponseBody, required: The gross price of the charging transaction.
      - `amount` string, required: The money amount.
      - `currency` 'usd' | 'gbp' | 'cad' | 'eur' | 'chf' | 'mxn', required: The currency of money. This is a 3-letter ISO 4217 currency code. Valid values: `usd`, `gbp`, `cad`, `eur`, `chf`, `mxn`
    - `transactionReference` string, required: The charging transaction reference.
    - `transactionTime` string, required: The time of the charging transaction in RFC 3339 format.
    - `vehicleId` string: Samsara ID of the vehicle that was charged.

## Other responses

- `401`: Unauthorized response.
- `404`: Not Found response.
- `405`: Method Not Allowed response.
- `409`: Conflict response.
- `413`: Content Too Large response.
- `429`: Too Many Requests response.
- `500`: Internal Server Error response.
- `501`: Not Implemented response.
- `502`: Bad Gateway response.
- `503`: Service Unavailable response.
- `504`: Gateway Timeout response.
- `default`: Bad Request response.

---

[API](https://skmtc.dev/samsara/apis/samsara-api.md) - [All operations](https://skmtc.dev/samsara/apis/samsara-api/llms.txt) - [OpenAPI document](https://skmtc.dev/samsara/apis/samsara-api/revisions/a9e35d4999be?raw)
