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

# Create a visit

> Starts a consultation for a patient. With `transcript`, the note is written at once. With `audio`, the visit waits in `recording` and the response carries an `upload` URL: PUT the file there, then call process. Scope `visits:write`.



## OpenAPI

````yaml /api-reference/openapi.json post /visits
openapi: 3.1.0
info:
  title: RxNote API
  version: 1.0.0
  description: >-
    The RxNote app's patient → visit → note flow for your own software: create a
    patient, create a visit with a recording or a transcript, and get back the
    transcript and a structured clinical note.
servers:
  - url: https://rxnote.ai/api/v1
    description: Production
  - url: https://dev.rxnote.ai/api/v1
    description: Sandbox (test keys)
  - url: http://localhost:3000/api/v1
    description: Local development
security: []
paths:
  /visits:
    post:
      tags:
        - Visits
      summary: Create a visit
      description: >-
        Starts a consultation for a patient. With `transcript`, the note is
        written at once. With `audio`, the visit waits in `recording` and the
        response carries an `upload` URL: PUT the file there, then call process.
        Scope `visits:write`.
      operationId: createVisit
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 255
            description: >-
              Your unique id for this consultation (for example your appointment
              id). Retrying with the same key returns the same visit.
            example: appt-2026-10-21-0001
          required: true
          name: Idempotency-Key
          in: header
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateVisitRequest'
      responses:
        '201':
          description: The visit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Visit'
        '400':
          description: The request is not valid, or the Idempotency-Key header is missing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing, invalid, revoked or expired API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: The key lacks the scope, or the API is not enabled for the account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such patient for this key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: The Idempotency-Key was used with a different body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: The audio is larger than allowed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: The clinician is not a member of the account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate or concurrency limit reached; see `Retry-After`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - apiKey: []
components:
  schemas:
    CreateVisitRequest:
      type: object
      properties:
        patient_id:
          type: integer
          exclusiveMinimum: 0
          description: From POST /patients.
          example: 4821
        clinician_email:
          type: string
          maxLength: 255
          format: email
          description: >-
            Required with an organization key: the RxNote member acting. With a
            personal key, omit it or send the owner's own email.
          example: doctor@clinic.example
        language:
          type: string
          minLength: 2
          maxLength: 10
          default: en
          description: Language of the consultation.
          example: en
        template_id:
          type: integer
          exclusiveMinimum: 0
          description: >-
            A template from GET /templates. Omitted: the clinician's default
            template, as in the app.
          example: 12
        outputs:
          type: array
          items:
            type: string
            enum:
              - transcript
              - note
              - summary
          minItems: 1
          default:
            - transcript
            - note
          description: >-
            What to produce. A note always needs the transcript, so `note`
            implies it.
        audio:
          type: object
          properties:
            content_type:
              type: string
              enum:
                - audio/webm
                - audio/ogg
                - audio/mpeg
                - audio/mp4
                - audio/x-m4a
                - audio/wav
                - audio/x-wav
                - audio/flac
            size_bytes:
              type: integer
              exclusiveMinimum: 0
              maximum: 524288000
          required:
            - content_type
            - size_bytes
          description: >-
            Send this to upload a recording: the response carries a URL to PUT
            the file to.
        transcript:
          type: string
          minLength: 1
          maxLength: 500000
          description: >-
            Send this instead of `audio` to write the note from text you already
            have. Processing starts at once.
      required:
        - patient_id
    Visit:
      type: object
      properties:
        id:
          type: integer
          example: 90211
        patient_id:
          type: integer
        status:
          type: string
          enum:
            - recording
            - pending
            - processing
            - transcribing
            - generating-soap
            - completed
            - failed
            - no-speech
        language:
          type: string
        template_id:
          type:
            - integer
            - 'null'
        outputs:
          type: array
          items:
            type: string
            enum:
              - transcript
              - note
              - summary
        created_at:
          type: string
          format: date-time
        completed_at:
          type:
            - string
            - 'null'
          format: date-time
        upload:
          $ref: '#/components/schemas/Upload'
        transcript:
          $ref: '#/components/schemas/Transcript'
        note:
          $ref: '#/components/schemas/Note'
        summary:
          type:
            - object
            - 'null'
          additionalProperties: {}
          description: Omitted unless requested; null until ready.
        icd_codes:
          $ref: '#/components/schemas/IcdCodes'
        error:
          type:
            - object
            - 'null'
          properties:
            code:
              type: string
              enum:
                - TRANSCRIPTION_FAILED
                - NOTE_FAILED
                - TIMED_OUT
            message:
              type: string
          required:
            - code
            - message
      required:
        - id
        - patient_id
        - status
        - language
        - template_id
        - outputs
        - created_at
        - completed_at
        - icd_codes
        - error
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: VALIDATION_FAILED
            message:
              type: string
            request_id:
              type: string
              example: req_Q2w9Lx7Hc4Vb8Np1Zs3Kt6
          required:
            - code
            - message
            - request_id
      required:
        - error
    Upload:
      type: object
      properties:
        url:
          type: string
          format: uri
        method:
          type: string
          enum:
            - PUT
        headers:
          type: object
          additionalProperties:
            type: string
          example:
            Content-Type: audio/webm
        expires_at:
          type: string
          format: date-time
      required:
        - url
        - method
        - headers
        - expires_at
      description: Only while the status is `recording` (waiting for the audio).
    Transcript:
      type:
        - object
        - 'null'
      properties:
        text:
          type: string
          description: 'The transcript with speaker labels, e.g. `[Speaker 1]: …`.'
        duration_seconds:
          type:
            - integer
            - 'null'
        segments:
          type: array
          items:
            $ref: '#/components/schemas/TranscriptSegment'
      required:
        - text
        - duration_seconds
        - segments
      description: Omitted unless requested; null until ready.
    Note:
      type:
        - object
        - 'null'
      properties:
        template:
          type:
            - object
            - 'null'
          properties:
            id:
              type: integer
            name:
              type: string
          required:
            - id
            - name
        framework:
          type: string
          example: soap
        sections:
          type: array
          items:
            $ref: '#/components/schemas/NoteSection'
          description: The note in template order. Ids are stable across label renames.
        html:
          type: string
          description: The same note, rendered for display.
      required:
        - template
        - framework
        - sections
        - html
      description: Omitted unless requested; null until ready.
    IcdCodes:
      type:
        - object
        - 'null'
      properties:
        code_version:
          type:
            - string
            - 'null'
          example: icd11
        generated_at:
          type:
            - string
            - 'null'
        codes:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                example: CA02
              name:
                type: string
                example: Acute pharyngitis
              confidence:
                type:
                  - string
                  - 'null'
                enum:
                  - high
                  - medium
                  - low
            required:
              - code
              - name
              - confidence
      required:
        - code_version
        - generated_at
        - codes
      description: Set once POST /visits/{id}/icd-codes has run.
    TranscriptSegment:
      type: object
      properties:
        speaker:
          type:
            - integer
            - 'null'
        start_ms:
          type: integer
        end_ms:
          type: integer
        text:
          type: string
      required:
        - speaker
        - start_ms
        - end_ms
        - text
    NoteSection:
      type: object
      properties:
        id:
          type: string
        title:
          type: string
        fields:
          type: array
          items:
            $ref: '#/components/schemas/NoteField'
      required:
        - id
        - title
        - fields
    NoteField:
      type: object
      properties:
        id:
          type: string
        label:
          type: string
        text:
          type: string
      required:
        - id
        - label
        - text
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        Your API key, created in RxNote under Settings → API: `Authorization:
        Bearer rxn_live_…`.

````

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