Skip to main content
POST
/
devices
Add Device
curl --request POST \
  --url https://api.example.com/devices \
  --header 'Content-Type: application/json' \
  --data '
{
  "device_id": "<string>"
}
'
{
  "400": {},
  "500": {},
  "code": "<string>",
  "message": "<string>",
  "status": 123,
  "results": {
    "id": "<string>",
    "phone_number": "<string>",
    "display_name": "<string>",
    "state": "<string>",
    "jid": "<string>",
    "created_at": "<string>"
  }
}
Create a new device slot that can be used to connect a WhatsApp account. You can optionally provide a custom device ID, or let the system generate one automatically.

Endpoint

POST /devices

Authentication

This endpoint requires HTTP Basic Authentication.

Request Body

device_id
string
Optional custom device ID. If not provided, a UUID will be generated automatically.

Request Example

{
  "device_id": "my-custom-device-id"
}
Or for auto-generated device ID:
{}

Response

code
string
Response code
message
string
Response message
status
integer
HTTP status code
results
object
Device information object

Response Example

{
  "code": "SUCCESS",
  "message": "Device added",
  "status": 200,
  "results": {
    "id": "my-custom-device-id",
    "phone_number": "",
    "display_name": "",
    "state": "disconnected",
    "jid": "",
    "created_at": "2024-01-01T00:00:00Z"
  }
}

Error Responses

400
object
Bad Request - Device ID already exists or invalid
500
object
Internal Server Error

Example Request

curl -X POST http://localhost:3000/devices \
  -u username:password \
  -H "Content-Type: application/json" \
  -d '{"device_id": "my-custom-device-id"}'

Next Steps

After adding a device, you need to:
  1. Login the device using either:
  2. Use the device ID in subsequent API calls via the X-Device-Id header

Build docs developers (and LLMs) love