On this page

    1. Home
    2. API
    3. API Reference
    4. Network
    5. Auth Network Client

    Auth Network Client

    This endpoint is used to authenticate an existing client device or register a new one into your network. It returns a specific JWT for the client device (by_client_jwt) and optional proxy or relay configuration in proxy_config_result.


    POST /network/auth-client

    Register or authenticate a network client. For new devices, you can provide a description and hardware specification. You can also request proxy, HTTPS auth, WireGuard, IP locking, and an initial device state via proxy_config.

    Request

    POST /network/auth-client

    Headers:

    {
      "Host": "api.bringyour.com",
      "Content-Type": "application/json",
      "Authorization": "Bearer YOUR_JWT_TOKEN"
    }

    Body:

    {
      "client_id": "string",
      "source_client_id": "string",
      "derived_client_id": "string",
      "description": "My Laptop",
      "device_spec": "macOS-arm64-v1.0.0",
      "proxy_config": {
        "lock_caller_ip": true,
        "lock_ip_list": [
          "203.0.113.10"
        ],
        "https_require_auth": true,
        "enable_wg": true,
        "initial_device_state": {
          "country_code": "US",
          "location": {
            "connect_location_id": {
              "client_id": "string",
              "location_id": "string",
              "location_group_id": "string",
              "best_available": true
            },
            "name": "United States",
            "location_type": "country"
          },
          "performance_profile": {
            "window_type": "quality",
            "window_size_settings": {
              "window_size_min": 0,
              "window_size_min_p2p_only": 0,
              "window_size_max": 0,
              "window_size_hard_max": 0,
              "window_size_reconnect_scale": 0,
              "keep_healthiest_count": 0,
              "ulimit": 0
            }
          }
        }
      }
    }

    Fields

    FieldTypeDescription
    client_idstringOptional. UDID of an existing client. Omit to register a new device.
    source_client_idstringOptional. The source client identifier for ancillary or derived clients.
    derived_client_idstringOptional. Identifier for a client derived from source_client_id where applicable.
    descriptionstringOptional. Sets the device name if this is a new registration.
    device_specstringOptional. Hardware or software specification identifier for the device.
    proxy_configobjectOptional. Configuration for proxy behavior, including IP locking, HTTPS auth, WireGuard, and an initial device state.
    proxy_config.lock_caller_ipbooleanOptional. If true, locks access to the caller IP observed by the API.
    proxy_config.lock_ip_liststring[]Optional. Explicit allow-list of IPs permitted to use the proxy.
    proxy_config.https_require_authbooleanOptional. If true, HTTPS proxy requires auth credentials/token.
    proxy_config.enable_wgbooleanOptional. If true, includes WireGuard configuration in the response.
    proxy_config.initial_device_stateobjectOptional. Sets initial country, location selection, and performance profile hints.
    proxy_config.initial_device_state.country_codestringOptional. Two-letter country code.
    proxy_config.initial_device_state.locationobjectOptional. Desired initial location selection.
    proxy_config.initial_device_state.location.connect_location_idobjectOptional. Specific location identity fields; set best_available to true to auto-pick.
    proxy_config.initial_device_state.location.namestringOptional. Human-readable location name.
    proxy_config.initial_device_state.location.location_typestringOptional. Location type, for example country.
    proxy_config.initial_device_state.performance_profileobjectOptional. Performance profile settings for connection selection behavior.
    proxy_config.initial_device_state.performance_profile.window_typestringOptional. Window strategy, for example quality.
    proxy_config.initial_device_state.performance_profile.window_size_settingsobjectOptional. Window sizing values controlling connection selection and health.

    Response

    200 Success

    Status: 200 OK
    Content-Type: application/json

    {
      "by_client_jwt": "string",
      "proxy_config_result": {
        "keepalive_seconds": 0,
        "http_proxy_url": "string",
        "https_proxy_url": "string",
        "socks_proxy_url": "string",
        "auth_token": "string",
        "instance_id": "string",
        "proxy_host": "string",
        "socks_proxy_port": 0,
        "http_proxy_port": 0,
        "https_proxy_port": 0,
        "wg_config": {
          "wg_proxy_port": 0,
          "client_private_key": "string",
          "client_public_key": "string",
          "client_ipv4": "string",
          "proxy_public_key": "string",
          "config": "string"
        }
      },
      "error": {
        "client_limit_exceeded": true,
        "message": "string"
      }
    }

    Fields

    FieldTypeDescription
    by_client_jwtstringThe authentication token specific to this client device.
    proxy_config_resultobjectResulting network configuration for the client, including proxy URLs, ports, and optional WireGuard config.
    proxy_config_result.keepalive_secondsnumberKeepalive interval (seconds) for maintaining the session.
    proxy_config_result.http_proxy_urlstringHTTP proxy URL if issued.
    proxy_config_result.https_proxy_urlstringHTTPS proxy URL if issued.
    proxy_config_result.socks_proxy_urlstringSOCKS proxy URL if issued.
    proxy_config_result.auth_tokenstringToken used for authenticating to proxy endpoints when required.
    proxy_config_result.instance_idstringProxy instance identifier.
    proxy_config_result.proxy_hoststringProxy host address.
    proxy_config_result.socks_proxy_portnumberSOCKS proxy port.
    proxy_config_result.http_proxy_portnumberHTTP proxy port.
    proxy_config_result.https_proxy_portnumberHTTPS proxy port.
    proxy_config_result.wg_configobjectWireGuard configuration, present when proxy_config.enable_wg is true.
    errorobjectPresent if authentication or registration failed.
    error.client_limit_exceededbooleanTrue if the network has reached its maximum device limit.

    Example

    HTTP Request

    POST /network/auth-client HTTP/1.1
    Host: api.bringyour.com
    Content-Type: application/json
    Authorization: Bearer YOUR_JWT_TOKEN
     
    {
      "description": "Office Desktop",
      "device_spec": "linux-x64-deb",
      "proxy_config": {
        "enable_wg": true,
        "https_require_auth": true,
        "lock_caller_ip": true
      }
    }

    Successful HTTP Response

    {
      "by_client_jwt": "eyJhbGciOiJIUzI1NiI...",
      "proxy_config_result": {
        "keepalive_seconds": 300,
        "http_proxy_url": "http://proxy.example:8080",
        "https_proxy_url": "https://proxy.example:8443",
        "socks_proxy_url": "socks5://proxy.example:1080",
        "auth_token": "token...",
        "instance_id": "instance...",
        "proxy_host": "proxy.example",
        "socks_proxy_port": 1080,
        "http_proxy_port": 8080,
        "https_proxy_port": 8443,
        "wg_config": {
          "wg_proxy_port": 51820,
          "client_private_key": "...",
          "client_public_key": "...",
          "client_ipv4": "10.0.0.2/32",
          "proxy_public_key": "...",
          "config": "..."
        }
      },
      "error": null
    }


    Powered by Sudoc v2.5.0
    Hide table of contents