Skip to main content

User

The User object is supported by the MiRTA PBX OpenAPI endpoint. This object is managed at system scope and requires a global API key.

Object Summary

PropertyValue
Objectuser
Primary path/users
ID fieldus_id
Label fieldus_username
Primary source tableus_users
Required on createus_username
Path aliases/user, /users, /nuser, /nusers, /us_user, /us_users

Endpoint Patterns

ActionExample pattern
ListGET https://pbx.example.com/pbx/openapi.php/users
Get by IDGET https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID
CreatePOST https://pbx.example.com/pbx/openapi.php/users
UpdatePATCH https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID
DeleteDELETE https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID

Accepted Field Aliases

Request fieldSource field
usernameus_username
nameus_username
descriptionus_description
emailus_email
profile_idus_up_id
userprofile_idus_up_id
passwordus_password
use_ldapus_useldap
ip_filterus_ipfilter
two_factor_typeus_2fatype
never_expireus_neverexpire
dynamic_ipus_dynamicip

Examples

List Users

Returns the users visible to the key and scope.

curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/users"

Get User

Reads one object by its internal ID.

curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID"

Create User

Creates a new object. Use the short aliases shown above or the source field names.

curl -X POST \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "username": "docs-api-user",
  "description": "Documentation API user",
  "email": "docs-api-user@example.com",
  "profile_id": 2,
  "password": "change-this-password",
  "tenant_ids": [
    1
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/users"

Edit User

Updates only the supplied fields.

curl -X PATCH \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "docs-api-user-updated@example.com",
  "force_change": true
}' \
  "https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID"

Delete User

Deletes the object. Check references before deleting configuration used by routing or reporting.

curl -X DELETE \
  -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID"

User Tenant and Routing Profile Relations

Replaces the user tenant, routing profile, and allowed profile relations with the supplied IDs.

curl -X PATCH \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "tenant_ids": [
    1
  ],
  "routingprofile_ids": [
    3
  ],
  "allowed_userprofile_ids": [
    2
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID"

User Object Restrictions

Restricts the user to specific queues, extensions, or providers.

curl -X PATCH \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "queue_restrictions": [
    12
  ],
  "extension_restrictions": [
    45
  ],
  "provider_restrictions": [
    7
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/users/OBJECT_ID"

Common Errors

ErrorMeaning
missing_api_keyNo API key was supplied in the query string, X-API-Key, or bearer token.
invalid_api_keyThe supplied key does not match the tenant or global API key.
tenant_requiredA tenant code is required for tenant-scoped writes or tenant-key reads.
read_only_api_keyThe key can read data but cannot create, update, or delete objects.
missing_required_fieldA required create field is missing.