Skip to content

Asynchronous Get Image Safety Score

API Endpoint

https://api.steamdata.cloud.cubicnode.com/service-api/image-moderation/get-image-score-async

This endpoint is used to submit an image for detection and returns the safety score of the image.

API Call Instructions

  • The recommended file size for images is less than 5MB (the maximum size depends on the corresponding service resources)
  • Recommended image resolution is greater than 512x512
  • Recommended image formats are jpeg, png, webp
  • Upload must use form-data format and POST method

Request Method

POST

Request Parameters

Parameter NameParameter TypeIs RequiredParameter validation rulesParameter Description
imagefileYesThe image name can only contain letters, numbers, underscores, hyphens, and periods, and the length cannot exceed 128 charactersThe image to be detected
callback_urlstringYesMust have a valid A or AAAA recordReceive information callback address. All results generated during the review process are sent to this address
marker_idstringYesCan only contain letters, numbers, underscores, hyphens, and cannot exceed 255 charactersIdentify id, identify the request, and the corresponding identification id will be returned in the callback
  • When an error occurs in the response of callback_url, a backoff algorithm will be used to retry up to 5 times, with the interval between each retry being number of retries * 5 seconds.

Request Example

POST /service-api/image-moderation/get-image-score-async HTTP/1.1

Request Headers:
    Host: api.safeimages.com
    Accept: */*
    Authorization: SD1-HMAC-SHA256 Credential=012345ABCDEFGHJKLNMOPQRSTU/20240101/ap-east-1/service/sd1_request,SignedHeaders=host;x-sd-api-version;x-sd-datetime,Signature=1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
    Content-Type: multipart/form-data; boundary=-----------------xxxxxxxxxxxxxxxxx
    X-SD-Instance-Id: 12345678-1234-1234-1234-123456789012
    X-SD-Api-Version: 1.0
    X-SD-Datetime: 20240101T173850Z
    ...

Request Body:
    image: <image>
    callback_url: https://example.com/callback
    marker_id: 12345678-1234-1234-1234-123456789012

Response Example

json
{
    "code": "00000",
    "message": "Request successful",
    "data": {}
}

Callback Request Example

json
{
    "message": "success",
    "code": 00000,
    "data": {
        "marker_id": "12345678-1234-1234-1234-123456789012",
        "safe_score": 0.90,
        "unsafe_score": 0.10
    }
}