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

# Apply a flat rewrite map to the segments' `speaker_label`s and rebuild the inline

> Apply a flat rewrite map to the segments' `speaker_label`s and rebuild the inline `transcription_text`. Used by the admin "Speakers" panel for cheap merge/rename without re-running diarisation.



## OpenAPI

````yaml /openapi.json post /admin/jobs/transcriptions/{job_id}/relabel-speakers
openapi: 3.0.0
info:
  title: Braid
  version: '1.0'
servers:
  - url: http://localhost:8001/api
security: []
tags:
  - name: Admin
  - name: ApiKey
  - name: Auth
  - name: Calendar
  - name: Capture
  - name: Concerns
  - name: Dashboard
  - name: DataRequests
  - name: Device
  - name: Feedback
  - name: Graph
  - name: Health
  - name: Job
  - name: OAuth
  - name: Organisation
  - name: Realtime
  - name: Search
  - name: Session
  - name: Workshop
  - name: Workspace
paths:
  /admin/jobs/transcriptions/{job_id}/relabel-speakers:
    post:
      tags:
        - Admin
      summary: >-
        Apply a flat rewrite map to the segments' `speaker_label`s and rebuild
        the inline
      description: >-
        Apply a flat rewrite map to the segments' `speaker_label`s and rebuild
        the inline `transcription_text`. Used by the admin "Speakers" panel for
        cheap merge/rename without re-running diarisation.
      parameters:
        - name: job_id
          schema:
            type: string
            format: uuid
          in: path
          required: true
          deprecated: false
          explode: true
      requestBody:
        content:
          application/json; charset=utf-8:
            schema:
              $ref: '#/components/schemas/AdminTranscriptionRelabelRequest'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json; charset=utf-8:
              schema: {}
        '201':
          description: ''
          content:
            application/json; charset=utf-8:
              schema: {}
        '202':
          description: ''
        '204':
          description: ''
        '400':
          description: ''
          content:
            application/json; charset=utf-8:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: ''
          content:
            application/json; charset=utf-8:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: ''
          content:
            application/json; charset=utf-8:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: ''
          content:
            application/json; charset=utf-8:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: ''
          content:
            application/json; charset=utf-8:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '410':
          description: ''
          content:
            application/json; charset=utf-8:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '413':
          description: ''
          content:
            application/json; charset=utf-8:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: ''
          content:
            application/json; charset=utf-8:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: ''
          content:
            application/json; charset=utf-8:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: ''
          content:
            application/json; charset=utf-8:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: ''
          content:
            application/json; charset=utf-8:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: ''
          content:
            application/json; charset=utf-8:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: ''
          content:
            application/json; charset=utf-8:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    AdminTranscriptionRelabelRequest:
      type: object
      title: AdminTranscriptionRelabelRequest
      description: |-
        Body for `POST /admin/jobs/transcriptions/:job_id/relabel-speakers`.

        Two complementary rewrite mechanisms, applied in order:

        1. `relabels` — flat rewrite map applied to every segment whose
        `speaker_label` matches a key. To merge S4 into S1 AND rename S1 to
        "Moderator", the client should send both rules already resolved:
        `{"S4": "Participant", "S1": "Moderator"}`. This is the bulk path.

        2. `segment_overrides` — per-segment fixes for cases where one
        misclustered segment shouldn't drag its whole speaker group with it.
        Applied AFTER `relabels`, so the operator can do "merge S1+S2 into
        Moderator AND override segment X to be Participant" in one save.
      required:
        - relabels
      properties:
        relabels:
          type: object
          additionalProperties:
            type: string
        segment_overrides:
          type: array
          default: []
          items:
            $ref: '#/components/schemas/AdminTranscriptionSegmentOverride'
    ErrorResponse:
      type: object
      title: ErrorResponse
      required:
        - success
        - message
      properties:
        success:
          type: boolean
        message:
          type: string
    AdminTranscriptionSegmentOverride:
      type: object
      title: AdminTranscriptionSegmentOverride
      required:
        - segment_id
        - new_speaker_label
      properties:
        segment_id:
          type: string
          format: uuid
        new_speaker_label:
          type: string

````

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