Skip to main content

C# Code Examples

Production-ready C# examples for integrating with DNCScrub APIs.

Prerequisites

  • .NET 6 or later
  • No third-party packages required — all examples use built-in System.Text.Json and System.Net.Http.Json
These examples use top-level statements, available in C# 9+ / .NET 6+. Wrap the code in a Main method if you’re targeting an older project style.

Scrub API — GET

Best for quick lookups of up to 50 phone numbers.
See the Output Guide for a full reference of result codes and response fields.

Scrub API — POST

Use POST for batches larger than 50 phone numbers.

TCPA Authority — Reassigned Number Check

Check whether a phone number has been reassigned to a new owner since consent was given. This uses carrier-level data for high accuracy.

Litigator Check

Check whether phone numbers belong to known TCPA litigators.

Internal DNC — Add / Remove

Add phone numbers to your organization’s private Internal Do Not Call list (also called Project DNC). Numbers on this list are automatically blocked during scrubs.

Production Client with Error Handling

A reusable client class suitable for production use. Handles authentication errors, rate limiting, timeouts, and proper resource cleanup.
Usage: