Token Authentication
Lytx APIs use bearer authentication (also known as token authentication). When a user authenticates in order to access the Lytx API, the authentication server generates the bearer token. This token should then be used in the Authorization header when making further requests.
You need a Lytx account with a username and password to get a bearer token.
SSO or MFA
This authentication method will not work for companies with SSO or MFA configured. For these use cases, use Advanced Authentication.
To receive an authentication token:
Send thePOST https://login.lytx.com/api/auth/user
request with the following structure:curl --location 'https://login.lytx.com/api/auth/user' \
--header 'Content-Type: application/json' \
--data '{
"username": "YOUR_USERNAME_HERE",
"password": "YOUR_PASSWORD_HERE"
}'
In the request body, enter the Lytx username and password.
An authentication token is returned. This is the authentication token you will use for subsequent requests.
Note
The returned token is valid for 1 hour.
In any subsequent request, include the authorization header, using the following structure:
--header 'Authorization: Bearer ImahFWLZWFdD8VVcUtIED2YuOjPFlZpldQTE5tUqKdv'
GET https://api.lytx.com/v0/vehicles/all
request, with the token in the header.curl -i -X GET \
'https://api.lytx.com/v0/vehicles/all?groupId=string&name=string&limit=100&page=1&includeSubgroups=true' \
--header 'Authorization: Bearer YOUR_TOKEN_HERE'