POST /device/
- Method:
POST - URL:
https://pos.b4bit.com/api/v1/device/ - Authentication:
X-Device-Idheader with an existing merchant device’s API Key.
Content-Type: application/json.
{ "name": "caja-tienda-3"}| Field | Type | Required | Max | Description |
|---|---|---|---|---|
name | string | ✓ | 128 | Human-readable device name. Unique per merchant recommended. |
Examples
Section titled “Examples”curl -X POST \-H "X-Device-Id: $B4BIT_API_KEY" \-H "Content-Type: application/json" \-d '{"name": "caja-tienda-3"}' \https://pos.b4bit.com/api/v1/device/const res = await fetch('https://pos.b4bit.com/api/v1/device/', {method: 'POST',headers: { 'X-Device-Id': process.env.B4BIT_API_KEY, 'Content-Type': 'application/json',},body: JSON.stringify({ name: 'caja-tienda-3' }),});const device = await res.json();console.log('Nueva API Key:', device.identifier);import os, requests
r = requests.post( 'https://pos.b4bit.com/api/v1/device/', headers={ 'X-Device-Id': os.environ['B4BIT_API_KEY'], 'Content-Type': 'application/json', }, json={'name': 'caja-tienda-3'},)device = r.json()print('Nueva API Key:', device['identifier'])200 response
Section titled “200 response”{ "name": "caja-tienda-3", "identifier": "abcdef12-3456-7890-abcd-ef1234567890"}identifieris the new API Key of the freshly created device. Save it: it cannot be recovered later.
Errors
Section titled “Errors”403— Missing or invalidX-Device-Id.500— Internal error.
Typical flow
Section titled “Typical flow”- Create the device via API.
- Copy the returned
identifierinto your production environment variables. - In the dashboard, configure the device’s
notification_urland default fiat. - Generate the Secret Key (to sign webhooks) from the dashboard.
Alternative
Section titled “Alternative”The most common way to create devices is from the web dashboard: Settings → Merchant → Devices. Use this endpoint only if you need to create devices programmatically (for example, automated branch onboarding).