API Documentation
Generate beautiful OG images programmatically using our API
Authentication
All API requests require an API key. You can generate API keys in your account settings.
Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEYEndpoints
Generate Image
POST /api/generateGenerate an image from any URL. Returns both a text version (with title, author, avatar) and a raw background version.
Request Body
{ "url": "https://whisper-api.com"}Response
{ "success": true, "url": "https://images.ogherro.com/b6ae44e7-1ec0-42b4-8fa3-128400a517ee.png", "rawUrl": "https://images.ogherro.com/da87c29b-32e1-4ffc-8d90-4bfaf25a73a0.png", "creditsRemaining": 45}Parameters
url(required) - The URL to generate an image for- Must be a valid HTTP/HTTPS URL
- Must be publicly accessible
Response Fields
url- Image with title, author, and avatar overlayrawUrl- Raw background image without textcreditsRemaining- Credits remaining in your account
Example Usage
const response = await fetch("https://og-herro.com/api/generate", { method: "POST", headers: { "Content-Type": "application/json", Authorization: "Bearer YOUR_API_KEY", }, body: JSON.stringify({ url: "https://whisper-api.com", }),});
const data = await response.json();console.log("Image URL:", data.url);console.log("Raw Image URL:", data.rawUrl);Error Handling
402 - Insufficient Credits
You don’t have enough credits to generate an image. Purchase more credits or wait for your plan to reset.
400 - Invalid URL
The provided URL is not valid or not accessible. Make sure the URL is:
- A valid HTTP/HTTPS URL
- Publicly accessible
- Returns a valid HTML response
Rate Limiting
API requests are rate limited to prevent abuse:
- API Key: 10 requests per 60 seconds
- Authenticated User: 5 requests per 60 seconds
Rate limit information is included in response headers.
Image Versions
Each generation returns two image versions:
With Text (url)
- Includes title extracted from the page
- Shows author name
- Displays author avatar (if available)
- Perfect for social media sharing
Raw Background (rawUrl)
- Background image only
- No text or overlays
- Great for custom designs or further processing
Best Practices
- Cache results - Store generated images to avoid regenerating the same URL
- Handle errors gracefully - Implement retry logic for transient failures
- Monitor credits - Check
creditsRemainingto avoid running out of credits - Use appropriate version - Choose between text or raw based on your use case