
API Credentials for LightRAG
Guide to obtaining tokens, keys, and connections.
To call the LightRAG API you need two things: (1) the “LightRAG Server URL”, which combines your server’s public IP address with the port where LightRAG listens (default 9621), and (2) the “API Key”, which is the value set in the LIGHTRAG_API_KEY variable inside LightRAG’s .env file. The following step‑by‑step instructions show you how to obtain both items, even if you only have basic internet skills.
LightRAG Server URL
-
1
Find your server’s public IP address. In most hosting dashboards (AWS Lightsail, DigitalOcean, etc.) it is displayed on the instance details page; alternatively, run the command curl ifconfig.me in the server’s terminal to print the IP.
-
2
Make sure LightRAG is running and listening on port 9621 (the default). You can confirm the port in your .env file (look for a line PORT=9621) or in the command you used to start the server.
-
3
Open a web browser and visit http://
:9621/webui. If the LightRAG page appears, the port is correct and reachable. -
4
Construct the base API URL by replacing
with your address and removing /webui, leaving: http:// :9621
API Key
-
1
Connect to the server via SSH or use a file manager, then open the LightRAG .env file (commonly at /opt/lightrag/.env).
-
2
Find the line starting with LIGHTRAG_API_KEY=. If it is commented out (starts with #), remove the # and enter a secure value, e.g., LIGHTRAG_API_KEY=MySuperSecretKey.
-
3
Save the .env file.
-
4
Restart the LightRAG server so it reloads the new key (for example: sudo systemctl restart lighrag).
-
5
Your “API Key” is exactly the text you placed after LIGHTRAG_API_KEY=. Include it in API requests using either the header Authorization: Bearer
or X-API-Key: .