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

# Update DTT training program

> Update one or more fields on a training program. Only include the fields you want to change — all fields are optional.

If `Segment` is provided, it **replaces** the entire segment list (existing segments are deleted).

**Ultra-only fields:** `handsFreeMode`, `tagline`, and `iconId` require an Ultra subscription or higher.
Setting these to their "off" values (`false` / `null`) is always allowed.




## OpenAPI

````yaml https://dashboard.researchanddesire.com/openapi.yaml patch /dtt/templates/{id}
openapi: 3.1.0
info:
  title: Research And Desire API
  description: >
    The Research And Desire API provides programmatic access to your devices and
    data.


    All responses follow a standard envelope format:

    - Success: `{ "ok": true, "data": <result> }`

    - Error: `{ "ok": false, "error": "<message>" }`


    ## Pagination


    List endpoints support pagination via query parameters:

    - `limit`: Number of records to return (default: 50, max: 100)

    - `offset`: Number of records to skip (default: 0)


    Paginated responses include pagination metadata alongside the data array.


    ## Authentication


    All endpoints require a Bearer token in the Authorization header.

    Tokens can be created in the Dashboard settings (requires Ultra
    subscription).
  version: 1.0.0
  contact:
    name: Research And Desire Support
    url: https://www.researchanddesire.com/support
servers:
  - url: https://dashboard.researchanddesire.com/api/v1
    description: Production API
security:
  - bearerAuth: []
tags:
  - name: Users
    description: User account information
  - name: DTT
    description: Deepthroat Trainer devices
  - name: DTT Templates
    description: Deepthroat Trainer training program templates
  - name: DTT Sessions
    description: Deepthroat Trainer training session history
  - name: LKBX
    description: Chastity Lockbox devices
  - name: Lock Templates
    description: Lock templates
  - name: Lock Sessions
    description: Lock session management
  - name: OSSM
    description: Open Source Sex Machine devices
paths:
  /dtt/templates/{id}:
    patch:
      tags:
        - DTT Templates
      summary: Update DTT training program
      description: >
        Update one or more fields on a training program. Only include the fields
        you want to change — all fields are optional.


        If `Segment` is provided, it **replaces** the entire segment list
        (existing segments are deleted).


        **Ultra-only fields:** `handsFreeMode`, `tagline`, and `iconId` require
        an Ultra subscription or higher.

        Setting these to their "off" values (`false` / `null`) is always
        allowed.
      operationId: updateDttTemplate
      parameters:
        - $ref: '#/components/parameters/DttTemplateId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDttTemplateRequest'
            examples:
              renameProgram:
                summary: Rename a program
                value:
                  name: Advanced Program
              updateMultipleFields:
                summary: Update multiple fields
                value:
                  name: Updated Program
                  targetDepth: 75
                  targetWindow: 20
                  message: Well done!
                  isPublic: true
                  description: A challenging program
              replaceSegments:
                summary: Replace all segments
                value:
                  Segment:
                    - type: endurance
                      duration: 300
                      speed: 50
                      repeat: 2
                    - type: freeform
                      duration: 60
                      speed: 80
                      repeat: 1
              enableUltraFeatures:
                summary: Enable Ultra features
                value:
                  handsFreeMode: true
                  tagline: Pro mode
                  iconId: 42
      responses:
        '200':
          description: Updated template with segments
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DttTemplateDetailResponse'
              example:
                ok: true
                data:
                  id: 1
                  bubbleId: prog-001
                  ownerId: 42
                  name: Advanced Program
                  description: A challenging program
                  tagline: null
                  message: Well done!
                  isPublic: true
                  isActive: true
                  handsFreeMode: false
                  targetDepth: 75
                  targetWindow: 20
                  toyId: null
                  createdDate: '2025-06-01T10:00:00Z'
                  updatedAt: '2026-02-23T10:30:00Z'
                  Segment:
                    - id: 10
                      type: endurance
                      duration: 300
                      speed: 50
                      repeat: 2
                    - id: 11
                      type: freeform
                      duration: 60
                      speed: 80
                      repeat: 1
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalidJson:
                  summary: Invalid JSON body
                  value:
                    ok: false
                    error: Invalid JSON body
                emptyBody:
                  summary: Empty request body
                  value:
                    ok: false
                    error: Request body must contain at least one field to update
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: Ultra subscription required for this field
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                handsFreeMode:
                  summary: handsFreeMode requires Ultra
                  value:
                    ok: false
                    error: >-
                      "handsFreeMode" requires an Ultra subscription or higher.
                      Your current tier does not include this feature.
                tagline:
                  summary: tagline requires Ultra
                  value:
                    ok: false
                    error: >-
                      "tagline" requires an Ultra subscription or higher. Your
                      current tier does not include this feature.
                iconId:
                  summary: iconId requires Ultra
                  value:
                    ok: false
                    error: >-
                      "iconId" requires an Ultra subscription or higher. Your
                      current tier does not include this feature.
        '404':
          description: DTT template not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                ok: false
                error: DTT template not found
        '422':
          description: Validation failed — per-field errors
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
              example:
                ok: false
                error: Validation failed
                fieldErrors:
                  - field: name
                    message: String must contain at least 4 character(s)
                  - field: Segment
                    message: At least one segment is required.
