Get Credits Balance
API Reference
Get Credits Balance
Check the remaining credits balance for your API key.
GET
Get Credits Balance
Get the remaining credits balance for the authenticated API key holder.
Response:
Overview
- Use Cases: Monitor credit usage, check balance before making requests
- Processing Time: Instant
- Response: JSON object with creditsRemaining count
Endpoint
Headers
Parameters
No request body required. Authentication is via theAuthorization header.
Example Request
Response
Success Response
Error Response - Missing Context
Error Response - Server Error
Credit Costs
Code Examples
cURL
Python
JavaScript/Node.js
TypeScript
Use Cases
Before Making Expensive Requests
Check your balance before initiating a spec request:Monitor Credit Usage
Track credit consumption over time:Dashboard Access
Solo Users
View your credits balance via the dashboard:- URL: https://pre.dev/projects/key
- Shows your remaining credits
- Option to purchase additional credits
Enterprise Users
Access credits and billing information:- URL: https://pre.dev/enterprise/dashboard?page=api
- View organization-wide credit usage
- Manage team API keys and quotas
Error Handling
Authentication Failures
Network Issues
Implement retry logic with exponential backoff:Best Practices
Regular Monitoring
- Check balance before making expensive spec requests
- Implement alerts when credits fall below a threshold
- Monitor credit usage patterns to plan purchases
Integration Patterns
- Cache balance checks (don’t call on every request)
- Update cache every 5-10 minutes
- Use for decision logic in your application
Error Handling
- Always handle network failures gracefully
- Implement retry logic for transient errors
- Provide meaningful error messages to users
HTTP Status Codes
Architect API Overview
View all available API endpoints.
Authorizations
API key for authentication. Get your API key from https://pre.dev/projects/key (Solo) or https://pre.dev/enterprise/dashboard?page=api (Enterprise). Use format: Bearer YOUR_API_KEY

