# NSFW Image Detector API

> NSFW Image Detector is an NSFW detection API that checks whether an image contains explicit adult content. Upload a JPG, PNG or GIF up to 5 MB, or pass an image URL, to get isNSFW and isSafe flags.

**Endpoint:** `POST https://api.apiverve.com/v1/nsfwimagedetector`  
**Category:** Images  
**Cost:** 10 credits per call  
**Canonical page:** https://apiverve.com/marketplace/nsfwimagedetector

## Overview

An NSFW image detection API for user uploads: check avatars, listings and chat attachments before other users see them. The image is scaled to 512 pixels on its longest side and run through a vision transformer classifier with two labels, sfw and nsfw, which APIVerve hosts itself, so images are not passed to a third-party moderation service. An image is flagged when its nsfw score reaches 0.6. Every plan gets isNSFW and isSafe; paid plans add that score as confidence, from 0 to 1, so you can apply a stricter or looser threshold, and the verdict label. It answers one question, explicit or not; there are no separate labels for violence, gore or weapons.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl -X POST "https://api.apiverve.com/v1/nsfwimagedetector" \
  -H "x-api-key: YOUR_API_KEY" \
  -F "image=@photo.jpg"
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `image` | string | No | An image file to classify (JPG, PNG or GIF, up to 5 MB), or a public image URL |

## Response fields

- `isNSFW` — boolean · Whether the image contains NSFW content
- `isSafe` — boolean · Whether the image is safe for general audiences
- `confidence` — number · How likely the image is NSFW, from 0 to 1; 0 on a clearly safe image · (premium)
- `category` — string · The verdict as a label, sfw or nsfw; nsfw once the score reaches 0.6, so it always agrees with isNSFW · (premium)

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "isNSFW": false,
    "isSafe": true,
    "confidence": 0.987,
    "category": "neutral"
  }
}
```

## Use cases

- **Avatar Upload Filtering** — Dating platforms inspect incoming profile pictures and immediately reject submissions flagged as adult content before they display publicly.
- **Marketplace Listing Screening** — When sellers publish new product photos, e-commerce sites check each image to prevent explicit inventory from appearing in public catalog searches.
- **Community Chat Moderation** — To keep discussion rooms family-friendly, messaging services block shared GIF and image attachments whenever the safe content check fails.
- **Support Ticket Attachment Triage** — Route incoming helpdesk image files through screening checks so support representatives avoid unexpected exposure to explicit material while troubleshooting.

## SDKs

- **npm** — `npm install @apiverve/nsfwimagedetector` (https://www.npmjs.com/package/@apiverve/nsfwimagedetector)
- **NuGet** — `dotnet add package APIVerve.API.NSFWImageDetector` (https://www.nuget.org/packages/APIVerve.API.NSFWImageDetector)
- **Source** — https://github.com/apiverve/nsfwimagedetector-api

## More

- Full reference: https://docs.apiverve.com/ref/nsfwimagedetector
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
