Skip to main content
POST
/
v1
/
remove-background
Remove Background
curl --request POST \
  --url https://api.legnext.ai/api/v1/remove-background \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "imgUrl": "<string>",
  "callback": "<string>"
}
'
Automatically remove backgrounds from any image, creating clean cutouts with transparent backgrounds.

Endpoint

POST https://api.legnext.ai/api/v1/remove-background

Headers

HeaderTypeRequiredDescription
x-api-keystringYesYour API key

Request Body

ParameterTypeRequiredDescription
imgUrlstringYesURL of the image to process (max length: 1024 characters)
callbackstringNoCallback URL for task completion notifications

Example Request

curl -X POST "https://api.legnext.ai/api/v1/remove-background" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "imgUrl": "https://example.com/image.jpg",
    "callback": "https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d"
  }'

Response

Returns a task object containing the task information.
{
    "job_id": "e5a2e10b-d982-4af6-8d91-bb62f6355f36",
    "model": "midjourney",
    "task_type": "remove_background",
    "status": "completed",
    "config": {
        "service_mode": "public",
        "webhook_config": {
            "endpoint": "https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d",
            "secret": ""
        }
    },
    "input": null,
    "output": {
        "image_url": "https://cdn.legnext.ai/temp/1760683584669.png",
        "image_urls": [
            "https://cdn.legnext.ai/temp/1760683584669.png"
        ],
        "seed": "0"
    },
    "meta": {
        "created_at": "2025-10-17T06:46:09Z",
        "started_at": "2025-10-17T06:46:09Z",
        "ended_at": "2025-10-17T06:46:27Z",
        "usage": {
            "type": "point",
            "frozen": 80,
            "consume": 80
        }
    },
    "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
imgUrl
string<uri>
required

URL of the image to process

Maximum string length: 1024
callback
string<uri>

Callback URL for task completion notifications

Response

200

Remove background task created successfully