POST/v1/imagine

Generate Images

Submit a text prompt to Midjourney or Google NanoBanana and receive a task ID. The image generation runs asynchronously — use the /v1/fetch endpoint to check the status and retrieve the result.

💡 Using Google NanoBanana: To route image requests to the NanoBanana model, you must use your Global NanoBanana API Key in the Authorization header. You can find, generate, and copy this key in the Settings page.

Request Body

promptrequired
string
The text prompt for Midjourney. Supports all MJ parameters (--ar, --v, --style, etc.)
reference_image
string
Optional URL of an image to use as a style/content reference. Allowed formats: JPG, JPEG, PNG, WebP.
webhook_url
string
Optional URL to receive a POST callback when the task completes or fails.

Content Policy

🚫 Prompt Validation
Certain prompts are rejected before being sent to Midjourney and return HTTP 400:
{
  "detail": "Your prompt contains a term that violates Midjourney's
             content policy. Please rephrase and try again."
}
This check runs before any Discord API call is made. Prompts are normalized (Unicode NFKD) and checked against a word-boundary blocklist.

Example Request

cURL
curl -X POST https://linkrapi.com/api/v1/imagine \
  -H "Authorization: Bearer lkr_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a futuristic city at sunset, cinematic lighting --ar 16:9",
    "reference_image": "https://example.com/reference.jpg",
    "webhook_url": "https://your-server.com/webhook"
  }'

Response

200 OK
{
  "status": "SUCCESS",
  "task_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "message": "Task submitted successfully"
}
status
string
"SUCCESS" if the task was submitted.
task_id
string
Unique task identifier. Use this with /v1/fetch to get results.
message
string
Human-readable status message.

Advanced: Image Prompting

🎨 Using Reference Images (Image Prompts)
LinkrAPI fully supports Midjourney's native image prompting, with integrated anti-bot protection to keep your Discord tokens completely safe.

How to use: Place a direct URL to an image (.png, .jpg, .webp) at the very beginning of your prompt, followed by a space and your text description.

{"prompt": "https://example.com/photo.jpg a cyberpunk city, neon lights --ar 16:9"}

Status Codes

200Task submitted successfully.
400Invalid request — prompt is empty or missing.
401Invalid or missing API key.
402Insufficient credits — NanoBanana generation requires 4 credits (Single) or 16 credits (Grid).
403Hold account is suspended.
502Failed to connect to Discord. Check your Discord token.
💡 Typical Workflow
1. Call POST /v1/imagine → get task_id
2. Poll GET /v1/fetch/{task_id} every 5-10 seconds
3. When status is completed, get the image_url
4. Optionally, use POST /v1/action to upscale or create variations

Error Handling

⚠️ Midjourney Rejections
If a task returns status: "failed" with a clear error message, it means Midjourney rejected the request. Common reasons include:

Inactive subscription — the Discord account's MJ subscription has expired
Banned keyword — the prompt triggered Midjourney's content filter
Account suspension — the Discord account was banned or restricted

Your client should read the error field from the /v1/fetch response and surface it to the end user.
⚠️ Notes
• Image generation typically takes 30–120 seconds depending on Midjourney load.
• All standard Midjourney prompt parameters are supported (--ar, --v, --style, --chaos, etc.).
• If you provide a webhook_url, we'll POST the result to it when the task completes — no need to poll.