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

# Create / Update Tokens

> Register or Update FCM Token

<Info>Pass `existingToken` to update it with the `fcmToken`</Info>


## OpenAPI

````yaml POST /tokens
openapi: 3.0.0
info:
  title: Token Management API
  version: 1.0.0
  description: API for managing FCM tokens and sending push notifications.
servers:
  - url: https://our-secret-api-url.com
security: []
paths:
  /tokens:
    post:
      description: Register or Update FCM Token
      parameters:
        - $ref: '#/components/parameters/X-API-KEY'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                fcmToken:
                  type: string
                existingToken:
                  type: string
              required:
                - fcmToken
      responses:
        '200':
          description: Token registered or updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '400':
          description: Bad Request - fcmToken is required
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '500':
          description: Internal Server Error - Error registering or updating token
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - bearerAuth: []
components:
  parameters:
    X-API-KEY:
      name: X-API-KEY
      description: API key required for authentication
      in: header
      required: true
      schema:
        type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````