MarketIntell

Auth API

User registration and API key management

Auth API

Manage API keys. These endpoints handle self-service signup, key info retrieval, and full CRUD operations on API keys. Admin routes require the admin scope; the signup endpoint is public.


POST /v1/auth/signup

Create a free-tier API key (public, no auth required). Rate limited to 3 signups per IP per hour.

Request Body

FieldTypeRequiredDescription
namestringYesYour name (1–128 characters)
emailstringNoEmail address (for key ownership tracking)

Request

curl -X POST https://api.marketintell.ai/v1/auth/signup \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Your Name",
    "email": "[email protected]"
  }'

Response

{
  "success": true,
  "data": {
    "key": "mi_k_abc123def456...",
    "id": "clx...",
    "name": "signup:Your Name",
    "key_prefix": "mi_k_abc1...",
    "scopes": ["read", "chat"],
    "rate_limit": 10,
    "tier": "free",
    "daily_query_limit": 20,
    "_message": "Save this API key — it will not be shown again."
  }
}

Save your API key immediately — it is only returned once at signup. Free-tier keys are limited to 20 queries/day and 10 requests/minute.


GET /v1/auth/me

Get the current API key's info and daily quota. Requires admin scope.

Request

curl https://api.marketintell.ai/v1/auth/me \
  -H "X-API-Key: YOUR_API_KEY"

Response

{
  "success": true,
  "data": {
    "key": {
      "id": "clx...",
      "name": "signup:Your Name",
      "key_prefix": "mi_k_abc1...",
      "scopes": ["read", "chat"],
      "rate_limit": 10,
      "owner": "[email protected]",
      "expires_at": null,
      "last_used_at": "2025-01-15T14:30:00.000Z",
      "is_active": true,
      "created_at": "2025-01-15T10:00:00.000Z",
      "tier": "free"
    },
    "quota": {
      "tier": "free",
      "daily_queries_used": 12,
      "daily_queries_remaining": 8,
      "daily_queries_limit": 20
    }
  }
}

POST /v1/auth/keys

Create a new API key with specific scopes. Requires admin scope (unless in bootstrap mode — see below).

Bootstrap Mode

If no API keys exist in the database, the first key can be created without authentication. The first key is automatically granted admin scope regardless of what you request.

Request Body

FieldTypeRequiredDescription
namestringYesA descriptive name (1–128 characters)
scopesstring[]NoPermission scopes (defaults to ["read"])
ownerstringNoOwner identifier (max 128 characters)
rate_limitnumberNoPer-key rate limit override (requests/minute)
expires_atstringNoExpiration as ISO 8601 datetime

Request

curl -X POST https://api.marketintell.ai/v1/auth/keys \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "name": "Read-only Dashboard",
    "scopes": ["read", "chat"]
  }'

Response

{
  "success": true,
  "data": {
    "key": "mi_k_xyz789...",
    "id": "clx...",
    "name": "Read-only Dashboard",
    "key_prefix": "mi_k_xyz7...",
    "scopes": ["read", "chat"],
    "rate_limit": null,
    "owner": null,
    "expires_at": null,
    "created_at": "2025-01-15T12:00:00.000Z"
  }
}

The full key value is only returned at creation time. Store it securely.


GET /v1/auth/keys

List all API keys (paginated). Requires admin scope.

Query Parameters

ParameterTypeDefaultDescription
pagenumber1Page number
limitnumber20Items per page (max 100)
include_revokedstring"false"Include revoked keys ("true" / "false")
ownerstring—Filter by owner

Request

curl "https://api.marketintell.ai/v1/auth/keys?page=1&limit=20" \
  -H "X-API-Key: YOUR_API_KEY"

Response

