Base URL
The API is available at:Request format
All POST requests should include aContent-Type: application/json header and send data as JSON in the request body.
Response format
API responses are returned in JSON format with appropriate HTTP status codes.Success response
Error response
Available endpoints
README generation
POST /api/generate
Generate a professional README file for a GitHub repository using AI.
Credit management
GET /api/credits
Retrieve the authenticated user’s current credit balance.
POST /api/credits
Update the user’s credit balance (admin use).
README history
GET /api/readme-history
Fetch all READMEs generated by the authenticated user.
POST /api/readme-history
Save a generated README to the user’s history.
Payment processing
POST /api/create-checkout-session
Create a Stripe checkout session for purchasing credits.
POST /api/verify-payment
Verify a completed Stripe payment and add credits.
Error handling
The API uses standard HTTP status codes to indicate success or failure:| Status Code | Description |
|---|---|
200 | Request successful |
400 | Bad request - invalid parameters or repository URL |
401 | Unauthorized - authentication required |
402 | Payment required - insufficient credits |
429 | Too many requests - server is busy |
500 | Server error - something went wrong |
When you receive a 429 status code, the response may include a
queuePosition field indicating your position in the generation queue.Rate limiting
To ensure service stability, GitRead implements a request queue system:- Maximum queue size: 20 concurrent requests
- Requests beyond this limit receive a 429 error
- Queue position is returned when your request is queued
If the server is busy, wait a few moments before retrying your request.
Repository limits
When generating READMEs, repositories must meet these constraints:- Maximum input tokens: 900,000
- Maximum file size: Varies by repository
- Maximum total size: Varies by repository
- Maximum directory depth: Limited
These limits are returned in the API response when exceeded, along with the specific constraint that was violated.