• Introduction
    • Getting Started
    • Authentication
    • Error Handling
    • Contact Support
    • Modaltrans API
      • Get Auth Token
        • Get Bearer Token
      • Accounting
        • Invoices
          • Retrieve an Invoice
          • List all Invoices
      • Customs
        • NCTS Declarations
          • List all NCTS Declarations
          • Retrieve an NCTS Declaration
          • Create an NCTS Declaration with XML Data
          • Create an Ens Declaration from JSON
          • Update an NCTS Declaration
          • Download an NCTS Declaration
          • List Timelines of NCTS Declaration
          • List Messages of NCTS Decalaration
        • Customs Declarations
          • List all Customs Declarations
          • Retrieve a Custom Declaration
          • Create a Customs Declaration
          • Update a Custom Declaration
          • Delete a Custom Declaration
          • Retrieve a Declaration History
          • Retrieve an MRN Status of Declaration
        • Declaration Requests
          • List all Declaration Orders
          • Retrieve a Declaration Request
          • Create a Declaration Request
          • Update a Declaration Request
          • Delete a Declaration Request
      • Logistics
        • Bookings
          • Retrieve a Booking
          • List all Bookings
          • Create a Booking
          • Update a Booking
        • Locations
          • List all Locations
          • Retrieve a Location
        • Positions
          • Update a Transport
        • Tracking
          • Available Shipping Lines
          • Retrieve a Tracking Data
          • Subscribe to Tracking
        • Shipments
          • Retrieve a Shipment
          • List All Shipments
          • Retrieve Financials of Shipment
          • List Contacts of the Shipment
          • Create a Shipment
          • Update a Shipment
      • Depot
        • Orders
          • Retrieve an Order
          • List all Orders
          • Create an Order
          • Update an Order
        • Products
          • Retrieve a Product
          • List all Products
          • Create a Product
          • Update a Product
          • List Product Stocks
        • Inventories
          • List all Inventories
      • Fleet Management
        • Drivers
          • Retrieve a Driver
          • Retrieve a Driver's Vehicle
          • List Driver Positions
          • Update a Driver
        • Vehicles
          • Retrieve a Vehicle
          • Update a Vehicle
        • Gps Service Controller
          • Create Gps Responses
        • Service Logs
          • List all Service Logs
          • Retrieve a Service Log
          • Create a Service Log
          • Delete a Service Log
          • Update a Service Log
        • Periodic Documents
          • Retrieve a Periodic Document
          • Update a Periodic Document
          • Create a Periodic Document
      • CRM
        • Companies
          • List all Companies
          • Retrieve a Company
          • Create a Company
          • Update a Company
          • Delete a Company
      • Timelines
        • Retrieve a Timeline
        • List Timelines
        • Create a Timeline
      • S3 Files
        • List all S3Files
        • Create an S3File
        • Delete an S3File
      • Notifications
        • List all Notifications
        • Update a Notification Status
      • User Details
        • List User Details
        • Update User Details

    Authentication

    The Modaltrans API requires JWT Bearer tokens for authentication, which are obtained using valid login credentials. If the credentials are incorrect, the API will return a '403 Forbidden' error. Tokens are valid for one hour, after which a new token must be generated. You may also obtain a new token before each request if needed.
    Please use the "Get Bearer Token" method under the "Get Auth Token" collection.

    UpdateGettingStarted1.png

    Security Considerations#

    When interacting with the Modaltrans API using JWT Bearer tokens, it's important to follow these security best practices to protect your application and data:

    Securely Store the JWT Token
    Once you receive a JWT Bearer token from the Modaltrans API, ensure it is stored securely. Do not store the token in places accessible to JavaScript, such as local storage or session storage.
    Token Expiry and Rotation
    JWT tokens provided by the Modaltrans API have a limited validity period (typically one hour). Make sure to handle token expiry in your application by refreshing the token before it expires or requesting a new token when necessary. This ensures continuous and secure access to the API.
    Do Not Share Your JWT Token
    Treat your JWT token like a password. Do not share it publicly or hard-code it in client-side code, as this could allow unauthorized access to your API.

    By following these security considerations, you can help ensure that JWTs are used safely and effectively within your applications.

    Authentication error response#

    When interacting with the Modaltrans API, authentication is a crucial step. If the API detects issues with the provided login credentials, you will receive an HTTP 403 Forbidden response. This status code indicates that the request was valid, but the server is refusing to fulfill it due to authentication issues.

    Possible Causes of HTTP 403 Response:#

    Incorrect Credentials: The username or password provided is incorrect.
    Missing Credentials: The required authentication information is not included in the request.
    Malformed Credentials: The format of the credentials is incorrect or not as expected.

    Example of an Authentication Error Response#

    When an authentication error occurs, the API response will include details about the failure. Below is an example of a typical error response when invalid login credentials are provided:

    Example

    How to Handle Authentication Errors:#

    Verify Credentials: Double-check that the credentials being sent are correct and formatted properly. Ensure that any required fields are not missing.
    Check Token Validity: If using a JWT Bearer token, ensure that the token is valid, not expired, and correctly formatted.

    If you need help or have any questions, please Contact our support team.

    Modified at 2024-09-09 13:25:59
    Previous
    Getting Started
    Next
    Error Handling
    Built with