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

# Generate registration token

> Generate a one-time-use registration token for a patient with a lifetime of 10 minutes.

<Tip>
  This endpoint is only needed if you want to use your own authentication system to manage kit registration. It's
  not needed in most cases. Speak to us if you want to build your registration flow this way.
</Tip>

This endpoint generates a one-time-use token that can be passed to your kit registration page to allow for a more
convenient registration process for repeat patients. This token is patient-specific. “patient\_id” is Spot’s unique
identifier for a patient. It is returned by any of our api endpoints that supply patient information, such as
sample and order retrieval.

<ResponseExample>
  ```json Response theme={null}
  {
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtYXgiOjEsInN1YiI6InBhdGllbnRfcmVnaXN0cmF0aW9uIiwibW9kIjoibiIsImp0aSI6MzYsImV4cCI6MTY2MTg4NjgzOCwiaWF0IjoxNjYxODg2MjM4fQ.byD8FThgvNGm3csx_QzrpZQUrsfFW3rmBU3mLQQlL2I"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml POST /api/v2/tokens/patient_registration/
openapi: 3.0.3
info:
  title: Spot API v2
  version: 2.0.0
  description: API Docs for Spot API
servers:
  - url: https://app.spotdx.com
    description: Production
security: []
paths:
  /api/v2/tokens/patient_registration/:
    post:
      description: >-
        Generate a one-time-use registration token for a patient with a lifetime
        of 10 minutes.
      operationId: api_v2_create_patient_token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePatientRegistrationToken'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CreatePatientRegistrationToken'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CreatePatientRegistrationToken'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PatientRegistrationTokenResponse'
          description: ''
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequest'
          description: ''
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFound'
          description: ''
      security:
        - tokenAuth: []
components:
  schemas:
    CreatePatientRegistrationToken:
      type: object
      properties:
        patient_id:
          type: string
          description: UUID of a patient you've already created.
        kit_type:
          type: string
          description: >-
            If this is a multi-purpose kit, optionally specify the kit type it
            should become. For more information about multi-purpose kits, read
            the advanced kit workflows guide.
          example: health_kit_1
      required:
        - patient_id
    PatientRegistrationTokenResponse:
      type: object
      properties:
        token:
          type: string
          readOnly: true
          example: >-
            eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtYXgiOjEsInN1YiI6InBhdGllbnRfcmVnaXN0cmF0aW9uIiwibW9kIjoibiIsImp0aSI6MzYsImV4cCI6MTY2MTg4NjgzOCwiaWF0IjoxNjYxODg2MjM4fQ.byD8FThgvNGm3csx_QzrpZQUrsfFW3rmBU3mLQQlL2I
      required:
        - token
    BadRequest:
      type: object
      properties:
        error:
          type: object
          properties:
            status:
              type: number
              example: 400
              enum:
                - 400
                - 401
                - 403
                - 404
                - 500
            type:
              type: string
              example: bad_request
              enum:
                - bad_request
                - not_found
                - unauthorized
                - forbidden
                - rate_limit_exceeded
                - internal_server_error
            detail:
              type: string
              example: The first_name field is required
      required:
        - error
    NotFound:
      type: object
      properties:
        error:
          type: object
          properties:
            status:
              type: number
              example: 404
              enum:
                - 400
                - 401
                - 403
                - 404
                - 500
            type:
              type: string
              example: forbidden
              enum:
                - bad_request
                - not_found
                - unauthorized
                - forbidden
                - rate_limit_exceeded
                - internal_server_error
            detail:
              type: string
              example: Kit id SPOTZZZZZZ not found
      required:
        - error
  securitySchemes:
    tokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Token-based authentication with required prefix "Token"

````