Skip to main content

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
  • Segmind Workflow Submission:
    • With Logo: https://api.segmind.com/workflows/67792f3899c1698a193130be-v2
    • Without Logo: https://api.segmind.com/workflows/67d66d953fccc7a19c84cfa1-v1
    • Method: POST
  • Segmind Polling:
    • URL: https://api.segmind.com/workflows/request/[request_id]
    • Method: GET
  • Content-Type: application/json

Authentication

This API requires two API keys:
  1. For Prompt Generation (via text-tad.droplinked.workers.dev):
    • Header: api-key
    • Value: <YOUR_API_KEY> (provided by Droplinked).
  2. For Segmind API (via api.segmind.com):
    • Header: x-api-key
    • Value: <YOUR_SEGMIND_API_KEY> (your Segmind account API key).
Contact Droplinked support at support@droplinked.com to obtain these API keys.

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
FieldTypeRequiredDescription
command_nameStringYesMust be set to "banner_prompt".
descriptionStringYesA brief or detailed description of the company.
categoryStringYesThe company’s category (e.g., “technology”).
Example Request Body
{
  "command_name": "banner_prompt",
  "description": "droplinked , we are a company offering web3 based and onchain solution to businesses and indivisuals .",
  "category": "technology"
}
Response A JSON object containing the generated prompt. Example Response
{"success":true,"output":"A futuristic digital node amidst circuit patterns and geometric shapes, symbolizing seamless connectivity and innovative web3 solutions."}

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
FieldTypeRequiredDescription
input_descriptionStringYesThe generated banner prompt from Step 1.
input_seedStringYesA seed value for generation (e.g., “1”).
input_logoStringYesURL of the logo image to include in the banner.
Example Request Body
{
  "input_description": "A blockchain node radiates energy amidst a grid of interconnected circuits, symbolizing seamless web3 connectivity",
  "input_seed": "1",
  "input_logo": "https://upload-file-droplinked.s3.amazonaws.com/860b369c4ceefd8b643713e955f487423b080e424cda8379ff0860c4bd92395f_small.jpg"
}
Endpoint
  • URL: https://api.segmind.com/workflows/67792f3899c1698a193130be-v2
Option 2: Banner Without Logo Request Body
FieldTypeRequiredDescription
input_descriptionStringYesThe generated banner prompt from Step 1.
input_seedStringYesA seed value for generation (e.g., “1”).
Example Request Body
{
  "input_description": "A blockchain node radiates energy amidst a grid of interconnected circuits, symbolizing seamless web3 connectivity",
  "input_seed": "1"
}
Endpoint
  • URL: https://api.segmind.com/workflows/67d66d953fccc7a19c84cfa1-v1
Response (Both Options) A JSON object with a polling URL and request ID. Example Response
{
  "message": "Your request with this id 68fe486045f6afa20e521094f20192ab currently in queue. Please be patient while we process it.",
  "poll_url": "https://api.segmind.com/workflows/request/68fe486045f6afa20e521094f20192ab",
  "request_id": "68fe486045f6afa20e521094f20192ab",
  "status": "QUEUED"
}

Step 3: Poll for Final Image URL

