Lesson 4 of 5
Open Cloud automation: APIs, webhooks, data tools
Use Roblox Open Cloud from outside the game, with API keys, OAuth, data stores, messaging, place publishing, Luau execution and webhooks, and build a Lune tool that reads a Beacon Yard profile.
By the end you can
- Name the Open Cloud APIs for data stores, messaging, assets and place publishing, Luau execution and webhooks, and what each is for
- Create a least-privilege API key, and know when an app needs OAuth 2.0 instead
- Build a small Lune admin tool that reads a player's Beacon Yard profile without opening Studio
- Avoid the write that a live server will silently overwrite
Before this: DataStores: saving without losing a single coin, Deploying with Open Cloud: staging and production
1A support ticket on a Sunday
A player writes in: "I had 85 coins yesterday and now I have 10." You are at home, without Studio. To answer, you need to read what Beacon Yard saved for them. At m14-ship that profile belongs to ProfileStore (ProfileStore: the library pros use). It lives in a data store named BeaconYard_v2 (Config.PROFILE_STORE_NAME), under the key Player_ plus the user id. ProfileStore wraps the game's own fields in an envelope. Your fields sit under Data, and MetaData says who holds the profile. MetaData.ActiveSession is set while a server holds it and is missing once the profile is released. The fields under Data come from the template:
function DataMigration.template(): ProfileData
return {
coins = 0,
speedOwned = false,
legacyImported = false,
onboardingStep = 0,
Until m09-react-shop the game wrote a flat record to BeaconYard_v1 instead, under the plain user id. That store still holds older profiles, and the Coin Pack receipt rows (r_<purchaseId>) that m12-money and m13-art-pass wrote. A player who joined after m10-memory has no profile there. From m14-ship the Coin Pack's purchase id is saved inside the profile (Data.recentPurchaseIds), next to the coins, and the r_ rows are only read as a fallback. The level 3 grader at the end of this lesson reads the profile envelope, and it rejects a flat BeaconYard_v1 record.
Open CloudOpen CloudRoblox's web APIs at apis.roblox.com for working with your experiences from outside Studio.Think of it as the yard office's service window, open to anyone with the right key. is Roblox's set of web APIs at apis.roblox.com. Any program that can send an HTTPS request (a script, a dashboard, a CI job) can read that record, publish a message to live servers, upload a place or run Luau in one, without Studio1.
Which data store and key hold the profile of the player with user id 42?
Answer
Data store BeaconYard_v2, key "Player_42". At m14-ship the profile is in BeaconYard_v2 under Player_ plus the user id. BeaconYard_v1 keeps the older flat records, imported once, and the old receipt rows: keys starting with r_ were written by the m12 and m13 handler. From m14-ship the purchase id is saved in the profile itself.
Open this step in lesson mode · Link to this step · This confused me
2What Open Cloud can do
The APIs you will meet most:
- Data stores read, list, create, update and delete entries, including old revisions2.
- Messaging publishes a message to a topic that live servers subscribe to with
MessagingService3. - Assets upload and update models, images, audio and places. Place publishing now goes through it:
PATCH /assets/v1/assets/{placeId}withpublishedset to true, then poll the returned operation4. The olderPOST /universes/v1/{universeId}/places/{placeId}/versionsis still in the API reference on 2026-11-25, and older tools use it, but the guide teaches the Assets API. - Luau execution runs a script inside a real server of a place version and returns its output and logs5.
- Webhooks go the other way: Roblox calls your URL when something happens, such as a refund6.
Match each job to the Open Cloud feature that does it.
Answer
Read player 42's coins from a laptop: Data stores; Tell every live server to show an announcement: Messaging; Push a tested place file from CI: Assets (place publishing); Run the game's tests in a real server: Luau execution; Hear about a Coin Pack refund: Webhooks. Data stores read and write saved data, Messaging reaches live servers, Assets uploads and publishes places, Luau execution runs code in a server, and webhooks push events to your endpoint.
Open this step in lesson mode · Link to this step · This confused me
3API keys vs OAuth 2.0
For your own scripts and CI jobs, use an API keyAPI keyA secret string that lets a program call Open Cloud with permissions you choose.Think of it as a keycard that opens only the doors you programmed into it. in the x-api-key header, following the least-privilege, secret-storage and 60-day expiry rules from Deploying with Open Cloud: staging and production7. For the support tool in this lesson, grant only universe-datastores.objects:read on your single experience (never write scopes unless the tool truly writes).
OAuth 2.0 solves a different problem: apps that act on behalf of other creators without ever asking for their API keys8. For example, a web dashboard where a studio owner signs in with Roblox and grants your app permission to read their experience's data stores:
- How it works: your app redirects the user to Roblox's consent screen listing the exact scopes; if they approve, Roblox redirects back with a short-lived code your server exchanges for access and refresh tokens.
- Who can use it: registering and publishing an OAuth 2.0 app requires a verified ID, and the creator authorizing it must have a 13+ account.
- Why not for your own scripts: if only you or your CI pipeline calls Open Cloud for your own experience, an API key is simpler and needs no sign-in flow.

Select a numbered pin, or a row below, to read what it marks.
Creating a read-only key for one experience: choose the Data Stores access permission, one experience, the read scope, an IP list if fixed, and an expiry.
Your support tool only reads profiles from your own game. Which auth choice fits best?
Answer
An API key with only universe-datastores.objects:read for Beacon Yard, kept in an environment variable. Least privilege: a read-only API key scoped to one experience cannot change anyone's coins if leaked. OAuth 2.0 is for apps that other creators sign into.
Open this step in lesson mode · Link to this step · This confused me
4Reading the vault from outside
The data store is the bank vault in another city. Game servers visit it through DataStoreService; Open Cloud is the vault's office door for you, with your own key. It is the same vault and the same records. The v2 endpoint for one entry is:
GET https://apis.roblox.com/cloud/v2/universes/{universe_id}/data-stores/{data_store_id}/entries/{entry_id}
The data store id is its name, and the response carries value (the record, as JSON) plus revisionId, etag and timestamps9.
Think of it as A bank vault in another city
-- What Get Data Store Entry returns for one Beacon Yard player at m14, after JSON decoding.
-- ProfileStore keeps the game's fields in Data and the session in MetaData.
local entry = {
path = "universes/1234/data-stores/BeaconYard_v2/entries/Player_42",
id = "Player_42",
revisionId = "rev-1",
value = {
Data = { coins = 85, speedOwned = true },
MetaData = { ActiveSession = { 1, "job-a", "session-a" } },
},
}
local function entryUrl(universeId: number, dataStore: string, key: string): string
return string.format(
"https://apis.roblox.com/cloud/v2/universes/%d/data-stores/%s/entries/%s",
universeId,
dataStore,
key
)
end
print(entryUrl(1234, "BeaconYard_v2", "Player_" .. 42))
local data = entry.value.Data
print("coins:", data.coins, "speed:", data.speedOwned)
print("lock held:", entry.value.MetaData.ActiveSession ~= nil)
https://apis.roblox.com/cloud/v2/universes/1234/data-stores/BeaconYard_v2/entries/Player_42
coins: 85 speed: true
lock held: trueThe cell prints lock held: true. What does that tell you about player 42?
Answer
A server holds this profile's session, so the player is probably in a game right now, or that server crashed without releasing it. ProfileStore writes the holding server into MetaData.ActiveSession and clears it when the session ends. If it is present, a session is active or was never released. Either way, a support tool must not write to the profile.
Open this step in lesson mode · Link to this step · This confused me
5Where the vault picture breaks
Stored dataRemember: A DataStore is a bank vault in another city.
A real vault has guards at every door. This one does not check who else is holding the record. Answer before you open the breakdown.
Where does it break?“A bank vault in another city” is a good picture of a datastore. Where does it stop being true?
It breaks here. The vault keeps only the last write for a key, so two servers writing the same key can silently undo each other.
The true model. A DataStore is a remote key-value store with request budgets. Calls are slow and can throw, so code wraps them, retries carefully and uses UpdateAsync or a session lock when more than one server might write.
Player 42 is online. You PATCH their entry to 85 coins through Open Cloud. What happens next?
Answer
Their server saves its own copy on the next save or when they leave, and your 85 is overwritten. The session lock only guards writes made through ProfileStore. Open Cloud does not enforce it, and the live server keeps the profile in memory and writes it back, so last write wins. Checking the lock first does not fix this: a server can take the profile between your check and your write. Hand the change to the server that owns the session.
Open this step in lesson mode · Link to this step · This confused me
6Build the admin tool in Lune
LuneLuneA standalone Luau runtime for scripts and tools outside Roblox.Think of it as luau with a terminal, a filesystem and the internet. is a standalone Luau runtime with a filesystem, a network client and JSON built in10, so the tool is written in the same language as the game. Save this as tools/profile.luau in your copy of the game repo:
-- tools/profile.luau: read one Beacon Yard profile through Open Cloud.
-- Usage: lune run tools/profile 12345 67890
-- (your universe id first, then the user id, both numbers)
local net = require("@lune/net")
local process = require("@lune/process")
local serde = require("@lune/serde")
local apiKey = process.env.ROBLOX_API_KEY
assert(apiKey, "Set ROBLOX_API_KEY first. Never put the key in this file.")
local universeId, userId = process.args[1], process.args[2]
assert(universeId and userId, "Usage: lune run tools/profile 12345 67890")
local url = "https://apis.roblox.com/cloud/v2/universes/" .. universeId
.. "/data-stores/BeaconYard_v2/entries/Player_" .. userId
local response = net.request({ url = url, method = "GET", headers = { ["x-api-key"] = apiKey } })
if not response.ok then
error(response.statusCode .. " " .. response.statusMessage .. ": " .. response.body)
end
local entry = serde.decode("json", response.body)
local value = if type(entry.value) == "table" then entry.value else {}
local data = if type(value.Data) == "table" then value.Data else {}
local meta = if type(value.MetaData) == "table" then value.MetaData else {}
print("coins", data.coins, "speed", data.speedOwned, "revision", entry.revisionId)
print(if meta.ActiveSession ~= nil then "LOCKED: a server holds this profile, do not write" else "not locked")
Build along
tools/profile.luaurokit.toml
Add Lune to the project's tools with
rokit add lune-org/lune.You should see lune --version prints a version number from inside the repo folder.
On the Creator Dashboard, create an API key with universe-datastores.objects:read for your published copy of Beacon Yard only.
You should see The dashboard shows the key once. You copy it straight into a password manager.
Set
ROBLOX_API_KEYin your terminal session: in Windows PowerShell run$env:ROBLOX_API_KEY = "..."; on macOS or Linux runexport ROBLOX_API_KEY="...".You should see Printing the variable's length shows a long number; the key itself never appears in a file or in Git.
Run
lune run tools/profile 12345 67890, replacing the two sample numbers with your universe id and your user id, which are longer. Type the numbers, not angle brackets, or PowerShell will not parse the line.You should see Your own profile prints with its coins, speed, revision and lock state. A user who never played gets 404 Not Found.
Open this step in lesson mode · Link to this step · This confused me
7Messages to live servers, and publishing places
Messaging. POST /cloud/v2/universes/{universe}:publishMessage with a JSON body {"topic": "...", "message": "..."} sends the message to the servers subscribed to that topic. Delivery is best effort, so a successful publish does not promise that every server heard it: fine for an announcement, wrong as the only path for a refund or a change to a player's data11. Topics are created only from inside the game with MessagingService:SubscribeAsync; a topic name is at most 80 characters and a message at most 1 KiB; limits are shared with in-game publishing3. Beacon Yard already has AnnounceService.say, which writes a system line in chat, so a subscriber that passes message.Data to it turns your tool into a yard-wide announcer.
Place publishing. CI uploads the built place with PATCH /assets/v1/assets/{placeId}, assetType Place and published true, then polls /assets/v1/operations/{id} until done. The guide lists instance types this route does not update: EditableImage, EditableMesh, PartOperation, SurfaceAppearance and BaseWrap4.
Beacon Yard's coin, drone and beacon models carry SurfaceAppearance objects. You change the coin's SurfaceAppearance and publish through the Assets API. What should you expect?
Answer
The change may not be applied; the guide says to publish from Studio after changing SurfaceAppearance. The place publishing API does not update SurfaceAppearance (and a few other types). Code and most instances publish fine from CI; art changes of those types go through Studio.
Open this step in lesson mode · Link to this step · This confused me
8Luau execution and webhooks
Luau execution creates a task with POST /cloud/v2/universes/{universe_id}/places/{place_id}/luau-execution-session-tasks (optionally pinned to a version), then you poll the task and read its logs5. A CI job can publish a staging place, run RunGameTests inside a real server, and fail the build if any line says TEST FAIL. Roblox's demo repository for that flow is archived but still readable12.
Webhooks call your HTTPS endpoint, which must answer with a 2xx within 5 seconds; Roblox retries a failed delivery 5 times. Triggers include subscriptions, right-to-erasure requests, commerce orders, experiment harm alerts and Transaction Refunded. When you set a secret, each request carries a roblox-signature header of the form t=<timestamp>,v1=<signature>: recompute an HMAC-SHA256 of timestamp.body with your secret, base64 it, compare, and reject old timestamps6.
Go deeper Applying a refund without a race
Two traps wait here. If you read the profile, see no lock and then write, a server can start a session between your read and your write, and its save overwrites yours. If you remove the coins in one write and store the refund id in another, a crash between them lets a retried webhook take the coins twice.
A safe design hands the work to the server that owns the session. Your endpoint stores the refund by its id in a place your servers read, so a retried webhook finds it. The game applies it inside the player's own ProfileStore session: it takes the 50 coins and adds the refund id to the profile's Data, in one save. ProfileStore has a message queue for this, ProfileStore:MessageAsync, whose messages the session owner handles through Profile:MessageHandler13. Messaging topics can nudge a server to check sooner, but they are best effort, so they are never the only path.
A Transaction Refunded webhook arrives for one Coin Pack. Developer product benefits live only in your data, so you must take them back. How many coins does your handler remove?
Answer
50 coins. Each Coin Pack grants 50 coins. Remove 50 from the profile, but let the server that owns the session do it, and record the refund id in the same save as the coins so a retried webhook does not remove them twice.
Open this step in lesson mode · Link to this step · This confused me
9Which language and tool
Other ways pros do this
| Option | What it is | When pros pick it | Trade-offs |
|---|---|---|---|
| Lune | Standalone Luau runtime with net, serde, fs and process. | Teams that want tools in the game's language and can share pure modules between the game and the tool. | Smaller ecosystem than Python or Node; licence is MPL-2.0. |
| Python or Node.js | General-purpose languages with HTTP built in. | Dashboards, bots and data jobs; Roblox's own Open Cloud guides show Python and Node examples. | A second language in the repo; types and helpers are written by hand. |
| rbxcloud | Community CLI and Rust library for Open Cloud. | Shell scripts and CI steps that call a few endpoints. | Community-maintained; its repository's last push was in March 2025, so check new endpoints. |
| Mantle | Infrastructure-as-code deploys for places, products and passes. | You may still see it in older repositories. | Its README opens with a notice that Mantle is no longer maintained ('Do not expect responses to tickets, bug fixes, or new features'). Do not start new projects on it; use Open Cloud APIs directly. |
Go deeper The same read in Python
import json, os, sys, urllib.request
key = os.environ["ROBLOX_API_KEY"]
universe, user = sys.argv[1], sys.argv[2]
url = f"https://apis.roblox.com/cloud/v2/universes/{universe}/data-stores/BeaconYard_v2/entries/Player_{user}"
request = urllib.request.Request(url, headers={"x-api-key": key})
with urllib.request.urlopen(request) as response:
entry = json.load(response)
value = entry.get("value", {})
print(value.get("Data"), value.get("MetaData"), entry.get("revisionId"))
A teammate commits tools/profile.luau with the API key pasted in, then deletes it in the next commit. What do you do?
Answer
Treat the key as leaked: disable or regenerate it on the dashboard, then make a new one. Git history keeps the key, and clones and forks may already have it. Revoke it at the source. That is why the tool reads ROBLOX_API_KEY from the environment.
Open this step in lesson mode · Link to this step · This confused me
10Challenges
Level 1, Apprentice
Challenge
Make your first Open Cloud call: list the data stores of your published copy.
- Start from
- A published copy of Beacon Yard
Done means
- An API key with only the data store list scope for your experience
- A request to list data stores returns the stores your game has created, such as BeaconYard_v2
- The key is stored in an environment variable, not in a file
Hints
- The scope is universe-datastores.control:list.
- The v2 path is /cloud/v2/universes/{universe_id}/data-stores.
- In macOS/Linux/Git Bash run: curl -H "x-api-key: $ROBLOX_API_KEY" <url>. In Windows PowerShell (where curl aliases Invoke-WebRequest), run: Invoke-RestMethod -Uri <url> -Headers @{ "x-api-key" = $env:ROBLOX_API_KEY } (or curl.exe -H ...).
Level 2, Builder
Challenge
Turn the admin tool into an announcer for every live yard.
- Start from
- m06-drone-wrench, published, with the Lune tool working
Done means
- The server subscribes to a topic named yard-announce and passes message.Data to AnnounceService.say
- A second Lune script publishes to that topic with a key that has only universe-messaging-service:publish
- A message sent from your terminal appears in chat in a live server
Hints
- SubscribeAsync works only in a published, running game, not in Studio's local test.
- The body is JSON with topic and message.
- Use serde.encode("json", ...) for the body and set Content-Type to application/json.
Why does the level 3 challenge test entryUrl and summarize without calling Open Cloud?
Answer
They are pure functions, so they can be tested anywhere without a key, a network or a published game. Keeping URL building and parsing pure means the risky logic is tested in Studio or CI, and the thin network layer is the only part that needs a key.
Level 3, Professional
Challenge
Fix the pure half of the admin tool. Start from the m14-ship tag in the game repo, then run it with game.ServerScriptService.RunGameTests:Invoke("open-cloud-automation").
The grader reads the same envelope as the Lune tool above: value.Data holds coins and speedOwned, and value.MetaData.ActiveSession is a table while a server holds the profile. ProfileStore's lock is the session itself, so there is no clock to compare, and summarize takes only the entry. The old flat BeaconYard_v1 record with sessionJob and sessionAt reads as blank here.
- Start from
- The game at milestone m14 (download)
- Grade it
- In Studio, press Play, then run
game.ServerScriptService.RunGameTests:Invoke("open-cloud-automation")in the server command bar. Copy the pass code from Output.
Done means
- challenges/work/profile_reader.luau builds the v2 Get Data Store Entry URL
- entryUrl returns the v2 path for BeaconYard_v2 and Player_42 (cloud_url)
- summarize(entry) takes no time argument. It reads coins and speedOwned from value.Data, and a profile is locked when value.MetaData.ActiveSession is a table (cloud_live_lock), not locked once it is gone (cloud_released)
- A flat BeaconYard_v1 record at the top of value is not a profile and reads as blank (cloud_envelope_only)
- Wrong types, an ActiveSession that is not a table, or a missing value read as a blank profile instead of throwing (cloud_bad_value, cloud_no_value)
- The open-cloud-automation challenge prints TEST PASS for all six checks: cloud_url, cloud_live_lock, cloud_released, cloud_envelope_only, cloud_bad_value and cloud_no_value
Hints
- The stock URL is the older v1 standard-datastores form. The v2 path is /cloud/v2/universes/{id}/data-stores/{store}/entries/{key}.
- Check type(value) before you index it, then do the same for value.Data and value.MetaData.
- There is no time rule. A profile is locked when type(MetaData.ActiveSession) is "table". Anything else, a string for example, is not locked.
Two endpoint families can read a standard data store entry. Which should new tools use?
Answer
The /cloud/v2/ data store endpoints, marked stable. The storage reference marks the v2 entry endpoints stable and the v1 ones beta with recommended alternatives. Unofficial website endpoints can change without notice and are not for tools.
Open this step in lesson mode · Link to this step · This confused me
11Recap
Retiring the analogy
You no longer need “a bank vault in another city”. A DataStore is a remote key-value store with request budgets. Calls are slow and can throw, so code wraps them, retries carefully and uses UpdateAsync or a session lock when more than one server might write.
Recap
- Open Cloud is HTTPS at apis.roblox.com: data stores, messaging, assets and place publishing, Luau execution, and webhooks that call you.
- Your tools use narrow API keys kept in environment variables or CI secrets; OAuth 2.0 is for apps acting for other people.
- Open Cloud does not respect ProfileStore's session lock, so read freely and hand every write to the server that owns the profile.
A DataStore is a bank vault in another city, until the vault keeps only the last write for a key, so two servers writing the same key can silently undo each other.
Queued for review
- Which data store and key hold the profile of the player with user id 42?
- Your support tool only reads profiles from your own game. Which auth choice fits best?
- Player 42 is online. You PATCH their entry to 85 coins through Open Cloud. What happens next?
- Beacon Yard's coin, drone and beacon models carry SurfaceAppearance objects. You change the coin's SurfaceAppearance and publish through the Assets API. What should you expect?
- A Transaction Refunded webhook arrives for one Coin Pack. Developer product benefits live only in your data, so you must take them back. How many coins does your handler remove?
Next Beyond Roblox: HttpService, Secrets and your own backend
Open this step in lesson mode · Link to this step · This confused me