SDKs and language examples
Choose language examples without assuming an SDK has been published.
On this page
Use a small HTTP client before depending on an SDK. The release examples cover the authentication contract, not business execution.
Choose a language
Read the HTTP, TypeScript, Python or Ruby guide. They use ordinary language HTTP facilities and keep secrets outside source code.
No new Market Monolith package publication, marketplace installation or client acceptance is implied. Existing SDK and OpenAPI source foundations need compatibility and release verification before being described as supported distributions.
Keep clients predictable
Set a bounded timeout, inspect HTTP status before parsing a success shape, and refuse redirects when sending the application credential. Log safe result metadata, not request headers, raw exceptions or secrets.
Authentication checks are free but may be rate-limited. Do not add aggressive background retries merely to make an onboarding indicator turn green.
Native clients
Native-shell path configuration is a compatibility topic, not proof of a shipped iOS or Android application. Server keys must not be embedded in mobile binaries.
Upgrade deliberately
Pin any dependencies your own application uses and review their official documentation. Future business SDK examples must state supported contract versions and preserve partial/uncertain outcomes rather than hiding them behind a success object.
Authentication examples
Use these examples after availability is confirmed. This page does not execute a request.
cURL
curl --request GET --max-time 15 \
--url https://api.marketmonolith.com/v1/me \
--header "X-Market-Monolith-Key: $MARKET_MONOLITH_API_KEY"
JavaScript / TypeScript
const key = process.env.MARKET_MONOLITH_API_KEY;
if (!key) throw new Error("A server-side API key is required");
const response = await fetch("https://api.marketmonolith.com/v1/me", {
headers: { "X-Market-Monolith-Key": key, Accept: "application/json" },
redirect: "error",
signal: AbortSignal.timeout(10_000),
});
if (!response.ok) {
throw new Error("Authentication check returned HTTP " + response.status);
}
const identity = await response.json();
console.log({
accountRef: identity.accountRef,
applicationRef: identity.applicationRef,
businessAccess: identity.businessAccess,
billable: identity.billable,
});
Python
import json
import os
import urllib.error
import urllib.request
class NoRedirect(urllib.request.HTTPRedirectHandler):
def redirect_request(self, req, fp, code, msg, headers, newurl):
return None
key = os.environ.get("MARKET_MONOLITH_API_KEY")
if not key:
raise RuntimeError("A server-side API key is required")
request = urllib.request.Request(
"https://api.marketmonolith.com/v1/me",
headers={"X-Market-Monolith-Key": key, "Accept": "application/json"},
)
opener = urllib.request.build_opener(NoRedirect())
try:
with opener.open(request, timeout=10) as response:
identity = json.load(response)
except urllib.error.HTTPError as error:
raise RuntimeError(
"Authentication check returned HTTP " + str(error.code)
) from None
print({
"accountRef": identity.get("accountRef"),
"applicationRef": identity.get("applicationRef"),
"businessAccess": identity.get("businessAccess"),
"billable": identity.get("billable"),
})
Ruby
require "net/http"
require "json"
key = ENV.fetch("MARKET_MONOLITH_API_KEY")
uri = URI("https://api.marketmonolith.com/v1/me")
request = Net::HTTP::Get.new(uri)
request["X-Market-Monolith-Key"] = key
request["Accept"] = "application/json"
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.open_timeout = 5
http.read_timeout = 10
http.max_retries = 0
response = http.request(request)
unless response.is_a?(Net::HTTPSuccess)
raise "Authentication check returned HTTP #{response.code}"
end
identity = JSON.parse(response.body)
puts identity.slice("accountRef", "applicationRef", "businessAccess", "billable")