
Easiest Way To Use APIs In Unreal Engine For Beginners
Beginner-friendly guide to connect Unreal Engine 5.6 to any API with C++. Make async GET requests and call them in Blueprints using a simple function library.
This is Rambod, and in this guide I’ll show you the simplest way to connect Unreal Engine to any API without plugins or third-party tools.
We’ll write a single C++ file inside a Blueprint Function Library, set up Unreal’s built-in HTTP module, and create a Blueprint node that makes live GET requests.
By the end, you’ll have a working fetch data from URL node that prints real-time API data directly into your game.
1) Project Setup
- Engine: Unreal Engine 5.6
- Project: Create a new Blank C++ Project (recommended for clarity).
- Name:
UnrealAPICallSample
- Template: Blank C++
👉 Any project works, but a clean C++ starter keeps things simple.
Editor Preferences
- Go to Edit → Editor Preferences → Live Coding.
- Disable Enable Live Coding.
- Optional, but recommended. Disabling avoids random compile crashes and makes rebuilds more predictable.
IDE
I’m using Rider Non-commercial Edition for Unreal.
If you want Rider setup instructions, check my Rider tutorial.
2) Create a Blueprint Function Library
- Go to Tools → New C++ Class.
- In the wizard, switch to All Classes.
- Search for Blueprint Function Library.
- Select it → Next → leave the class name (e.g.
MyBlueprintFunctionLibrary
). - Click Create Class.
📌 Why Function Library?
- Functions here are static, global, and Blueprint-callable.
- No actors, inheritance, or messy setup.
- You get nodes available everywhere in your project.
3) Declare a Delegate & Static Function (Header File)
Open the generated .h
file.
Step 1 – Add Delegate
At the top of the class, add:
// Delegate for API response
DECLARE_DYNAMIC_DELEGATE_TwoParams(FOnAPIResponse, int32, StatusCode, const FString&, Response);
This creates a Blueprint-friendly delegate that passes back:
StatusCode
(HTTP status code, e.g., 200).Response
(string data returned from the server).
Step 2 – Declare the Function
Inside public:
section:
UFUNCTION(BlueprintCallable, Category="RambodDev|API")
static void FetchDataFromURL(const FString& URL, const FOnAPIResponse& Callback);
Key points:
BlueprintCallable
→ available as a node.Category
→ organizes node underRambodDev → API
.static
→ global utility, no object needed.void
return → async results handled via delegate, not immediate return.
4) Implement the Function (CPP File)
Right-click function name → Generate Definition in .cpp
.
Includes
At the top of .cpp
:
#include "HttpModule.h"
#include "Interfaces/IHttpResponse.h"
#include "Http.h"
Without these, Unreal won’t recognize HTTP types.
Function Logic
void UMyBlueprintFunctionLibrary::FetchDataFromURL(const FString& URL, const FOnAPIResponse& Callback)
{
if (!FHttpModule::Get().IsHttpEnabled()) return;
// Create request
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> Request = FHttpModule::Get().CreateRequest();
Request->SetVerb("GET");
Request->SetURL(URL);
// Optional headers (e.g. JSON, API key)
// Request->SetHeader(TEXT("Content-Type"), TEXT("application/json"));
// Request->SetHeader(TEXT("Authorization"), TEXT("Bearer YOUR_API_KEY"));
// Async response handler
Request->OnProcessRequestComplete().BindLambda(
[Callback](FHttpRequestPtr Request, FHttpResponsePtr Response, bool bSuccess)
{
int32 StatusCode = bSuccess && Response.IsValid() ? Response->GetResponseCode() : -1;
FString Result = bSuccess && Response.IsValid() ? Response->GetContentAsString() : TEXT("Request failed");
Callback.ExecuteIfBound(StatusCode, Result);
}
);
Request->ProcessRequest();
}
✅ This creates a GET request, waits asynchronously, then triggers the delegate with results.
5) Update Build.cs
Inside Source/UnrealAPICallSample/UnrealAPICallSample.Build.cs
:
PublicDependencyModuleNames.AddRange(
new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HTTP", "Json" }
);
👉 Without HTTP
and Json
, the project won’t compile.
6) Compile & Test
- Hit Build in Rider/Visual Studio.
- If everything compiles, open Unreal.
7) Testing the API Node in Blueprint
-
Create a new empty level for testing.
-
Open Level Blueprint.
-
Add
Event Begin Play
. -
Search for your function: Fetch Data From URL.
-
Connect
Event Begin Play → Fetch Data From URL
. -
URL: use a safe test endpoint:
https://jsonplaceholder.typicode.com/todos/1
-
From the
Callback
pin → create Custom Event. -
Drag from
Response
→ connect to Print String.
Now hit Play. 💡 You’ll see the live API JSON printed on screen.
Subtitle Expansion (Flow of Video)
“We’re connecting Unreal Engine 5.6 to any API using one simple setup. Start with a clean C++ project. Disable Live Coding under Editor Preferences for stability. Create a
Blueprint Function Library
class. Add a delegate with two params: StatusCode and Response. Declare a staticFetchDataFromURL
function with URL + Callback. In the CPP file, include HTTP headers. Inside, create an HTTP request, set verb to GET, pass the URL, optionally add headers for JSON or authentication. Bind a lambda to handle completion: check success, grab status code, grab content as string, then fire the delegate back to Blueprint. Don’t forget to addHTTP
andJson
toBuild.cs
dependencies. After building, open Unreal, make a test level, hook Event Begin Play to FetchDataFromURL, print the response in Blueprint. Hit Play—you’ll see live data printed from the API. This setup works for any endpoint and makes Blueprint API integration super easy. Advanced POST/DELETE/JSON parsing can be added later.”
8) Real-World Use Cases
- 🎮 Inventory systems that fetch live data from a server.
- 📊 Stats dashboards pulling player profiles from APIs.
- 💬 Chat windows powered by HTTP requests.
- 🔄 Dynamic menus pulling data from the web.
Wrap-Up
We’ve built a beginner-friendly API integration:
- Blueprint Function Library with static node
- Delegate for async handling
- HTTP GET request with flexible headers
- Blueprint node printing live API data
👉 Watch the full tutorial: YouTube Link 👉 Sample Project: GitHub Repo 👉 Subscribe for more: Rambod Dev Channel