> ## Documentation Index
> Fetch the complete documentation index at: https://bmpmoneyplus-sandbox.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 4 - Address Registration

Through this endpoint, the partner can create or update address records for a specific customer, using the CPF/CNPJ already registered.

For an update to occur, the code field must be filled in with the registration number in the BMP database, otherwise the search will be performed using the CEP (postal address code) field.

### Tables

<Expandable title="Tables">
  <Expandable title="Address Type Table">
    | ID | Descrição   |
    | -- | ----------- |
    | 1  | Residencial |
    | 2  | Comercial   |
  </Expandable>

  <Expandable title="Residence Type Table">
    | ID | Descrição      |
    | -- | -------------- |
    | 1  | Alugado        |
    | 2  | Próprio        |
    | 3  | Financiado     |
    | 4  | Casa Funcional |
  </Expandable>

  ***
</Expandable>

### Messaging

<Expandable title="Messaging">
  | Categoria | Operação                   | Ação           | Código | Código Detalhado | Mensagem                                                    |
  | --------- | -------------------------- | -------------- | ------ | ---------------- | ----------------------------------------------------------- |
  | Pessoa    | CreateUpdatePessoaEndereco | SalvarEndereco | C0108  | V0001            | Documento Federal deve ser informado                        |
  | Pessoa    | CreateUpdatePessoaEndereco | SalvarEndereco | C0108  | V0002            | Cliente não encontrado com o documento `{documentoCliente}` |
  | Pessoa    | CreateUpdatePessoaEndereco | SalvarEndereco | C0108  | V0003            | Cliente não cadastrado pelo parceiro de integração          |
  | Pessoa    | CreateUpdatePessoaEndereco | SalvarEndereco | T0608  | D0001            | Informe o CEP                                               |
  | Pessoa    | CreateUpdatePessoaEndereco | SalvarEndereco | T0608  | D0002            | CEP inválido                                                |
  | Pessoa    | CreateUpdatePessoaEndereco | SalvarEndereco | T0608  | D0003            | Informe o Logradouro                                        |
  | Pessoa    | CreateUpdatePessoaEndereco | SalvarEndereco | T0608  | D0004            | Informe a Cidade                                            |
  | Pessoa    | CreateUpdatePessoaEndereco | SalvarEndereco | T0608  | D0005            | Informe o Estado                                            |
  | Pessoa    | CreateUpdatePessoaEndereco | SalvarEndereco | T0608  | D0006            | Informe o Tipo de Imóvel                                    |
  | Pessoa    | CreateUpdatePessoaEndereco | SalvarEndereco | T0608  | D0007            | Informe o Tipo de Endereço                                  |
  | Pessoa    | CreateUpdatePessoaEndereco | SalvarEndereco | T0608  | D0008            | Informe o tempo em que está situado no endereço             |
</Expandable>


## OpenAPI

````yaml post /Pessoa/SalvarEndereco
openapi: 3.0.1
info:
  title: BMPDigitalCore.ApiExterna.Pessoa.API
  version: '1.0'
servers:
  - url: https://api.bmpdigital.moneyp.dev.br/
    description: Localhost
security:
  - Bearer: []
paths:
  /Pessoa/SalvarEndereco:
    post:
      tags:
        - Pessoa
      parameters:
        - name: IdempotencyKey
          in: header
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUpdatePessoaEnderecoCommand'
          text/json:
            schema:
              $ref: '#/components/schemas/CreateUpdatePessoaEnderecoCommand'
          application/*+json:
            schema:
              $ref: '#/components/schemas/CreateUpdatePessoaEnderecoCommand'
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/CreateUpdatePessoaEnderecoResponse'
            application/json:
              schema:
                $ref: '#/components/schemas/CreateUpdatePessoaEnderecoResponse'
            text/json:
              schema:
                $ref: '#/components/schemas/CreateUpdatePessoaEnderecoResponse'
        '400':
          description: Bad Request
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ResponseBase'
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseBase'
            text/json:
              schema:
                $ref: '#/components/schemas/ResponseBase'
components:
  schemas:
    CreateUpdatePessoaEnderecoCommand:
      type: object
      properties:
        dto:
          $ref: '#/components/schemas/PessoaEnderecoDTO'
        param:
          $ref: '#/components/schemas/CreateUpdatePessoaParam'
      additionalProperties: false
    CreateUpdatePessoaEnderecoResponse:
      type: object
      properties:
        msg:
          type: string
          nullable: true
        result:
          type: boolean
          writeOnly: true
        hasError:
          type: boolean
        messages:
          type: array
          items:
            $ref: '#/components/schemas/Message'
          nullable: true
        codigo:
          type: string
          format: uuid
      additionalProperties: false
    ResponseBase:
      type: object
      properties:
        msg:
          type: string
          nullable: true
        result:
          type: boolean
          writeOnly: true
        hasError:
          type: boolean
        messages:
          type: array
          items:
            $ref: '#/components/schemas/Message'
          nullable: true
      additionalProperties: false
    PessoaEnderecoDTO:
      required:
        - cep
        - cidade
        - logradouro
        - tipoEndereco
        - tipoResidencia
        - uf
      type: object
      properties:
        codigo:
          type: string
          description: Será preenchido apenas pelo método SelectPessoa
          nullable: true
        cep:
          maximum: 8
          minimum: 0
          type: string
          description: Código de endereçamento postal (CEP)
          nullable: true
        logradouro:
          type: string
          description: Logradouro
          nullable: true
        nroLogradouro:
          type: string
          description: Número do Logradouro
          nullable: true
        bairro:
          type: string
          description: Bairro
          nullable: true
        complemento:
          type: string
          description: Complemento
          nullable: true
        cidade:
          type: string
          description: Cidade
          nullable: true
        uf:
          type: string
          description: 'Unidade Federal (UF). Exemplo: SC (Sigla de Santa Catarina)'
          nullable: true
        tipoEndereco:
          type: integer
          description: Consultar tabela Tipo de Endereço
          format: int32
          nullable: true
        tipoResidencia:
          type: integer
          description: Consultar tabela Tipo de residência
          format: int32
          nullable: true
        enderecoDesde:
          type: string
          description: Data de início no endereço
          format: date-time
          nullable: true
        enderecoPrincipal:
          type: boolean
          description: Indica se é o endereço principal
          nullable: true
        enderecoCorrespondencia:
          type: boolean
          description: Indica se é o endereço que recebe correspondências
          nullable: true
      additionalProperties: false
    CreateUpdatePessoaParam:
      required:
        - documentoCliente
      type: object
      properties:
        documentoCliente:
          maxLength: 20
          minLength: 0
          type: string
          description: Documento federal do cliente
          nullable: true
      additionalProperties: false
    Message:
      type: object
      properties:
        messageType:
          $ref: '#/components/schemas/ErrorType'
        code:
          type: string
          nullable: true
        context:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        field:
          type: string
          nullable: true
      additionalProperties: false
    ErrorType:
      enum:
        - 1
        - 2
        - 3
      type: integer
      format: int32
  securitySchemes:
    Bearer:
      type: apiKey
      description: Informe o token
      name: Authorization
      in: header

````