> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dncscrub.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Internal DNC List

> Add or remove phone numbers from your Internal DNC list

Manage your Internal Do Not Call (IDNC) list programmatically. The IDNC list is your organization's private DNC database, separate from national and state DNC lists.

<Note>
  If a consumer on your Internal DNC list later opts back in with express
  written consent, see
  [Handling Opt-Outs and Opt-Ins](/api-reference/scrub/opt-outs-and-opt-ins)
  — remove them from Internal DNC and record a Permission EBR.
</Note>

## Request

### Headers

<ParamField header="loginId" type="string" required>
  Your API Key
</ParamField>

### Query Parameters

<ParamField query="phoneList" type="string" required>
  The 10-digit phone number(s) to add or remove. For multiple numbers,
  comma-separate them (e.g., `5039367187,7075276405`)
</ParamField>

<ParamField query="actionType" type="string" required>
  Action to perform: - `add` - Add numbers to Internal DNC list - `remove` -
  Remove numbers from Internal DNC list - `count` - Get the count of numbers in
  your IDNC database - `status` - Check if a number is on your Internal DNC list
</ParamField>

<ParamField query="projId" type="string">
  Optional Project ID of the Internal DNC list.
</ParamField>

<ParamField query="ignoreInvalid" type="boolean" default="false">
  Only applies to `actionType=add`. Controls behavior when the request contains
  an invalid phone number:

  * `0` / `false` (default) - Abort the entire import on the first invalid
    number. No numbers are added and a 4xx error is returned.
  * `1` / `true` - Skip invalid numbers and import the valid ones.
</ParamField>

## Example Request

<CodeGroup>
  ```bash cURL (Add) theme={null}
  curl --location --request GET \
    'https://www.dncscrub.com/app/main/rpc/pdnc?phoneList=5039367187&actionType=add' \
    --header 'loginId: YOUR_API_KEY'
  ```

  ```bash cURL (Remove) theme={null}
  curl --location --request GET \
    'https://www.dncscrub.com/app/main/rpc/pdnc?phoneList=5039367187&actionType=remove' \
    --header 'loginId: YOUR_API_KEY'
  ```

  ```bash cURL (Status, JSON) theme={null}
  curl --location --request GET \
    'https://www.dncscrub.com/app/main/rpc/pdnc?phoneList=5039367187&actionType=status' \
    --header 'loginId: YOUR_API_KEY' \
    --header 'Content-Type: application/json'
  ```

  ```javascript JavaScript theme={null}
  // Add a phone number
  await fetch(
    "https://www.dncscrub.com/app/main/rpc/pdnc?phoneList=5039367187&actionType=add",
    {
      method: "GET",
      headers: { loginId: "YOUR_API_KEY" },
    }
  );

  // Remove a phone number
  await fetch(
    "https://www.dncscrub.com/app/main/rpc/pdnc?phoneList=5039367187&actionType=remove",
    {
      method: "GET",
      headers: { loginId: "YOUR_API_KEY" },
    }
  );
  ```

  ```csharp C# theme={null}
  using (var client = new HttpClient())
  {
      client.DefaultRequestHeaders.Add("loginId", "YOUR_API_KEY");

      // Add a phone number
      var addResponse = await client.GetAsync(
          "https://www.dncscrub.com/app/main/rpc/pdnc?phoneList=5039367187&actionType=add"
      );

      // Remove a phone number
      var removeResponse = await client.GetAsync(
          "https://www.dncscrub.com/app/main/rpc/pdnc?phoneList=5039367187&actionType=remove"
      );
  }
  ```
</CodeGroup>

<ResponseExample>
  ```json Response (add/remove, JSON mode) theme={null}
  { "message": "success" }
  ```

  ```json Response (status, JSON mode) theme={null}
  [
    {
      "phone": "5039367187",
      "onList": true,
      "addedOn": "2024-03-15",
      "lastModifiedOn": "2024-03-15"
    },
    {
      "phone": "7075276405",
      "onList": false,
      "addedOn": null,
      "lastModifiedOn": null
    }
  ]
  ```

  ```json Response (count, JSON mode) theme={null}
  { "count": 1523, "lastModifiedOn": "2024-03-15" }
  ```

  ```text Response (status, plain text) theme={null}
  5039367187,2024-03-15,2024-03-15
  ```
</ResponseExample>

## Response

Responses are `text/plain` by default. To receive JSON instead, include the
request header `Content-Type: application/json` — all four actions (and error
responses, as `{ "error": "..." }`) then return JSON.

