Graine AI

Get the calling account

Return the account behind this API key.

Return the account behind this API key.

Five fields deserve a word, because each of them is easy to read wrongly:

  • concurrency.max is min(org_limit, agent_limit). The per-agent limit only holds calls back when it is below the organisation's limit.
  • concurrency.enforced says whether the limits hold calls back at all. When it is false nothing is held back, so the numbers above it are informational.
  • concurrency.current is the live count of calls holding a line. If it cannot be read just then it reports 0 rather than failing the request.
  • wallet.balance is always computed as allocated minus spent.
  • wallet.uses_parent_credits is true for a sub-account that runs on its parent organization's credits. Its calls are then charged to the parent's balance, so wallet.balance (its own wallet) can read zero while it calls; wallet.spent_this_month and wallet.monthly_limit say where it stands.

Errors: 401 (invalid key), 403 (wrong organization), 429 (rate limited), 503 (account details could not be read; retry).

Rate limit: 2000 requests per minute per organization, counted together with every endpoint that has no stricter limit of its own. Exceeding it returns 429 with Retry-After; the X-RateLimit-* response headers report your remaining allowance on every call.

GET
/v2/user/me
/v2/user/me

The Authorization access token

Authorization

Authorization
Required
Bearer <token>

Your Graine API key. Create one in the dashboard under Developers, or via POST /v2/api-keys. Send it as Authorization: Bearer <key>.

In: header

Query Parameters

organization_idOrganization Id

Optional. Must equal the API key's own organization; any other value is rejected.

Response Body

200

Identity, plan, concurrency capacity, wallet balance and rate limits.

organization_id
Required
Organization Id

The organization the calling key belongs to.

developer
Required
Developer

Who this key belongs to.

plan
Required
Plan

Commercial plan the organization is on.

rate_limit_tier
Required
Rate Limit Tier

Tier the request ceilings are drawn from.

concurrency
Required
Concurrency

Simultaneous-call capacity, and how much of it is in use.

wallet
Required
Wallet

Prepaid credit balance.

rate_limits
Required
Rate Limits

Request ceilings applied to this organization.

401

1100 — missing, unknown or inactive API key. 1101 — a browser session token was presented instead of an API key.

error
Required
Error

Stable integer code from the /v2 error table. Branch on this.

message
Required
Message

One human-readable sentence. Wording may change; the code will not.

403

1102 — the key is valid but lacks the scope this endpoint requires, or names another organization. GET /v2/scopes reports what a key holds.

error
Required
Error

Stable integer code from the /v2 error table. Branch on this.

message
Required
Message

One human-readable sentence. Wording may change; the code will not.

422

1001 — the body or query failed validation; the message names the first offending field.

error
Required
integer

Stable integer code from the error table. Branch on this, not on the message.

message
Required
string

One human-readable sentence. Wording may change; the code will not.

429

1300 — the per-organization request rate or concurrent-call limit was reached. Carries Retry-After.

error
Required
Error

Stable integer code from the /v2 error table. Branch on this.

message
Required
Message

One human-readable sentence. Wording may change; the code will not.

503

1501 — a service this endpoint depends on is unreachable or returned a 5xx.

error
Required
Error

Stable integer code from the /v2 error table. Branch on this.

message
Required
Message

One human-readable sentence. Wording may change; the code will not.

curl -X GET "https://api.graine.ai/v2/user/me?organization_id=string" \
  -H "Authorization: Bearer <token>"

Identity, plan, concurrency capacity, wallet balance and rate limits.

{
  "organization_id": "string",
  "developer": {
    "id": "dev_1a2b3c4d5e6f7a8b",
    "name": "Production integration",
    "key_id": "key_1a2b3c4d5e6f7890",
    "key_preview": "gat_exampleK...6Yc1"
  },
  "plan": "growth",
  "rate_limit_tier": "growth",
  "concurrency": {
    "max": 5,
    "current": 3,
    "agent_max": 5,
    "global_max": 20,
    "enforced": true
  },
  "wallet": {
    "currency": "USD",
    "balance": 912.673829,
    "allocated_total": 1999.5,
    "lifetime_allocated": 1999.5,
    "total_spent": 1086.826171,
    "uses_parent_credits": false,
    "monthly_limit": 500,
    "spent_this_month": 123.456789
  },
  "rate_limits": {
    "default_per_minute": 1000,
    "calls_per_minute": 600,
    "executions_per_minute": 600
  }
}