Create my private car
Registers a new private car owned by the caller and returns it.
Adds a car the caller can use on their own mileage registrations. The server fixes everything except the name, plate and default flag: type Private, owner = the caller, the caller's legal entity, active, the legal entity's default mileage rate for private cars, and "employee may change the rate" off. A car for another employee or a company car cannot be created through the API (use the TimeLog car administration page). Plates are not checked for duplicates.
Use it to:
- Self-service: an employee adds their own car from a mobile mileage app
Not for:
- Creating company cars or cars for other employees
Behaviour:
- Not idempotent.
- Not safe to retry blindly. Each call creates another car (new GUID, no duplicate check). After a lost response, check
GET /v1/carbefore retrying. - Duplicates: Not deduplicated (no unique constraint on name or plate).
- Side effect: Inserts the car and raises CarCreated.
- Side effect: IsDefault true: the caller's default-car user setting now points to the new car.
- Changes are visible to the next read immediately.
Next: POST /v1/mileage-registration
See also: GET /v1/car, GET /v1/mileage-rate
Not yet documented: examples.
curl -X POST "https://app3.timelog.com/your-account/api/v1/car" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"Name": "John Doe",
"LicensePlate": "example_string",
"IsDefault": true
}'
import requests
import json
url = "https://app3.timelog.com/your-account/api/v1/car"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"Name": "John Doe",
"LicensePlate": "example_string",
"IsDefault": true
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://app3.timelog.com/your-account/api/v1/car", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"Name": "John Doe",
"LicensePlate": "example_string",
"IsDefault": true
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"Name": "John Doe",
"LicensePlate": "example_string",
"IsDefault": true
}`)
req, err := http.NewRequest("POST", "https://app3.timelog.com/your-account/api/v1/car", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://app3.timelog.com/your-account/api/v1/car')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"Name": "John Doe",
"LicensePlate": "example_string",
"IsDefault": true
}'
response = http.request(request)
puts response.body
{
"Properties": {
"CarID": 123,
"ID": "123e4567-e89b-12d3-a456-426614174000",
"Name": "John Doe",
"LicensePlate": "example_string",
"CarType": 42,
"EmployeeUserID": "null",
"EmployeeUser": {
"UserID": 123,
"ID": "123e4567-e89b-12d3-a456-426614174000",
"FirstName": "John Doe",
"LastName": "John Doe",
"Initials": "example_string",
"IsActive": true,
"UserType": "Employee",
"LegalEntityID": 123,
"Email": "user@example.com"
},
"IsActive": true,
"DefaultMileageRate": {
"ID": "123e4567-e89b-12d3-a456-426614174000",
"MileageRateID": 123,
"Name": "John Doe",
"IsActive": true,
"SalaryCodeTaxFree": "null",
"SalaryCodeTaxable": "null",
"AccountNumber": "null",
"IsDefaultForPrivateCar": true,
"HasReimbursement": true,
"UnitType": 42,
"ReimbursementCurrencyID": 123,
"LegalEntityID": 123
},
"IsDefault": true,
"AllowEmployeeChangeMileageRate": true
},
"Links": [
{
"Href": "example_string",
"Rel": "example_string"
}
],
"Actions": [
{}
]
}
{
"Code": 200,
"Details": [
"'Name' must not be empty.",
"'License Plate' must not be empty."
],
"Message": "Invalid model state error.",
"Parameters": "model: {"Name":null,"LicensePlate":null,"IsDefault":false}",
"Url": "https://app{server-number}.timelog.com/{account}/api/v1/car"
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
{
"error": "Internal Server Error",
"message": "An unexpected error occurred on the server",
"code": 500,
"requestId": "req_1234567890"
}
/v1/car
Target server for requests. Edit to use your own host.
OAuth 2.0 bearer token, sent as Authorization: Bearer <token>. JWT and reference tokens are both accepted. The token must carry the required scope (default tlp).
The token's sub claim is the acting user. A token WITHOUT sub (client-credentials) acts as the system service user. If the sub user cannot log in (inactive, locked, deleted), the request is rejected with 401 — it is no longer let through without a user.
> Not yet documented: how to obtain a token.
> Not yet documented: token lifetime.
Authorization: Bearer <token>. JWT and reference tokens are both accepted. The token must carry the required scope (default tlp).
The token's sub claim is the acting user. A token WITHOUT sub (client-credentials) acts as the system service user. If the sub user cannot log in (inactive, locked, deleted), the request is rejected with 401 — it is no longer let through without a user.
> Not yet documented: how to obtain a token.
> Not yet documented: token lifetime.The media type of the request body
Display name of the car. Can be set on create only. - Missing, null or empty — 400 Code 200 "'Name' must not be empty." (captured). > Not yet documented: behaviour.
Registration plate. Free text; duplicates are not checked. Can be set on create only. Contains personal data. - Missing, null or empty — 400 Code 200 "'License Plate' must not be empty." (captured).
true = make the new car the caller's default car (preselected on new mileage registrations). Can be set on create only. - true — The caller's default-car user setting is set to the new car. - false or omitted — The caller's existing default car is kept (it is cleared only if the caller had none).
Request Preview
Response
Response will appear here after sending the request
Authentication
Bearer token. OAuth 2.0 bearer token, sent as Authorization: Bearer <token>. JWT and reference tokens are both accepted. The token must carry the required scope (default tlp).
The token's sub claim is the acting user. A token WITHOUT sub (client-credentials) acts as the system service user. If the sub user cannot log in (inactive, locked, deleted), the request is rejected with 401 — it is no longer let through without a user.
Not yet documented: how to obtain a token.
Not yet documented: token lifetime.
Body
Display name of the car.
Can be set on create only.
- Missing, null or empty — 400 Code 200 "'Name' must not be empty." (captured).
Not yet documented: behaviour.
Registration plate. Free text; duplicates are not checked.
Can be set on create only.
Contains personal data.
- Missing, null or empty — 400 Code 200 "'License Plate' must not be empty." (captured).
true = make the new car the caller's default car (preselected on new mileage registrations).
Can be set on create only.
-
true — The caller's default-car user setting is set to the new car.
-
false or omitted — The caller's existing default car is kept (it is cleared only if the caller had none).
Responses
A car that mileage registrations are driven in. Two kinds exist (CarType): a COMPANY car (1) has no owner and can be picked by every employee of its legal entity; a PRIVATE car (2) belongs to exactly one employee (EmployeeUserID) and only that employee may register mileage with it. Each car belongs to one legal entity and carries a default mileage rate (the rate preselected on a mileage registration). The registration plate and the owner make a private car personal data.