API reference · App API
Keys
Check which app and environment a key belongs to, before you send anything with it.
Check a key
/v1/whoamiWhich app and environment the key you signed with belongs to. Nothing is stored, so it is the request to test a connection with: a 401 says whether the key, the secret or the clock is wrong.
AuthSigned request with an app key, fg_live_… or fg_test_…
Returns · 200
appobjectrequiredThe app the key belongs to.
Child attributes
idstringrequirednamestringrequiredenvironmentstringrequiredsandbox for a test key (fg_test_…), production for a production key (fg_live_…).
One of production sandbox
keyIdstringrequiredThe key id the request was signed with.
Errors
- 401
missing_signature One of
x-fg-key,x-fg-timestampandx-fg-signatureis missing.- 401
invalid_timestamp x-fg-timestampis not Unix time in seconds.- 401
stale_timestamp x-fg-timestampis more than 300 seconds from the server clock. Sign each attempt again, and keep your clock in sync.- 401
invalid_key The key id is unknown or revoked, or the app is archived.
- 401
invalid_signature The signature does not match. Sign the exact bytes you send.
- 429
too_many_attempts Too many requests with this key in the last minute. Wait
Retry-Afterseconds.
TS=$(date +%s)
SIG=$(printf '%s.' "$TS" | openssl dgst -sha256 -hmac "$FG_SECRET" | sed 's/^.*= //')
curl "https://api.affiliate.yflow.io/v1/whoami" \
-H "x-fg-key: $FG_KEY_ID" \
-H "x-fg-timestamp: $TS" \
-H "x-fg-signature: $SIG"import { createFlowGrowth } from '@flow/growth-sdk';
const fg = createFlowGrowth({
baseUrl: 'https://api.affiliate.yflow.io',
keyId: process.env.FG_KEY_ID!, // fg_test_… in the sandbox
secret: process.env.FG_SECRET!,
});
const res = await fg.whoami();
if (res.ok) console.log(res.data.app.name, res.data.environment); // 'sandbox' for a fg_test_ key{
"app": {
"id": "0c9e6f3a-1b2d-4c5e-8f7a-9b0c1d2e3f4a",
"name": "Example Shop"
},
"environment": "sandbox",
"keyId": "fg_test_k7qxa2mpw"
}