---
title: "Check for duplicate task"
method: POST
path: "/api/dedupq/check"
tags: ["DedupQ"]
---

# Check for duplicate task

`POST /api/dedupq/check`

## Request

- Base URL: `https://plith.ai`
- URL: `https://plith.ai/api/dedupq/check`
- Auth: none required

Semantic task-level deduplication pipeline: Redis hash cache → Supabase exact hash → advisory lock check → OpenAI vector similarity search. Returns hit, miss, or in_progress. Costs 1 credit.

## Request body

- object
  - `content` string, required: Task content to check for duplicates.
  - `task_id` string: Optional caller task ID for tracing and lock correlation.
  - `hash_only` boolean: Skip vector similarity search; use hash matching only.
  - `similarity_threshold` number: Cosine similarity threshold for semantic match. Default 0.92.

## Response `200`

Dedup result

- object
  - `status` 'hit' | 'miss' | 'in_progress': hit — duplicate found; miss — no duplicate, proceed; in_progress — another worker holds the lock.
  - `match` object: Present when status is 'hit'.
    - `task_id` string
    - `similarity` number: 1.0 for exact hash matches; cosine similarity for semantic matches.
    - `result` unknown
    - `match_type` 'exact' | 'semantic'
    - `cached_at` string, date-time
  - `cache_hit` 'redis' | 'db_exact' | 'vector': Which cache layer produced the hit. Present when status is 'hit'.
  - `cached_at` string, date-time: When the cached result was stored. Present on hits.
  - `cache_age_seconds` integer: Age of the cached result in seconds. Present on hits.
  - `lock_holder_task_id` string: Task ID currently holding the advisory lock. Present when status is 'in_progress'.
  - `content_hash` string: SHA-256 of the content. Present when status is 'miss'.
  - `message` string
  - `cross_product` unknown
  - `request_id` string
  - `credits_used` integer
  - `credits_remaining` integer
  - `fallback_behavior` string

## Other responses

- `400`: Missing or invalid request body
- `401`: Invalid or missing API key
- `402`: Insufficient credits
- `500`: Internal server error

---

[API](https://skmtc.dev/plith/apis/plith-api.md) · [All operations](https://skmtc.dev/plith/apis/plith-api/llms.txt) · [OpenAPI document](https://skmtc.dev/plith/apis/plith-api/revisions/4a03164b0d75?raw)