{
  "success": true,
  "data": {
    "keys": [
      {
        "id": "clx...",
        "name": "Default Admin",
        "key_prefix": "mi_k_abc1...",
        "scopes": ["admin"],
        "rate_limit": null,
        "owner": "[email protected]",
        "expires_at": null,
        "last_used_at": "2025-01-15T14:30:00.000Z",
        "is_active": true,
        "created_at": "2025-01-15T10:00:00.000Z",
        "revoked_at": null
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 20,
      "total": 1,
      "total_pages": 1
    }
  }
}

GET /v1/auth/keys/:id

Get details for a specific API key. Requires admin scope.

Path Parameters

ParameterTypeDescription
idstringThe key ID

Request

curl https://api.marketintell.ai/v1/auth/keys/KEY_ID \
  -H "X-API-Key: YOUR_API_KEY"

Response

{
  "success": true,
  "data": {
    "key": {
      "id": "clx...",
      "name": "Read-only Dashboard",
      "key_prefix": "mi_k_xyz7...",
      "scopes": ["read", "chat"],
      "rate_limit": null,
      "owner": null,
      "expires_at": null,
      "last_used_at": null,
      "is_active": true,
      "created_at": "2025-01-15T12:00:00.000Z",
      "revoked_at": null
    }
  }
}

PATCH /v1/auth/keys/:id

Update an API key's name, scopes, rate limit, or expiration. Requires admin scope.

Path Parameters

ParameterTypeDescription
idstringThe key ID

Request Body

FieldTypeRequiredDescription
namestringNoUpdated name (1–128 characters)
scopesstring[]NoUpdated scopes (at least one required if provided)
rate_limitnumber | nullNoUpdated rate limit override (requests/minute)
expires_atstring | nullNoUpdated expiration (ISO 8601 datetime, or null to remove)

Request

curl -X PATCH https://api.marketintell.ai/v1/auth/keys/KEY_ID \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "name": "Dashboard Key",
    "scopes": ["read", "chat", "alpha"]
  }'

Response

{
  "success": true,
  "data": {
    "key": {
      "id": "clx...",
      "name": "Dashboard Key",
      "key_prefix": "mi_k_xyz7...",
      "scopes": ["read", "chat", "alpha"],
      "rate_limit": null,
      "owner": null,
      "expires_at": null,
      "last_used_at": null,
      "is_active": true,
      "created_at": "2025-01-15T12:00:00.000Z",
      "revoked_at": null
    }
  }
}

DELETE /v1/auth/keys/:id

Revoke an API key. This immediately invalidates the key. Requires admin scope.

Path Parameters

ParameterTypeDescription
idstringThe key ID

Request

curl -X DELETE https://api.marketintell.ai/v1/auth/keys/KEY_ID \
  -H "X-API-Key: YOUR_API_KEY"

Response

{
  "success": true,
  "data": {
    "id": "clx...",
    "revoked": true,
    "message": "API key has been revoked"
  }
}

Revoking a key is permanent. Any service using this key will immediately lose access.


GET /v1/auth/keys/:id/usage

Get usage statistics for a specific API key. Requires admin scope.

Path Parameters

ParameterTypeDescription
idstringThe key ID

Query Parameters

ParameterTypeDefaultDescription
daysnumber30Number of days of history (max 365)

Request

curl "https://api.marketintell.ai/v1/auth/keys/KEY_ID/usage?days=7" \
  -H "X-API-Key: YOUR_API_KEY"

Response

{
  "success": true,
  "data": {
    "key_id": "clx...",
    "key_name": "signup:Your Name",
    "period_days": 7
  }
}

GET /v1/auth/usage

Get global usage summary across all API keys. Requires admin scope.

Query Parameters

ParameterTypeDefaultDescription
daysnumber30Number of days of history (max 365)

Request

curl "https://api.marketintell.ai/v1/auth/usage?days=30" \
  -H "X-API-Key: YOUR_API_KEY"

Response

{
  "success": true,
  "data": {
    "period_days": 30
  }
}

Valid Scopes

ScopeDescription
readRead access to data endpoints
writeWrite/modify data
adminFull administrative access (required for key management)
alphaAccess alpha signals and scans
agentsCreate and manage autonomous agents
chatAccess to the Chat API
webhooksManage webhook subscriptions

Scopes by Tier

TierScopesRate LimitDaily Queries
Freeread, chat10 req/min20
Proread, chat, alpha, webhooks60 req/min500
EnterpriseAll scopes300 req/minUnlimited

On this page