Add user
Creates a user in your company with a role (admin, user or agent).
Parameters
Send as application/x-www-form-urlencoded.
typestringrequiredSelects the operation. Always
add_userfor this endpoint.tokenstringrequiredYour API token from Log in. See Authentication.
First name.
ExampleJaneLast name.
ExampleDoeDCDial username.
Examplejane.doePassword.
Example••••••••Role of the new user.
One ofadminuseragentYour DCDial company ID.
Example101Mobile number.
Example5551234567Phone extension for the user.
Example1001
curl https://api.dcdial.com/api/ \ -d type=add_user \ -d token="$DCDIAL_TOKEN" \ -d first_name=Jane \ -d last_name=Doe \ -d user=jane.doe \ -d pass="$DCDIAL_PASSWORD" \ -d user_level=admin \ -d company_id=101 \ -d mobile_number=5551234567 \ -d extension=1001<?php$ch = curl_init('https://api.dcdial.com/api/');curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => http_build_query([ 'type' => 'add_user', 'token' => getenv('DCDIAL_TOKEN'), 'first_name' => 'Jane', 'last_name' => 'Doe', 'user' => 'jane.doe', 'pass' => getenv('DCDIAL_PASSWORD'), 'user_level' => 'admin', 'company_id' => 101, 'mobile_number' => '5551234567', 'extension' => '1001', ]),]);$result = json_decode(curl_exec($ch), true);curl_close($ch);
if (($result['response']['success'] ?? 0) != 1) { throw new RuntimeException($result['response']['error'] ?? 'Request failed');}const res = await fetch('https://api.dcdial.com/api/', { method: 'POST', body: new URLSearchParams({ type: "add_user", token: process.env.DCDIAL_TOKEN, first_name: "Jane", last_name: "Doe", user: "jane.doe", pass: process.env.DCDIAL_PASSWORD, user_level: "admin", company_id: "101", mobile_number: "5551234567", extension: "1001", }),});const { response } = await res.json();if (response.success != 1) throw new Error(response.error);import osimport requests
r = requests.post( "https://api.dcdial.com/api/", data={ "type": "add_user", "token": os.environ["DCDIAL_TOKEN"], "first_name": "Jane", "last_name": "Doe", "user": "jane.doe", "pass": os.environ["DCDIAL_PASSWORD"], "user_level": "admin", "company_id": 101, "mobile_number": "5551234567", "extension": "1001", }, timeout=30,)response = r.json()["response"]if str(response.get("success")) != "1": raise RuntimeError(response.get("error")){ "response": { "success": "1|0", "error": "[IF ANY]" }}Try it