Overview
The Segmind Banner Generation API generates a banner image by first creating a text prompt using the existing Banner Prompt Generator, then submitting it to Segmind’s API for image generation. It offers two options: a banner with a logo or a banner without a logo. The process concludes with polling for the final image URL, making this tool ideal for creating professional, web3-themed banners for businesses.API Endpoints
- Prompt Generation:
- URL:
https://text-tad.droplinked.workers.dev/ - Method:
POST
- URL:
- Segmind Workflow Submission:
- With Logo:
https://api.segmind.com/workflows/67792f3899c1698a193130be-v2 - Without Logo:
https://api.segmind.com/workflows/67d66d953fccc7a19c84cfa1-v1 - Method:
POST
- With Logo:
- Segmind Polling:
- URL:
https://api.segmind.com/workflows/request/[request_id] - Method:
GET
- URL:
- Content-Type:
application/json
Authentication
This API requires two API keys:- For Prompt Generation (via
text-tad.droplinked.workers.dev):- Header:
api-key - Value:
<YOUR_API_KEY>(provided by Droplinked).
- Header:
- For Segmind API (via
api.segmind.com):- Header:
x-api-key - Value:
<YOUR_SEGMIND_API_KEY>(your Segmind account API key).
- Header:
Request Format
The process involves three steps:Step 1: Generate Banner Prompt
This step uses the existing Banner Prompt Generator API to create a text prompt. Request Body
Example Request Body
Step 2: Submit to Segmind Workflow
Submit the generated prompt to Segmind’s API to start banner generation. There are two options: with a logo or without a logo. Option 1: Banner With Logo Request Body
Example Request Body
- URL:
https://api.segmind.com/workflows/67792f3899c1698a193130be-v2
Example Request Body
- URL:
https://api.segmind.com/workflows/67d66d953fccc7a19c84cfa1-v1
Step 3: Poll for Final Image URL
Use thepoll_url from Step 2 to check the status and retrieve the final image URL.
Request
- Method:
GET - URL: The
poll_urlfrom the Step 2 response (e.g.,https://api.segmind.com/workflows/request/68fe486045f6afa20e521094f20192ab). - Headers: Include the Segmind API key (
x-api-key).
JavaScript Example
Below is an example of how to use the Segmind Banner Generation API in JavaScript with thefetch API, supporting both banner options:
Error Handling
- Prompt Generation Errors:
- Invalid API Key: Returns “Unauthorized”.
- Missing Fields: If
command_name,description, orcategoryis missing, an error may occur.
- Segmind Submission Errors:
- 401 Unauthorized: If the Segmind API key is invalid.
- 400 Bad Request: If
input_descriptionorinput_seedis missing (orinput_logofor the “With Logo” option).
- Polling Errors:
- 404 Not Found: If the
request_idis invalid. - 503 Service Unavailable: If Segmind is down.
- 404 Not Found: If the
Example Error Output (Segmind Submission)
Best Practices
- Input Quality: Provide a detailed
descriptionand relevantcategoryfor optimal banner prompts. - Logo URL: For the “With Logo” option, ensure the
input_logoURL is accessible and points to a valid image. - Polling Strategy: Use a reasonable polling interval (e.g., 5-10 seconds) to avoid overloading the Segmind API.
- Error Handling: Implement retry logic for polling to handle transient failures.