SettingsCreate my private car

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/car before 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
}'
{
  "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": [
    {}
  ]
}
POST
/v1/car
POST
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token
Bearer Tokenstring
Required

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.

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.
Content-Typestring
Required

The media type of the request body

Options: application/json
Namestring

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.

Min length: 1 • Max length: 255
LicensePlatestring

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).

Min length: 1 • Max length: 255
IsDefaultboolean

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

header
Authorizationstring
Required

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

application/json
Namestring

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.

LicensePlatestring

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).
IsDefaultboolean

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

Propertiesobject

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.

Linksarray
Actionsobject[]