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

# Sincronizar Person Account no login

> Orquestra o Person Account no Salesforce: GET → match / PATCH silencioso de email / POST create em 404 (contaOrigem Portal Pref.Rio). Usa CPF, nome e email do JWT. Não persiste dados do SF no Mongo do RMI.



## OpenAPI

````yaml https://raw.githubusercontent.com/prefeitura-rio/app-rmi/refs/heads/main/docs/openapi-v3.json get /auth/validate
openapi: 3.0.0
info:
  description: >-
    API para gerenciamento de dados de cidadãos do Rio de Janeiro, incluindo
    autodeclaração de informações e verificação de contato.
  title: API RMI
  termsOfService: http://swagger.io/terms/
  contact:
    name: Suporte RMI
    url: http://www.rio.rj.gov.br
    email: suporte@rio.rj.gov.br
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: '1.0'
servers:
  - url: https://services.pref.rio/rmi/v1
    description: Production
  - url: https://services.staging.app.dados.rio/rmi/v1
    description: Staging
security: []
tags:
  - description: >-
      Operações relacionadas a cidadãos, incluindo consulta e atualização de
      dados autodeclarados
    name: citizen
  - description: >-
      Carteira de veículos (bicicleta elétrica, autopropelido, ciclomotor),
      condutores e catálogo
    name: mobilidade
  - description: Operações relacionadas a departamentos/unidades administrativas (UA)
    name: departments
  - description: Gerenciamento de categorias de notificação (admin) e listagem pública
    name: notification-categories
  - description: Gerenciamento de preferências de notificação por CPF e telefone
    name: notification-preferences
  - description: Operações de verificação de saúde da API
    name: health
  - description: >-
      Integração Salesforce Person Account: login sync, webhook inbound (delta),
      proxies CRM e push assíncrono RMI→SF via sync worker
    name: salesforce
paths:
  /auth/validate:
    get:
      tags:
        - salesforce
      summary: Sincronizar Person Account no login
      description: >-
        Orquestra o Person Account no Salesforce: GET → match / PATCH silencioso
        de email / POST create em 404 (contaOrigem Portal Pref.Rio). Usa CPF,
        nome e email do JWT. Não persiste dados do SF no Mongo do RMI.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.AuthValidateResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrorResponse'
        '502':
          description: Falha ao chamar Salesforce
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrorResponse'
        '503':
          description: SALESFORCE_BASE_URL não configurado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    handlers.AuthValidateResponse:
      type: object
      properties:
        action:
          type: string
          enum:
            - matched
            - updated
            - created
          example: matched
        cidadao:
          $ref: '#/components/schemas/clients.SalesforceCidadao'
    handlers.ErrorResponse:
      type: object
      properties:
        error:
          type: string
    clients.SalesforceCidadao:
      type: object
      properties:
        accountId:
          type: string
        canalOrigem:
          type: string
        canalUltimaModificacao:
          type: string
        complemento:
          type: string
        consentimento:
          type: array
          items:
            $ref: '#/components/schemas/clients.SalesforceConsentimento'
        cpf:
          type: string
        dataNascimento:
          type: string
        deficiencia:
          type: string
        email:
          type: string
        endereco:
          $ref: '#/components/schemas/clients.SalesforceEndereco'
        escolaridade:
          type: string
        genero:
          type: string
        idioma:
          type: array
          items:
            type: string
        isTourist:
          type: boolean
        nacionalidade:
          type: string
        nome:
          type: string
        nomeExibicao:
          type: string
        nomeSocial:
          type: string
        passaporte:
          type: string
        raca:
          type: string
        rendaFamiliar:
          type: string
        telefone1:
          type: string
        telefone2:
          type: string
        telefone3:
          type: string
        telefoneInternacional:
          type: string
        telefonePrincipal:
          type: string
        tipoTelefone1:
          type: string
        tipoTelefone2:
          type: string
        tipoTelefone3:
          type: string
    clients.SalesforceConsentimento:
      type: object
      properties:
        acao:
          description: 'legacy: optin | optout'
          type: string
        canal:
          type: string
        categoria:
          type: string
        data:
          type: string
        finalidade:
          type: string
        motivo:
          description: required when status=OUT / acao=optout
          type: string
        status:
          description: IN | OUT
          type: string
    clients.SalesforceEndereco:
      type: object
      properties:
        bairro:
          type: string
        cep:
          type: string
        cidade:
          type: string
        complemento:
          type: string
        estado:
          type: string
        logradouro:
          type: string
        pais:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.