Link a Steam account
curl --request POST \
--url https://api.manalens.dev/v0/link \
--header 'Content-Type: application/json' \
--header 'X-Publishable-Key: <api-key>' \
--data '
{
"provider": "steam",
"ticket": "140000000a0b0c0d0e0f101112131415",
"anonymous_id": "6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11"
}
'import requests
url = "https://api.manalens.dev/v0/link"
payload = {
"provider": "steam",
"ticket": "140000000a0b0c0d0e0f101112131415",
"anonymous_id": "6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11"
}
headers = {
"X-Publishable-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Publishable-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
provider: 'steam',
ticket: '140000000a0b0c0d0e0f101112131415',
anonymous_id: '6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11'
})
};
fetch('https://api.manalens.dev/v0/link', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.manalens.dev/v0/link",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'provider' => 'steam',
'ticket' => '140000000a0b0c0d0e0f101112131415',
'anonymous_id' => '6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Publishable-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.manalens.dev/v0/link"
payload := strings.NewReader("{\n \"provider\": \"steam\",\n \"ticket\": \"140000000a0b0c0d0e0f101112131415\",\n \"anonymous_id\": \"6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Publishable-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.manalens.dev/v0/link")
.header("X-Publishable-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"steam\",\n \"ticket\": \"140000000a0b0c0d0e0f101112131415\",\n \"anonymous_id\": \"6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.manalens.dev/v0/link")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Publishable-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"steam\",\n \"ticket\": \"140000000a0b0c0d0e0f101112131415\",\n \"anonymous_id\": \"6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11\"\n}"
response = http.request(request)
puts response.read_body{
"linked": true,
"provider": "steam"
}{
"error": {
"code": "STEAM_TICKET_INVALID",
"message": "Steam did not accept this ticket. Get a new ticket for the identity \"manalens\" and try again."
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}Events API
Link API
Reference for POST /v0/link, the endpoint that a game calls to link the Steam account of a player with a Steam ticket.
POST
/
v0
/
link
Link a Steam account
curl --request POST \
--url https://api.manalens.dev/v0/link \
--header 'Content-Type: application/json' \
--header 'X-Publishable-Key: <api-key>' \
--data '
{
"provider": "steam",
"ticket": "140000000a0b0c0d0e0f101112131415",
"anonymous_id": "6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11"
}
'import requests
url = "https://api.manalens.dev/v0/link"
payload = {
"provider": "steam",
"ticket": "140000000a0b0c0d0e0f101112131415",
"anonymous_id": "6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11"
}
headers = {
"X-Publishable-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Publishable-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
provider: 'steam',
ticket: '140000000a0b0c0d0e0f101112131415',
anonymous_id: '6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11'
})
};
fetch('https://api.manalens.dev/v0/link', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.manalens.dev/v0/link",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'provider' => 'steam',
'ticket' => '140000000a0b0c0d0e0f101112131415',
'anonymous_id' => '6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Publishable-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.manalens.dev/v0/link"
payload := strings.NewReader("{\n \"provider\": \"steam\",\n \"ticket\": \"140000000a0b0c0d0e0f101112131415\",\n \"anonymous_id\": \"6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Publishable-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.manalens.dev/v0/link")
.header("X-Publishable-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"steam\",\n \"ticket\": \"140000000a0b0c0d0e0f101112131415\",\n \"anonymous_id\": \"6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.manalens.dev/v0/link")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Publishable-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"steam\",\n \"ticket\": \"140000000a0b0c0d0e0f101112131415\",\n \"anonymous_id\": \"6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11\"\n}"
response = http.request(request)
puts response.read_body{
"linked": true,
"provider": "steam"
}{
"error": {
"code": "STEAM_TICKET_INVALID",
"message": "Steam did not accept this ticket. Get a new ticket for the identity \"manalens\" and try again."
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
],
"refused": [
{
"index": 0,
"message_id": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"results": [
{
"index": 0,
"user_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}
],
"feature": "<string>",
"billing_url": "<string>"
}
}Link a Steam account
POST /v0/link
X-Publishable-Key: YOUR_PUBLISHABLE_KEY
Content-Type: application/json
{
"provider": "steam",
"ticket": "140000000a0b0c0d...",
"anonymous_id": "6a2f41a2-7d36-4c8e-9a54-2b1f9b0f0c11"
}
https://api.manalens.dev; events.manalens.dev serves only POST /v0/events.
The project needs a Steam Web API key and an App ID on the Connect Steam card. Manalens checks the ticket with Steam (ISteamUserAuth/AuthenticateUserTicket) and the project’s key, for the project’s App ID and the identity manalens. The identity is fixed: a ticket made for another service is refused. Then it reads once which of your apps the account owns (ISteamUser/GetPublisherAppOwnership). See Steam ownership.
Authentication
Send the project’s publishable key inX-Publishable-Key, as for events. A game server can send the secret key in Authorization: Bearer mana_sk_... instead. The publishable key checks apply: a web build must run on the project domain or an allowed origin. A game sends no origin.
Body
| Field | Type | Rules |
|---|---|---|
provider | string | steam. Other stores come later. |
ticket | string | The bytes of the Steam ticket from GetAuthTicketForWebApi, as a hex string: 32 to 4096 hex characters, an even number. |
anonymous_id | string | The SDK’s anonymous ID of this game install (a UUID). |
user_id | string | Optional, 1 to 255 characters. Read only with the secret key (a game server). With the publishable key it is checked but not stored, because a client can send any user ID. A stored user ID is never replaced. |
GetAuthTicketForWebApi("manalens").
A verified link binds the Steam account to the game install that made the ticket. It does not make the player identified: the player’s user ID comes from identify, as before.
Responses
| Status | Body | When |
|---|---|---|
200 | { "linked": true, "provider": "steam" } | Steam accepted the ticket. The response never contains the SteamID. |
400 | INVALID_JSON | The body is not valid JSON. |
400 | INVALID_BODY | A field is missing or does not match the rules. The message names the field. |
400 | STEAM_TICKET_INVALID | Steam did not accept the ticket: it is expired, for another app, or not made with the identity manalens. Get a new ticket and try again. |
401 | UNAUTHORIZED | The key is missing or wrong, or the request has both keys. |
403 | FORBIDDEN or WORKSPACE_SUSPENDED | The origin does not match the project, or the workspace takes no events. |
409 | STEAM_NOT_CONNECTED | The project has no Steam Web API key or App ID. |
413 | TOO_LARGE | The body is larger than 2 MB. |
429 | RATE_LIMITED | More than 30 link calls from one IP address in 10 minutes, more than 5 from one game install in 10 minutes, or more than 600 for the project in one minute. Read Retry-After. A request that fails an earlier check (body, key, Steam not connected, a refused Steam key) does not count. |
502 | STEAM_KEY_REFUSED | Steam refused the project’s Steam Web API key. Manalens does not try a refused key again until an owner saves a key on the Connect Steam card. |
502 | STEAM_UNAVAILABLE | Manalens could not reach Steam. Try again later. |
500 | INTERNAL | An unexpected error. The body has a request_id. |
503 | NOT_CONFIGURED | The server cannot read the saved key, or integration encryption is not configured on the server. |
{ "error": { "code": "...", "message": "..." } }.
When Steam accepts the ticket but the ownership read fails, the link is saved and the call still returns 200. Ownership is read at the next link.
SDK call
Each SDK has the call. The SDK sends the ticket as hex with the anonymous ID, after consent. It does not send a refused ticket again, and tries once more only after a429 with Retry-After.
| SDK | Call | Ticket |
|---|---|---|
| Godot | link_steam(), or the option steam_link: true | With GodotSteam, the SDK calls Steam.getAuthTicketForWebApi("manalens") and waits for the get_ticket_for_web_api signal. Or pass your own ticket bytes. |
| Unity | Manalens.LinkSteam(), or the option SteamLink = true | With Steamworks.NET, the SDK calls SteamUser.GetAuthTicketForWebApi("manalens") and waits for GetTicketForWebApiResponse_t. Or pass the bytes to LinkSteam(ticket) (Facepunch: GetAuthTicketForWebApiAsync("manalens")). |
| Unreal | LinkSteamTicket(Ticket) | The game gets a Web API ticket with the identity manalens from the Steamworks SDK or the Steam Online Subsystem and passes the bytes. |
| Web | link({ provider: 'steam', ticket }) | The ticket as hex. |
| Node | link({ provider: 'steam', ticket, anonymousId, userId }) | A game server with the secret key; userId is optional. |
curl https://api.manalens.dev/v0/link \
-H "X-Publishable-Key: $MANALENS_PUBLISHABLE_KEY" \
-H "Content-Type: application/json" \
-d '{"provider":"steam","ticket":"<hex>","anonymous_id":"<anonymous id>"}'
Authorizations
PublishableKeySecretKey
Body
application/json
Fields that are not in this list are ignored.