Nudity Detection

Models / Drug Detection

Recreational Drug and Medical Drug Detection

Description of concepts

The API returns confidence scores for the following concepts:


Recreational drugs


Photos and illustrations containing recreational drugs. This includes:

  • Powder-like drugs such as cocaine, ketamine, where indicated by context (in line, in pouch) or by usage (snorting)
  • Self-administration through syringes of drugs such as heroin
  • Cannabis buds, joints and related products
  • Cannabis leaf or plant
  • Bongs, pipes, or other paraphernalia related to marijuana consumption
  • Pills and pill bottles in a recreational context (i.e. unlikely to be for medical use, based on quantity, color/shape or context)



Any reference to cannabis/marijuana. This includes:

  • Cannabis logo (cannabis leaf)
  • Cannabis plant
  • Cannabis drug (joints, haschich)

Cannabis logo (only)


Image where the only reference to cannabis is through a symbol designed to represent marijuana (think of the cannabis leaf outline). This typically appears on objects, apparels or as logos super-imposed on the image. If other references to marijuana are present, then this class will not trigger.

Cannabis plant


Marijuana plants.

Cannabis drug


Displays of weed, marijuana buds, joints, blunts. This also includes marijuana-related paraphernalia such as pipes, bongs.

Recreational drug excluding cannabis


Photos and illustrations:

  • Snorting of drugs such as cocaine, ketamine
  • Self-administration through syringes of drugs such as heroin

Medical pills


Pills and pill bottles in a medical context.

Medical paraphernalia


Medical syringes or medical equipment. This does not include syringes in the context of recreational drugs such as self-administration.

Excluded concepts

The API will ignore situations where regular tobacco is smoked. This means that the following concepts would not be flagged as drug:

  • Regular Tobacco
  • Industrial cigarettes, cigarette packs
  • People smoking or puffing, unless there are references to recreational drugs
  • Smoking pipes used with regular tobacco
  • Hookahs, shishas

To detect tobacco smoking and tobacco products, please refer to the Smoking & Tobacco detection model.

Use the model

If you haven't already, create an account to get your own API keys.

Detect drugs

Let's say you want to moderate an image containing marijuana:

You can either upload a public URL to the image, or upload the raw binary image. Here's how to proceed if you choose to share the image's public URL:

curl -X GET -G '' \
    -d 'models=recreational_drug,medical' \
    -d 'api_user={api_user}&api_secret={api_secret}' \
    --data-urlencode 'url='

# this example uses requests
import requests
import json

params = {
  'url': '',
  'models': 'recreational_drug,medical',
  'api_user': '{api_user}',
  'api_secret': '{api_secret}'
r = requests.get('', params=params)

output = json.loads(r.text)

$params = array(
  'url' =>  '',
  'models' => 'recreational_drug,medical',
  'api_user' => '{api_user}',
  'api_secret' => '{api_secret}',

// this example uses cURL
$ch = curl_init(''.http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

$output = json_decode($response, true);

// this example uses axios
const axios = require('axios');

axios.get('', {
  params: {
    'url': '',
    'models': 'recreational_drug,medical',
    'api_user': '{api_user}',
    'api_secret': '{api_secret}',
.then(function (response) {
  // on success: handle response
.catch(function (error) {
  // handle error
  if (error.response) console.log(;
  else console.log(error.message);

The API will then return a JSON response:

    "status": "success",
    "request": {
        "id": "req_gcTp4s63IAAni0lFOT7KK",
        "timestamp": 1714997478.552115,
        "operations": 1
    "recreational_drug": {
        "prob": 0.99,
        "classes": {
            "cannabis": 0.99,
            "cannabis_logo_only": 0.01,
            "cannabis_plant": 0.01,
            "cannabis_drug": 0.99,
            "recreational_drugs_not_cannabis": 0.01
    "medical": {
        "prob": 0.01,
        "classes": {
            "pills": 0.01,
            "paraphernalia": 0.01
    "media": {
        "id": "med_gcTpqyOZ18IMsiMe4Ar28",
        "uri": ""

Any other needs?

See our full list of Image/Video models for details on other filters and checks you can run on your images and videos. You might also want to check our Text models to moderate text-based content: messages, reviews, comments, usernames...

Was this page helpful?