Get user info & credits
https://api.imagemcpserver.com/auth/user-dataReturns the account record behind the API key you authenticated with — name, email, sign-in provider, plan, and the live credit balance. Agents typically call this first so they can check the balance before starting an expensive batch of image work.
Overview
Read the authenticated account's profile, plan and remaining credit balance.
This endpoint never deducts credits.
Request
Headers
| Field | Type | Description |
|---|---|---|
Authorizationrequired | string | Bearer <IMAGEMCP_API_KEY>. The header x-api-key: <key> is accepted as an alternative. |
This endpoint takes no parameters — only the authorization header.
Examples
The same call in five forms. The MCP tab is what an MCP client sends under the hood; the CLI tab is what an agent with the agent skill runs.
curl "https://api.imagemcpserver.com/auth/user-data" \
-H "Authorization: Bearer $IMAGEMCP_API_KEY"imagemcp.js user:infoconst res = await fetch("https://api.imagemcpserver.com/auth/user-data", {
headers: { Authorization: `Bearer ${process.env.IMAGEMCP_API_KEY}` },
});
const data = await res.json();
console.log(data);import os
import requests
res = requests.get(
"https://api.imagemcpserver.com/auth/user-data",
headers={"Authorization": f"Bearer {os.environ['IMAGEMCP_API_KEY']}"},
timeout=30,
)
print(res.json()){
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_user_info",
"arguments": {}
}
}Response
Response fields
| Field | Type | Description |
|---|---|---|
user._id | string | Account identifier. |
user.name | string | Display name on the account. |
user.email | string | Account email address. |
user.credits | number | Credits currently available to spend. |
user.plan | "free" | "starter" | "pro" | "business" | Active subscription plan. |
user.provider | "google" | "github" | "local" | How the account signs in. |
user.planValidity | string | null | ISO date the current paid plan runs until. |
{
"user": {
"_id": "6712c0f4a91b4c2f9d0e5a31",
"name": "Alex Rivera",
"email": "alex@example.com",
"profilePicture": "https://lh3.googleusercontent.com/a/...",
"provider": "google",
"credits": 2500,
"plan": "pro",
"planValidity": "2026-09-12T00:00:00.000Z",
"billingCycle": "monthly",
"createdAt": "2026-01-15T08:30:00.000Z"
}
}When it fails
success: false with a message. See errors & troubleshooting for the status codes and whether a retry is worth it.FAQ
Does checking my credit balance cost credits?
No. Both /auth/user-data and /playground/models are free to call and never deduct credits.
Can an agent read the balance before generating images?
Yes — that is the intended pattern. Call the get_user_info tool first, compare user.credits against the cost of the work you are about to queue, and stop early if the balance is short.