> ## 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.

# Create organization

> Creates the organization for the authenticated user; each user owns at most one.



## OpenAPI

````yaml /openapi.json post /organizations
openapi: 3.1.0
info:
  title: CSMS API
  description: Backend API documentation
  version: 0.0.0
servers: []
security: []
paths:
  /organizations:
    post:
      tags:
        - organizations
      summary: Create organization
      description: >-
        Creates the organization for the authenticated user; each user owns at
        most one.
      operationId: postOrganizations
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                document:
                  type: string
                  minLength: 1
                contact:
                  type: string
                  minLength: 1
                contactPhone:
                  type: string
                  minLength: 1
                zip:
                  type: string
                  minLength: 1
                address:
                  type: string
                  minLength: 1
                city:
                  type: string
                  minLength: 1
                state:
                  type: string
                  enum:
                    - AC
                    - AL
                    - AP
                    - AM
                    - BA
                    - CE
                    - DF
                    - ES
                    - GO
                    - MA
                    - MT
                    - MS
                    - MG
                    - PA
                    - PB
                    - PR
                    - PE
                    - PI
                    - RJ
                    - RN
                    - RS
                    - RO
                    - RR
                    - SC
                    - SP
                    - SE
                    - TO
                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,}$
                phone:
                  type: string
                  minLength: 1
                partners:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                        minLength: 1
                      document:
                        type: string
                        minLength: 1
                    required:
                      - name
                      - document
              required:
                - name
                - document
                - contact
                - contactPhone
                - zip
                - address
                - city
                - state
                - email
                - phone
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  organization:
                    type: object
                    properties:
                      id:
                        type: number
                      name:
                        type: string
                      document:
                        type: string
                      contact:
                        type: string
                      contactPhone:
                        type: string
                      zip:
                        type: string
                      address:
                        type: string
                      city:
                        type: string
                      state:
                        type: string
                        enum:
                          - AC
                          - AL
                          - AP
                          - AM
                          - BA
                          - CE
                          - DF
                          - ES
                          - GO
                          - MA
                          - MT
                          - MS
                          - MG
                          - PA
                          - PB
                          - PR
                          - PE
                          - PI
                          - RJ
                          - RN
                          - RS
                          - RO
                          - RR
                          - SC
                          - SP
                          - SE
                          - TO
                      email:
                        type: string
                      phone:
                        type: string
                      partners:
                        anyOf:
                          - type: array
                            items:
                              type: object
                              properties:
                                name:
                                  type: string
                                  minLength: 1
                                document:
                                  type: string
                                  minLength: 1
                              required:
                                - name
                                - document
                          - type: 'null'
                      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
                      - document
                      - contact
                      - contactPhone
                      - zip
                      - address
                      - city
                      - state
                      - email
                      - phone
                      - partners
                      - createdAt
                      - updatedAt
                required:
                  - organization
        '409':
          description: User already has an organization
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: number
                    const: 409
                  message:
                    type: string
                    const: User already has an organization
                  type:
                    type: string
                    const: ORGANIZATION_ALREADY_EXISTS
                  attributes:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties:
                      type: string
                required:
                  - status
                  - message
                  - type

````