POST
/
reports
/
music
import os, requests


# Set API key ENV variable or replace with your own API key
API_KEY = os.getenv("AIORNOT_API_KEY")
MUSIC_ENDPOINT = "https://api.aiornot.com/v1/reports/music"

with open("audio.mp3", "rb") as audio_file:
    files = {"file": audio_file}
    resp = requests.post(
        MUSIC_ENDPOINT, 
        headers={"Authorization": f"Bearer {API_KEY}"},
        files=files,
        timeout=120
    )
    if resp.status_code != 200:
        raise Exception(f"Failed to analyze image: {resp.status_code} {resp.text}")

print(resp.json())
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "created_at": "2023-11-07T05:31:56Z",
  "report": {
    "verdict": "ai",
    "confidence": 0.95,
    "duration": 120,
    "total_bytes": 362594,
    "md5": "db36d923800f6ca6b7f87cff8a19d1d1"
  }
}

Authorizations

Authorization
string
header
required

Your API key as the Bearer token in the Authorization header.

Body

multipart/form-data

Response

200 - application/json

Successful Response

The response is of type object.