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

# Add member

> Links an existing user to the organization with the given role.



## OpenAPI

````yaml /openapi.json post /organization-memberships
openapi: 3.1.0
info:
  title: CSMS API
  description: Backend API documentation
  version: 0.0.0
servers: []
security: []
paths:
  /organization-memberships:
    post:
      tags:
        - organization memberships
      summary: Add member
      description: Links an existing user to the organization with the given role.
      operationId: postOrganizationMemberships
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                email:
                  type: string
                  format: email
                  pattern: >-
                    ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
                password:
                  type: string
                  minLength: 8
              required:
                - name
                - email
                - password
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  organizationMembership:
                    type: object
                    properties:
                      id:
                        type: number
                      role:
                        type: string
                        enum:
                          - OWNER
                          - MANAGER
                      userId:
                        type: number
                      organizationId:
                        type: number
                      createdAt:
                        type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                      updatedAt:
                        type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                      user:
                        type: object
                        properties:
                          id:
                            type: number
                          name:
                            type: string
                          email:
                            type: string
                          emailVerified:
                            type: boolean
                          image:
                            type: string
                          username:
                            type: string
                          displayUsername:
                            type: string
                          role:
                            type: string
                            enum:
                              - admin
                              - merchant
                              - merchant_manager
                              - user
                          banned:
                            type: boolean
                          banReason:
                            type: string
                          banExpires:
                            type: string
                            format: date-time
                            pattern: >-
                              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                          createdAt:
                            type: string
                            format: date-time
                            pattern: >-
                              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                          updatedAt:
                            type: string
                            format: date-time
                            pattern: >-
                              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                        required:
                          - id
                          - name
                          - email
                          - emailVerified
                          - role
                          - createdAt
                          - updatedAt
                    required:
                      - id
                      - role
                      - userId
                      - organizationId
                      - createdAt
                      - updatedAt
                      - user
                required:
                  - organizationMembership
        '404':
          description: Organization not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: number
                    const: 404
                  message:
                    type: string
                    const: Organization not found
                  type:
                    type: string
                    const: ORGANIZATION_NOT_FOUND
                  attributes:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties:
                      type: string
                required:
                  - status
                  - message
                  - type
        '409':
          description: A user with this email already exists
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: number
                    const: 409
                  message:
                    type: string
                    const: A user with this email already exists
                  type:
                    type: string
                    const: USER_EMAIL_TAKEN
                  attributes:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties:
                      type: string
                required:
                  - status
                  - message
                  - type

````