Skip to main content

Replace object


Replace object

Base URLs:

  • https://api.novita.ai

POST Replace object

POST /v3/async/replace-object

Replace unwanted objects, defects, people to target as your wish. The returned images can be access by https://novita.ai/reference/task/task.htmlopen in new window endpoint with parameter 'task_id'.

Request header parameters

  • AuthorizationstringRequired

    In Bearer {{Key}} format.

  • Content-TypestringRequired

    Only application/json supported

Request Body parameters

  • image_filestringRequired

    The base64 of original image, with a maximum resolution of 16 megapixels and a max file size of 30 Mb.

  • promptstringRequired

    Positive prompt word, length [1, 512], divided by ,

  • extraobject

    Extra info.

    Show properties
  • negative_promptstringRequired

    Negtive prompt word, length [0, 512], divided by ,

  • object_promptstringRequired

    The prompt of the object to be replaced, used to specify the object, length [1, 512], divided by ,

Responses

  • task_idstring

Example

This API helps to replace unwanted objects, defects, people to target as your wish.

Please set the Content-Type header to application/json in your HTTP request to indicate that you are sending JSON data. Currently, only JSON format is supported.

Try it in playgroundopen in new window.

Request:

curl --location --request POST 'https://api.novita.ai/v3/async/replace-object' \
--header 'Authorization: Bearer {{key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "negative_prompt": "ng_deepnegative_v1_75t, (badhandv4:1.2), (worst quality:2), (low quality:2), (normal quality:2), lowres, bad anatomy, bad hands, ((monochrome)), ((grayscale)) watermark, moles",
    "prompt": "a dog",
    "object_prompt": "1girl",
    "image_file": "{{Base64 encoded image}}"
}'

Response:

{
    "task_id": "d4b2b68f-fd45-41b7-a095-a563e9d3405f"
}

Use task_id to get images

HTTP status codes in the 2xx range indicate that the request has been successfully accepted, while status codes in the 5xx range indicate internal server errors.

You can get images url in imgs.image_url of response.

Request:

curl --location --request GET 'https://api.novita.ai/v3/async/task-result?task_id=d4b2b68f-fd45-41b7-a095-a563e9d3405f' \
--header 'Authorization: Bearer {{key}}'

Response:

{
    "task": {
        "task_id": "d4b2b68f-fd45-41b7-a095-a563e9d3405f",
        "status": "TASK_STATUS_SUCCEED",
        "reason": ""
    },
    "images": [
        {
            "image_url": "https://faas-output-image.s3.*****",
            "image_url_ttl": "3600",
            "image_type": "jpeg"
        }
    ]
}
novita.ai API
novita.ai API