On this page

    1. Home
    2. API
    3. API Reference
    4. Device
    5. Create Adopt Code

    Create Adopt Code

    The create-adopt-code endpoint initiates the hardware adoption process. It generates a unique adopt_code and a corresponding adopt_secret. These credentials allow another network to "adopt" the device, effectively transferring its ownership and management to the target network.


    POST /device/create-adopt-code

    Generate a new adoption code for a specified device profile.

    Request

    POST /device/create-adopt-code

    Headers:

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

    Body:

    {
      "device_name": "string",
      "device_spec": "string"
    }
    FieldTypeDescription
    device_namestringRequired. The human-readable name assigned to the device being prepared for adoption.
    device_specstringRequired. Hardware or software specification identifier for the device.

    Response

    200 Success

    Status: 200 OK

    Content-Type: application/json

    {
      "adopt_code": "string",
      "adopt_secret": "string",
      "duration_minutes": 0,
      "error": {
        "message": "string"
      }
    }

    Fields

    FieldTypeDescription
    adopt_codestringThe unique code used by the adopter to identify the device.
    adopt_secretstringA secret token that must be shared with the adopter to authorize the transfer.
    duration_minutesintegerThe amount of time (in minutes) before the adoption code expires.
    errorobjectReturned if the code generation fails.
    error.messagestringA description of the error encountered.

    Example

    HTTP Request

    POST /device/create-adopt-code HTTP/1.1
    Host: api.bringyour.com
    Content-Type: application/json
    Authorization: Bearer YOUR_JWT_TOKEN
     
    {
      "device_name": "Living Room Relay",
      "device_spec": "urn-pi-v4"
    }

    Successful HTTP Response

    {
      "adopt_code": "ADOPT-ABCD-1234",
      "adopt_secret": "sec_987654321",
      "duration_minutes": 15,
      "error": null
    }


    Powered by Sudoc v2.5.0
    Hide table of contents