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

# Register a device



## OpenAPI

````yaml /openapi/backapp-public.json post /v2/auth/device
openapi: 3.1.0
info:
  title: Backapp API
  version: 2.0.0
  description: >-
    Initial reference for the Backapp image integration. Source baseline:
    owlly_api main at 21e55f3. Verify environment and request costs before
    running examples.
servers:
  - url: https://api.backapp.dev
security: []
paths:
  /v2/auth/device:
    post:
      summary: Register a device
      operationId: registerDevice
      parameters:
        - $ref: '#/components/parameters/AppVersion'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                device_id:
                  type: string
                  maxLength: 128
                  minLength: 1
              required:
                - device_id
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  user_id:
                    type: string
                    format: uuid
                  is_new:
                    type: boolean
                  access_token:
                    type: string
                  refresh_token:
                    type: string
                  subscription:
                    $ref: '#/components/schemas/Subscription'
                required:
                  - user_id
                  - is_new
                  - access_token
                  - refresh_token
                  - subscription
        '400':
          description: Missing app version header or invalid request fields.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: App credentials or user token rejected
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - AppKey: []
components:
  parameters:
    AppVersion:
      name: X-App-Version
      in: header
      required: true
      schema:
        type: string
        minLength: 1
      description: Version of the client application.
  schemas:
    Subscription:
      type: object
      properties:
        is_active:
          type: boolean
        is_trial:
          type: boolean
        product_id:
          type: string
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
        will_renew:
          type:
            - boolean
            - 'null'
      required:
        - is_active
        - is_trial
        - product_id
        - expires_at
        - will_renew
    Error:
      type: object
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            fields:
              type: object
              additionalProperties: true
      required:
        - error
  securitySchemes:
    AppKey:
      type: apiKey
      in: header
      name: X-App-Key
      description: Public application identifier.

````

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