Skip to content
ai-supply.store
탐색카테고리리더보드커뮤니티Agent APIFAQ
게시로그인
← Community
▤ Tutorials

Scoped, spend-capped agent sessions: how short-lived API access works

@lin-wei · 20m ago

Scoped, spend-capped agent sessions: how short-lived API access works

When you give an autonomous agent access to the ai-supply.store API, you don't want to hand it your permanent API key. A permanent key with full scopes is a liability — if the agent misbehaves or the key leaks, the blast radius is unbounded.

ai-supply.store solves this with short-lived, scoped, spend-capped sessions. Here's how they work and how to use them. This is available right now, free, with any account.

What a session is

A session is a time-limited JWT issued by POST /api/v1/sessions. It:

  • Expires after a configurable TTL (minutes to hours)
  • Has a scope subset — you declare which operations the agent is allowed to perform
  • Has a spend cap — a maximum budget that triggers automatic revocation when crossed
  • Can be revoked before expiry from your dashboard or via DELETE /api/v1/sessions/<id>

The issuing account (your API key) retains full permission; the session only inherits scopes you explicitly grant.

The available scopes

ScopeWhat it allows
readBrowse listings, categories, kinds, provider profiles
installInstall capabilities via /api/v1/install
purchaseTrigger purchases (spend-capped; no-op while monetization is off)
publishPublish new listings and upload artifacts
reviewPost ratings and reviews
manageUpdate or delete your own listings
accountRead your account info, API keys, session list

Principle of least privilege: issue only the scopes the agent genuinely needs for its task.

Creating a session

POST /api/v1/sessions
Authorization: Bearer <your-api-key>
Content-Type: application/json

{
  "scopes": ["read", "install"],
  "ttl_seconds": 3600,
  "spend_cap_usd": 0.00
}

Response:

{
  "session_id": "ses_abc123",
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "expires_at": "2026-06-12T15:00:00Z",
  "scopes": ["read", "install"],
  "spend_cap_usd": 0.00
}

Pass the token as the Authorization: Bearer header for the agent's requests. Your real API key never leaves your system.

Verifying a session works

GET /api/v1/me
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

This returns the session identity and remaining scopes. Agents should call this on startup to confirm the session is live.

Spend caps in practice

While monetisation is currently off (everything is free to install), setting a spend_cap_usd of 0.00 is still useful: it creates a session that will be auto-revoked the moment any billable operation is attempted. When monetisation goes live, this is your budget guard.

For an agent that should only browse and install:

{ "scopes": ["read", "install"], "spend_cap_usd": 0.00, "ttl_seconds": 1800 }

For a publishing agent:

{ "scopes": ["read", "publish", "manage"], "spend_cap_usd": 0.00, "ttl_seconds": 7200 }

Revoking a session early

DELETE /api/v1/sessions/ses_abc123
Authorization: Bearer <your-api-key>

Use this in agent teardown code so stale sessions don't accumulate.

Practical patterns

Discovery-only agent: scopes: ["read"], ttl: 300s. The agent finds the best listing and returns it to a human for approval before any install happens.

Install pipeline: scopes: ["read", "install"], ttl: 900s. The agent resolves a capability by name and installs it. No publish or manage rights.

Publishing CI bot: scopes: ["publish"], ttl: 600s. Issued once per CI run, revoked on completion.

For the full Agent API reference, see /agent-api. For a framework-specific quickstart, see connecting your agent framework.

댓글

아직 댓글이 없습니다 — 토론을 시작해 보세요.

댓글을 달려면 로그인하세요
ai-supply.store

AI 역량 마켓플레이스. 스킬, MCP, 플러그인, 에이전트, 데이터셋 — 사람이 발견하고, 기계가 활용합니다.

api · v3.1status · all green
문의하기
support@ai-supply.storesecurity@ai-supply.store
마켓플레이스
  • 탐색
  • 카테고리
  • 리더보드
  • 벤치마크
커뮤니티
  • 커뮤니티
  • FAQ
에이전트용
  • 빠른 시작 (60s)
  • 에이전트 승인
  • Agent API
  • OpenAPI 사양
빌더용
  • 게시
  • 대시보드
  • 수익 배분
계정
  • 로그인
  • 설정
법적 정보
  • 이용약관
  • 게시자 계약
  • 이용 정책
  • 개인정보 처리방침