rankion.ai
API

Account Meta API

Current user, team switch, profile updates, token management — account-specific endpoints.

The account meta API delivers the account and team master data every frontend needs at bootstrap — current team, credits balance, dashboard KPIs, and (admin only) internal API cost reports. All endpoints are Sanctum-authenticated and team-scoped.

Endpoints

Method Endpoint Description Credits
GET /v1/team Current team of the authenticated user — name, slug, owner, member count, plan
GET /v1/credits Current credits balance {balance, period_start, period_end, plan}
GET /v1/credits/history Paginated credit ledger (?per_page=50)
GET /v1/dashboard Aggregated dashboard payload — KPIs, recent activity, quick actions
GET /v1/admin/api-costs External provider costs per endpoint — admin only

/v1/team

Returns the current team. Team switch happens in the frontend via session cookie — the API itself always reads the currently selected team from $request->user()->currentTeam().

curl "$BASE/team" -H "Authorization: Bearer $TOKEN"
{
  "data": {
    "id": 3,
    "name": "Acme GmbH",
    "slug": "acme-gmbh",
    "owner_id": 12,
    "member_count": 4,
    "plan": "pro",
    "created_at": "2025-11-04T10:22:13Z"
  }
}

/v1/credits

Shows credits balance including billing period. Detailed transaction history with spending patterns is available via the dedicated credits endpoint — see Credits API.

curl "$BASE/credits" -H "Authorization: Bearer $TOKEN"
{
  "data": {
    "balance": 4823,
    "plan": "pro",
    "period_start": "2026-04-01T00:00:00Z",
    "period_end": "2026-04-30T23:59:59Z",
    "auto_topup": false
  }
}

GET /v1/credits/history paginates the individual consumption events with endpoint, credits_used, created_at.

/v1/dashboard

Aggregated bootstrap payload for the dashboard UI. Contains:

  • headline_kpis — AVI score, top-10 keyword count, new backlinks, site audit score
  • recent_activity — last 10 events team-wide (article generated, audit completed, ...)
  • quick_actions — high-priority tasks suggested by the action center

A single round-trip instead of 5 separate calls — that is why the endpoint exists.

curl "$BASE/dashboard" -H "Authorization: Bearer $TOKEN" | jq .data.headline_kpis

/v1/admin/api-costs

Admin only — returns the cost-tracking table for external providers (OpenAI, Anthropic, ScraperAPI, DataForSEO, Resend ...). Users without the admin role get 403 Forbidden.

curl "$BASE/admin/api-costs?from=2026-04-01&to=2026-04-30" \
  -H "Authorization: Bearer $TOKEN"

Response:

{
  "data": [
    { "provider": "anthropic", "model": "claude-opus-4-7",
      "calls": 1842, "input_tokens": 4_120_000, "output_tokens": 980_000,
      "usd_cost": 184.32 },
    { "provider": "scraperapi",
      "calls": 9211, "usd_cost": 27.63 }
  ],
  "totals": { "usd_cost": 312.84, "credits_billed": 12_400 }
}

Token management

API tokens are created in the UI under /settings/api-tokens — the HTTP interface for that lives in the auth module (login/logout/token issue). Details: Auth API.

Rule of thumb:

  • Personal access token — manually created in the UI, long lifetime, scope = current team.
  • OAuth token — for third-party integrations, shorter TTL, refresh flow.

Tokens are not rotated through the account meta endpoints — use the auth endpoints for that.

Pitfalls

  • currentTeam() is cookie-driven. If a user is in multiple teams, switch in the frontend first (/teams/switch) before reading /v1/team.
  • /dashboard is not cached. For frequent polling, add a client cache with ~30 s TTL.
  • /admin/api-costs is raw. The columns are the internal provider cost entries — credit conversion happens separately in the billing layer.
  • Plan limits do not leak through /team. Read quota details (max projects, max articles) via the plan endpoint in the auth module.

Related: Auth API · Credits API · Projects API.

Letzte Aktualisierung: May 1, 2026

Cookies: We use necessary cookies for functionality and optional ones for improvements. Details

Necessary
Active
Analytics
Marketing