---
updatedAt: 2026-09-09T22:08:03.000Z
agentTools:
  projectIndex: https://developer.callhub.io/llms.txt
---

# /dnc_contacts/

Create a new contact

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "api-settings",
    "version": "2.1"
  },
  "servers": [
    {
      "url": "https://api.callhub.io"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "x-default": "",
        "type": "apiKey",
        "name": "Authorization",
        "in": "header",
        "x-bearer-format": "token"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/v1/dnc_contacts/": {
      "post": {
        "summary": "/dnc_contacts/",
        "description": "",
        "operationId": "dnc_contacts",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "dnc",
                  "phone_number"
                ],
                "properties": {
                  "dnc": {
                    "type": "string",
                    "description": "URL of the DNC list that the phone number belongs to"
                  },
                  "phone_number": {
                    "type": "string",
                    "description": "Phone number of the contact."
                  },
                  "category": {
                    "type": "integer",
                    "description": "use category as 1 for only Opted out of calling; category as 2 for only Opted out of texting; category as 3 for both Opted out of calling and texting",
                    "default": 3,
                    "format": "int32"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "201",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"url\": \"https://api.callhub.io/v1/dnc_contacts/11738262/\",\n  \"dnc\": \"https://api.callhub.io/v1/dnc_lists/78226/\",\n  \"phone_number\": \"15019028176\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "example": "https://api.callhub.io/v1/dnc_contacts/11738262/"
                    },
                    "dnc": {
                      "type": "string",
                      "example": "https://api.callhub.io/v1/dnc_lists/78226/"
                    },
                    "phone_number": {
                      "type": "string",
                      "example": "15019028176"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "python",
              "code": "# You'll need to install requests\nimport requests\n# api_key can be found at https://callhub.io/user_detail_change/?action=tabs-1\nheaders = {'Authorization': 'Token %s' % api_key}\ndata = {'dnc':'https://api.callhub.io/v1/dnc_lists/5769/','phone_number' : '4015872345'}\nr = requests.post('https://api.callhub.io/v1/dnc_contacts/', data=data, headers=headers)\nprint \"DNC list contact created in JSON\", r.json()"
            },
            {
              "language": "php",
              "code": "<?php\n\t\t$ch = curl_init();\n    $headers = array();\n    $headers[] = \"Authorization: token {$api_key}\";\n    $headers[] = \"Content-Type: application/json\";\n\t\t\n\t\t$data = array(\"dnc\" => \"https://api.callhub.io/v1/dnc_lists/5769/\",\n                  \"phone_number\" => \"4015872346\");                        \n\t\t$data_to_post = json_encode($data);   \n  \n    $url =\"https://api.callhub.io/v1/dnc_contacts/\";\n    curl_setopt($ch, CURLOPT_URL, $url);\n    curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);\n    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true);\n    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\n    curl_setopt($ch,CURLOPT_POSTFIELDS, $data_to_post);\n\n    $curl_response = curl_exec($ch); // Send request\n\t\tcurl_close($ch);\n     \n\t\t$decoded = json_decode($curl_response,true);\n\t\tprint \"DNC Contact Added:\". var_export($decoded);\n \n?>"
            }
          ],
          "samples-languages": [
            "python",
            "php"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```