> ## Documentation Index
> Fetch the complete documentation index at: https://docs.notvis.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Register Device

> Register a device for push notifications. No API key required.

<Info>
  This endpoint is designed for client-side SDKs and does not require an API key. Authentication is handled via `account_id` and `app_id` validation.
</Info>

## Request Body

<ParamField body="account_id" type="string" required>
  Your Notvis account ID.
</ParamField>

<ParamField body="app_id" type="string" required>
  Your push notification app ID (configured in the dashboard).
</ParamField>

<ParamField body="platform" type="string" required>
  Push notification platform. Must be one of: `apns` (iOS), `fcm` (Android/Web via Firebase), or `web` (Web Push).
</ParamField>

<ParamField body="token" type="string" required>
  Device push token obtained from the platform SDK (APNs device token, FCM registration token, or Web Push subscription).
</ParamField>

<ParamField body="device_id" type="string">
  Unique device identifier. Used for device deduplication and anonymous-to-identified user linking.
</ParamField>

<ParamField body="os_version" type="string">
  Operating system version (e.g., `"iOS 17.4"`, `"Android 14"`).
</ParamField>

<ParamField body="app_version" type="string">
  Your application version (e.g., `"2.1.0"`).
</ParamField>

<ParamField body="locale" type="string">
  Device locale (e.g., `"en-US"`, `"hi-IN"`).
</ParamField>

<ParamField body="timezone" type="string">
  Device timezone (e.g., `"Asia/Kolkata"`, `"America/New_York"`).
</ParamField>

## Response

<ResponseField name="registration_id" type="string">
  Unique registration identifier for this device.
</ResponseField>

<ResponseField name="contact_id" type="string">
  Contact ID associated with this device.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.notvis.com/v1/push/register \
    -H "Content-Type: application/json" \
    -d '{
      "account_id": "your-account-id",
      "app_id": "your-app-id",
      "platform": "fcm",
      "token": "dGhpcyBpcyBhIHB1c2ggdG9rZW4...",
      "device_id": "device-uuid-123",
      "os_version": "Android 14",
      "app_version": "2.1.0",
      "locale": "en-US",
      "timezone": "Asia/Kolkata"
    }'
  ```

  ```javascript JavaScript (SDK) theme={null}
  await fetch('https://api.notvis.com/v1/push/register', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      account_id: 'your-account-id',
      app_id: 'your-app-id',
      platform: 'fcm',
      token: fcmToken,
      device_id: deviceId,
    }),
  });
  ```
</RequestExample>

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "registration_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "contact_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
  ```

  ```json 400 Validation Error theme={null}
  {
    "code": 400,
    "message": "validation failed",
    "details": {
      "platform": "platform must be one of: apns, fcm, web"
    }
  }
  ```
</ResponseExample>
