API Reference
Spritz provides a comprehensive REST API for interacting with the platform programmatically.
Base URL
https://app.spritz.chat/api
Authentication
Most endpoints require authentication via Sign-In with Ethereum (SIWE/SIWS). Sessions are managed via HTTP-only cookies.
Quick Start Authentication
// 1. Get a pre-formatted SIWE message with nonce from the server
const { message, nonce } = await fetch(
`https://app.spritz.chat/api/auth/verify?address=${walletAddress}`, {
credentials: 'include',
}).then(r => r.json());
// 2. Sign the message with the wallet
const signature = await wallet.signMessage(message);
// 3. Verify signature and create session
await fetch('https://app.spritz.chat/api/auth/verify', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'include', // Required for cookies
body: JSON.stringify({ address: walletAddress, message, signature }),
});
// 4. Make authenticated requests (session cookie sent automatically)
const agents = await fetch('https://app.spritz.chat/api/agents', {
credentials: 'include',
}).then(r => r.json());
The server generates a standard SIWE message for you. The GET request to /api/auth/verify?address=... returns both the pre-formatted message string and the nonce. You sign the message as-is and send it back for verification.
Spritz uses HTTP-only session cookies for security. Always include credentials: 'include' in your fetch requests.
For server-to-server requests, you can also use the Authorization header:
Authorization: Bearer <session_token>
Rate Limiting
API requests are rate-limited to prevent abuse using Upstash Redis. Limits are tiered by endpoint type:
| Tier | Limit | Used For |
|---|---|---|
| auth | 10/min | Login, registration, session endpoints |
| strict | 5/min | Sensitive operations (invites, points, streams) |
| contact | 3/min | Contact form submissions |
| ai | 30/min | AI agent chat endpoints |
| messaging | 60/min | Real-time messaging operations |
| general | 100/min | Default for other endpoints |
Rate limit headers are included in responses:
X-RateLimit-Limit: Maximum requests allowedX-RateLimit-Remaining: Remaining requestsX-RateLimit-Reset: Unix timestamp when limit resetsRetry-After: Seconds until you can retry (on 429 errors)
Response Format
All API responses follow a consistent format:
Success Response
{
"success": true,
"data": { ... }
}
Error Response
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message"
}
}
Common Error Codes
| Code | Description |
|---|---|
UNAUTHORIZED | Authentication required |
FORBIDDEN | Insufficient permissions |
NOT_FOUND | Resource not found |
VALIDATION_ERROR | Invalid request data |
RATE_LIMIT_EXCEEDED | Too many requests |
INTERNAL_ERROR | Server error |
For a complete list of error codes with troubleshooting guidance, see the Error Reference.
API Endpoints
Agents
GET /api/agents- List agentsPOST /api/agents- Create agentGET /api/agents/:id- Get agentDELETE /api/agents/:id- Delete agentPOST /api/agents/:id/chat- Chat with agentGET /api/agents/:id/chat- Get chat historyDELETE /api/agents/:id/chat- Clear chat historyGET /api/agents/:id/knowledge- Get knowledge basePOST /api/agents/:id/knowledge- Add knowledge URLDELETE /api/agents/:id/knowledge- Remove knowledge URLPOST /api/agents/:id/knowledge/index- Index knowledgeGET /api/agents/discover- Discover public agentsGET /api/agents/favorites- Get favorite agentsPOST /api/agents/favorites- Add favoriteDELETE /api/agents/favorites- Remove favoriteGET /api/agents/:id/embed- Get embed code and SDK examplesPOST /api/agents/detect-api- Detect API type (GraphQL/OpenAPI/REST)POST /api/public/agents/:id/chat- Public agent chat (x402)GET /api/public/agents/:id- Get public agent info
Streaming
GET /api/streams- List streamsPOST /api/streams- Create streamGET /api/streams/:id- Get streamDELETE /api/streams/:id- Delete streamGET /api/streams/:id/assets- Get stream recordingsPOST /api/streams/:id/assets- Create stream assetGET /api/streams/:id/chat- Get stream chatPOST /api/streams/:id/chat- Send stream chat messagePOST /api/streams/:id/viewers- Increment viewer countDELETE /api/streams/:id/viewers- Decrement viewer countGET /api/public/streams/:id- Get public stream infoPOST /api/public/streams/:id- Join public streamDELETE /api/public/streams/:id- Leave public stream
Authentication
GET /api/auth/verify?address=...- Get SIWE message and nonce for signingGET /api/auth/verify- Verify SIWE signaturePOST /api/auth/verify- Verify SIWE signatureGET /api/auth/verify-solana- Verify SIWS signaturePOST /api/auth/verify-solana- Verify SIWS signatureGET /api/auth/session- Get current sessionPOST /api/auth/logout- Logout and clear sessionPOST /api/auth/world-id- Verify World ID proofPOST /api/auth/alien-id- Verify Alien ID
Passkey Authentication
POST /api/passkey/register/options- Get registration optionsPOST /api/passkey/register/verify- Verify registrationPOST /api/passkey/login/options- Get login optionsPOST /api/passkey/login/verify- Verify loginGET /api/passkey/credentials- List user's passkeysDELETE /api/passkey/credential- Remove a passkeyPOST /api/passkey/check-migration- Check passkey migration statusPOST /api/passkey/recover/email- Request passkey recovery via emailPOST /api/passkey/recover/email/verify- Verify recovery code and get token
Email Authentication
POST /api/email/send-code- Send email verification codePOST /api/email/verify-code- Verify email codePOST /api/email/login/send-code- Send email login codePOST /api/email/login/verify- Verify email loginPOST /api/email/restore-session- Restore session from email
Wallet
GET /api/wallet/balances?address=0x...- Get token balances (address required)GET /api/wallet/transactions- Get transaction historyPOST /api/wallet/smart-wallet- Get/create smart wallet addressGET /api/wallet/safe-status- Get Safe deployment status across chainsGET /api/wallet/recovery-signer- Get recovery signer statusPOST /api/wallet/recovery-signer- Add recovery signerPOST /api/wallet/onramp/session- Generate Coinbase Onramp session token
Username
GET /api/username?address=0x...- Get username for addressPOST /api/username- Claim or update usernameDELETE /api/username- Remove usernameGET /api/username/resolve?username=name- Resolve username to address
Profile Widgets
GET /api/profile/widgets- Get user's profile widgetsPOST /api/profile/widgets- Create/update profile widgetsGET /api/profile/theme- Get user's profile themePOST /api/profile/theme- Update profile theme
Friends
GET /api/friends- List friends (via Logos Messaging, not API)- Friend requests are handled via Logos Messaging
Channels
GET /api/channels- List channelsPOST /api/channels- Create channelGET /api/channels/:id- Get channelPOST /api/channels/:id/join- Join channelPOST /api/channels/:id/leave- Leave channelGET /api/channels/:id/messages- Get channel messagesPOST /api/channels/:id/messages- Send channel message
Rooms & Calls
POST /api/rooms- Create instant roomGET /api/rooms- List roomsGET /api/rooms/:code- Get roomDELETE /api/rooms/:code- Delete roomPOST /api/rooms/:code/token- Get room tokenGET /api/rooms/permanent- Get permanent roomsGET /api/calls- Get call historyPOST /api/calls- Create call
Scheduling
GET /api/scheduling/list- List scheduled callsPOST /api/scheduling/schedule- Schedule a callPOST /api/scheduling/invite- Invite to scheduled callGET /api/scheduling/availability- Get availabilityGET /api/scheduling/settings- Get scheduling settingsPOST /api/scheduling/settings- Update scheduling settingsPOST /api/scheduling/create-shareable- Create shareable linkGET /api/scheduling/join/:token- Join via tokenPOST /api/scheduling/join/:token- Confirm join
Calendar
GET /api/calendar/connect- Connect Google CalendarGET /api/calendar/callback- OAuth callbackGET /api/calendar/status- Get calendar connection statusGET /api/calendar/availability- Get calendar availabilityPOST /api/calendar/availability- Set availability windowDELETE /api/calendar/availability- Remove availability windowPOST /api/calendar/disconnect- Disconnect calendar
Points & Gamification
GET /api/leaderboard- Get leaderboardGET /api/points- Get user pointsPOST /api/points- Add pointsGET /api/points/daily- Get daily pointsPOST /api/points/daily- Claim daily points
Phone Verification
POST /api/phone/send-code- Send phone verification codePOST /api/phone/verify-code- Verify phone codePOST /api/phone/remove- Remove phone number
Uploads & Media
POST /api/pixel-art/upload- Upload pixel art avatarPOST /api/upload- Upload filePOST /api/bug-reports/upload- Upload media for bug reports
Other Endpoints
POST /api/push/send- Send push notificationGET /api/invites- Get invite codesPOST /api/invites- Redeem invite codePOST /api/contact- Contact form submissionPOST /api/beta-access/apply- Apply for beta accessGET /api/moderation- Get moderation dataGET /api/prices- Get token pricesGET /api/public/user- Get public user infoGET /api/public/user/:address- Get public user info by addressGET /api/public/schedule/:slug- Get public schedulePOST /api/bug-reports- Submit bug reportGET /api/github/issues- List GitHub issues (admin only)GET /api/github/issues/:number- Get GitHub issue (admin only)
Admin Endpoints
GET /api/admin/users- List all users (admin only)GET /api/admin/analytics- Get platform analytics (admin only)GET /api/admin/user-wallets?address=0x...- Get user wallet status across chains (admin only)GET /api/admin/invite-codes- List invite codes (admin only)POST /api/admin/grant-invites- Grant invite codes to user (admin only)GET /api/admin/bug-reports- List bug reports (admin only)POST /api/admin/bug-reports/:id/github- Create GitHub issue from bug report (admin only)
SDKs
Official SDKs are coming soon. For now, use standard HTTP requests.
Examples
Creating an Agent
const response = await fetch('https://app.spritz.chat/api/agents', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`,
},
body: JSON.stringify({
name: 'My Agent',
personality: 'Helpful and friendly',
system_instructions: 'You are a helpful assistant.',
visibility: 'private',
}),
});
const agent = await response.json();
Chatting with an Agent
const response = await fetch(`https://app.spritz.chat/api/agents/${agentId}/chat`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`,
},
body: JSON.stringify({
message: 'Hello!',
}),
});
const chat = await response.json();
Detailed API References
- Agents API - Detailed Reference: Complete agent endpoints
- Streaming API: Livestreaming endpoints
- Error Reference: Complete error code documentation
- Quick Reference: All endpoints overview
A single-file, machine-readable API reference is available at llms.txt. It includes base URL, authentication steps, all major endpoints, request/response patterns, x402 paid agent chat, and links to full documentation so agents can parse and call Spritz APIs correctly.
Next Steps
- Explore Agents API - Detailed Reference
- Check out Streaming API
- Review Error Codes for troubleshooting
- See Quick Reference for all endpoints
- Learn about Architecture