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

# Create Branch

<LanguageSwitch currentLang="pt" ptHref="/public-api/endpoint/public_create_branch_v0_branch__post" enHref="/public-api/endpoint/public_create_branch_v0_branch__post_en" />

<Info>
  Este endpoint cria uma <strong>unidade</strong> (Branch) associada a uma
  organização. Ele utiliza o schema
  <code>BranchRequestCreateSchema</code> como corpo da requisição
  e retorna <code>PublicApiBranchBaseResponse</code> em caso de sucesso.
</Info>

## Visão Geral

* **Método:** `POST`
* **Path:** `/v0/branch/`
* **OperationId:** `public_create_branch_v0_branch__post`
* **Autenticação:** header `x-api-key` (`APIKeyHeader` no OpenAPI)

<OpenAPIPlayground openapi="/public-api/openapi.json" operationId="public_create_branch_v0_branch__post" />

### Campos

2. **cnpj** — Identificador da Empresa / Filial
   A CNPJ (Cadastro Nacional da Pessoa Jurídica) é o identificador fiscal de uma entidade legal (empresa).
   Um único grupo de empresas pode ter vários CNPJs, pois cada filial/local de trabalho pode ter seu próprio registro legal (CNPJ específico da filial).
   Em nosso modelo, a Filial é identificada pelo CNPJ porque isso define a entidade empregadora legal responsável pela conformidade.

### Exemplo de Requisição

```bash theme={null}
curl -X POST "https://public-api.salu.com.vc/dev/routes/v0/branch/" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "x-api-key: $SALU_PUBLIC_API_KEY" \
  -d @branch_payload.json
```


## OpenAPI

````yaml POST  /v0/branch/
openapi: 3.1.0
info:
  title: Public API v0
  description: API publica da Salu para integracoes de SST.
  version: 0.1.0
servers:
  - url: https://public-api.salu.com.vc/dev/routes
    description: Development
  - url: https://public-api.salu.com.vc/prd/routes
    description: Production
security: []
paths:
  /v0/branch/:
    post:
      tags:
        - Branch
        - Branch
      summary: Public Create Branch
      operationId: public_create_branch_v0_branch__post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BranchRequestCreateSchema'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiBranchBaseResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    BranchRequestCreateSchema:
      properties:
        address:
          anyOf:
            - type: string
            - type: 'null'
          title: Address
        address_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Address Number
        address_detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Address Detail
        zip_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Zip Code
        neighborhood:
          anyOf:
            - type: string
            - type: 'null'
          title: Neighborhood
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
        city:
          anyOf:
            - type: string
            - type: 'null'
          title: City
        display_name:
          type: string
          title: Display Name
        company_name:
          type: string
          title: Company Name
        cnpj:
          type: string
          title: Cnpj
        is_active:
          type: boolean
          title: Is Active
          default: true
        hr_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Hr Code
        cnae:
          anyOf:
            - type: string
            - type: 'null'
          title: Cnae
        client_integration_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Client Integration Code
        organization_id:
          type: string
          format: uuid
          title: Organization Id
      additionalProperties: false
      type: object
      required:
        - display_name
        - company_name
        - cnpj
        - organization_id
      title: BranchRequestCreateSchema
    PublicApiBranchBaseResponse:
      properties:
        address:
          anyOf:
            - type: string
            - type: 'null'
          title: Address
        address_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Address Number
        address_detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Address Detail
        zip_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Zip Code
        neighborhood:
          anyOf:
            - type: string
            - type: 'null'
          title: Neighborhood
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
        city:
          anyOf:
            - type: string
            - type: 'null'
          title: City
        id:
          type: string
          format: uuid
          title: Id
        organization_id:
          type: string
          format: uuid
          title: Organization Id
        display_name:
          type: string
          title: Display Name
        company_name:
          type: string
          title: Company Name
        hr_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Hr Code
        cnpj:
          type: string
          title: Cnpj
        is_active:
          type: boolean
          title: Is Active
        client_integration_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Client Integration Code
      type: object
      required:
        - id
        - organization_id
        - display_name
        - company_name
        - cnpj
        - is_active
      title: PublicApiBranchBaseResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````