Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JReyna217/AutoLog/llms.txt

Use this file to discover all available pages before exploring further.

The Exchange Rates API manages the user’s catalog of USD/MXN conversion rates stored in AutoLog. Because fuel prices in border regions of Mexico are frequently quoted in US dollars, AutoLog needs an accurate exchange rate for each fill-up date to normalise costs to MXN. Users can manually maintain this catalog or pre-fill it using the live DOF lookup endpoint (GET /api/externalrates/dof/{date}). All five endpoints require a valid Authorization: Bearer token.
Use GET /api/externalrates/dof/{date} to fetch the official Banco de México rate published in the DOF, then create a record here with POST /api/exchangerates to persist it for future fuel log entries.

GET /api/exchangerates

GET /api/exchangerates Returns every exchange rate record in the user’s catalog, ordered by date. An empty array is returned if no rates have been saved yet.

Auth

Authorization: Bearer <accessToken> — required.

Response fields

Returns an array of exchange rate objects. Each object contains:
id
integer
Unique identifier of the exchange rate record.
date
string (DateOnly, YYYY-MM-DD)
The calendar date this rate applies to. Example: "2024-06-15".
usdToMxnRate
number (decimal)
The USD-to-MXN conversion rate for that date. Example: 17.35.

Response codes

CodeMeaning
200 OKArray of exchange rates returned (may be empty).
401 UnauthorizedMissing or invalid Bearer token.

Example

curl -X GET https://api.autolog.app/api/exchangerates \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
[
  {
    "id": 3,
    "date": "2024-06-15",
    "usdToMxnRate": 17.35
  },
  {
    "id": 4,
    "date": "2024-06-16",
    "usdToMxnRate": 17.42
  }
]

GET /api/exchangerates/date/

GET /api/exchangerates/date/{date} Returns the exchange rate record that matches a specific calendar date. Use this before creating a fuel log to retrieve the correct rate for the fill-up date.

Auth

Authorization: Bearer <accessToken> — required.

Path parameters

date
string (DateOnly, YYYY-MM-DD)
required
The date to look up, formatted as YYYY-MM-DD. Example: 2024-06-15.

Response fields

id
integer
Unique identifier of the exchange rate record.
date
string (DateOnly, YYYY-MM-DD)
The date this rate applies to.
usdToMxnRate
number (decimal)
The USD-to-MXN rate for that date.

Response codes

CodeMeaning
200 OKExchange rate record found and returned.
401 UnauthorizedMissing or invalid Bearer token.
404 Not FoundNo exchange rate is stored for the specified date.

Example

curl -X GET https://api.autolog.app/api/exchangerates/date/2024-06-15 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
{
  "id": 3,
  "date": "2024-06-15",
  "usdToMxnRate": 17.35
}

POST /api/exchangerates

POST /api/exchangerates Saves a new exchange rate entry for a specific date. Returns 201 Created with the persisted record. Dates must be unique — attempting to create a duplicate date will return 400.

Auth

Authorization: Bearer <accessToken> — required.

Request body

date
string (DateOnly, YYYY-MM-DD)
required
The calendar date this rate applies to. Format: YYYY-MM-DD. Example: "2024-06-15".
usdToMxnRate
number (decimal)
required
The USD-to-MXN conversion rate. Must be between 0.01 and 100.00.

Response fields

id
integer
Server-assigned unique identifier for the new record.
date
string (DateOnly, YYYY-MM-DD)
The date this rate was saved for.
usdToMxnRate
number (decimal)
The stored USD-to-MXN conversion rate.

Response codes

CodeMeaning
201 CreatedExchange rate record created. Response body contains the new object.
400 Bad RequestMissing fields, rate out of range (0.01–100.00), or duplicate date.
401 UnauthorizedMissing or invalid Bearer token.

Example

curl -X POST https://api.autolog.app/api/exchangerates \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "date": "2024-06-15",
    "usdToMxnRate": 17.35
  }'
{
  "id": 3,
  "date": "2024-06-15",
  "usdToMxnRate": 17.35
}

PUT /api/exchangerates/

PUT /api/exchangerates/{id} Updates an existing exchange rate record. Both the date and the rate value can be changed. Returns 204 No Content on success.

Auth

Authorization: Bearer <accessToken> — required.

Path parameters

id
integer
required
The unique identifier of the exchange rate record to update.

Request body

date
string (DateOnly, YYYY-MM-DD)
required
The updated calendar date. Format: YYYY-MM-DD.
usdToMxnRate
number (decimal)
required
The updated USD-to-MXN conversion rate. Must be between 0.01 and 100.00.

Response codes

CodeMeaning
204 No ContentExchange rate updated. No body returned.
400 Bad RequestMissing fields or rate out of allowed range.
401 UnauthorizedMissing or invalid Bearer token.
404 Not FoundNo exchange rate record with that ID exists.

Example

curl -X PUT https://api.autolog.app/api/exchangerates/3 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "date": "2024-06-15",
    "usdToMxnRate": 17.41
  }'

DELETE /api/exchangerates/

DELETE /api/exchangerates/{id} Permanently removes an exchange rate record from the catalog. Fuel log entries that previously used this rate retain their already-normalised MXN values and are not affected.

Auth

Authorization: Bearer <accessToken> — required.

Path parameters

id
integer
required
The unique identifier of the exchange rate record to delete.

Response codes

CodeMeaning
204 No ContentExchange rate record deleted. No body returned.
401 UnauthorizedMissing or invalid Bearer token.
404 Not FoundNo exchange rate record with that ID exists.

Example

curl -X DELETE https://api.autolog.app/api/exchangerates/3 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Build docs developers (and LLMs) love