> ## 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 an APNs device token

> Available only in hosted (managed) mode. 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 an APNs device token
      description: Available only in hosted (managed) mode. Requires write scope.
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PushSubscriptionRegistration'
        required: true
      responses:
        '201':
          description: token registered
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PushSubscription'
        '403':
          description: push unavailable in self-hosted mode or insufficient write scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: invalid or conflicting subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKeyAuth: []
components:
  schemas:
    PushSubscriptionRegistration:
      type: object
      required:
        - token
        - environment
        - platform
      properties:
        token:
          type: string
          maxLength: 2048
          pattern: ^(?:[0-9a-fA-F]{2})+$
        environment:
          type: string
          enum:
            - sandbox
            - production
        platform:
          type: string
          enum:
            - ios
        device_key:
          type: string
          pattern: ^[0-9a-f]{64}$
          description: >-
            Optional 256-bit installation secret, unique per server and kept in
            device secure storage. Required proof to replace another user’s
            registration for this device. Never returned.
    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
    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.

````

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