v1 · Random API
Random Number API
Generate a random number inside your chosen range.
Simple random integers for games, testing, giveaways, and application logic.
Random values support giveaways, simulations, games, sampling, test fixtures, and application logic. This API turns that common requirement into a documented request with a bounded result, helping teams avoid rebuilding and validating the same range-handling logic across multiple services.
Paid usage is intended for applications that need a dependable endpoint, predictable responses, centralized usage controls, and clear failure behavior. Instead of owning another small service, a team can integrate once and add capacity to the same key as traffic grows.
THE INTEGRATION CONTRACT
Everything behaves the way a developer expects.
Random Number API uses a small HTTP surface, header-based authentication, documented inputs, structured JSON responses, explicit status codes, and usage information returned with successful requests.
- Method and endpoint
- GET /api/v1/random-number/generate/
Send parameters in the query string when the API supports them. No client library or proprietary SDK is required.
- Authentication
- X-API-Key request header
Keys are scoped to one API product. Store the key server-side and include it with every API and balance request.
- Successful response
- HTTP 200 · application/json
The response contains the generated result and
credits_remaining, allowing the calling application to monitor usage. - Usage accounting
- 1 credit per successful request
Invalid, unauthorized, unavailable, and rate-limited calls do not deduct credits. Balance checks are always free.
REQUEST LIFECYCLE
From key to response in four predictable steps.
- 01Validate access
CodeCobra hashes the supplied key and confirms that it belongs to this API and has not been revoked.
- 02Check limits
The service evaluates the key’s per-minute and daily request windows before consuming usage.
- 03Run the API
The documented parameters are validated and the API produces its result through the published endpoint.
- 04Record usage
A successful call is logged, credits are deducted atomically, and the remaining balance is returned.
BUILT FOR REAL APPLICATIONS
Simple does not mean vague.
Authentication failures, exhausted balances, rate limits, and maintenance states each use a distinct HTTP status and machine-readable error code. Your application can decide whether to correct a request, add credits, retry later, or alert an operator.
The same key works for API calls, balance checks, and future credit purchases. There is no account session or SDK state to synchronize.