Skip to main content
POST
/
v1
/
shorten
Shorten Prompt
curl --request POST \
  --url https://api.legnext.ai/api/v1/shorten \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "prompt": "<string>",
  "callback": "<string>"
}
'
Analyze and simplify a prompt to its most essential elements using /shorten

Endpoint

POST https://api.legnext.ai/api/v1/shorten

Headers

HeaderTypeRequiredDescription
x-api-keystringYesYour API key

Request Body

ParameterTypeRequiredDescription
promptstringYesThe prompt to analyze and shorten (1-8192 characters)
callbackstringNoCallback URL for task completion notifications

Example Request

curl -X POST "https://api.legnext.ai/api/v1/shorten" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A cyberpunk hacker workspace filled with holographic screens, glowing code streams, mechanical keyboards, neon reflections, cables and circuit boards everywhere, volumetric lighting, ultra-detailed sci-fi aesthetic, cinematic atmosphere, inspired by Ghost in the Shell and Blade Runner, rendered in octane, 8k resolution --ar 21:9 --v 7 --style raw --q 2",
    "callback": "https://webhook.site/your-webhook-id"
  }'

Response

Returns a task object containing the task information.
{
    "job_id": "48833d7a-d588-4ad9-897b-25e1ea9edff7",
    "model": "midjourney",
    "task_type": "shorten",
    "status": "completed",
    "config": {
        "service_mode": "public",
        "webhook_config": {
            "endpoint": "",
            "secret": ""
        }
    },
    "input": null,
    "output": {
        "promptEn": "A cyberpunk hacker workspace filled with holographic screens, glowing code streams, mechanical keyboards, neon reflections, cables and circuit boards everywhere, volumetric lighting, ultra-detailed sci-fi aesthetic, cinematic atmosphere, inspired by Ghost in the Shell and Blade Runner, rendered in octane, 8k resolution --ar 21:9 --v 7 --style raw --q 2",
        "description": "/shorten A cyberpunk hacker workspace filled with holographic screens, glowing code streams, mechanical keyboards, neon reflections, cables and circuit boards everywhere, volumetric lighting, ultra-detailed sci-fi aesthetic, cinematic atmosphere, inspired by Ghost in the Shell and Blade Runner, rendered in octane, 8k resolution --ar 21:9 --v 7 --style raw --q 2",
        "finalPrompt": "## Important tokens\nA **cyberpunk** **hacker** **workspace** **filled** with **holographic** **screens**, glowing ~~code~~ streams, mechanical keyboards, **neon** ~~reflections~~, ~~cables~~ and circuit ~~boards~~ everywhere, volumetric ~~lighting~~, ~~ultra~~-detailed sci-fi aesthetic, ~~cinematic~~ ~~atmosphere~~, inspired by **Ghost in the Shell** and **Blade Runner**, rendered in ~~octane~~, **8k** resolution\n## Shortened prompts\n1️⃣ cyberpunk hacker workspace filled with holographic screens, mechanical keyboards, neon, detailed sci, aesthetic, inspired by Ghost in the Shell and Blade Runner, rendered, 8k\n\n2️⃣ cyberpunk hacker workspace filled with holographic screens, mechanical, neon, sci, inspired by Ghost in the Shell and Blade Runner, 8k\n\n3️⃣ cyberpunk hacker workspace filled with holographic screens, neon, Ghost in the Shell and Blade Runner, 8k\n\n4️⃣ cyberpunk hacker workspace, holographic, neon, Ghost in the Shell and Blade Runner\n\n5️⃣ cyberpunk, workspace, Ghost in the Shell and Blade Runner",
        "prompts": [
            "cyberpunk hacker workspace filled with holographic screens, mechanical keyboards, neon, detailed sci, aesthetic, inspired by Ghost in the Shell and Blade Runner, rendered, 8k",
            "cyberpunk hacker workspace filled with holographic screens, mechanical, neon, sci, inspired by Ghost in the Shell and Blade Runner, 8k",
            "cyberpunk hacker workspace filled with holographic screens, neon, Ghost in the Shell and Blade Runner, 8k",
            "cyberpunk hacker workspace, holographic, neon, Ghost in the Shell and Blade Runner",
            "cyberpunk, workspace, Ghost in the Shell and Blade Runner"
        ]
    },
    "meta": {
        "created_at": "2025-10-14T03:11:37Z",
        "started_at": "2025-10-14T03:11:37Z",
        "ended_at": "2025-10-14T03:11:42Z",
        "usage": {
            "type": "point",
            "frozen": 20,
            "consume": 20
        }
    },
    "detail": null,
    "logs": [],
    "error": {
        "code": 0,
        "raw_message": "",
        "message": "",
        "detail": null
    }
}

Authorizations

x-api-key
string
header
required

API key for authentication

Body

application/json
prompt
string
required

Prompt to shorten

Required string length: 1 - 8192
callback
string<uri>

Callback URL for task completion notifications

Response

200

Shortening task created successfully