Skip to main content
1

Set your API key

All requests require your API key in the x-api-key header.
export PANGRAM_API_KEY=<your API key>
2

Submit an AI detection task

Pangram AI detection uses an async task API. Submit text to create a task.
curl -X POST https://text.external-api.pangram.com/task \
  -H "Content-Type: application/json" \
  -H "x-api-key: $PANGRAM_API_KEY" \
  -d '{
    "text": "The text to analyze",
    "public_dashboard_link": false
  }'
Example Response
{
  "task_id": "123e4567-e89b-12d3-a456-426614174000"
}
3

Poll for the completed result

Poll the task endpoint until stage is STAGE_SUCCESS or STAGE_FAILED.
curl -X GET https://text.external-api.pangram.com/task/123e4567-e89b-12d3-a456-426614174000 \
  -H "x-api-key: $PANGRAM_API_KEY"
Example Success Response
{
  "stage": "STAGE_SUCCESS",
  "text": "The text to analyze",
  "version": "3.0",
  "headline": "AI Detected",
  "prediction": "We are confident that this document is a mix of AI-generated, AI-assisted, and human-written content",
  "prediction_short": "Mixed",
  "fraction_ai": 0.70,
  "fraction_ai_assisted": 0.20,
  "fraction_human": 0.10,
  "num_ai_segments": 7,
  "num_ai_assisted_segments": 2,
  "num_human_segments": 1,
  "windows": [
    {
      "text": "The text to analyze",
      "label": "AI-Generated",
      "ai_assistance_score": 0.85,
      "confidence": "High",
      "start_index": 0,
      "end_index": 19,
      "word_count": 4,
      "token_length": 5
    }
  ]
}
Key response fields:
  • stage — terminal task stage for completed results
  • fraction_ai / fraction_ai_assisted / fraction_human — breakdown of text by authorship
  • windows — segment-level classifications with confidence scores
  • headline — summary classification, such as "AI Detected" or "Human Written"
4

Request a dashboard link

Pass public_dashboard_link: true when submitting the task to get a shareable link in the completed result.
curl -X POST https://text.external-api.pangram.com/task \
  -H "Content-Type: application/json" \
  -H "x-api-key: $PANGRAM_API_KEY" \
  -d '{
    "text": "The text to analyze",
    "public_dashboard_link": true
  }'
5

Check for plagiarism

Check text against a database of online content. Note the different base URL.
curl -X POST https://plagiarism.api.pangram.com \
  -H "Content-Type: application/json" \
  -H "x-api-key: $PANGRAM_API_KEY" \
  -d '{
    "text": "Text to check for plagiarism"
  }'
Example Response
{
  "text": "Text to check for plagiarism",
  "plagiarism_detected": true,
  "plagiarized_content": [
    {
      "source_url": "https://example.com/source",
      "matched_text": "Text to check for plagiarism",
      "similarity_score": 0.95
    }
  ],
  "total_sentences": 1,
  "plagiarized_sentences": 1,
  "percent_plagiarized": 100.0
}

Error Handling

Status CodeDescription
400 Bad RequestThe request body is not properly formatted.
401 UnauthorizedThe x-api-key is missing or invalid.
402 Payment RequiredThe account has insufficient credits.
403 ForbiddenThe API key does not own the requested task.
404 Not FoundThe requested task does not exist.
422 Unprocessable EntityThe input text is invalid.
429 Too Many RequestsThe API key exceeds its configured rate limit.
500 Internal Server ErrorThere was an error processing the request.
If you are running into errors, please reach out at support@pangram.com.