Skip to main content
POST
/
serve
/
api
/
v1
/
upload_img
Upload Image from File
curl --request POST \
  --url https://api.memories.ai/serve/api/v1/upload_img \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'files=<string>' \
  --form unique_id=default \
  --form 'datetime_taken=2025-09-07 22:52:00' \
  --form 'camera_model=Canon EOS 5D' \
  --form latitude=39.9042 \
  --form longitude=116.4074 \
  --form 'tags[0]=test1' \
  --form 'tags[1]=test2' \
  --form files.items='@example-file'
{
  "code": "0000",
  "msg": "success",
  "data": [
    {
      "id": 568102998803353600
    },
    {
      "id": 568102998803353600
    }
  ],
  "success": true,
  "failed": false
}

Documentation Index

Fetch the complete documentation index at: https://api-tools.memories.ai/llms.txt

Use this file to discover all available pages before exploring further.

Prerequisites

  • You’re familiar with the concepts described on the Platform overview.
  • You have created a memories.ai API key.
  • Supported file extensions: .jpg, .jpeg, .png, .gif, .bmp, .webp (case-insensitive). The Content-Type of each file part must start with image/.
  • Max file size: 20 MB per image.
  • Max batch size: Limited by server configuration (the server returns an error message indicating the exact cap if exceeded).

Host URL

https://api.memories.ai

Endpoint

POST /serve/api/v1/upload_img
/serve/api/v1/upload_img

Authentication

Pass your API key in the Authorization request header. Requests without a valid API key are rejected.
Authorization: <API_KEY>

Content Type

The endpoint expects multipart/form-data. The files part must be repeated once per image; all other parameters are sent as form fields (not as JSON).

Request Example

import requests

headers = {"Authorization": "<API_KEY>"}
files = [
    ("files", ("test1.jpg", open(r"test1.jpg", "rb"), "image/jpeg")),
    ("files", ("test2.png", open(r"test2.png", "rb"), "image/png")),
]
data = {
    "unique_id": "default",
    "datetime_taken": "2025-09-07 22:52:00",
    "camera_model": "Canon EOS 5D",
    "latitude": "39.9042",
    "longitude": "116.4074",
    "tags": ["test1", "test2", "test3", "test4", "test5"]
}
response = requests.post(
    "https://api.memories.ai/serve/api/v1/upload_img",
    headers=headers,
    files=files,
    data=data
)
print("Status Code:", response.status_code)
print("Response:", response.text)

Request Parameters

files
file[]
required
One or more image files. Each file must have an extension of .jpg, .jpeg, .png, .gif, .bmp, or .webp (case-insensitive) and a Content-Type starting with image/. Each file must be ≤ 20 MB. The number of files per request is capped by server-side configuration.
unique_id
string
default:"default"
Scope identifier used to group uploads for the authenticated account. Defaults to "default" when omitted.
datetime_taken
string
Capture time of the image in the exact format yyyy-MM-dd HH:mm:ss (e.g. 2025-09-07 22:52:00). Invalid formats are rejected.
camera_model
string
Camera/device model name. Maximum length 200 characters.
latitude
number
Latitude where the image was captured. Must be a valid decimal number (e.g. 39.9042).
longitude
number
Longitude where the image was captured. Must be a valid decimal number (e.g. 116.4074).
tags
array
List of user-defined tags (e.g. ["test1", "test2"]). Maximum 50 tags per request. The server automatically appends an api tag to every upload.

Notes & Limits

  • Rate limiting: The endpoint is protected by a per-account upload rate limit. Exceeding the limit returns an error indicating the request has exceeded the limit.
  • Billing: This endpoint is metered — the cost of the upload is checked and deducted from your account balance at request time. Insufficient balance will cause the request to fail.
  • Per-file validation: If any file in the batch fails validation (extension, content-type, or size), the whole request is rejected with an error identifying the offending file name.

Response Example

{
    "code": "0000",
    "msg": "success",
    "data": [
        { "id": 568102998803353601 },
        { "id": 568102998803353602 }
    ],
    "success": true,
    "failed": false
}

Response Fields

code
string
Business status code. 0000 indicates success; any other value indicates an error and msg will describe it.
msg
string
Human-readable status message.
data
array
Array of uploaded-image entries, in the same order as the files parts.
data[].id
integer
Unique numeric identifier assigned to the uploaded image. Use this value for subsequent operations.

Authorizations

Authorization
string
header
required

Body

multipart/form-data
files
file[]
required

One or more image files. Allowed extensions: .jpg, .jpeg, .png, .gif, .bmp, .webp. Content-Type must start with image/. Max 20 MB per file. Batch size capped by server configuration.

unique_id
string
default:default

Scope identifier for the authenticated account.

datetime_taken
string

Capture time in format yyyy-MM-dd HH:mm:ss.

Example:

"2025-09-07 22:52:00"

camera_model
string

Camera/device model. Max 200 characters.

Maximum string length: 200
Example:

"Canon EOS 5D"

latitude
number<double>
Example:

39.9042

longitude
number<double>
Example:

116.4074

tags
string[]

User-defined tags. Max 50. The server automatically appends an 'api' tag.

Maximum array length: 50
Example:
["test1", "test2"]

Response

200 - application/json

Successful response

code
string

Business status code. 0000 indicates success.

Example:

"0000"

msg
string
Example:

"success"

data
object[]
Example:
[
{ "id": 568102998803353600 },
{ "id": 568102998803353600 }
]
success
boolean
Example:

true

failed
boolean
Example:

false