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

Submit a Bulk API job

Use POST /bulk for asynchronous AI detection across many inputs.
curl -X POST https://text.external-api.pangram.com/bulk \
  -H "Content-Type: application/json" \
  -H "x-api-key: $PANGRAM_API_KEY" \
  -d '{
    "items": [
      {"id": "row-001", "text": "First text to analyze"},
      {"id": "row-002", "text": "Second text to analyze"}
    ]
  }'
Example Response
{
  "bulk_id": "blk_123",
  "status": "queued",
  "total_items": 2,
  "accepted_items": [
    {"index": 0, "id": "row-001", "task_id": "123e4567-e89b-12d3-a456-426614174000"},
    {"index": 1, "id": "row-002", "task_id": "223e4567-e89b-12d3-a456-426614174000"}
  ],
  "failed_items": []
}
6

Poll and fetch bulk results

Poll the bulk job until status is succeeded, failed, or partial.
curl -X GET https://text.external-api.pangram.com/bulk/blk_123 \
  -H "x-api-key: $PANGRAM_API_KEY"
Then page through results.
curl -X GET "https://text.external-api.pangram.com/bulk/blk_123/results?offset=0&limit=100" \
  -H "x-api-key: $PANGRAM_API_KEY"
7

Upload a file

Send documents as multipart form data to create file-based AI detection results.
curl -s -X POST https://file-external.api.pangram.com \
  -H "x-api-key: $PANGRAM_API_KEY" \
  -F "files=@modeling/deployments/test/test_document.docx" \
  -F "public_dashboard_link=true" \
  | jq -r '.[0].public_dashboard_link'
8

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 or bulk job.
404 Not FoundThe requested task or bulk job does not exist.
413 Payload Too LargeThe bulk request exceeds the maximum billable units.
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.