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

# Create or update a patient profile



## OpenAPI

````yaml /openapi/marmar-cds.openapi.yaml post /v1/patients
openapi: 3.1.0
info:
  title: Marmar Clinical Decision Support Reference
  version: 0.1.0
  description: >
    API for integrating Marmar's medication safety assessments into clinical
    workflows. Tenants can synchronize patient records, request assessments, and
    receive webhook notifications when assessments are completed.
servers:
  - url: https://cds.marmar.life
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
tags:
  - name: Patients
  - name: Assessments
  - name: Tenants
  - name: Webhooks
  - name: FHIR
paths:
  /v1/patients:
    post:
      tags:
        - Patients
      summary: Create or update a patient profile
      operationId: createOrUpdatePatient
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatientRequest'
      responses:
        '200':
          description: Patient updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PatientResponse'
        '201':
          description: Patient created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PatientResponse'
        '400':
          description: Invalid request payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    PatientRequest:
      type: object
      properties:
        patientId:
          $ref: '#/components/schemas/Identifier'
        externalId:
          type: string
          description: Optional external identifier supplied by the tenant.
          nullable: true
          example: null
        demographics:
          allOf:
            - $ref: '#/components/schemas/PatientDemographics'
          nullable: true
          example: null
        reproductiveStatus:
          $ref: '#/components/schemas/ReproductiveStatus'
          nullable: true
          example: null
        hormonalTherapies:
          type: array
          items:
            $ref: '#/components/schemas/HormonalTherapy'
          nullable: true
          example: null
      anyOf:
        - required:
            - patientId
        - required:
            - demographics
    PatientResponse:
      type: object
      properties:
        patientId:
          $ref: '#/components/schemas/Identifier'
        created:
          type: boolean
      required:
        - patientId
        - created
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
      required:
        - message
    Identifier:
      type: string
      format: uuid
    PatientDemographics:
      type: object
      properties:
        firstName:
          type: string
          nullable: true
          example: null
        lastName:
          type: string
          nullable: true
          example: null
        phone:
          type: string
          nullable: true
          example: null
        dateOfBirth:
          type: string
          format: date
          nullable: true
          example: null
        sex:
          $ref: '#/components/schemas/Sex'
        genderIdentity:
          type: string
          nullable: true
          example: null
        weightKg:
          type: number
          format: float
          nullable: true
          example: null
        heightCm:
          type: number
          format: float
          nullable: true
          example: null
        ethnicity:
          type: string
          nullable: true
          example: null
    ReproductiveStatus:
      type: string
      enum:
        - REGULAR_CYCLE
        - PREGNANT
        - BREASTFEEDING
        - PERIMENOPAUSE
        - POSTMENOPAUSAL
        - PLANNING_PREGNANCY
        - UNKNOWN
    HormonalTherapy:
      type: object
      properties:
        name:
          type: string
        classification:
          type: string
        startDate:
          type: string
          format: date
          nullable: true
        endDate:
          type: string
          format: date
          nullable: true
      required:
        - name
        - classification
    Sex:
      type: string
      enum:
        - MALE
        - FEMALE
        - OTHER
      nullable: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key obtained from the Tenant Dashboard. Use as Authorization: Bearer
        YOUR_API_KEY

````