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>"
}
'
{
  "code": 400,
  "message": "Invalid request parameters",
  "raw_message": "Invalid request parameters",
  "detail": null
}

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": "pending",
    "config": {
        "service_mode": "public",
        "webhook_config": {
            "endpoint": "",
            "secret": ""
        }
    },
    "input": null,
    "output": {
        "promptEn": "",
        "description": "",
        "finalPrompt": "",
        "prompts": []
    },
    "meta": {
        "created_at": "",
        "started_at": "",
        "ended_at": "",
        "usage": {
            "type": "point",
            "frozen": 20,
            "consume": 0
        }
    },
    "detail": null,
    "logs": [],
    "error": {
        "code": 0,
        "raw_message": "",
        "message": "",
        "detail": null
    }
}
This is the initial success response. Use the job_id to check the task status via the Get Task endpoint to retrieve the completed result with shortened prompts.

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

Shortening task created successfully