Get a challenge for App Attest
The first step of a session without an account. The challenge is valid for five minutes.
POST
https://api.switchfile.io/v1/app/guest/challengeExample
Request
curl "https://api.switchfile.io/v1/app/guest/challenge" \
-d ""const res = await fetch("https://api.switchfile.io/v1/app/guest/challenge", {
method: "POST",
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
console.log(await res.json());<?php
$ch = curl_init('https://api.switchfile.io/v1/app/guest/challenge');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => '',
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status >= 400) {
throw new RuntimeException("HTTP $status: $response");
}
print_r(json_decode($response, true));import requests
res = requests.post(
"https://api.switchfile.io/v1/app/guest/challenge",
)
res.raise_for_status()
print(res.json())Responses
200OK
challengestringrequiredPass the SHA-256 of these bytes (UTF-8) as clientDataHash to App Attest
expires_instring (integer) | integerrequiredSeconds the challenge stays valid
200 application/json{ "challenge": "1763116800.q8Jx2v3mQ0yS6nB1kR9tLw.Wm9vYmFyYmF6cXV4", "expires_in": 300 }429Too many requests or a daily quota is used up. See Retry-After
RATE_LIMIT_EXCEEDED429 application/problem+json{ "type": "https://switchfile.io/docs/api/v1#errors-rate-limit-exceeded", "title": "Rate limit exceeded", "status": 429, "code": "RATE_LIMIT_EXCEEDED", "detail": "Too many requests. Try again in 12 seconds." }