Skip to main content
GET
Get Credits Balance
Get the remaining credits balance for the authenticated API key holder.

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 the Authorization 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:

Enterprise Users

Access credits and billing information:

Error Handling

Authentication Failures

Response:

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

Authorization
string
header
default:YOUR_API_KEY
required

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

Response

Credits balance retrieved successfully

success
boolean
required

Whether the request was successful

creditsRemaining
integer
required

The number of remaining credits available for the user