> This is Payabli documentation. For a complete page index, fetch https://docs.payabli.com/llms.txt — append .md to any page URL for lightweight markdown. For section-level indexes, query parameters, and other AI-optimized access methods, see https://docs.payabli.com/ai-agents.md

# Unregister a device

POST https://api-sandbox.payabli.com/api/Device/unregister/{entry}/{deviceId}

Starts unregistering a semi-integrated or standalone device that
Payabli manages, such as an AXIUM device. You can unregister a device
that's `Active` or `Inactive`.

Payabli sends the unregister command to the device and moves it to
`Unregistering` (`4`). The device can't take payments from this point.
When the device next connects and confirms, it moves to `Unregistered`
(`5`). If the device will never connect again, for example because it's
lost, use
[Force unregister a device](/developers/api-reference/device/force-unregister-device)
to move it to `Unregistered`.

You can't undo an unregistration. To use the device again, register it
with a new activation code. Payabli adds it as a new device with a new
`deviceId`.

Sending this request for a device that's already `Unregistering` or
`Unregistered` changes nothing and returns `200` with the device's
current status.

Requires one of the `device_delete` or `pos_delete` permissions.


Reference: https://docs.payabli.com/developers/api-reference/device/unregister-device

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.
- `requestToken` header (required) — Long-lived API token sent in the `requestToken` header. See [API token authentication](/developers/api-tokens).

## Servers

- `https://api-sandbox.payabli.com/api` (Sandbox, default)
- `https://api.payabli.com/api` (Production)

## Request

### Path parameters

- `entry` (string, required) — The paypoint's entrypoint identifier. [Learn more](/developers/api-reference/api-overview#entrypoint-vs-entry)
- `deviceId` (string, required) — The device's ID.

## Response

### 200

Success

- `responseText` (string, required) — Response text for operation: 'Success' or 'Declined'.
- `responseData` (DeviceLifecycleData, required) — The device and its status after the request.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/developers/api-reference/api-responses).
- `pageIdentifier` (string, optional) — Auxiliary validation used internally by payment pages and components.
- `roomId` (long, optional) — Field not in use on this endpoint. It always returns `0`.
- `isSuccess` (boolean, optional) — Boolean indicating whether the operation was successful. A `true` value indicates success. A `false` value indicates failure.

## Errors

### 400 Bad Request Error

Bad request / invalid data.

- `isSuccess` (boolean, required) — Always `false` for error responses.
- `responseText` (string, required) — Error text describing what went wrong.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/developers/api-reference/api-responses).
- `responseData` (PayabliErrorBodyResponseData, optional) — Object with detailed error context.

### 401 Unauthorized Error

Unauthorized request.

- `isSuccess` (boolean, required) — Always `false` for error responses.
- `responseText` (string, required) — Error text describing what went wrong.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/developers/api-reference/api-responses).
- `responseData` (PayabliErrorBodyResponseData, optional) — Object with detailed error context.

### 404 Not Found Error

The requested resource wasn't found.

- `isSuccess` (boolean, required) — Always `false` for error responses.
- `responseText` (string, required) — Error text describing what went wrong.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/developers/api-reference/api-responses).
- `responseData` (PayabliErrorBodyResponseData, optional) — Object with detailed error context.

### 409 Conflict Error

The request conflicts with the current state of the resource.

- `isSuccess` (boolean, required) — Always `false` for error responses.
- `responseText` (string, required) — Error text describing what went wrong.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/developers/api-reference/api-responses).
- `responseData` (PayabliErrorBodyResponseData, optional) — Object with detailed error context.

### 500 Internal Server Error

Internal server error.

- `isSuccess` (boolean, required) — Always `false` for error responses.
- `responseText` (string, required) — Error text describing what went wrong.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/developers/api-reference/api-responses).
- `responseData` (PayabliErrorBodyResponseData, optional) — Object with detailed error context.

## Types

### DeviceLifecycleData

The device and its status after the request.

- `deviceId` (string, required) — The device's ID.
- `deviceStatus` (integer, required) — The device's lifecycle status after the request: - `0`: Inactive - `1`: Active - `4`: Unregistering - `5`: Unregistered
- `message` (string, required) — A short description of what happened, such as `Device deactivated`.
- `correlationId` (string, optional, nullable) — The ID of the command Payabli sent to the device. Returned only when the request sends a command to the device, such as when you start an unregistration. Otherwise `null`.

### PayabliErrorBodyResponseData

Object with detailed error context.

- `explanation` (string, optional) — Human-readable explanation of what happened.
- `todoAction` (string, optional) — Suggested resolution.

## Examples

**Response**

```json
{
  "responseText": "Success",
  "responseData": {
    "deviceId": "499585-389fj484-3jcj8hj3",
    "deviceStatus": 4,
    "message": "Unregistration requested",
    "correlationId": "3b7e1f52-9c4d-4a8e-b2f6-0d5c8a1e7f94"
  },
  "responseCode": 1,
  "pageIdentifier": "",
  "roomId": 0,
  "isSuccess": true
}
```

**SDK Code**

```python
import requests

url = "https://api-sandbox.payabli.com/api/Device/unregister/8cfec329267/499585-389fj484-3jcj8hj3"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api-sandbox.payabli.com/api/Device/unregister/8cfec329267/499585-389fj484-3jcj8hj3';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api-sandbox.payabli.com/api/Device/unregister/8cfec329267/499585-389fj484-3jcj8hj3"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api-sandbox.payabli.com/api/Device/unregister/8cfec329267/499585-389fj484-3jcj8hj3")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api-sandbox.payabli.com/api/Device/unregister/8cfec329267/499585-389fj484-3jcj8hj3")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-sandbox.payabli.com/api/Device/unregister/8cfec329267/499585-389fj484-3jcj8hj3', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api-sandbox.payabli.com/api/Device/unregister/8cfec329267/499585-389fj484-3jcj8hj3");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Device/unregister/8cfec329267/499585-389fj484-3jcj8hj3")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```