Query Available DID Numbers of Specific Trunk

Query available DID numbers associated with specific trunk.

Request URL

GET {base_url}/dm/open_api/v1/did_management/usable

Request parameters

Headers
Parameter Required Type Description
Authorization Yes String Pass the access token in the header.

Format: Bearer {access_token}.

Query parameters
Send different request parameters as needed.
Query DID numbers that can be assigned to Cloud PBX
Parameter Required Type Description
trunkId Yes Integer The ID of the shared trunk.
Note: You can query the trunk ID using Query Available Shared Trunks.
cloudPbxId No Integer The ID of the Cloud PBX.
Note: You can query the PBX ID using Query All the Cloud PBXs.
Query DID numbers that can be assigned to subordinate user
Parameter Required Type Description
trunkId Yes Integer The ID of the shared trunk.
Note: You can query the trunk ID using Query Available Shared Trunks.
userId No Long The ID of the subordinate user.
Note: You can query the user ID using Query All Subordinate Users.

Response parameters

Parameter Type Description
data Object<Details> The detailed information.
requestId String The unique ID of the request, which can be used to quickly locate the request.
status String Request result:
  • Success
  • Failed
time Long The response time.
Note: The YCM API response returns a timestamp, you can convert the timestamp to detailed date and time as needed. For more information, see Convert Timestamp to Local Date and Time.
Details
Parameter Type Description
id Integer The unique ID of the DID number.
did String DID number.
didName String The name of the DID number.

Example

  • Request example 1

    Query the DID numbers associated with specific trunk (ID: 112129) that can be assigned to specific cloud PBX (ID: 358868).

    GET /dm/open_api/v1/did_management/usable?trunkId=112129&cloudPbxId=358868 HTTP/1.1
    Host: ycm.yeastar.com
    Authorization: Bearer ******

    Response example 1

    HTTP/1.1 200 OK
    {
        "data": [
            {
                "id": 1186852,
                "did": "83"
            },
            {
                "id": 1186853,
                "did": "84"
            }
        ],
        "requestId": "d62bdba9c44c08d9d39fcde1403721c5",
        "status": "Success",
        "time": 1766639052
    }
  • Request example 2

    Query the DID numbers associated with specific trunk (ID: 112129) that can be assigned to specific subordinate user (ID: 359054).

    GET dm/open_api/v1/did_management/usable?trunkId=112129&userId=359054 HTTP/1.1
    Host: ycm.yeastar.com
    Authorization: Bearer ******

    Response example 2

    HTTP/1.1 200 OK
    {
        "data": [
            {
                "id": 1186856,
                "did": "87"
            },
            {
                "id": 1186857,
                "did": "88"
            },
            {
                "id": 1186858,
                "did": "89"
            },
            {
                "id": 1186859,
                "did": "90"
            },
            {
                "id": 1186860,
                "did": "500"
            },
            {
                "id": 1186861,
                "did": "501"
            }
        ],
        "requestId": "25aa1ec145fcb32012ebf0b271f4ed88",
        "status": "Success",
        "time": 1766642449
    }