Use the poll_url from Step 2 to check the status and retrieve the final image URL. Request
  • Method: GET
  • URL: The poll_url from the Step 2 response (e.g., https://api.segmind.com/workflows/request/68fe486045f6afa20e521094f20192ab).
  • Headers: Include the Segmind API key (x-api-key).
Response A JSON object with the status and final image URL once completed. Example Response
{
  "output": "[{\"keyname\": \"output_banner\", \"value\": {\"data\": \"https://images.segmind.com/outputs/dbeae453-9a69-4622-83bf-8f4bd52eba49.png\", \"type\": \"image\"}}]",
  "status": "COMPLETED"
}

JavaScript Example

Below is an example of how to use the Segmind Banner Generation API in JavaScript with the fetch API, supporting both banner options:
// Step 1: Generate the banner prompt
const promptHeaders = new Headers();
promptHeaders.append("Content-Type", "application/json");
promptHeaders.append("api-key", "<YOUR_API_KEY>"); // Replace with your API key

const promptRaw = JSON.stringify({
  "command_name": "banner_prompt",
  "description": "droplinked , we are a company offering web3 based and onchain solution to businesses and indivisuals .",
  "category": "technology"
});

const promptRequestOptions = {
  method: "POST",
  headers: promptHeaders,
  body: promptRaw,
  redirect: "follow"
};

fetch("https://text-tad.droplinked.workers.dev/", promptRequestOptions)
  .then((response) => response.json())
  .then((promptResult) => {
    const bannerPrompt = promptResult.output;

    // Step 2: Submit to Segmind (Option: With Logo)
    const segmindHeaders = new Headers();
    segmindHeaders.append("x-api-key", "<YOUR_SEGMIND_API_KEY>"); // Replace with your Segmind API key
    segmindHeaders.append("Content-Type", "application/json");

    const segmindRaw = JSON.stringify({
      "input_description": bannerPrompt,
      "input_seed": "1",
      "input_logo": "https://upload-file-droplinked.s3.amazonaws.com/860b369c4ceefd8b643713e955f487423b080e424cda8379ff0860c4bd92395f_small.jpg"
    });

    const segmindRequestOptions = {
      method: "POST",
      headers: segmindHeaders,
      body: segmindRaw,
      redirect: "follow"
    };

    // Change the URL for "Without Logo" option if needed
    const segmindUrl = "https://api.segmind.com/workflows/67792f3899c1698a193130be-v2"; // Use 67d66d953fccc7a19c84cfa1-v1 for "Without Logo"

    return fetch(segmindUrl, segmindRequestOptions)
      .then((response) => response.json())
      .then((segmindResult) => {
        const pollUrl = segmindResult.poll_url;

        // Step 3: Poll for the final image URL
        const pollHeaders = new Headers();
        pollHeaders.append("x-api-key", "<YOUR_SEGMIND_API_KEY>");

        const pollRequestOptions = {
          method: "GET",
          headers: pollHeaders,
          redirect: "follow"
        };

        // Polling loop
        const pollForResult = () => {
          fetch(pollUrl, pollRequestOptions)
            .then((pollResponse) => pollResponse.json())
            .then((pollResult) => {
              if (pollResult.status === "COMPLETED") {
                const output = JSON.parse(pollResult.output);
                const imageUrl = output[0].value.data;
                console.log("Final Banner URL:", imageUrl);

                // Display the banner
                const imgElement = document.createElement("img");
                imgElement.src = imageUrl;
                document.body.appendChild(imgElement);
              } else {
                console.log("Still processing, status:", pollResult.status);
                setTimeout(pollForResult, 5000); // Retry after 5 seconds
              }
            })
            .catch((error) => console.error("Polling Error:", error));
        };

        pollForResult();
      });
  })
  .catch((error) => console.error("Prompt Generation Error:", error));

Error Handling

  • Prompt Generation Errors:
    • Invalid API Key: Returns “Unauthorized”.
    • Missing Fields: If command_name, description, or category is missing, an error may occur.
  • Segmind Submission Errors:
    • 401 Unauthorized: If the Segmind API key is invalid.
    • 400 Bad Request: If input_description or input_seed is missing (or input_logo for the “With Logo” option).
  • Polling Errors:
    • 404 Not Found: If the request_id is invalid.
    • 503 Service Unavailable: If Segmind is down.

Example Error Output (Segmind Submission)

{"error":"Invalid API key"}

Best Practices

  1. Input Quality: Provide a detailed description and relevant category for optimal banner prompts.
  2. Logo URL: For the “With Logo” option, ensure the input_logo URL is accessible and points to a valid image.
  3. Polling Strategy: Use a reasonable polling interval (e.g., 5-10 seconds) to avoid overloading the Segmind API.
  4. Error Handling: Implement retry logic for polling to handle transient failures.

Support

For assistance or to request API keys (for either the prompt generation or Segmind API), contact Droplinked support at support@droplinked.com. Provide details such as your use case and expected request volume.