Skip to main content
POST
/
v1
/
understand
/
uploadImg
Image Caption
curl --request POST \
  --url https://security.memories.ai/v1/understand/uploadImg \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data @- <<EOF
{
  "user_prompt": "What's happening in this picture?",
  "url": "https://example.com/test_image.png",
  "urls": [
    "<string>"
  ],
  "system_prompt": "You are an image understanding system.",
  "thinking": false,
  "qa": false,
  "reasoning_effort": "2"
}
EOF
{
  "code": "0000",
  "msg": "success",
  "data": {},
  "success": true,
  "failed": false
}

Prerequisites

  • You’re familiar with the concepts described on the Platform overview.
  • You have acquired for special memories.ai API key.
  • Supported file formats: image/png, image/jpeg.

Host URL

https://security.memories.ai

Endpoints

  • POST /v1/understand/uploadImg – Upload image by URL
  • POST /v1/understand/uploadImgFile – Upload image by local file (multipart form)
  • POST /v1/understand/uploadImgFileBase64 – Upload image by base64 encoding

Request Example 1a (Upload by URL - Single Image)

import requests, json

url = "https://security.memories.ai/v1/understand/uploadImg"
headers = {"Authorization": "<API_KEY>"}
json_body = { 
    "url": "https://example.com/test_image.png", 
    "user_prompt": "What's happening in this picture?", 
    "system_prompt": "You are an image understanding system.", 
    "thinking": False, 
    "qa": False, 
    "reasoning_effort": "2" 
}
response = requests.post(url, headers=headers, json=json_body)
print(response.json())

Request Example 1b (Upload by URL - Multiple Images)

import requests, json

url = "https://security.memories.ai/v1/understand/uploadImg"
headers = {"Authorization": "<API_KEY>"}
json_body = { 
    "urls": [ 
        "https://example.com/test_image1.png", 
        "https://example.com/test_image2.jpg", 
        "https://example.com/test_image3.png" 
    ], 
    "user_prompt": "What's happening in these pictures?", 
    "system_prompt": "You are an image understanding system.", 
    "thinking": False, 
    "qa": False
}
response = requests.post(url, headers=headers, json=json_body)
print(response.json())

Request Example 2a (Upload by Local File - Single Image)

import requests
import json

url = "https://security.memories.ai/v1/understand/uploadImgFile"
headers = {"Authorization": "<API_KEY>"}
data = { 
    "user_prompt": "What's happening in this picture?", 
    "system_prompt": "You are an image understanding system.", 
    "thinking": False, 
    "qa": False, 
    "reasoning_effort": "2"
}
files = [ 
    ("req", ("req.json", json.dumps(data), "application/json")), 
    ('file', ('test.png', open(r"C:\Users\memories\Desktop\test.png", 'rb'), 'image/png')),
]
response = requests.post(url, files=files, headers=headers)
print(response.json())

Request Example 2b (Upload by Local File - Multiple Images)

import requests
import json

url = "https://security.memories.ai/v1/understand/uploadImgFile"
headers = {"Authorization": "<API_KEY>"}
data = { 
    "user_prompt": "What's happening in these pictures?", 
    "system_prompt": "You are an image understanding system.", 
    "thinking": False, 
    "qa": False,
}
files = [ 
    ("req", ("req.json", json.dumps(data), "application/json")), 
    ('file', ('test1.png', open(r"C:\Users\memories\Desktop\test1.png", 'rb'), 'image/png')), 
    ('file', ('test2.jpg', open(r"C:\Users\memories\Desktop\test2.jpg", 'rb'), 'image/jpeg')), 
    ('file', ('test3.png', open(r"C:\Users\memories\Desktop\test3.png", 'rb'), 'image/png')),
]
response = requests.post(url, files=files, headers=headers)
print(response.json())

Request Example 3a (Upload by Local File with base64 encoding)

import requests
import base64

url = "https://security.memories.ai/v1/understand/uploadImgFileBase64"
headers = {"Authorization": "<API_KEY>"}

with open(r"C:\Users\memories\Desktop\test.png", "rb") as f: 
    img_base64 = base64.b64encode(f.read()).decode("utf-8")

data = { 
    "user_prompt": "Describe the image within 10 words.", 
    "image_base64": img_base64, 
    "img_type": "image/png", 
    "thinking": False, 
    "qa": False, 
    "reasoning_effort": "2" 
}
response = requests.post(url, json=data, headers=headers)
print(response.json())

Response Example

{ 
    "code": 0, 
    "msg": "success", 
    "data": { 
        "text": "It shows a person lying on the ground...", 
        "token": { "input": 273, "output": 79, "total": 352 } 
    }
}

Authorizations

Authorization
string
header
required

Body

application/json
user_prompt
string
required
Example:

"What's happening in this picture?"

url
string<uri>
Example:

"https://example.com/test_image.png"

urls
string<uri>[]
system_prompt
string
Example:

"You are an image understanding system."

thinking
boolean
default:false
qa
boolean
default:false
reasoning_effort
string
Example:

"2"

Response

200 - application/json

Successful response

code
Example:

"0000"

msg
string
Example:

"success"

data
success
boolean
Example:

true

failed
boolean
Example:

false