Skip to main content
POST
/
api
/
v1
/
files
/
init
Initialize file upload
import requests

url = "https://api.memic.ai/api/v1/files/init"

payload = {
    "filename": "<string>",
    "size": 123,
    "mime_type": "<string>",
    "metadata": {},
    "reference_id": "<string>",
    "environment_slug": "production",
    "folder_id": "<string>"
}
headers = {
    "X-API-Key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
{
  "file_id": "<string>",
  "upload_url": "<string>",
  "expires_in": 3600
}

Authorizations

X-API-Key
string
header
required

Memic API key. Every key is bound to exactly one environment — get one from the Memic dashboard under API Keys.

Body

application/json

Request DTO for initializing file upload (presigned URL approach).

filename
string
required

Original filename

Required string length: 1 - 500
size
integer
required

File size in bytes

mime_type
string
required

MIME type of the file

metadata
Metadata · object

Optional metadata

reference_id
string | null

Client-provided reference ID for linking with external systems (e.g., 'TG_G1_Math'). Stored in both database and Pinecone for lookup-based search filtering.

Maximum string length: 255
environment_slug
string | null
default:production

Target environment slug ('staging' or 'production'). Defaults to 'production'.

folder_id
string<uuid4> | null

Target folder ID within the environment. If not provided, uses the default folder.

Response

Successful Response

Response DTO for file upload initialization.

file_id
string<uuid4>
required
upload_url
string
required
expires_in
integer
default:3600

URL expiry in seconds