components:
  parameters:
    DttTemplateId:
      name: id
      in: path
      required: true
      description: The DTT template (training program) ID
      schema:
        type: integer
        minimum: 1
        example: 1
  schemas:
    UpdateDttTemplateRequest:
      type: object
      description: >-
        All fields are optional. Only include the fields you want to change. If
        Segment is provided, it replaces the entire segment list.
      properties:
        name:
          type: string
          minLength: 4
          maxLength: 128
          description: Program name (4–128 characters, cannot be blank)
        targetWindow:
          type: number
          description: Target window size
        targetDepth:
          type: number
          description: Target depth percentage
        toyId:
          type: integer
          nullable: true
          description: Associated toy ID (0 or null to unset)
        message:
          type: string
          maxLength: 50
          nullable: true
          description: Completion message (max 50 chars, defaults to "Good Work!")
        handsFreeMode:
          type: boolean
          description: Enable hands-free mode (Ultra only)
        tagline:
          type: string
          maxLength: 25
          nullable: true
          description: Short tagline (Ultra only, max 25 chars)
        toyTagline:
          type: string
          maxLength: 25
          nullable: true
          description: Toy tagline (max 25 chars)
        iconId:
          type: integer
          nullable: true
          description: Icon ID (Ultra only)
        isPublic:
          type: boolean
          description: Whether the program is publicly shared
        description:
          type: string
          maxLength: 500
          nullable: true
          description: Program description (max 500 chars)
        Segment:
          type: array
          minItems: 1
          maxItems: 100
          description: >-
            Full replacement segment list. If provided, all existing segments
            are deleted and replaced with these.
          items:
            $ref: '#/components/schemas/DttSegmentInput'
    DttTemplateDetailResponse:
      type: object
      required:
        - ok
        - data
      properties:
        ok:
          type: boolean
          const: true
        data:
          $ref: '#/components/schemas/DttTemplateDetail'
    ErrorResponse:
      type: object
      required:
        - ok
        - error
      properties:
        ok:
          type: boolean
          const: false
        error:
          type: string
    ValidationErrorResponse:
      type: object
      required:
        - ok
        - error
        - fieldErrors
      properties:
        ok:
          type: boolean
          const: false
        error:
          type: string
          const: Validation failed
        fieldErrors:
          type: array
          items:
            type: object
            required:
              - field
              - message
            properties:
              field:
                type: string
                description: >-
                  Dot-separated path to the invalid field (e.g. "name",
                  "Segment.0.type")
              message:
                type: string
                description: Human-readable explanation of the validation error
    DttSegmentInput:
      type: object
      required:
        - type
        - duration
        - speed
      properties:
        type:
          type: string
          enum:
            - repetition
            - endurance
            - freeform
            - bounce
          description: Segment type
        duration:
          type: integer
          minimum: 1
          description: Duration (meaning varies by type)
        speed:
          type: integer
          minimum: 1
          maximum: 1000
          description: Speed setting (1–1000)
        repeat:
          type: integer
          minimum: 1
          default: 1
          description: Number of times to repeat this segment
        passFailEnabled:
          type: boolean
          default: false
          description: Whether pass/fail grading is enabled
        passGradeThreshold:
          type: integer
          minimum: 0
          maximum: 100
          default: 0
          description: Minimum grade to pass (0–100)
        failureText:
          type: string
          maxLength: 80
          nullable: true
          description: Message shown on failure (max 80 chars)
    DttTemplateDetail:
      allOf:
        - $ref: '#/components/schemas/DttTemplateSummary'
        - type: object
          properties:
            Segment:
              type: array
              items:
                $ref: '#/components/schemas/DttSegment'
    DttTemplateSummary:
      type: object
      properties:
        id:
          type: integer
          description: Template ID
        bubbleId:
          type: string
          description: Unique public identifier
        ownerId:
          type: integer
          description: Owner user ID
        name:
          type: string
          description: Program name
        description:
          type: string
          description: Program description
        tagline:
          type: string
          description: Short tagline
        message:
          type: string
          description: Welcome message
        isPublic:
          type: boolean
          description: Whether publicly visible
        isActive:
          type: boolean
          description: Whether currently active
        handsFreeMode:
          type: boolean
          description: Hands-free mode enabled
        targetDepth:
          type: integer
          description: Target depth percentage
        targetWindow:
          type: integer
          description: Target window size
        toyId:
          type: integer
          nullable: true
          description: Associated toy ID
        createdDate:
          type: string
          format: date-time
          description: Creation date
        updatedAt:
          type: string
          format: date-time
          description: Last update time
    DttSegment:
      type: object
      properties:
        id:
          type: integer
        type:
          type: string
          enum:
            - repetition
            - endurance
            - freeform
            - bounce
          description: Segment type
        duration:
          type: integer
          description: Duration (meaning varies by type)
        speed:
          type: integer
          description: Speed setting (1–1000)
        repeat:
          type: integer
          description: Number of times to repeat
        order:
          type: integer
          description: Position in the segment list (0-based)
        passFailEnabled:
          type: boolean
          description: Whether pass/fail grading is enabled
        passGradeThreshold:
          type: integer
          description: Minimum grade to pass (0–100)
        failureText:
          type: string
          nullable: true
          description: Message shown on failure
  responses:
    Unauthorized:
      description: Authentication required or token invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            ok: false
            error: Unauthorized
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |
        API tokens can be created in the Dashboard settings.
        Requires an Ultra subscription.

````