{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Token Authentication","description":"The best API documentation generator ever.","siteUrl":"https://developer-portal-starter.redoc.ly","keywords":"redocly developer portal, api portal starter, api reference docs","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"token-authentication","__idx":0},"children":["Token Authentication"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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 ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Authorization"]}," header when making further requests."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You need a Lytx account with a username and password to get a bearer token."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning","name":"SSO or MFA"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This authentication method will not work for companies with SSO or MFA configured. For these use cases, use ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/authentication_advanced"},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Advanced Authentication"]}]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["To receive an authentication token:"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Send the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST https://login.lytx.com/api/auth/user"]}," request with the following structure:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sh","header":{"controls":{"copy":{}}},"source":"curl --location 'https://login.lytx.com/api/auth/user' \\\n--header 'Content-Type: application/json' \\\n--data '{\n    \"username\": \"YOUR_USERNAME_HERE\",\n    \"password\": \"YOUR_PASSWORD_HERE\"\n}'\n","lang":"sh"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the request body, enter the Lytx username and password."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An authentication token is returned. This is the authentication token you will use for subsequent requests."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The returned token is valid for 1 hour."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In any subsequent request, include the authorization header, using the following structure:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"--header 'Authorization: Bearer ImahFWLZWFdD8VVcUtIED2YuOjPFlZpldQTE5tUqKdv'\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following is an example of the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET https://api.lytx.com/v0/vehicles/all"]}," request, with the token in the header."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sh","header":{"controls":{"copy":{}}},"source":"curl -i -X GET \\\n  'https://api.lytx.com/v0/vehicles/all?groupId=string&name=string&limit=100&page=1&includeSubgroups=true' \\\n  --header 'Authorization: Bearer YOUR_TOKEN_HERE'\n","lang":"sh"},"children":[]}]},"headings":[{"value":"Token Authentication","id":"token-authentication","depth":1}],"frontmatter":{"seo":{"title":"Token Authentication"}},"lastModified":"2026-04-23T11:52:44.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/authentication_token","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}