---
title: "Create Charging Entry"
method: POST
path: "/charging_entries"
tags: ["Charging Entries"]
---

# Create Charging Entry

`POST /charging_entries`

## Request

- Base URL: `https://secure.fleetio.com/api`
- URL: `https://secure.fleetio.com/api/charging_entries`
- Auth: API key in header `Authorization` and API key in header `Account-Token`
- TypeScript: <https://skmtc.dev/fleetio/apis/fleetio-developer-api/docs/charging_entries/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a new Charging Entry

## Request body

- object
  - `additional_fees_cents` integer: The amount, in cents, of any fees applied to the Charging Entry.
  - `approved_at` string, date-time: The time a Charging Entry was approved.
  - `approved_by_id` integer: The ID associated with the User who approved this Charging Entry.
  - `custom_fields` CustomFields, nullable: *Full details on working with Custom Fields [here](/docs/overview/custom-fields).
  - `discount_cents` integer: The amount, in cents, of any discounts applied to the Charging Entry, must be a negative number.
  - `documents_attributes` object[]: An array of one or more document objects to add to the record. Follow our [Attaching Documents and Images](/docs/overview/attaching-documents-and-images) guide to upload to our third party storage provider in order to obtain `file_url`.
    - `name` string: The name to give the file which will be shown in the UI.
    - `file_url` string: The URL obtained from our storage provider that points to the file.
    - `file_mime_type` string: The MIME type of the file. For example, `application/pdf`.
    - `file_name` string: The name of the file.
    - `file_size` integer: The size of the file in bytes.
  - `duration_seconds` integer: The duration, in seconds, between the Charging Entry start and end events. If started_at and ended_at are provided, it will automatically calculate the duration_seconds using those attributes.
  - `ended_at` string, date-time: The date and time at which the Charging Entry ended.
  - `geolocation` Geolocation, nullable
    - `gps_device` string, nullable
    - `original_vendor` string, nullable
    - `exception_distance_in_mi` number, nullable
    - `exception_distance_in_km` number, nullable
  - `images_attributes` object[]: An array of one or more image objects to add to the record. Follow our [Attaching Documents and Images](/docs/overview/attaching-documents-and-images) guide to upload to our third party storage provider in order to obtain `file_url`.
    - `name` string: The name to give the image which will be shown in the UI.
    - `file_url` string: The URL obtained from our storage provider that points to the image.
    - `file_mime_type` string: The MIME type of the image. For example, `image/png`.
    - `file_name` string: The name of the image.
    - `file_size` integer: The size of the image file in bytes.
  - `meter_entry_attributes` object: Each Charging Entry can have an associated [Meter Entry](/docs/api/meter-entries)
    - `value` number, float: The value is the actual number on the meter that increments over time. The unit is determined by the [configured `meter_unit`](https://help.fleetio.com/s/article/Fuel-Settings#vehicle-settings) on the associated Vehicle.
    - `void` boolean: If you attempt to save a meter value, which is too high or too low, Fleetio's validation rules will reject it. If you need to bypass this validation, you may [mark an entry as void](https://help.fleetio.com/s/article/Meter-Entry-Mark-As-Void-Unmark-As-Void).
  - `personal` boolean: Indicates whether this Charging Entry was for personal use. This field is `false` if not provided.
  - `price_per_kwh_cents` number, float: The unit price per kilowatt hour for the Charging Entry.
  - `reference` string: A reference number or identifier for this Charging Entry. This field is often used to store a receipt number or other unique identifier.
  - `started_at` string, date-time, required: We recommend using [ISO-8601](/docs/overview/date-formatting) formatted dates to avoid ambiguity.
  - `status` 'in_progress' | 'target_reached' | 'ready_for_review' | 'manually_completed' | 'approved' | 'auto_approved' | 'unknown': The status of the Charging Entry. This field is "manually_completed" if not provided.
  - `total_amount_cents` integer: The total cost, in cents, of the Charging Entry.
  - `total_kwh` number, float: The total kilowatt hours of the Charging Entry.
  - `vehicle_id` integer, required
  - `vendor_id` integer: The Fleetio `id` of the [Vendor](/docs/api/vendors) associated with this Charging Entry.

## Response `201`

OK

- ChargingEntry: A Charging Entry
  - `additional_fees_cents` integer, nullable, required: The amount, in cents, of any fees applied to the Charging Entry.
  - `approved_at` string, date-time, nullable, required: The time a Charging Entry was approved.
  - `approved_by_id` integer, nullable, required: The ID associated with the User who approved this Charging Entry.
  - `cost_per_hr` string, nullable, required: The automatically calculated cost per hour since the last Charging Entry.
  - `cost_per_km` string, nullable, required: The automatically calculated cost per kilometer since the last Charging Entry.
  - `cost_per_mi` string, nullable, required: The automatically calculated cost per mile since the last Charging Entry.
  - `discount_cents` integer, nullable, required: The amount, in cents, of any discounts applied to the Charging Entry, must be a negative number.
  - `duration_seconds` integer, required: The duration, in seconds, between the Charging Entry start and end events. If started_at and ended_at are provided, it will automatically calculate the duration_seconds using those attributes.
  - `ended_at` string, date-time, nullable, required: The date and time at which the Charging Entry ended.
  - `geolocation` Geolocation, nullable, required
    - `gps_device` string, nullable
    - `original_vendor` string, nullable
    - `exception_distance_in_mi` number, nullable
    - `exception_distance_in_km` number, nullable
  - `km_per_kwh` string, required: The automatically calculated kilometers per kilowatt hour since the last Charging Entry.
  - `mi_per_kwh` string, required: The automatically calculated miles per kilowatt hour since the last Charging Entry.
  - `personal` boolean, required: Indicates whether this Charging Entry was for personal use. This field is `false` if not provided.
  - `price_per_kwh_cents` string, nullable, required: The unit price per kilowatt hour for the Charging Entry.
  - `reference` string, nullable, required: Optional data field for collecting information such as the invoice number, transaction id, or receipt number, for example.
  - `started_at` string, date-time, required: The date and time at which this Charging Entry started.
  - `status` 'in_progress' | 'target_reached' | 'ready_for_review' | 'manually_completed' | 'approved' | 'auto_approved' | 'unknown', required: The status of the Charging Entry. This field is "manually_completed" if not provided.
  - `total_amount_cents` integer, nullable, required: The total cost, in cents, of the Charging Entry.
  - `total_kwh` string, required: The total kilowatt hours of the Charging Entry.
  - `usage_in_hr` string, nullable, required: The automatically calculated usage in hours since the most recent Charging Entry.
  - `usage_in_km` string, nullable, required: The automatically calculated usage in kilometers since the most recent Charging Entry.
  - `usage_in_mi` string, nullable, required: The automatically calculated usage in miles since the most recent Charging Entry.
  - `vehicle_id` integer, required: The Fleetio `id` of the [Vehicle](/docs/api/vehicles) associated with this Charging Entry.
  - `vendor_id` integer, nullable, required: The Fleetio `id` of the [Vendor](/docs/api/vendors) associated with this Charging Entry.
  - `comments_count` integer, required: The number of comments on this Charging Entry.
  - `documents_count` integer, required: The number of documents added to this Charging Entry.
  - `images_count` integer, required: The number of images added to this Charging Entry.
  - `comments` Comment[]: Comments associated with this Charging Entry.
    - `id` integer, required
    - `created_at` string, date-time: The date and time at which this record was created.
    - `updated_at` string, date-time: The date and time at which this record was most recently updated.
    - `commentable_type` 'Contact' | 'FleetcorCard' | 'FuelEntry' | 'InventoryJournalEntry' | 'Issue' | 'Part' | 'PurchaseOrder' | 'ServiceEntry' | 'ServiceReminder' | 'SubmittedInspectionItem' | 'Vehicle' | 'VehicleAssignment' | 'Vendor' | 'WexCard' | 'WorkOrder', required: The type of record that the Comment will be left on. Must be associated with a matching `commentable_id`.
    - `commentable_id` integer, required
    - `user_id` integer, required
    - `title` string: The title of the Comment.
    - `comment` string, required: The content of the Comment message body.
    - `user_full_name` string, required: The full name of the `User` who created the Comment.
    - `user_image_url` string, nullable, required: The image url for the `User` who created the Comment.
    - `rich_content` object, nullable, required
    - `html_content` string, nullable, required: The comment message body rendered as HTML.
    - `with_mentions` boolean, required: Indicates if the message body contains @mentions.
  - `documents` Document[]: Documents associated with this Charging Entry.
    - `id` integer, required
    - `created_at` string, date-time: The date and time at which this record was created.
    - `updated_at` string, date-time: The date and time at which this record was most recently updated.
    - `name` string, required: The name of the document.
    - `description` string, required: The description of the document.
    - `documentable_id` integer, required
    - `documentable_type` 'ServiceEntry' | 'FuelEntry' | 'Issue' | 'WorkOrder' | 'ExpenseEntry' | 'Vehicle', required
    - `file_name` string, required: The name of the file.
    - `file_mime_type` string, required: The MIME type of the file.
    - `file_size` number, required: The size of the file in bytes.
    - `file_url` string, required: The URL to access the file.
    - `full_file_url` string, required: The full URL to access the file, including any necessary authentication or parameters.
  - `images` Image[]: Images associated with this Charging Entry.
    - `id` integer, required
    - `created_at` string, date-time: The date and time at which this record was created.
    - `updated_at` string, date-time: The date and time at which this record was most recently updated.
    - `name` string, nullable, required: The name of the document.
    - `description` string, nullable, required: The description of the document.
    - `imageable_id` integer, required
    - `imageable_type` 'ExpenseEntry' | 'WorkOrder' | 'Equipment' | 'IssueResolution' | 'ServiceEntry' | 'Vendor' | 'ServiceProgram' | 'Issue' | 'Contact' | 'Part' | 'Vehicle' | 'FuelEntry' | 'SubmittedInspectionItem', required
    - `file_name` string, required: The name of the image.
    - `file_mime_type` string, required: The MIME type of the image.
    - `file_size` number, required: The size of the image file in bytes.
    - `file_url` string, required: The URL to access the image.
    - `full_url` string, required: The full URL to access the image, including any necessary authentication or parameters.

## Other responses

- `400`: The format or parameters of the request was invalid
- `401`: Request could not be authenticated
- `403`: Insufficient permission to perform this operation
- `422`: Unprocessable Entity
- `500`: Something unexpected happened

---

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