Organizations
Organizations let a team share API keys, pool quota, and view aggregated usage. Every request still uses the same two-key auth model — orgs simply group keys and members under a billing parent.
₹3,999/month). Free and Pro accounts can create personal API keys but cannot create orgs or invite teammates. Upgrade in billing.Authentication
Org management endpoints authenticate with a Supabase access token (the JWT returned from POST /v1/auth/login), not with a mt_live_… proxy key. They mirror the auth model used by key management.
Roles
| Role | Can do |
|---|---|
owner | Everything. Created automatically for the user who calls POST /v1/orgs. Cannot be removed by other members. |
admin | Invite + remove members, view analytics. Cannot remove the owner. |
member | View org details and analytics. Cannot manage members. |
Create an organization
POST /v1/orgs creates a new org and adds the caller as owner. The slug is optional — if omitted, mintoken derives it from name (lowercased, non-word characters stripped, spaces hyphenated, max 50 chars).
curl -X POST https://api.mintoken.in/v1/orgs \
-H "Authorization: Bearer <supabase-jwt>" \
-H "Content-Type: application/json" \
-d '{
"name": "Acme AI",
"slug": "acme-ai"
}'
# Response
# {
# "id": "8a3c…",
# "name": "Acme AI",
# "slug": "acme-ai",
# "owner_id": "…"
# }
Request body
| Field | Type | Notes |
|---|---|---|
name | string | Required. Display name shown in the dashboard. |
slug | string? | Optional. URL-safe identifier. Auto-generated from name if omitted. |
List your organizations
GET /v1/orgs returns every org the caller belongs to, with their role per-org embedded on each row.
curl https://api.mintoken.in/v1/orgs \
-H "Authorization: Bearer <supabase-jwt>"
# Response
# {
# "organizations": [
# {
# "id": "8a3c…",
# "name": "Acme AI",
# "slug": "acme-ai",
# "owner_id": "…",
# "role": "owner"
# }
# ]
# }
Get an organization
GET /v1/orgs/{org_id}returns the org plus its full member list and the caller's role. Returns 403 if the caller is not a member.
curl https://api.mintoken.in/v1/orgs/<org_id> \
-H "Authorization: Bearer <supabase-jwt>"
# Response
# {
# "id": "8a3c…",
# "name": "Acme AI",
# "slug": "acme-ai",
# "owner_id": "…",
# "members": [
# { "user_id": "…", "role": "owner", "joined_at": "2026-04-12T…" },
# { "user_id": "…", "role": "admin", "joined_at": "2026-04-13T…" },
# { "user_id": "…", "role": "member", "joined_at": "2026-04-15T…" }
# ],
# "your_role": "owner"
# }
Invite a member
POST /v1/orgs/{org_id}/members adds an existing mintoken user to the org by email. Requires the caller to be owner or admin.
curl -X POST https://api.mintoken.in/v1/orgs/<org_id>/members \
-H "Authorization: Bearer <supabase-jwt>" \
-H "Content-Type: application/json" \
-d '{
"user_email": "teammate@acme.ai",
"role": "member"
}'
# Response
# {
# "message": "Member added",
# "member": {
# "org_id": "8a3c…",
# "user_id": "…",
# "role": "member"
# }
# }
user_email and returns 404 User not found if no account exists.Request body
| Field | Type | Notes |
|---|---|---|
user_email | string | Required. Email of an existing mintoken user. |
role | string | Defaults to member. Allowed: admin, member. |
Remove a member
DELETE /v1/orgs/{org_id}/members/{user_id} removes a member. Requires owner or admin. The org owner cannot be removed.
curl -X DELETE \
https://api.mintoken.in/v1/orgs/<org_id>/members/<user_id> \
-H "Authorization: Bearer <supabase-jwt>"
# Response
# { "message": "Member removed" }
Organization analytics
GET /v1/orgs/{org_id}/analytics returns aggregated usage across every API key tied to the org. Useful for tracking team-wide spend and savings in one place — see Analytics for the per-key breakdown.
curl https://api.mintoken.in/v1/orgs/<org_id>/analytics \
-H "Authorization: Bearer <supabase-jwt>"
# Response
# {
# "total_requests": 14823,
# "total_output_tokens": 2841902,
# "total_tokens_saved": 6553201
# }
Response fields
| Field | Meaning |
|---|---|
total_requests | Sum of proxy requests across every API key in the org. |
total_output_tokens | Compressed output tokens actually billed by the upstream provider. |
total_tokens_saved | Tokens you would have paid for without mintoken. Uses the real uncompressed baseline where available, otherwise the standard 3.3x ratio estimate. |
Errors
| Status | Meaning |
|---|---|
400 Failed to create organization | Slug collision or invalid input. Try a different name/slug. |
403 Not a member of this organization | The caller's account is not on the org's member list. |
403 Must be owner or admin | Member-management endpoints require an elevated role. |
404 User not found | The invited email doesn't match any mintoken account. Have them sign up first. |
409 User is already a member | The invitee is already on the org. |
400 Cannot remove the organization owner | The owner is permanent. Transfer ownership first if you need to remove them (contact support). |