Generating and providing an API Key with requests,
Obtaining a Key
Visit our Discord and post in the #support
channel to request a key.
Using the Key
Simply set the x-api-key
header with your api key when making a request against the Arcade.xyz API. You may optionally set x-expires-at
with a epoch timestamp in milliseconds that is in the future as an additional security measure to prevent replay attacks.
Example
const { ADDRESS, ARCADE_API_KEY } = process.env;
const url = `https://api-v2.arcade.xyz/api/v2/accounts/${ADDRESS}`;
(async function () {
// Request expires 10 seconds from now
const expiresAt = (Date.now() + 10 * 1000).toString();
const res = await fetch(url, {
headers: {
'x-api-key': ARCADE_API_KEY,
'x-expires-at': expiresAt,
},
})
console.log(res)
})();
Errors
Status Code | Error Code | Error | Solution |
---|---|---|---|
401 | 401 | Unauthorized | |
403 | 804 | x-expires-at is not an integer | Send expires at as an epoch timestamp in milliseconds. |
403 | 805 | x-expires-at must be in the future | Send an expires at that is at least ten seconds in the future. |
403 | 806 | x-expires-at is greater than 60 secs in future | Send an expires at that is less than sixty seconds in the future. |