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

# Register a push subscription

> Registers an APNs device token for push notifications. If the token already exists for the user it is updated in place. Requires write scope.




## OpenAPI

````yaml /openapi.yaml post /api/v1/push_subscriptions
openapi: 3.0.3
info:
  title: Sure API
  version: v1
  description: OpenAPI documentation generated from executable request specs.
servers:
  - url: https://app.sure.am
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
paths:
  /api/v1/push_subscriptions:
    post:
      tags:
        - Push Subscriptions
      summary: Register a push subscription
      description: >
        Registers an APNs device token for push notifications. If the token
        already exists for the user it is updated in place. Requires write
        scope.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - token
                - environment
                - platform
              properties:
                token:
                  type: string
                  description: >
                    APNs device token (hex string, 64–200 lowercase hex
                    characters).
                environment:
                  type: string
                  enum:
                    - sandbox
                    - production
                  description: APNs environment the token belongs to.
                platform:
                  type: string
                  enum:
                    - ios
                  description: >-
                    The platform of the device. Currently only `ios` is
                    supported.
      responses:
        '201':
          description: push subscription registered or updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PushSubscription'
        '422':
          description: validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKeyAuth: []
        - bearerAuth: []
components:
  schemas:
    PushSubscription:
      type: object
      required:
        - id
        - environment
        - platform
        - last_registered_at
      properties:
        id:
          type: string
          format: uuid
        environment:
          type: string
          enum:
            - sandbox
            - production
        platform:
          type: string
          enum:
            - ios
        last_registered_at:
          type: string
          format: date-time
          description: When the device last registered this token.
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        message:
          type: string
          nullable: true
        details:
          oneOf:
            - type: array
              items:
                type: string
            - type: object
          nullable: true
        errors:
          type: array
          items:
            type: string
          nullable: true
          description: >-
            Validation error messages (alternative to details used by trades,
            valuations, etc.)
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      name: X-Api-Key
      in: header
      description: API key for authentication. Generate one from your account settings.
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        OAuth2 Bearer token. Obtain a token from the /api/v1/auth/login or
        /api/v1/auth/refresh endpoints. The token must have the 'read' or
        'read_write' scope.

````