The AI Detection API detects AI-generated content in text. It provides a score between 0 and 1 that indicates the confidence that the content is AI- or human-generated.

You need an API key to access the Writer API. Get an API key by following the steps in the API quickstart.

We recommend setting the API key as an environment variable in a .env file with the name WRITER_API_KEY.

AI Detection endpoint

Endpoint: POST /v1/ai-detect

curl --request POST \
  --url https://api.writer.com/v1/tools/ai-detect \
  --header "Authorization: Bearer $WRITER_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "input": "AI and ML continue to be at the forefront of technological advancements. In 2025, we can expect more sophisticated AI systems that can handle complex tasks with greater efficiency. AI will play a crucial role in various sectors, including healthcare, finance, and manufacturing. For instance, AI-powered diagnostic tools will become more accurate, helping doctors detect diseases at an early stage. In finance, AI algorithms will enhance fraud detection and risk management."
}'

Request body

The request body is a JSON object with the following fields. All fields are required.

ParameterTypeDescription
inputstringThe text to detect AI content in.

Response format

The response is a JSON object with the following fields.

ParameterTypeDescription
labelstringThe label of the AI content. fake indicates the text is AI-generated, real indicates the text is human-generated.
scorenumberThe confidence score of the label, from 0 to 1.
{
    "label": "fake",
    "score": 0.95
}