API Reference

Upload Media

Learn how to upload media for analysis

Clarity Media Statements represent a fundamental feature of Clarity AI's Deepfake detection, facilitated through two key endpoints:

  1. Uploading Media
  2. Viewing Results Analysis

This page provides a comprehensive guide on uploading media to the API.

Media Types

The Clarity API accommodates a wide range of media types, including:

  1. Video Media Files: e.g., mp4, avi, webm, mov, etc.
  2. Audio Media Files: e.g., mp3, m4a, wav, wma, etc.
  3. Images: Coming soon.

Upload request

As described in the Authentication Guide, a request must be authorized with an access token.

Uploading media is a straightforward process, as demonstrated in the example below:

url = "https://api.getclarity.ai/v1/media-statement"

files = {"media_obj": ("video_file_name_overrided.mp4", open("video_file.mp4", "rb"))}

headers = {"authorization": "Bearer <ACCESS_TOKEN>"}

# Send the POST request with multipart/form-data encoding
response = requests.post(url, headers=headers, files=files, timeout=9999)

# Check the response
if response.status_code == 200:
	print("Upload successful!")
	print(response.json())
else:
	print(f"Error: {response.status_code}")
	print(response.text)

Please take note that this request is a multipart/form-data request, transmitting the file to Clarity's servers.

In the event of a successful response with a status code of 200, you will be provided with a unique statement identifier, mcid, representing this particular media statement.

{
    "mcid": "69f17519-b0ca-4ec4-b12c-46e7dff13c7c"
}
Language
Credentials
Bearer
JWT
URL
Click Try It! to start a request and see the response here!