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

# Register a device token

> Upserts an FCM registration token for the authenticated user. Call this after login and whenever the FCM SDK reports a token refresh.

If the token already exists under a different user (e.g. the device was previously signed into another account), it is reassigned to the current caller rather than duplicated.



## OpenAPI

````yaml /openapi/shared.yaml post /api/v1/notifications/devices
openapi: 3.0.3
info:
  title: Shared Service API
  version: 1.0.0
  description: |2-

        **Shared Service API** - Comprehensive shared service and management system.

        ## Versionings
        The API uses URL path versioning (e.g., `/api/v1/`, `/api/v2/`).
        Current version: **v1**
        
  contact:
    name: API Support
    email: thakacreations@gmail.com
  license:
    name: thakacreations
servers: []
security: []
paths:
  /api/v1/notifications/devices:
    post:
      tags:
        - notifications
      summary: Register a device token
      description: >-
        Upserts an FCM registration token for the authenticated user. Call this
        after login and whenever the FCM SDK reports a token refresh.


        If the token already exists under a different user (e.g. the device was
        previously signed into another account), it is reassigned to the current
        caller rather than duplicated.
      operationId: notifications_devices_register
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceTokenRegisterRequest'
            examples:
              RegisterRequest:
                value:
                  token: <fcm-registration-token>
                  platform: android
                  provider: fcm
                summary: Register request
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/DeviceTokenRegisterRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/DeviceTokenRegisterRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceTokenRegisterResponse'
              examples:
                Registered:
                  value:
                    success: true
                    message: Device token registered
                    data: {}
          description: ''
      security:
        - bearerAuth: []
components:
  schemas:
    DeviceTokenRegisterRequest:
      type: object
      properties:
        token:
          type: string
          minLength: 1
          maxLength: 255
        platform:
          enum:
            - ios
            - android
            - web
          type: string
          description: |-
            * `ios` - ios
            * `android` - android
            * `web` - web
          x-spec-enum-id: 07115ed106932beb
        provider:
          type: string
          minLength: 1
          default: fcm
          maxLength: 16
      required:
        - platform
        - token
    DeviceTokenRegisterResponse:
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
        data:
          type: object
          additionalProperties: {}
      required:
        - data
        - message
        - success
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Enter your JWT token in the format: Bearer <token>'

````