Docs
Image Editing API

Image Editing API

Documentation on our cost-friendly, state-of-the-art Image Editing API!

GoAPI now offers Remove backgroud, Segment with prompt, Super resolution(Upscale) API for you to integrate into your app!


Pricing

This API is will be pay-as-you-go for all users, see details: Image Editing API | PPU Quota | Endpoint Usage.



Create API

This is a unified task creation endpoint for all Image Editing API, including FaceSwap, Remove backgroud, Segment with prompt and Super resolution(Upscale).

POST

https://api.goapi.ai/api/image_toolkit/v2/create

All in one task creation api for image editing.

Parameters:

Header
NameTypeRequiredDescription
X-API-Keystring✔️Your GoAPI Key used for request authorization
Body
NameTypeRequiredDescription
task_typestring✔️face_swap, background_remove, segment or upscale
result_typestring✔️url is the default value
task_inputjson✔️task data json based on task type, see docs for specific endpoint

Response Codes:

200: OK
Successful Response
400: Bad Request
The request format does not meet the requirements.
401: Unauthorized
The API key is incorrect
500: Internal Server Error
Service is experiencing an error

Task Type List

TypeDescription
background_removecheck Remove Background API
segmentcheck Segment With Prompt API
upscalecheck Super Resolution API
face_swapTBD

Request Example


curl --location 'https://api.goapi.ai/api/image_toolkit/v2/create' \
--header 'X-API-KEY: {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data '{
    "task_type": "upscale",
    "result_type": "url",
    "task_input": {
        "image": "https://example.com/cat.jpg",
        "scale": 2
    }
}'

Response Example


{
    "code": 200,
    "data": {
        "task_id": "40307027-c713-4314-9c29-49e7f591733c", //important for retriving task result using Fetch API
        "task_type": "upscale",
        "status": "success", 
        "task_info": {
            "created_at": "2024-03-19T09:38:59.975840Z",
            "started_at": "2024-03-19T01:39:40.428051Z",
            "completed_at": "2024-03-19T01:39:42.688459Z",
            "frozen_credits": 0,
            "task_input": {
                "scale": 2,
                "image": "https://example/cat.jpg"
            }
        },
        "task_result": {
            "used_credits": 0,
            "error_messages": [],
            "task_output": {
                "image_base64": "",
                "image_url": "https://img.midjourneyapi.xyz/temp/c8dd89d1-1d5f-47e1-8649-9.png"
            }
        }
    },
    "message": "success"
}


Fetch API

In most scenarios you will need a fetch call to retrive the task result, using task_id.

POST

https://api.goapi.ai/api/image_toolkit/v2/fetch

Retrive task result using task_id.

Parameters:

Header
NameTypeRequiredDescription
X-API-Keystring✔️Your GoAPI Key used for request authorization
Body
NameTypeRequiredDescription
task_idstring✔️your task_id

Response Codes:

200: OK
Successful Response
400: Bad Request
The request format does not meet the requirements.
401: Unauthorized
The API key is incorrect
500: Internal Server Error
Service is experiencing an error

Request Example


curl --location 'https://api.goapi.ai/api/image_toolkit/v2/fetch' \
--header 'X-API-KEY: {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data '{
    "task_id": "82e0210d-0121-4eba-91d2-3c55333d79ee"
}'

Response Example


Same as Image Editing API Response

Status List

Statusdescription
pendingthe task is in wait queue of GoAPI
startingthe task is beginning to procceed
processingrendering the task
successtask finished
failedtask failed
retrythis usually happens if your image url is hard to download