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

# Send a test notification

> Sends a push to the devices this student registered, to prove a registration works.
Omit `token` to reach every registered device, or name one to test it alone.

`results[].reason` carries the failure from FCM verbatim — that string is the point
of this endpoint. A device that FCM reports as dead is removed from the registry
here, so a second call will no longer list it.



## OpenAPI

````yaml /api-reference/openapi.json post /api/devices/test
openapi: 3.1.0
info:
  title: Lala Client API
  description: >-
    The HTTP API behind Lala, the AI study companion for Turkish YKS and LGS
    students. This document is generated from the Zod schemas that validate each
    request at runtime. Do not hand-edit openapi.json. Student-visible text is
    Turkish. All identifiers are English.
  version: 1.0.0
servers:
  - url: https://client-api.lala.ist
    description: production
  - url: http://localhost:3000
    description: local dev
security:
  - supabaseJwt: []
tags:
  - name: chat
    description: The chat stream, the message history, and reactions
  - name: media
    description: Upload and read message attachments
  - name: plan
    description: The study planner — blocks of work on a day
  - name: journey
    description: Deneme results, topic performance, study-hours stats, and the streak
  - name: profile
    description: The student profile and onboarding
  - name: devices
    description: Push notification devices
  - name: system
    description: Health check
paths:
  /api/devices/test:
    post:
      tags:
        - devices
      summary: Send a test notification
      description: >-
        Sends a push to the devices this student registered, to prove a
        registration works.

        Omit `token` to reach every registered device, or name one to test it
        alone.


        `results[].reason` carries the failure from FCM verbatim — that string
        is the point

        of this endpoint. A device that FCM reports as dead is removed from the
        registry

        here, so a second call will no longer list it.
      operationId: postApiDevicesTest
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceTestBody'
      responses:
        '200':
          description: What each device did with the notification
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceTestResponse'
        '401':
          description: The token is missing, expired, or invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: The student has no registered device
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Push is not configured on the server
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    DeviceTestBody:
      type: object
      properties:
        token:
          description: Send to this device only. Omit to send to every registered device.
          type: string
          minLength: 1
          maxLength: 4096
        text:
          type: string
          minLength: 1
          maxLength: 500
    DeviceTestResponse:
      type: object
      properties:
        sent:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        failed:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        results:
          type: array
          items:
            $ref: '#/components/schemas/DeviceTestResult'
      required:
        - sent
        - failed
        - results
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        issues:
          description: >-
            Present only on a 400 raised by request validation, capped at 10
            entries. Every other error carries `error` alone.
          type: array
          items:
            $ref: '#/components/schemas/ValidationIssue'
      required:
        - error
      description: Error body. `error` is a short English string.
    DeviceTestResult:
      type: object
      properties:
        token:
          type: string
          description: Masked to its last 12 characters.
        ok:
          type: boolean
        reason:
          description: The FCM failure, verbatim. Present when `ok` is false.
          type: string
      required:
        - token
        - ok
    ValidationIssue:
      type: object
      properties:
        path:
          type: string
          description: Dotted path to the offending field, empty at the root.
        message:
          type: string
      required:
        - path
        - message
  securitySchemes:
    supabaseJwt:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Supabase access token: `Authorization: Bearer <token>`'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.