This guide will get you all set up and ready to use the GoLogin API. We’ll cover how to get started using one of our API clients and how to make your first API request. We’ll also look at where to go next to find all the information you need to take full advantage of our powerful REST API.
Before you can make requests to the GoLogin API, you will need to grab your
API key from your dashboard. You find it under Settings » API.
import{GologinApi}from'gologin';// Token can be passed here in code or from env const token = process.env.GL_API_TOKEN||'your dev token here';const gologin =GologinApi({ token,// If you want to run particular profile you need to pass profileId param});asyncfunctionmain(){// This line of code creates new profile that will be run. If you want to run existed profile - delete this line of codeconst profile =await gologin.createProfileRandomFingerprint();const profileId = profile.id;// This line of code adds gologin proxy to the profile.await gologin.addGologinProxyToProfile(profileId,'US');// This line of code starts the browser and return object that can be managed by puppeteerconst{ browser }=await gologin.launch({ profileId });// Opens new page in browserconst page =await browser.newPage();// Goes to website and waits untill all parts of the website is loadedawait page.goto('https://iphey.com/',{waitUntil:'networkidle2'});// Reads profile check result in websiteconst status =await page.$eval('.trustworthy:not(.hide)',(elt)=> elt?.innerText?.trim(),);awaitnewPromise((resolve)=>setTimeout(resolve,10000));console.log('status', status);// This line of code deletes used profile. If you dont want to delete used profie - remove this lineawait gologin.deleteProfile(profileId);return status;}main().catch(console.error).finally(gologin.exit);
# Install required packagesnpm i gologin# Run the code - change filename.js to your actual filename and add your tokenGL_API_TOKEN=[YOUR_GOLOGIN_API_TOKEN]node filename.js
# create local env for the projectpython3 -m venv venv# Install required packagessource venv/bin/activate && pip install gologin selenium webdriver-manager# Run the script. Your file should not be named gologin.py as it will cause conflict with importGL_API_TOKEN=[YOUR_GOLOGIN_API_TOKEN] python3 filename.py
Great, you’re now set up with an API client and have made your first request to the API. Here are a few links that might be handy as you venture further into the GoLogin API: