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

# Register Device

> Register or refresh an FCM token.

Idempotent on (tenant_id, fcm_token): a re-POST updates last_seen,
locale, app_version, device_model, push_consent, and links to the
current user if the request is now authenticated.



## OpenAPI

````yaml https://api.vellaro.io/openapi.json post /api/v1/devices
openapi: 3.1.0
info:
  title: Vellaro API
  description: Vellaro 2026 — E-commerce API
  version: 0.1.0
servers:
  - url: https://api.vellaro.io
    description: Produzione
security: []
tags: []
paths:
  /api/v1/devices:
    post:
      tags:
        - devices
      summary: Register Device
      description: |-
        Register or refresh an FCM token.

        Idempotent on (tenant_id, fcm_token): a re-POST updates last_seen,
        locale, app_version, device_model, push_consent, and links to the
        current user if the request is now authenticated.
      operationId: register_device_api_v1_devices_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceRegisterBody'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse_DeviceOut_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    DeviceRegisterBody:
      properties:
        fcm_token:
          type: string
          maxLength: 255
          minLength: 20
          title: Fcm Token
        platform:
          type: string
          enum:
            - ios
            - android
            - web
          title: Platform
        locale:
          anyOf:
            - type: string
              maxLength: 5
            - type: 'null'
          title: Locale
        app_version:
          anyOf:
            - type: string
              maxLength: 40
            - type: 'null'
          title: App Version
        device_model:
          anyOf:
            - type: string
              maxLength: 120
            - type: 'null'
          title: Device Model
        push_consent:
          type: boolean
          title: Push Consent
          default: false
      additionalProperties: false
      type: object
      required:
        - fcm_token
        - platform
      title: DeviceRegisterBody
      description: |-
        POST /devices payload.

        The same body is used for first register + re-register on token
        rotation. Idempotency is enforced by the unique constraint on
        (tenant_id, fcm_token).
    ApiResponse_DeviceOut_:
      properties:
        data:
          anyOf:
            - $ref: '#/components/schemas/DeviceOut'
            - type: 'null'
        meta:
          anyOf:
            - $ref: '#/components/schemas/PaginationMeta'
            - type: 'null'
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Code
      type: object
      title: ApiResponse[DeviceOut]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    DeviceOut:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        platform:
          type: string
          title: Platform
        locale:
          anyOf:
            - type: string
            - type: 'null'
          title: Locale
        app_version:
          anyOf:
            - type: string
            - type: 'null'
          title: App Version
        device_model:
          anyOf:
            - type: string
            - type: 'null'
          title: Device Model
        push_consent:
          type: boolean
          title: Push Consent
        last_seen_at:
          type: string
          title: Last Seen At
      type: object
      required:
        - id
        - platform
        - locale
        - app_version
        - device_model
        - push_consent
        - last_seen_at
      title: DeviceOut
    PaginationMeta:
      properties:
        page:
          type: integer
          title: Page
        page_size:
          type: integer
          title: Page Size
        total:
          type: integer
          title: Total
        total_pages:
          type: integer
          title: Total Pages
      type: object
      required:
        - page
        - page_size
        - total
        - total_pages
      title: PaginationMeta
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````