> 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

# Deactivate or activate a device

PATCH https://api-sandbox.payabli.com/api/Device/status/{entry}/{deviceId}
Content-Type: application/json

Deactivates or activates a semi-integrated or standalone device that
Payabli manages, such as an AXIUM device. Set `deviceStatus` to `0` to
deactivate the device, or to `1` to activate it again.

A deactivated device keeps its registration and history, but it refuses
new sales and authorizations with error `E7070`. You can deactivate a
device that's `Active` or `Pending`, and activate a device that's
`Inactive`. Any other change returns `409`.

To remove a device from its paypoint for good, unregister it instead.
See [Manage AXIUM devices](/guides/pay-in-developer-devices-axium-manage).

Requires one of the `device_operation`, `device_update`, or
`pos_create` permissions.


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

## 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.

### Body (application/json)

This endpoint expects a DeviceStatusRequestBody.

- `deviceStatus` (enum, required) — The status to move the device to: - `0`: Inactive. Deactivates the device. - `1`: Active. Activates a deactivated device.
  - Allowed values: `0`, `1`

## 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

### DeactivateDevice

**Request**

```json
{
  "deviceStatus": 0
}
```

**Response**

```json
{
  "responseText": "Success",
  "responseData": {
    "deviceId": "499585-389fj484-3jcj8hj3",
    "deviceStatus": 0,
    "message": "Device deactivated",
    "correlationId": null
  },
  "responseCode": 1,
  "pageIdentifier": "",
  "roomId": 0,
  "isSuccess": true
}
```

**SDK Code**

```python DeactivateDevice
import requests

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

payload = { "deviceStatus": 0 }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript DeactivateDevice
const url = 'https://api-sandbox.payabli.com/api/Device/status/8cfec329267/499585-389fj484-3jcj8hj3';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"deviceStatus":0}'
};

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

```go DeactivateDevice
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"deviceStatus\": 0\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

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

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

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"deviceStatus\": 0\n}"

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

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

HttpResponse<String> response = Unirest.patch("https://api-sandbox.payabli.com/api/Device/status/8cfec329267/499585-389fj484-3jcj8hj3")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"deviceStatus\": 0\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api-sandbox.payabli.com/api/Device/status/8cfec329267/499585-389fj484-3jcj8hj3', [
  'body' => '{
  "deviceStatus": 0
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp DeactivateDevice
using RestSharp;

var client = new RestClient("https://api-sandbox.payabli.com/api/Device/status/8cfec329267/499585-389fj484-3jcj8hj3");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"deviceStatus\": 0\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift DeactivateDevice
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["deviceStatus": 0] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

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

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()
```

### ActivateDevice

**Request**

```json
{
  "deviceStatus": 1
}
```

**Response**

```json
{
  "responseText": "Success",
  "responseData": {
    "deviceId": "499585-389fj484-3jcj8hj3",
    "deviceStatus": 1,
    "message": "Device activated",
    "correlationId": null
  },
  "responseCode": 1,
  "pageIdentifier": "",
  "roomId": 0,
  "isSuccess": true
}
```

**SDK Code**

```python ActivateDevice
import requests

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

payload = { "deviceStatus": 1 }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript ActivateDevice
const url = 'https://api-sandbox.payabli.com/api/Device/status/8cfec329267/499585-389fj484-3jcj8hj3';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"deviceStatus":1}'
};

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

```go ActivateDevice
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"deviceStatus\": 1\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

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

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

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"deviceStatus\": 1\n}"

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

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

HttpResponse<String> response = Unirest.patch("https://api-sandbox.payabli.com/api/Device/status/8cfec329267/499585-389fj484-3jcj8hj3")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"deviceStatus\": 1\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api-sandbox.payabli.com/api/Device/status/8cfec329267/499585-389fj484-3jcj8hj3', [
  'body' => '{
  "deviceStatus": 1
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp ActivateDevice
using RestSharp;

var client = new RestClient("https://api-sandbox.payabli.com/api/Device/status/8cfec329267/499585-389fj484-3jcj8hj3");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"deviceStatus\": 1\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift ActivateDevice
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["deviceStatus": 1] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

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

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()
```