import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const wireguardPeerListResponse of client.wireguardPeers.list()) {
console.log(wireguardPeerListResponse);
}{
"data": [
{
"id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
"record_type": "sample_record_type",
"created_at": "2018-02-02T22:25:27.521Z",
"updated_at": "2018-02-02T22:25:27.521Z",
"public_key": "qF4EqlZq+5JL2IKYY8ij49daYyfKVhevJrcDxdqC8GU=",
"last_seen": "2018-02-02T22:25:27.521Z",
"wireguard_interface_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
"private_key": "qF4EqlZq+5JL2IKYY8ij49daYyfKVhevJrcDxdqC8GU="
}
],
"meta": {
"total_pages": 3,
"page_number": 2,
"total_results": 55,
"page_size": 25
}
}List all WireGuard peers.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const wireguardPeerListResponse of client.wireguardPeers.list()) {
console.log(wireguardPeerListResponse);
}{
"data": [
{
"id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
"record_type": "sample_record_type",
"created_at": "2018-02-02T22:25:27.521Z",
"updated_at": "2018-02-02T22:25:27.521Z",
"public_key": "qF4EqlZq+5JL2IKYY8ij49daYyfKVhevJrcDxdqC8GU=",
"last_seen": "2018-02-02T22:25:27.521Z",
"wireguard_interface_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
"private_key": "qF4EqlZq+5JL2IKYY8ij49daYyfKVhevJrcDxdqC8GU="
}
],
"meta": {
"total_pages": 3,
"page_number": 2,
"total_results": 55,
"page_size": 25
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Successful response
Show child attributes
Identifies the resource.
"6a09cdc3-8948-47f0-aa62-74ac943d6c58"
Identifies the type of the resource.
"sample_record_type"
ISO 8601 formatted date-time indicating when the resource was created.
"2018-02-02T22:25:27.521Z"
ISO 8601 formatted date-time indicating when the resource was updated.
"2018-02-02T22:25:27.521Z"
The WireGuard PublicKey.
If you do not provide a Public Key, a new Public and Private key pair will be generated for you.
"qF4EqlZq+5JL2IKYY8ij49daYyfKVhevJrcDxdqC8GU="
ISO 8601 formatted date-time indicating when peer sent traffic last time.
"2018-02-02T22:25:27.521Z"
The id of the wireguard interface associated with the peer.
"6a09cdc3-8948-47f0-aa62-74ac943d6c58"
Your WireGuard Interface.PrivateKey.
This attribute is only ever utlised if, on POST, you do NOT provide your own public_key. In which case, a new Public and Private key pair will be generated for you. When your private_key is returned, you must save this immediately as we do not save it within Telnyx. If you lose your Private Key, it can not be recovered.
"qF4EqlZq+5JL2IKYY8ij49daYyfKVhevJrcDxdqC8GU="
Was this page helpful?