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

# Upsert a mirror source for the authenticated user. Toggling `enabled` notifies the mirror process over NATS so it can start/stop the per-user task without a restart.



## OpenAPI

````yaml /api-reference/openapi.json post /app.rocksky.mirror.putMirrorSource
openapi: 3.1.0
info:
  title: AT Protocol XRPC API
  summary: >-
    An unofficial conversion of AT Protocol's lexicons to OpenAPI's schema
    format.
  version: 0.0.0
  license:
    name: MIT License
    identifier: MIT
servers:
  - url: https://api.rocksky.app/xrpc/
    description: AT Protocol AppView XRPC server
security: []
tags:
  - name: app.rocksky.actor
  - name: app.bsky.actor
  - name: app.rocksky.album
  - name: app.rocksky.apikey
  - name: app.rocksky.apikeys
  - name: app.rocksky.artist
  - name: app.rocksky.charts
  - name: app.rocksky.feed
  - name: app.rocksky.graph
  - name: app.rocksky.like
  - name: app.rocksky.mirror
  - name: app.rocksky.player
  - name: app.rocksky.playlist
  - name: app.rocksky.playlistItem
  - name: app.rocksky.scrobble
  - name: app.rocksky.shout
  - name: app.rocksky.song
  - name: app.rocksky.spotify
  - name: app.rocksky.stats
  - name: com.atproto.repo
paths:
  /app.rocksky.mirror.putMirrorSource:
    post:
      tags:
        - app.rocksky.mirror
      summary: >-
        Upsert a mirror source for the authenticated user. Toggling `enabled`
        notifies the mirror process over NATS so it can start/stop the per-user
        task without a restart.
      operationId: app.rocksky.mirror.putMirrorSource
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - provider
              properties:
                provider:
                  type: string
                  description: 'One of: lastfm, listenbrainz, tealfm'
                enabled:
                  type: boolean
                  description: Enable or disable mirroring for this provider.
                externalUsername:
                  type: string
                  description: >-
                    External username (Last.fm / ListenBrainz). Required when
                    enabling those providers. Ignored for Teal.fm.
                apiKey:
                  type: string
                  description: >-
                    API key / token to be encrypted at rest. Omit to leave the
                    existing key unchanged. Pass an empty string to clear it.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/app.rocksky.mirror.defs.mirrorSourceView'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                  - message
                properties:
                  error:
                    type: string
                    oneOf:
                      - const: InvalidRequest
                      - const: ExpiredToken
                      - const: InvalidToken
                  message:
                    type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                  - message
                properties:
                  error:
                    const: AuthMissing
                  message:
                    type: string
      security:
        - Bearer: []
components:
  schemas:
    app.rocksky.mirror.defs.mirrorSourceView:
      type: object
      required:
        - provider
        - enabled
        - hasCredentials
      properties:
        provider:
          type: string
          description: 'One of: lastfm, listenbrainz, tealfm'
        enabled:
          type: boolean
          description: Whether scrobbles from this source are being mirrored into Rocksky.
        externalUsername:
          type: string
          description: >-
            Username on the external service (Last.fm / ListenBrainz). Null for
            Teal.fm.
        hasCredentials:
          type: boolean
          description: >-
            True when an API key is stored. Last.fm/ListenBrainz only; always
            false for Teal.fm.
        lastPolledAt:
          type: string
          description: The last time the mirror process successfully polled this source.
          format: date-time
        lastScrobbleSeenAt:
          type: string
          description: >-
            Watermark — scrobbles from the external service older than this are
            skipped.
          format: date-time
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

````