Image Recognition
HTTP Method: POST
API Endpoint
http://api.open.tuputech.com/v3/recognition/your_secretId
NOTE: 'your_secretId' need to be replaced by your own secretId, please contact Tuputech to create a secretId.
Request Method:
POST
Request Header:
Content-Type: multipart/form-data
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
image | String or File | Yes | 1. Support adding image URL or uploading image file. However, one request only supports one type of image inputting. Image URL and image file cannot appear in one request. 2. Support uploading multiple images at a time. 3. Only supports static image file formats like png, jpg, jpeg, tif, webp. For animated image file formats like gif, see Video Recognition. 4. To speed up the transmission, the size of an image to be uploaded should be smaller than 1 MB. It is suggested that images be compressed until the longest side of the image is between 256 and 512 pixels. |
timestamp | String | Yes | The current UNIX timestamp of the server (can be displayed in both seconds and milliseconds). |
nonce | String | Yes | Random number. It is recommended to use decimal number between 0 and 1, for example 0.1527317095951506. |
signature | String | Yes | The algorithm used for digital signature is "RSA-SHA256" , and the signature will be base64 encoded. Please follow the steps below for authentication: 1. All the parameters involving in the authentication process are secretId, timestamp, and nounce. Separate them with half-width comma, obtain sign string. 2. Use your private key to generate signature based on "RSA-SHA256" algorithm, encode in base64 , and obtain value of signature parameter.See Public Key Management to learn how to generate private key and upload your public key for authentication. |
tag | String | No | Additional description of image or text moderated (such as room ID, streamers’ user ID) used for specific image or text searching. 1. Support multiple tag parameters. Each tag parameter corresponds to each image or text parameter. 2. If the number of tag parameters is less than the one of image and text, it will complement with the last uploaded tag. |
referer | String | No | During the image downloading from URLs, it is assigned to HTTP Header Referer for anti-leech. |
task | String | No | Use this parameter to run specific tasks in the API based on different task ID, for example: 54bcfc6c329af61034f7c2fc. Without this parameter, all the tasks in the API will be performed. |
QPS Limits
- maximum 50 queries per second
- maximum 10 images per query
To increase concurrency, please contact Tuputech team.
Sample curl request
For one image
curl -X POST --header 'Content-Type: multipart/form-data' \
-F 'image=@your_image_file_path_or_url' \
-F 'timestamp=1553249299' \
-F 'nonce=0.04708760756305974' \
-F 'signature=your_signature' \
'http://api.open.tuputech.com/v3/recognition/your_secret_id'
For multiple images
curl -X POST --header 'Content-Type: multipart/form-data' \
-F 'image=@your_image_file_path_or_url_0' \
-F 'image=@your_image_file_path_or_url_1' \
-F 'timestamp=1553249299' \
-F 'nonce=0.04708760756305974' \
-F 'signature=your_signature' \
'http://api.open.tuputech.com/v3/recognition/your_secret_id'
Sample curl request for specific task
- Only run pornography detection task
curl -X POST --header 'Content-Type: multipart/form-data' \
-F 'image=@your_image_file_path_or_url' \
-F 'timestamp=1553249299' \
-F 'task=54bcfc6c329af61034f7c2fc' \
-F 'nonce=0.04708760756305974' \
-F 'signature=your_signature' \
'http://api.open.tuputech.com/v3/recognition/your_secret_id'
- Only run task for pornography and violence detection
curl -X POST --header 'Content-Type: multipart/form-data' \
-F 'image=@your_image_file_path_or_url' \
-F 'timestamp=1553249299' \
-F 'task=54bcfc6c329af61034f7c2fc' \
-F 'task=5e1d70adeec2874f7318dc52' \
-F 'nonce=0.04708760756305974' \
-F 'signature=your_signature' \
'http://api.open.tuputech.com/v3/recognition/your_secret_id'