Tunploy
APIReferenceDevices

Create a device

POST/devices

Send public_key to keep the private key on the client; the config then has no PrivateKey line. Send server_id: "auto" (with country or city if you like) to let the panel pick the emptiest running server.

Needs the devices:write scope.

Authorization

apiKey
AuthorizationBearer <token>

An API key: tp_….

In: header

Header Parameters

Idempotency-Key?string

A retry with the same key within 24 hours gets the first reply back (with Idempotent-Replayed: true) instead of running again.

Lengthlength <= 255

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/devices" \  -H "Content-Type: application/json" \  -d '{    "server_id": 0  }'
{  "id": 0,  "server_id": 0,  "name": "string",  "external_id": "string",  "metadata": {},  "address": "10.8.0.2",  "public_key": "string",  "client_key": true,  "enabled": true,  "status": "active",  "online": true,  "last_handshake": "2019-08-24T14:15:22Z",  "data_limit": 0,  "limit_period": "monthly",  "period_usage": {    "rx_bytes": 0,    "tx_bytes": 0,    "total_bytes": 0  },  "usage_reset_at": "2019-08-24T14:15:22Z",  "expires_at": "2019-08-24T14:15:22Z",  "speed_limit": 0,  "month_usage": {    "rx_bytes": 0,    "tx_bytes": 0,    "total_bytes": 0  },  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z",  "config": "string"}