← Extension Management
Extension Management

Guide

How to Add, Edit and Delete Extensions or Contacts Using the HTTP API

Mr. VoIP's custom-built 3CX HTTP API lets you add, update and delete extensions and phonebook contacts from one place. This reference covers every operation, with request and response examples, field requirements and error codes.

Overview

Every call is an HTTP POST to your 3CX server's API endpoint. The operation is chosen with the action parameter, your security key goes in qsSecuritykey, and the data is sent as JSON in qsValue.

Base URL

https://your-3cx-server:8000/api.aspx

Replace your-3cx-server with your server address and YOUR_SECURITY_KEY with the key issued for your system.

  • Every request is checked against your security key before anything is added, updated, or deleted.
  • For every add or update, an email is sent to the extension's email address, as long as one is provided.
  • An extension number can't be changed after the extension is created.
  • Deleting an extension backs up its call recordings and voicemail automatically.

1. Add a single extension

Creates one extension. Extension number and first name are required.

POST URL

https://your-3cx-server:8000/api.aspx?action=addExt&qstype=1&qsSecuritykey=YOUR_SECURITY_KEY&qsValue={json}

Request body (qsValue)

{
  "sExtension": [
    {
      "ExtentionNumber": "xxxx",
      "EmailAddress": "",
      "FirstName": "xxxx",
      "LastName": "",
      "OutboundCallerID": ""
    }
  ]
}

Response — success

{"status":"Extension Created", "errorMessage":"", "errorCode":""}

Response — failure

{"message":"Authentication Token invalid", "errorCode":"INVALID_AUTH_ID"}

2. Add multiple extensions

Creates several extensions in one call by sending more than one object in the array.

POST URL

https://your-3cx-server:8000/api.aspx?action=addExt&qstype=1&qsSecuritykey=YOUR_SECURITY_KEY&qsValue={json}

Request body (qsValue)

{
  "mExtension": [
    {
      "ExtentionNumber": "xxxx",
      "EmailAddress": "",
      "FirstName": "xxxx",
      "LastName": "",
      "OutboundCallerID": ""
    },
    {
      "ExtentionNumber": "xxxx",
      "EmailAddress": "",
      "FirstName": "xxxx",
      "LastName": "",
      "OutboundCallerID": ""
    }
  ]
}

Response — success

{"status":"All Extension Created", "errorMessage":"", "errorCode":""}

Response — failure

{"message":"Authentication Token invalid", "errorCode":"INVALID_AUTH_ID"}

3. Update an extension

Changes an existing extension's details. The extension number identifies the record and cannot itself be changed.

POST URL

https://your-3cx-server:8000/api.aspx?action=updateExt&qstype=1&qsSecuritykey=YOUR_SECURITY_KEY&qsValue={json}

Request body (qsValue)

{
  "uExtension": [
    {
      "ExtentionNumber": "xxxx",
      "EmailAddress": "",
      "FirstName": "xxxx",
      "LastName": "",
      "OutboundCallerID": ""
    }
  ]
}

Response — success

{"status":"Extension Updated", "errorMessage":"", "errorCode":""}

4. Delete an extension

Removes an extension. Its call recordings and voicemail are backed up automatically.

POST URL

https://your-3cx-server:8000/api.aspx?action=deleteExt&qstype=1&qsSecuritykey=YOUR_SECURITY_KEY&qsValue={json}

Request body (qsValue)

{
  "dExtension": [
    { "ExtentionNumber": "xxxx" }
  ]
}

Response — success

{"status":"Extension Deleted", "errorMessage":"", "errorCode":""}

5. Add a contact

Creates a phonebook contact.

POST URL

https://your-3cx-server:8000/api.aspx?action=addPhonebook&qstype=1&qsSecuritykey=YOUR_SECURITY_KEY&qsValue={json}

Request body (qsValue)

{
  "sContact": [
    {
      "FirstName": "xxxx",
      "LastName": "xxxx",
      "PhoneNumber": "xxxx",
      "CompanyName": ""
    }
  ]
}

Response — success

{"status":"Contact Created", "errorMessage":"", "errorCode":""}

6. Update a contact

Changes a phonebook contact. RegisteredPhoneNumber is the contact's current number and identifies the record.

POST URL

https://your-3cx-server:8000/api.aspx?action=updatePhonebook&qstype=1&qsSecuritykey=YOUR_SECURITY_KEY&qsValue={json}

Request body (qsValue)

{
  "uContact": [
    {
      "FirstName": "xxxx",
      "LastName": "xxxx",
      "PhoneNumber": "xxxx",
      "CompanyName": "",
      "RegisteredPhoneNumber": "xxxx"
    }
  ]
}

Response — success

{"status":"Contact Updated", "errorMessage":"", "errorCode":""}

7. Delete a contact

Removes a phonebook contact by phone number.

POST URL

https://your-3cx-server:8000/api.aspx?action=deletePhonebook&qstype=1&qsSecuritykey=YOUR_SECURITY_KEY&qsValue={json}

Request body (qsValue)

{
  "dContact": [
    { "PhoneNumber": "xxxx" }
  ]
}

Response — success

{"status":"Contact Deleted", "errorMessage":"", "errorCode":""}

Field reference

Field names are case-sensitive and used exactly as shown, including the API's spelling of ExtentionNumber.

Extension fields

FieldRequiredDescription
ExtentionNumberYesUnique extension identifier
EmailAddressNoThe user's email address
FirstNameYesThe user's first name
LastNameNoThe user's last name
OutboundCallerIDNoOutbound caller identification

Contact fields

FieldRequiredDescription
FirstNameYesThe contact's first name
LastNameYesThe contact's last name
PhoneNumberYesThe contact's phone number
CompanyNameNoThe contact's company
RegisteredPhoneNumberUpdate onlyThe contact's existing number, used to find the record

Error codes

Failed requests return an errorCode and message:

CodeMessageWhen it happens
INVALID_AUTH_IDAuthentication Token invalidThe security key is invalid
AUTH_ID_EXPIREDAuthentication Token expiredThe security key has expired
INVALID_EXTENSIONInvalid Extension numberThe extension is empty, illegal, or does not exist
EXTENSION_EXISTExtension number already existYou tried to add a duplicate extension
INVALID_EMAILInvalid Email AddressThe email address is malformed
FNAME_INVALIDInvalid First nameThe first name is empty
LNAME_INVALIDInvalid Last nameThe last name is empty
PHONE_NUMBER_INVALIDInvalid Phone NumberThe phone number is empty, illegal, or invalid
WEBSERVICE_ERRORException detailA server-side error; the message carries the exception detail
500Internal Server errorA general server error

Want this for your call center?

Every Mr. VoIP tool is built around your existing 3CX setup — tell us what you're running and we'll scope it.

Get in touch