In short
You get a FiveM license key for free at portal.cfx.re with your Cfx.re account. Create a new key in the server registration keys section and enter a server name and the server's public IP address. Paste the key into server.cfg as sv_licenseKey "KEY" or into the txAdmin setup wizard. FXServer won't start without a key, and a wrong key causes the invalid license key error.
In this guide
- What is a license key and why do you need one?
- Creating a key in the Cfx.re portal: step by step
- What should you enter in the IP field?
- Managed game server or your own VDS?
- Adding the key to your server
- "Invalid license key" error: checklist
- How to tell the key is working
- Element Club and the slot limit
- Managing the key in a team
- What to do if your key leaks
- Which server should you start with?
- Next step
A FiveM license key is a free key from the Cfx.re portal (portal.cfx.re) that registers your FiveM server with the Cfx.re platform. Creating one takes a few minutes: sign in with your Cfx.re account, enter your server's name and IP address, and add the generated key to server.cfg with the sv_licenseKey line. FXServer won't start without a key. This guide covers how to get the key, what the IP field means and what to do about the "invalid license key" error.
What is a license key and why do you need one?
A server license key is a unique code FXServer uses to authenticate with Cfx.re's servers at startup. If authentication succeeds, your server runs and can register with the public server list. The key:
- Is free. A basic FiveM server doesn't require payment.
- Is tied to an account. The Cfx.re account that creates the key is treated as the server owner.
- Must be kept secret. Anyone who gets your key can run a server in your name.
While the key is free, some features, such as going above 48 slots, require Cfx.re's paid Element Club subscription. The subscription is assigned to the account that created the key.
Creating a key in the Cfx.re portal: step by step
- Sign up or sign in. Go to portal.cfx.re. If you don't have a Cfx.re account (forum account), register for free and complete email verification.
- Open the server keys section. In the portal menu, go to the section that lists server registration keys.
- Create a new key. Click the button to create a key.
- Enter a server name. This name only appears in your own list; it helps you tell servers apart if you have more than one. For example, "RP Main Server" or "Test Server".
- Enter the IP address. Type your server's public IPv4 address. This is explained in detail in the next section.
- Choose the server type. The portal asks where the server is hosted; if you use a rented game server or a VDS, pick the appropriate option other than a home connection.
- Copy the key. Save the generated key somewhere safe. Current keys usually start with
cfxk_.
What should you enter in the IP field?
The IP field identifies which server the key was created for. Enter your server's public IP address, the one visible from the outside world:
- Rented game server: The server IP shown in the service details of your client area.
- VDS: Your VDS's public IP address. On Linux you can see it with the
curl -4 ifconfig.mecommand. - Home computer: Your router's external IP. Keep in mind that home connection IPs can change.
When you move your server to another machine, the cleanest approach is to update the portal entry or create a new key. Don't use one key on multiple servers at the same time; create a separate key for each server (including test servers).
Managed game server or your own VDS?
The steps to get the key are the same in both cases; the difference is where you enter it.
| Scenario | Where do you enter the key? | What goes in the IP field? |
|---|---|---|
| Managed FiveM server | The txAdmin wizard or server.cfg edited from the panel | The server IP in your service details |
| Linux VDS | server.cfg (or a separate file loaded with exec) | The VDS's public IP |
| Windows VDS | server.cfg (you can edit it with Notepad) | The VDS's public IP |
When editing server.cfg on Windows, make sure the file isn't saved as server.cfg.txt; turning on file name extensions in File Explorer prevents this mistake.
Adding the key to your server
Method 1: Write it in server.cfg
Open server.cfg and add this line, or update the existing one:
sv_licenseKey "cfxk_BURAYA_ANAHTARINIZ"
The key must be in quotes, with no leading or trailing spaces. Save the file and restart the server. You can find out what the other lines in server.cfg do in the guide that explains server.cfg settings line by line.
Method 2: The txAdmin setup wizard
If you're setting up the server with txAdmin for the first time, a license key field appears at the recipe step. When you paste the key there, txAdmin writes it to the server.cfg it generates automatically. The full wizard is covered in the txAdmin setup and usage guide.
Storing the key safely
If you keep server.cfg in a Git repository, move the key to a separate file and don't add that file to the repo:
# server.cfg
exec gizli.cfg
# gizli.cfg
sv_licenseKey "cfxk_BURAYA_ANAHTARINIZ"
"Invalid license key" error: checklist
If the server console shows an error saying license validation failed, check the following in order:
- Copy error: Make sure you copied the whole key with no leading or trailing spaces or line breaks. Copy it again from the portal.
- Missing quotes: The line must look like
sv_licenseKey "...". - Deleted or regenerated key: If you deleted or regenerated the key in the portal, the old key is invalid. Enter the new key.
- Multiple definitions: If there's a second
sv_licenseKeyline in server.cfg or in another file loaded withexec, the value read last wins. Search your files and keep only one line. - Same key on two servers: If your test and live servers share a key, they may conflict. Give each server its own key.
- Wrong file edited: txAdmin may be using a different cfg file. Check which cfg file is selected in the txAdmin settings.
- Server can't reach Cfx.re: Very rarely, the problem isn't the key but the outbound connection. On a VDS, check whether a firewall rule is blocking outbound connections.
If the server starts after these steps but players can't connect, the problem is most likely port or network settings, not the key. Confirm that port 30120 is open for both TCP and UDP and that the endpoint_add_tcp and endpoint_add_udp lines in server.cfg point to the same port.
If nothing works, create a new key in the portal and try starting the server with only that key and no extra exec files. This clean test tells you for certain whether the problem is the key or the configuration.
How to tell the key is working
After adding the key and restarting the server, run these three checks:
- Console: No license or authentication errors should appear at startup; resources should start in order.
- Connection: You should be able to open the F8 console in the FiveM client and connect with
connect SUNUCU_IP:30120. - Server list: After a few minutes, your server should appear in the public list under the name in the
sv_hostnameline. If it doesn't, check whether server.cfg has asv_master1 ""line; that line hides the server from the list.
Element Club and the slot limit
Although the license key is free, Cfx.re limits how many players your server can hold. With OneSync enabled, you can go up to 48 slots for free. For more slots and some extra features, the Cfx.re account that created the key needs a paid Element Club subscription. Because the subscription is tied to the account, if you create the key from a different account, the subscription's benefits won't apply to that server. So decide up front whose account your team will use to create the key; ideally, the server owner's long-term account.
Managing the key in a team
On roleplay servers, developers and admins change often. Creating the key with a developer's personal account can cause ownership problems when that person leaves. Create the key with the server owner's account and give developers only the file access they need, not the key itself. Regenerating the key when you part ways with a developer is a good security habit.
What to do if your key leaks
- Sign in to the portal and delete or regenerate the leaked key.
- Write the new key to server.cfg and restart the server.
- Find out where it leaked from: a public repository, a shared screenshot or a file shared with a developer you don't trust.
- The database password or API keys may have leaked from the same source; change the other secrets in server.cfg too.
Which server should you start with?
Once your license key is ready, the next step is a server to run FXServer. For script development, trying out frameworks or a small server for friends, the OB-FIVEM-1 FiveM server plan with 2 CPUs, 2 GB DDR5 RAM and 40 GB NVMe storage is enough to start. FXServer is installed automatically on this plan, so you can paste your key into the txAdmin wizard and get going right away.
If you're planning a roleplay framework, addon vehicles and a large player base, you'll need plans with more RAM. You can compare all options on the FiveM server plans page.
Next step
You've got the key and added it to your server; now it's time to get the server running. OyunBulut FiveM servers are hosted in an Istanbul data center and come with DDoS protection and automatic setup. Start with OB-FIVEM-1 for testing, then move to a more powerful FiveM plan as your community grows. If you get stuck with the key or setup, you can open a support ticket in Turkish.
Frequently asked questions
Is a FiveM license key free?
Yes, the server license key is free from the Cfx.re portal. Some extra features, such as more than 48 slots, require a paid Element Club subscription.
Where do I put my FiveM license key?
Put the key in server.cfg with the line sv_licenseKey "KEY". If you're setting up with txAdmin, just paste it into the license field in the wizard.
Can I use one license key on multiple servers?
It's not recommended. Running the same key on two servers at once can cause validation problems; create separate keys for your test and live servers.
I moved my server. Do I need a new key?
If your IP address changed, the cleanest approach is to update the portal entry or create a new key. Then write the new key to server.cfg.
What causes the invalid license key error?
The most common causes are a key copied incompletely or with spaces, missing quotes, a key deleted in the portal, and a second sv_licenseKey line in your cfg files.