> 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

# Generate device activation code

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

Generates a one-time, 6-digit verification code for activating a
semi-integrated card-present device in a paypoint. After calling this endpoint, an operator enters the returned code
on the device's terminal, along with a device name, to register the
device to the paypoint resolved from `{entry}`.

A code expires 5 minutes after it's issued. A paypoint can have several
codes active at once — for example, when activating a batch of devices —
and a code binds to whichever device enters it first.

Authenticate with an OAuth2 Bearer token that has the `device_registry` scope.

Reference: https://docs.payabli.com/developers/api-reference/device/generate-device-activation-code

## Authentication

- `Authorization` header (bearer token, required)

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

## Response

### 200

Success

- `responseText` (string, required) — Response text for operation: 'Success' or 'Declined'.
- `responseData` (object, required) — The issued activation code and the time it expires.
  - `code` (string, required) — The 6-digit verification code the operator enters on the device's terminal to activate it. It can start with leading zeros, so keep it as a string.
  - `expiresAt` (datetime, required) — UTC time when the code expires, in ISO-8601 round-trip format. A code is valid for 5 minutes after it's issued.
- `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.

## Examples

**Response**

```json
{
  "responseText": "Success",
  "responseData": {
    "code": "748801",
    "expiresAt": "2026-08-13T19:58:27.5860203Z"
  },
  "responseCode": 1,
  "pageIdentifier": "",
  "roomId": 0,
  "isSuccess": true
}
```

**SDK Code**

```typescript
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient();
    await client.device.challenge("8cfec329267");
}
main();

```

```python
from payabli import payabli

client = payabli()

client.device.challenge(
    entry="8cfec329267",
)

```

```java
package com.example.usage;

import io.github.payabli.api.PayabliApiClient;

public class Example {
    public static void main(String[] args) {
        PayabliApiClient client = PayabliApiClient
            .builder()
            .build();

        client.device().challenge("8cfec329267");
    }
}
```

```csharp
using PayabliApi;
using System.Threading.Tasks;

public partial class Examples
{
    public async Task Example() {
        var client = new PayabliApiClient();

        await client.Device.ChallengeAsync(
            "8cfec329267"
        );
    }

}

```

```go
package example

import (
    context "context"

    client "github.com/payabli/sdk-go/client"
)

func do() {
    client := client.NewClient()
    client.Device.Challenge(
        context.TODO(),
        "8cfec329267",
    )
}

```

```php
<?php

namespace Example;

use Payabli\PayabliClient;

$client = new PayabliClient();
$client->device->challenge(
    '8cfec329267',
);

```

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

url = URI("https://api-sandbox.payabli.com/api/Device/challenge/8cfec329267")

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

```swift
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Device/challenge/8cfec329267")! 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()
```