Authentication

This page explains how to authenticate with the Alvys Public API using the OAuth 2.0 Client Credentials flow.

๐Ÿ”„

Update (June 2025): A new token endpoint has been introduced to enhance security and scalability. While the authentication flow remains based on the Client Credentials model, tokens must now be requested from the updated URL.

The legacy /api/authentication/{tenant_id}/token based endpoint is deprecated and will be fully shut down on July 31, 2025.

By leveraging OAuth 2.0, developers can empower their applications to seamlessly interact with Alvys' API on behalf of their users. This guide outlines the authentication process and provides detailed instructions on obtaining access tokens through direct application integration.

๐Ÿ“˜

Getting API Access

  • Existing Alvys customers can obtain API access by contacting their account representative.
  • Independent Software Vendors (ISV) should contact the Alvys Partnership team.

๐Ÿ” Creating Client Application Credentials

Follow these steps to create your credentials in the Alvys Admin Portal:

  1. Navigate to Admin โ†’ API Access

  2. Click Create New Application

  3. Fill out the Name and Description

  4. Select your desired permissions (scopes)

  5. Set an optional expiration date for the credentials

  6. Click Generate

After creation, your Client ID and Client Secret will be shown, along with the scopes included for token generation. Customers can generate up to 10 sets of client credentials, but only newly generated ones can be edited.

โš ๏ธ

These values are sensitive and must be stored securelyโ€”avoid sharing them publicly or exposing them in front-end code.

These credentials are used to request an access token via the issue token endpoint.

Construct Authorization Request

Construct a URL with the following parameters in the request body:

  1. client_id: The unique identifier assigned to your application by Alvys.
  2. client_secret: The confidential token provided by Alvys upon application registration.
  3. audience: Must be "https://api.alvys.com/public/" .
  4. grant_type: The type of grant flow to use. Must beclient_credentials

๐Ÿ” New Token Endpoint

All new token requests must now use the following endpoint:

Token URL

https://auth.alvys.com/oauth/token

Request Body (JSON)

{
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET",
  "audience": "https://api.alvys.com/public/",
  "grant_type": "client_credentials"
}

โœ…

When including a "scope" field in the token request body, please note:

  • The returned token will always include all scopes that have been granted to your client application, regardless of what you specify in the scope field.
  • Therefore, including a scope field in the request does not override or limit the access defined by your assigned permissions in the issued token.
  • The only functional effect of providing a scope field is that the token request will fail (unauthorized) if you include any scope that has not been granted to your client.
  • If the scope field is omitted, the token will still include all scopes granted to your application.

Either format may be used (JSON or Form-Encoded) ; both will return the same token and enforce scopes identically.

Curl JSON Content-Type Example

curl --request POST \
     --url 'https://auth.alvys.com/oauth/token' \
     --header 'Content-Type: application/json' \
     --data '{
       "client_id": "YOUR_CLIENT_ID",
       "client_secret": "YOUR_CLIENT_SECRET",
       "audience": "https://api.alvys.com/public/",
       "grant_type": "client_credentials"
     }'

Curl Form-Encoded Format Example

curl --request POST \
     --url https://auth.alvys.com/oauth/token \
     --header 'Content-Type: application/x-www-form-urlencoded' \
     --data 'client_id=YOUR_CLIENT_ID' \
     --data 'client_secret=YOUR_CLIENT_SECRET' \
     --data 'audience=https://api.alvys.com/public/' \
     --data 'grant_type=client_credentials'

The token you receive will include a scope claim (e.g. "load:read trip:create"), and our Public API enforces those scopes on every request. Use the resulting access token in your API request headers:

Authorization: Bearer YOUR_ACCESS_TOKEN

