---
title: "Swap device"
method: POST
path: "/v2/partition/{partitionId}/account/{accountId}/deviceline/{deviceId}/swap"
tags: ["Account Device Line"]
---

# Swap device

`POST /v2/partition/{partitionId}/account/{accountId}/deviceline/{deviceId}/swap`

## Request

- Base URL: `https://api.alianza.com`
- URL: `https://api.alianza.com/v2/partition/{partitionId}/account/{accountId}/deviceline/{deviceId}/swap`
- Auth: API key in header `X-AUTH-TOKEN`
- TypeScript: <https://skmtc.dev/alianza/apis/alianza-public-api/docs/v2/partition/:partitionId/account/:accountId/deviceline/:deviceId/swap/post.ts> (a function with typed inputs; its response is checked against the schema)

Use to replace an existing device with a new one. Swapping is not allowed when  i) the existing device includes side cars,  ii) only one of the devices is an SMB phone,  iii) the existing device is enabled for SIP paging while the new device is not, or  iv) the existing device line number is greater than the new device line count. <span hidden>See more about <a href="accountDeviceLine.html">Account Device Lines</a>.</span>

## Path parameters

- `accountId` string, required
- `deviceId` string, required
- `partitionId` string, required

## Request body

- DeviceSwapX: Refers to swapping <span hidden><a href="accountDeviceLine.html">Account Device Lines</a></span>Account Device Lines.
  - `macAddress` string, required: The 48-bit hexadecimal address assigned to the device by the manufacturer. Required if the device line refers to a physical device. Must not be claimed in another device request.
  - `deviceTypeId` string, required: Identifies the equipment as well as the features that the device supports. Refers to <a href="#/~schema/DeviceTypeX">deviceType.id</a>. See also: <a href="#/~operation/Reference%20Resources/getDeviceTypes">Get All Device Types</a> and <a href="#/~operation/Reference%20Resources/getDeviceTypeById">Get Device Type by ID</a>
  - `deviceName` string, required

## Response `200`

Successful operation

- DeviceX
  - `id` string, required: Not required for creating a new device line
  - `deviceTypeId` string, required: Identifies the equipment as well as the features that the device supports. Refers to <a href="#/~schema/DeviceTypeX">deviceType.id</a>. See also: <a href="#/~operation/Reference%20Resources/getDeviceTypes">Get All Device Types</a> and <a href="#/~operation/Reference%20Resources/getDeviceTypeById">Get Device Type by ID</a>
  - `accountId` string, required: Not required for creating a new device line
  - `partitionId` string, required: Not required for creating a new device line
  - `macAddress` string: The 48-bit hexadecimal address assigned to the device by the manufacturer. Required if the device line refers to a physical device. Must not be claimed in another device request.
  - `deviceName` string, required
  - `emergencyNumber` string: Required if emergencyNumberReservationId is absent
  - `emergencyNumberReservationId` string: Required if emergencyNumber is absent
  - `faxEnabled` boolean, required
  - `lineNumber` integer, required: Required for POST & PUT operations only
  - `userId` string, required
  - `sipPassword` string
  - `sipUsername` string: Required to be globally unique if specified
  - `zipcode` string
  - `state` string
  - `lineType` 'Line' | 'AdvancedSharedLine' | 'ReferencedUser' | 'IntercomLine' | 'PresenceBlfUser' | 'SpeedDialUser' | 'SpeedDialTn' | 'CallParkingSpot' | 'SipPaging' | 'Custom'
  - `referenceId` string: Changes Depending on LineType. If LineType.Line then this should be null. If LineType.ReferencedUser, PresenceBlfUser, or SpeedDialUser then this should be a valid userid. If LineType.SpeedDialTn then this should be a valid phone number.
  - `provisioningRequest` ProvisioningRequestX
    - `id` string: The 48-bit hexadecimal address assigned to the device by the manufacturer.
    - `requestDate` string, date-time: The ISO 8601 formatted date string indicating when the device last tried to retrieve provisioning data.
    - `httpStatus` integer: The http status of the device's most recent request for provisioning.
    - `deviceId` string: DeviceId, reference to <a href="#/~schema/DeviceX">device.id</a>
    - `ipAddress` string
    - `userAgent` string: The user agent that was used to retrieve the provisioning data.

## Other responses

- `400`: Invalid request parameters
- `401`: Unauthorized
- `404`: Not found

---

[API](https://skmtc.dev/alianza/apis/alianza-public-api.md) - [All operations](https://skmtc.dev/alianza/apis/alianza-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/alianza/apis/alianza-public-api/revisions/7223246c352c?raw)
