# URL Hygiene & Dedup API (`craigtechservicesllc/url-hygiene-dedup-api`) Actor

Normalize and deduplicate URL lists before crawling, enrichment, analytics, or RAG. Remove tracking parameters, sort queries, flag invalid URLs, and group duplicate links without fetching target websites.

- **URL**: https://apify.com/craigtechservicesllc/url-hygiene-dedup-api.md
- **Developed by:** [Daniel Craig](https://apify.com/craigtechservicesllc) (community)
- **Categories:** Developer tools, Automation, SEO tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## URL Hygiene & Dedup API

Turn messy URL lists into deterministic, duplicate-aware rows before they enter a crawler, enrichment job, vector store, or analytics pipeline.

This Actor does **not fetch target websites**. It normalizes the supplied strings locally, so runs are fast, predictable, and do not need proxies or login credentials.

### What it does

- removes UTM, ad-click, and common email-campaign tracking parameters;
- optionally removes or preserves your own query parameters;
- sorts remaining query parameters;
- removes fragments, repeated path slashes, and non-root trailing slashes;
- reports the registrable domain and every applied transformation;
- groups URLs that normalize to the same value;
- rejects malformed, credential-bearing, and non-HTTP(S) URLs without inventing replacements;
- accepts direct URL lists, JSON objects, or rows from an Apify dataset.

### Common use cases

- deduplicate seeds before an expensive crawl;
- clean scraped outbound links before enrichment;
- remove campaign parameters from analytics exports;
- create stable URL keys for RAG and change-detection pipelines;
- quantify duplicate rates in a supplier's dataset.

### Input

Choose exactly one source: `urls`, `items`, or `datasetId`.

```json
{
  "urls": [
    "https://Example.com/products/?utm_source=email&b=2&a=1#details",
    "https://example.com/products?a=1&b=2"
  ],
  "removeTrackingParameters": true,
  "includeUniqueOnly": false
}
```

For object or dataset inputs, set `urlField` to a dot path such as `page.canonical`.

Risky identity-changing options are deliberately off by default:

- `dropWww`: some sites serve different content on `www` and the apex domain;
- `forceHttps`: HTTP and HTTPS are not universally interchangeable.

`keepParameters` always wins over the built-in tracker list and `removeParameters`.

### Output

Each input produces one dataset row unless `includeUniqueOnly` is enabled.

```json
{
  "inputIndex": 0,
  "originalUrl": "https://Example.com/products/?utm_source=email&b=2&a=1#details",
  "normalizedUrl": "https://example.com/products?a=1&b=2",
  "registrableDomain": "example.com",
  "hostname": "example.com",
  "isValid": true,
  "invalidReason": null,
  "changes": [
    "removed_trailing_slash",
    "removed_fragment",
    "removed_parameter:utm_source",
    "sorted_query_parameters"
  ],
  "isDuplicate": false,
  "duplicateOfInputIndex": null,
  "duplicateGroupSize": 2
}
```

The run's `OUTPUT` record contains totals, duplicate rate, and the effective settings.

### Limits and accuracy

- maximum 100,000 input URLs per run;
- absolute HTTP(S) URLs only;
- no content-based duplicate detection;
- no redirect resolution or `<link rel="canonical">` fetching;
- normalization is deterministic, not a claim that two resources contain identical content.

### API use

The Actor can be run from Apify Console, schedules, the Apify API, webhooks, and the automatically generated MCP interface. The Store API tab provides language-specific examples for the published Actor.

### Privacy and security

- The Actor does not send input URLs to any external service.
- Do not put API tokens, passwords, or other credentials in URLs. Credential-bearing URLs are rejected, but they are still part of the run input and should never be submitted.
- Dataset access uses the caller's Apify account context. Do not place tokens inside `datasetId`.

### Support

Open an issue on the Actor's Apify Store **Issues** tab with a minimal redacted input and the expected normalized URL. Do not post private URLs or credentials.

### License

Copyright © 2026 Craig Technology Services LLC. All rights reserved. No public source-code license is granted.

# Actor input Schema

## `urls` (type: `array`):

Absolute HTTP(S) URLs to normalize.

## `items` (type: `array`):

Objects containing a URL field.

## `datasetId` (type: `string`):

Dataset in the current Apify account. Do not include a token in this field.

## `urlField` (type: `string`):

Dot path used for JSON items or dataset rows.

## `maxItems` (type: `integer`):

Maximum number of input URLs to process in one run.

## `removeTrackingParameters` (type: `boolean`):

Removes UTM, ad-click, and common email-campaign parameters.

## `removeParameters` (type: `array`):

Extra query-parameter names to remove from every URL.

## `keepParameters` (type: `array`):

Overrides the tracking and removal lists.

## `stripFragment` (type: `boolean`):

Removes the #fragment portion because it is not sent to web servers.

## `sortQueryParameters` (type: `boolean`):

Sorts query parameters into a stable order for deterministic comparison.

## `removeTrailingSlash` (type: `boolean`):

Treats non-root paths with and without a final slash as equivalent.

## `collapsePathSlashes` (type: `boolean`):

Replaces repeated slashes in URL paths with a single slash.

## `dropWww` (type: `boolean`):

Off by default because some sites serve different content on www.

## `forceHttps` (type: `boolean`):

Off by default because changing scheme can merge distinct resources.

## `includeUniqueOnly` (type: `boolean`):

Outputs only the first item in each duplicate group.

## Actor input object example

```json
{
  "urls": [
    "https://example.com/products/?utm_source=newsletter#details",
    "https://example.com/products"
  ],
  "urlField": "url",
  "maxItems": 100000,
  "removeTrackingParameters": true,
  "removeParameters": [],
  "keepParameters": [],
  "stripFragment": true,
  "sortQueryParameters": true,
  "removeTrailingSlash": true,
  "collapsePathSlashes": true,
  "dropWww": false,
  "forceHttps": false,
  "includeUniqueOnly": false
}
```

# Actor output Schema

## `normalizedUrls` (type: `string`):

Dataset rows containing the original URL, normalized URL, validity, transformations, and duplicate-group information.

## `summary` (type: `string`):

Run totals, duplicate rate, estimated rows saved, and effective settings.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://example.com/products/?utm_source=newsletter#details",
        "https://example.com/products"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("craigtechservicesllc/url-hygiene-dedup-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": [
        "https://example.com/products/?utm_source=newsletter#details",
        "https://example.com/products",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("craigtechservicesllc/url-hygiene-dedup-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://example.com/products/?utm_source=newsletter#details",
    "https://example.com/products"
  ]
}' |
apify call craigtechservicesllc/url-hygiene-dedup-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,craigtechservicesllc/url-hygiene-dedup-api"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/qpkJn8yzw4PSOvrlg/builds/GU1oeC9b8YHMyA7LG/openapi.json
