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

# Mileage expenses (standard format)

🚗

Alrighty, to create our first mileage for the user we need to check which mileage categories are available, make a call to this [endpoint](/reference/getorganizationcategories) with `expense type: CarSpecification`.

<Frame>
  <img src="https://mintcdn.com/findity-docs/fTsgC-3N_Y6D9oSZ/images/docs/7d044cbf78638c117b28a113e5603e0af6948a9aa9a5a8c6da98e38639777600-Get_mileage_categoies.png?fit=max&auto=format&n=fTsgC-3N_Y6D9oSZ&q=85&s=ce756e35b213c9ce53202a5a675106b2" align="center" width="1662" height="1546" data-path="images/docs/7d044cbf78638c117b28a113e5603e0af6948a9aa9a5a8c6da98e38639777600-Get_mileage_categoies.png" />
</Frame>

Get the `id` of the category and head over to this [endpoint](/reference/getorganizationcartypes) to see which vehicle types are available for that category. Since we can have different reimbursement configurations on vehicle type, we need this when creating the mileage.

<Frame>
  <img src="https://mintcdn.com/findity-docs/fTsgC-3N_Y6D9oSZ/images/docs/0aacbf0de32e3cf80257cc2b3c6c0b07cb39aaaca000353024f5f109367f2d61-Get_vehicle_types_from_mileage_category.png?fit=max&auto=format&n=fTsgC-3N_Y6D9oSZ&q=85&s=320b49151a05e4bac8e164ef57286bfd" width="650px" align="center" data-path="images/docs/0aacbf0de32e3cf80257cc2b3c6c0b07cb39aaaca000353024f5f109367f2d61-Get_vehicle_types_from_mileage_category.png" />
</Frame>

Get the `id`.

Now we are ready to create the mileage, we are going to use this [endpoint](/reference/createexpense) for that.

You need to provide at least this data:

* [ ] organizationId
* [ ] categoryId
* [ ] verification/type
* [ ] verification/description - Always good to explain why this trip was made
* [ ] verification/travelDate - And of course when it was made
* [ ] verification/distance - Without this we can't calculate the reimbursement amount
* [ ] verification/carType - Same as above
* [ ] route - Where did the trip start and where did it end? Will generate a map with the route. See this [article](/docs/mileage-route) for more info.

<Frame>
  <img src="https://mintcdn.com/findity-docs/fTsgC-3N_Y6D9oSZ/images/docs/5c89711326f0cb647c53b07152602015af2d41e2391761852e6432dd85273537-mileage_create_new_with_standard_format.png?fit=max&auto=format&n=fTsgC-3N_Y6D9oSZ&q=85&s=3c8a3452692b74373839f905a81cc933" width="600px" align="center" data-path="images/docs/5c89711326f0cb647c53b07152602015af2d41e2391761852e6432dd85273537-mileage_create_new_with_standard_format.png" />
</Frame>

Hopefully, you will get a `201` response and a payload of the created mileage. This means that this mileage expense is visible to the user.

<Frame caption="This is how it appears in the Findity app">
  <img src="https://mintcdn.com/findity-docs/fTsgC-3N_Y6D9oSZ/images/docs/4088958209a58e8361205345981f75bd23c46f43075e9bd44fc2c386099390b8-Mileage_in_picard_app.jpg?fit=max&auto=format&n=fTsgC-3N_Y6D9oSZ&q=85&s=0d302c6919820bd36fbff10b101f17fa" alt="This is how it appears in the Findity app" width="350px" align="center" data-path="images/docs/4088958209a58e8361205345981f75bd23c46f43075e9bd44fc2c386099390b8-Mileage_in_picard_app.jpg" />
</Frame>

## Things goes wrong

In this example below we have added a project dimension to the user's organization, and this field is set to mandatory on mileages. This results in a validation error that is sent back in the response.

<Frame caption="400 bad request">
  <img src="https://mintcdn.com/findity-docs/fTsgC-3N_Y6D9oSZ/images/docs/2e808412811ad5792723ba9c876210b222eae5f00aa46e3e78f570856d677521-Mileage_validation_error.png?fit=max&auto=format&n=fTsgC-3N_Y6D9oSZ&q=85&s=276e92144fd734fb2a220d1b018d3c4c" alt="400 bad request" width="500px" align="center" data-path="images/docs/2e808412811ad5792723ba9c876210b222eae5f00aa46e3e78f570856d677521-Mileage_validation_error.png" />
</Frame>

You can still save the mileage with the query parameter `forceSave:true`below is an example of how we give the choice to the user to save it anyway even though it gets a validation error and cannot be submitted until corrected.

<Frame>
  <img src="https://mintcdn.com/findity-docs/fTsgC-3N_Y6D9oSZ/images/docs/41d6e7b333cae1124dcaaa705d4e18a5fbd776271808f162e14f245138892284-Picard_Save_anyway.jpg?fit=max&auto=format&n=fTsgC-3N_Y6D9oSZ&q=85&s=f1171bbd34634d8eaf7fe02967f3caf9" width="350px" align="center" data-path="images/docs/41d6e7b333cae1124dcaaa705d4e18a5fbd776271808f162e14f245138892284-Picard_Save_anyway.jpg" />
</Frame>