| Status Code | Meaning                                      |
| ----------- | -------------------------------------------- |
| `200`       | Success - see per-action formats below       |
| `4xx`       | Error - Response body contains error message |

### `add` / `remove`

Plain text mode returns an empty body with HTTP 200. JSON mode returns:

```json theme={null}
{ "message": "success" }
```

### `status`

JSON mode returns an array with one object per phone number:

```json theme={null}
[
  { "phone": "5039367187", "onList": true, "addedOn": "2024-03-15", "lastModifiedOn": "2024-03-15" },
  { "phone": "7075276405", "onList": false, "addedOn": null, "lastModifiedOn": null },
  { "phone": "150393671", "invalid": true, "onList": false, "addedOn": null, "lastModifiedOn": null }
]
```

Use the `onList` boolean to determine membership. A number that isn't exactly
10 digits is reported with `"invalid": true`.

Plain text mode returns one line per number, `<phoneNumber>,<addedOn>,<lastModifiedOn>`
with dates as `YYYY-MM-DD`. A number **not** on your Internal DNC list has
empty dates:

```
5039367187,,
```

<Warning>
  Numbers must be exactly 10 digits (no `+1`, country code, or punctuation).
  In plain text mode, a number in any other format is silently skipped — it
  produces no output line at all, and if every number is skipped the response
  body is empty. Use JSON mode to have invalid numbers reported explicitly.
</Warning>

### `count`

JSON mode:

```json theme={null}
{ "count": 1523, "lastModifiedOn": "2024-03-15" }
```

Plain text mode returns a single line, `<count>,<lastModifiedOn>` — for
example `1523,2024-03-15`. An account whose Internal DNC list has never had
numbers added returns `0,` (or `{ "count": 0, "lastModifiedOn": null }` in
JSON mode).

## Multiple Phone Numbers

Add or remove multiple phone numbers by comma-separating them:

```bash theme={null}
curl --location --request GET \
  'https://www.dncscrub.com/app/main/rpc/pdnc?phoneList=5039367187,7075276405,7072842774&actionType=add' \
  --header 'loginId: YOUR_API_KEY'
```

## Add to Specific Project

To add a phone number to a specific project's IDNC list:

```bash theme={null}
curl --location --request GET \
  'https://www.dncscrub.com/app/main/rpc/pdnc?phoneList=5039367187&actionType=add&projId=YOUR_PROJECT_ID' \
  --header 'loginId: YOUR_API_KEY'
```

## Error Handling

If you pass an invalid phone number, the API returns an error:

**Request:**

```
https://www.dncscrub.com/app/main/rpc/pdnc?phoneList=BADNUMBER&actionType=add
```

**Response (HTTP 4xx):**

```
Error importing or updating phone numbers. Check that the numbers are of a probable format: BADNUMBER
```

### Skipping Invalid Numbers

By default, a single bad number aborts the entire `add` request. To import the
valid numbers and silently skip invalid ones, pass `ignoreInvalid=1`:

```bash theme={null}
curl --location --request GET \
  'https://www.dncscrub.com/app/main/rpc/pdnc?phoneList=5039367187,BADNUMBER,7075276405&actionType=add&ignoreInvalid=1' \
  --header 'loginId: YOUR_API_KEY'
```

The two valid numbers are added; `BADNUMBER` is skipped.

## Best Practices

<AccordionGroup>
  <Accordion title="Validate Before Adding">
    Always validate that phone numbers are exactly 10 digits before making the
    API call.
  </Accordion>

  <Accordion title="Handle Duplicates">
    Adding a number that already exists won't cause an error - it simply has no
    effect (idempotent). Note this means re-adding a number does **not**
    refresh its added-on date, which matters when EBR/consent records are also
    present — see [Handling Opt-Outs and Opt-Ins](/api-reference/scrub/opt-outs-and-opt-ins).
  </Accordion>

  <Accordion title="Remove on Opt-In">
    When a consumer on your Internal DNC list opts back in with express
    written consent, remove them from the list (`actionType=remove`) and add a
    Permission EBR with the consent date. See
    [Handling Opt-Outs and Opt-Ins](/api-reference/scrub/opt-outs-and-opt-ins).
  </Accordion>

  <Accordion title="Removing Non-Existent Numbers">
    Removing a number that doesn't exist has no effect and won't cause an error.
  </Accordion>

  <Accordion title="Use Projects">
    If you have multiple campaigns or clients, use the `projId` parameter to
    organize your IDNC lists.
  </Accordion>
</AccordionGroup>
