cURL
curl --request GET \
--url https://api.mage.space/v1/account \
--header 'Authorization: Bearer <token>'import Mage from '@mage-space/sdk';
const mage = new Mage(); // reads MAGE_API_KEY
const account = await mage.account.get();
console.log(account.gems.balance);from mage_space import Mage
mage = Mage() # reads MAGE_API_KEY
account = mage.account.get()
print(account["gems"]["balance"])const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mage.space/v1/account', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"gems": {
"balance": 1250
}
}{
"error": {
"code": "unauthorized",
"message": "The API key is invalid or has been revoked."
}
}{
"error": {
"code": "payment_required",
"message": "The Mage API and MCP server need a successful payment on this account first: buy any Gem pack or start a plan at https://www.mage.space/gems, then retry. Signup bonus Gems work in the Mage app only."
}
}{
"error": {
"code": "internal_error",
"message": "Something went wrong on our side. Retry, and contact support if it persists."
}
}Endpoints
Get account
GET /v1/account returns the gems balance the Mage API draws from.
GET
/
v1
/
account
cURL
curl --request GET \
--url https://api.mage.space/v1/account \
--header 'Authorization: Bearer <token>'import Mage from '@mage-space/sdk';
const mage = new Mage(); // reads MAGE_API_KEY
const account = await mage.account.get();
console.log(account.gems.balance);from mage_space import Mage
mage = Mage() # reads MAGE_API_KEY
account = mage.account.get()
print(account["gems"]["balance"])const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mage.space/v1/account', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"gems": {
"balance": 1250
}
}{
"error": {
"code": "unauthorized",
"message": "The API key is invalid or has been revoked."
}
}{
"error": {
"code": "payment_required",
"message": "The Mage API and MCP server need a successful payment on this account first: buy any Gem pack or start a plan at https://www.mage.space/gems, then retry. Signup bonus Gems work in the Mage app only."
}
}{
"error": {
"code": "internal_error",
"message": "Something went wrong on our side. Retry, and contact support if it persists."
}
}The gems balance the API’s generations draw from. A generation whose price exceeds the balance is refused with
402 insufficient_gems and gems_required. If auto top-up is on for the account, an API request can trigger it exactly as a generation in the app would.Authorizations
Create a key in API → API Keys: select Create API key, name it in the popup, then select Create key. Copy the one-time key and send it as Authorization: Bearer mage_sk_…. Keys are for server-side code only.
Last modified on September 23, 2026

