Overview
The Tank Registry API supports two authentication methods:- API Keys (recommended for CLI and automation)
- Session Cookies (for web browser access)
API Keys
API keys are prefixed withtank_ and provide programmatic access to the registry.
Key Properties
- Format:
tank_followed by random characters - Expiration: Configurable (default 90 days for CLI tokens)
- Rate Limit: Configurable per key (default 1000 requests/day)
- Scopes: Optional permission scopes (e.g.,
skills:publish)
Using API Keys
Include the API key in theAuthorization header:
CLI OAuth Flow
Thetank login command uses a 3-step OAuth flow to obtain an API key.
Step 1: Start OAuth Session
Endpoint:POST /api/v1/cli-auth/start
The CLI initiates authentication by creating a session.
Request
Random state string generated by CLI for CSRF protection
Response
URL for the user to visit in their browser
Unique session identifier for polling
Step 2: User Authorization
Endpoint:POST /api/v1/cli-auth/authorize
The user visits authUrl in their browser, logs in via GitHub OAuth, and authorizes the CLI.
This step is performed in the browser with a session cookie. The CLI does not call this endpoint directly.
Request
Session code from Step 1
Response
Indicates whether authorization succeeded
Step 3: Exchange for API Key
Endpoint:POST /api/v1/cli-auth/exchange
The CLI polls this endpoint until the user completes authorization.
Request
Session code from Step 1
Same state string from Step 1 (CSRF verification)
Response
API key with
tank_ prefix (store securely)User information
OAuth Flow Diagram
Session Lifetime
- Duration: 5 minutes
- One-time use: Session is consumed after successful exchange
- Storage: In-memory store (not persisted)
Error Responses
401 Unauthorized
Missing or invalid API key:403 Forbidden
API key lacks required scope:400 Bad Request
Invalid session during OAuth flow:API Key Scopes
Scopes restrict what an API key can do:| Scope | Permissions |
|---|---|
skills:publish | Publish new skills and versions |
skills:read | Read skill metadata (default for public skills) |
skills:write | Update skill settings |
skills:delete | Delete skills (requires ownership) |
CLI tokens created via OAuth have
skills:publish scope by default.Security Best Practices
- Never commit API keys to version control
- Store keys securely in
~/.tank/config.jsonor environment variables - Rotate keys periodically (default 90-day expiration)
- Use scoped keys for automation (grant minimum required permissions)
- Revoke compromised keys immediately via the dashboard
Managing API Keys
Create and manage API keys in the API Keys section:- View active keys
- Create service account keys
- Revoke keys
- Set custom expiration and rate limits
Next Steps
Skills API
Publish and download skills
Search API
Search the skill registry