OG Image Generator
No credit card required
OG Image Generator
No credit card required
OG Image Generator is a tool that lets you dynamically create OG images from your HTML templates via an API. The tool is flexible, allowing you to use the default template or create fully custom templates.
You can access the OG Image Generator programmatically from your own applications by using the Apify API. You can choose the language preference from below. To use the Apify API, you’ll need an Apify account and your API token, found in Integrations settings in Apify Console.
1# Set API token
2API_TOKEN=<YOUR_API_TOKEN>
3
4# Prepare Actor input
5cat > input.json << 'EOF'
6{
7 "html": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <script src=\"https://cdn.tailwindcss.com\"></script>\n</head>\n<body class=\"bg-gray-100 text-gray-900 flex items-center justify-center h-screen\">\n\n <!-- OG Image Container -->\n <div class=\"relative bg-white w-[1200px] h-[630px] rounded-lg shadow-xl border border-gray-200 overflow-hidden\">\n \n <!-- Background Accent -->\n <div class=\"absolute inset-0 bg-gradient-to-r from-indigo-100 via-pink-100 to-yellow-100 opacity-50\"></div>\n\n <!-- Logo -->\n <div class=\"absolute bottom-6 left-6\">\n <img src=\"{{logoUrl}}\" alt=\"Blog Logo\" class=\"h-10\">\n </div>\n\n <!-- Content Wrapper -->\n <div class=\"relative flex flex-col h-full p-16\">\n \n <!-- Blog Category -->\n <div class=\"text-base uppercase tracking-wider text-indigo-500 font-semibold mb-6\">{{category}}</div>\n \n <!-- Blog Title -->\n <h1 class=\"text-6xl font-bold leading-tight text-gray-800 mb-8\">{{title}}</h1>\n \n <!-- Author and Date -->\n <div class=\"flex items-center space-x-6 text-gray-600 text-xl\">\n <div class=\"flex items-center space-x-3\">\n <img class=\"w-12 h-12 rounded-full\" src=\"{{authorImage}}\" alt=\"{{author}}\">\n <span>{{author}}</span>\n </div>\n <span>•</span>\n <span>{{date}}</span>\n </div>\n </div>\n </div>\n\n</body>\n</html>\n",
8 "templateData": {
9 "category": "Technology",
10 "title": "How to create dynamic OG title for your web",
11 "logoUrl": "https://w7.pngwing.com/pngs/243/698/png-transparent-apify-logo-tech-companies.png",
12 "date": "January 3, 2025",
13 "author": "Daniil Poletaev",
14 "authorImage": "https://images.apifyusercontent.com/rO00zibE4A243KKKW3pwsdT-IXjgOFWuA2s4RJV_7VM/rs:fill:70:70/aHR0cHM6Ly9saDMuZ29vZ2xldXNlcmNvbnRlbnQuY29tL2EvQUNnOG9jSWRPZ1QxMHAxblVSbGhKZUswSlZUdXpLZzJmVWN6MkEtNGZka1hwVWRSX1NtOVFSZw"
15 }
16}
17EOF
18
19# Run the Actor using an HTTP API
20# See the full API reference at https://docs.apify.com/api/v2
21curl "https://api.apify.com/v2/acts/daniil.poletaev~og-image-generator/runs?token=$API_TOKEN" \
22 -X POST \
23 -d @input.json \
24 -H 'Content-Type: application/json'
OG Image Generator API
Below, you can find a list of relevant HTTP API endpoints for calling the OG Image Generator Actor. For this, you’ll need an Apify account. Replace <YOUR_API_TOKEN> in the URLs with your Apify API token, which you can find under Integrations in Apify Console. For details, see the API reference .
Run Actor
https://api.apify.com/v2/acts/daniil.poletaev~og-image-generator/runs?token=<YOUR_API_TOKEN>
Note: By adding the method=POST
query parameter, this API endpoint can be called using a GET request and thus used in third-party webhooks. Please refer to our Run Actor API documentation .
Run Actor synchronously and get dataset items
https://api.apify.com/v2/acts/daniil.poletaev~og-image-generator/run-sync-get-dataset-items?token=<YOUR_API_TOKEN>
Note: This endpoint supports both POST and GET request methods. However, only the POST method allows you to pass input data. For more information, please refer to our Run Actor synchronously and get dataset items API documentation .
Get Actor
https://api.apify.com/v2/acts/daniil.poletaev~og-image-generator?token=<YOUR_API_TOKEN>
For more information, please refer to our Get Actor API documentation .
Actors can be used to scrape web pages, extract data, or automate browser tasks. Use the OG Image Generator API programmatically via the Apify API.
You can choose from:
You can start OG Image Generator with the Apify API by sending an HTTP POST request to the Run Actor endpoint. An Actor’s input and its content type can be passed as a payload of the POST request, and additional options can be specified using URL query parameters. The OG Image Generator is identified within the API by its ID, which is the creator’s username and the name of the Actor.
When the OG Image Generator run finishes you can list the data from its default dataset (storage) via the API or you can preview the data directly on Apify Console .
Actor Metrics
1 monthly user
-
0 No stars yet
>99% runs succeeded
Created in Jan 2025
Modified 4 days ago