API access token

Hi guys, i am trying to pull SIM card data from my RUT241 router via API call.
However, every time i try it on postman i have to key in a access token that i can only find when i am logged in to the routers status page and inspect the page to locate the bulk api pathway, something like this;
{endpoint: “/api/sim_cards/status”, method: “GET”}

which is fine in but eache i try to do the get request, i need a new barer access token as the page is refreshed.

is there a way to find a the access token that does not change every time i am logged in.

Hello,

Thank you for reaching out.

To address this, you can increase the session timeout for the API by modifying the api_session_timeout parameter in the router’s configuration. This will extend the time before the access token expires. Below are the steps to achieve it:

  1. Access the router’s CLI via SSH or WebUI:
  • Connect to your router with an SSH client (e.g., PuTTY).
  • Enter the router’s IP address, then log in using your credentials.
  1. Once logged in, open the configuration file using a text editor like vim or nano:
vim /etc/config/vuci

or

nano /etc/config/vuci
  1. Modify the Session Timeout:
  • Locate the api_session_timeout setting in the configuration file.
  • By default, this value is set to 300 seconds (5 minutes). You can increase this to 600 (10 minutes) or higher, depending on your needs.
  1. Save and Exit:
  • If using vim, press ESC, then type :wq to save and exit.
  • If using nano, press CTRL + X, then Y, and Enter to save and exit.

Once the api_session_timeout is increased, the access token should remain valid for a longer period, reducing the need to constantly retrieve a new token.

If you need further assistance, feel free to reach out.

Best Regards,

@shanerobi Are you not using the login endpoint to get the token? If not you should use it. It’s documented here: Teltonika Networks Web API.

In the same page you can see /session/status endpoint and by periodically executing it you can extend the session.

Also I suggest you explore the documentation page if you haven’t done so already, there is a lot of information there, you can see examples with python of using the API here: Examples | Teltonika Networks Web API