API Endpoint
- URL:
https://logo.droplinked.workers.dev/ - Method:
POST - Content-Type:
application/json
Authentication
An API key is required for access. Contact Droplinked support to obtain your API key. Include it in the request headers as follows:- Header:
api-key - Value:
<YOUR_API_KEY>(provided by Droplinked)
Request Format
The API accepts a JSON payload with the following field:Request Body
| Field | Type | Required | Description |
|---|---|---|---|
description | String | Yes | A brief or detailed description of the company or shop. |
Example Request Body
Response Format
- Content-Type:
application/json - Response: A JSON object containing:
base64_image: A base64-encoded string of the generated logo image.generated_prompt: The text prompt used to create the image.
Example Response
Guidelines for Logo Generation
The API operates as follows:- Prompt Generation:
- Internally calls a service (bound as
env.ratatatata) with the"logo_prompt"command and the provideddescription. - Generates a concise text prompt capturing the brand’s identity and style.
- Internally calls a service (bound as
- Image Generation:
- Uses the Flux.1 Schnell model (
@cf/black-forest-labs/flux-1-schnell). - Fixed dimensions: 1024x1024 pixels.
- Uses the Flux.1 Schnell model (
- Output:
- Returns the base64-encoded image and the prompt used.
- CORS-enabled for cross-origin requests.
JavaScript Example
Below is an example of how to use the Logo Image Generator API in JavaScript with thefetch API, including rendering the image:
Error Handling
The API provides JSON error responses with CORS headers:- 405 Method Not Allowed: If the request method isn’t
POST.- Example:
{ "error": "Method not allowed" }
- Example:
- 401 Unauthorized: If the API key is missing.
- Example:
{ "error": "API key is required in headers as 'api-key'" }
- Example:
- 400 Bad Request: If
descriptionis missing.- Example:
{ "error": "Description is required" }
- Example:
- 500 Internal Server Error: If prompt generation or image creation fails.
- Example:
{ "error": "Failed to generate image" }
- Example:
- 503 Service Unavailable: If the internal text-tad worker is unreachable.
- Example:
{ "error": "Failed to connect to text-tad worker", "details": "..." }
- Example:
Example Error Output
Best Practices
- Description Quality: Provide a detailed description with brand name, style, and key traits for optimal logo output.
- Image Rendering: Decode the
base64_imageclient-side to display or save the logo (e.g., as PNG). - CORS: The API supports cross-origin requests, making it versatile for web applications.
- Error Handling: Check response status and parse errors to manage failures gracefully.
Worker Code Insights
- CORS: Configured with permissive headers (
Access-Control-Allow-Origin: *) for broad compatibility. - Service Binding: Uses
env.ratatatatato fetch the logo prompt internally, passing the API key and description. - Image Model: Employs Flux.1 Schnell for high-quality, fast logo generation at 1024x1024.
- Debugging: Includes console logs for diagnostics (e.g., environment binding checks).