The client_id and `client_secret are created in the Alvys Admin Portal under API Access.

Postman Token Request Example:

Each client credentialโ€™s token is restricted to the exact scopes you assign, ensuring it can only access those corresponding API endpoints.


๐Ÿšง

Note

While you can assigncreate, update, and delete scopes and your token will include them, the corresponding write endpoints are not yet available. At this time, the Public API only exposes read operationsโ€”those additional scopes are in place for seamless adoption once write functionality is release


๐Ÿ”’ Scope Claim

Important: Legacy tokens generated through the previous /api/authentication/{tenant_id}/token authentication flow do not include the scope claim. These tokens will temporarily remain valid and behave as if all read-only scopes are granted, but this is only supported during the transition period. All clients must migrate to the new flow by July 31, 2025 to avoid disruption.

New tokens now follow a fine-grained permissions model, ensuring each application only has access to the specific API features it was granted.

Example:

"scope": "load:read driver:create"

Scopes control access to API endpoints and must be selected when creating your application in the Admin Portal.

Available Scopes

EntityPermissionDescription
Customerscustomer:readView customer records
Customerscustomer:createAdd a customer
Customerscustomer:updateEdit customer details
Customerscustomer:deleteRemove a customer
Driversdriver:readView driver profiles
Driversdriver:createAdd new driver
Driversdriver:updateEdit driver info
Driversdriver:deleteRemove a driver
Fuelfuel:readView fuel records
Fuelfuel:createAdd fuel transaction
Fuelfuel:updateUpdate fuel entry
Fuelfuel:deleteDelete fuel record
Invoicesinvoice:readView invoices
Invoicesinvoice:createCreate invoice
Invoicesinvoice:updateEdit invoice
Invoicesinvoice:deleteDelete invoice
Loadsload:readRetrieve load info
Loadsload:createCreate a load
Loadsload:updateUpdate a load
Loadsload:deleteDelete a load
Maintenancemaintenance:readView maintenance data
Maintenancemaintenance:createLog maintenance event
Maintenancemaintenance:updateEdit maintenance record
Maintenancemaintenance:deleteRemove maintenance record
Tollstoll:readView toll data
Tollstoll:createLog toll
Tollstoll:updateUpdate toll entry
Tollstoll:deleteDelete toll entry
Trailerstrailer:readView trailer info
Trailerstrailer:createRegister trailer
Trailerstrailer:updateEdit trailer record
Trailerstrailer:deleteRemove trailer
Tripstrip:readView trip details
Tripstrip:createCreate trip
Tripstrip:updateUpdate trip
Tripstrip:deleteCancel/delete trip
Truckstruck:readView truck info
Truckstruck:createRegister truck
Truckstruck:updateUpdate truck record
Truckstruck:deleteRemove truck
Usersuser:readView users
Usersuser:createAdd new user
Usersuser:updateModify user
Usersuser:deleteRemove user
Visibilityvisibility:readAccess tracking data
Visibilityvisibility:createTrigger visibility update
Visibilityvisibility:updateModify visibility data
Visibilityvisibility:deleteRemove tracking entry
Dispatch Preferencesdispatch:readView dispatch rules
Dispatch Preferencesdispatch:updateUpdate dispatch preferences
Carrierscarrier:readView carrier profiles
Carrierscarrier:createAdd a new carrier
Carrierscarrier:updateUpdate carrier details
Carrierscarrier:deleteRemove a carrier from records

๐Ÿ›‘ Legacy Authentication (Deprecated)

This older flow will stop working on July 31, 2025.

Create Client Application

To begin, create a new application from the Alvys Admin page. This will allow you to generate a client_id and client_secret.

  • client_id: The unique identifier assigned to this application or caller.
  • client_secret: A confidential token also provided by Alvys upon application registration.

Construct Authorization Request

Construct a URL with the following parameters in the request body:

  1. client_id: The unique identifier assigned to your application by Alvys.
  2. client_secret: The confidential token provided by Alvys upon application registration.
  3. tenant_id: The tenant ID for which the client application was registered.
  4. grant_type: The type of grant flow to use. Must beclient_credentials

Old Token Endpoint

https://integrations.alvys.com/api/authentication/{TENANT_ID}/token

JSON Format Example

curl --request POST \
     --url 'https://integrations.alvys.com/api/authentication/{TENANT_ID}/token' \
     --header 'Content-Type: application/json' \
     --data '{
       "client_id": "YOUR_CLIENT_ID",
       "client_secret": "YOUR_CLIENT_SECRET",
       "grant_type": "client_credentials"
     }'

Form-Encoded Format Example

curl --request POST \
     --url 'https://integrations.alvys.com/api/authentication/{TENANT_ID}/token' \
     --header 'Content-Type: application/x-www-form-urlencoded' \
     --data 'grant_type=client_credentials' \
     --data 'client_id=YOUR_CLIENT_ID' \
     --data 'client_secret=YOUR_CLIENT_SECRET'

๐Ÿงช Troubleshooting

  • โœ… Double-check your client_id, client_secret, and audience
  • โœ… Ensure scopes are correctly assigned in API Access- Admin Portal
  • โœ… Validate that the client is active and not expired
  • โœ… Use only supported content types: application/json or application/x-www-form-urlencoded
  • For technical support: [email protected]