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

# Webhook Salesforce cidadão

> JWT Keycloak com azp em SALESFORCE_WEBHOOK_CLIENTS. Body: cpf + evento (atualizacao default ou anonimizacao) + updatedAt opcional. Para atualizacao, dados é delta obrigatório (ausente=não alterar; null=limpar; \"\"=vazio). Para anonimizacao, dados é opcional e ignorado — o RMI limpa o espelho SF por inteiro (self_declared PII + salesforce_consentimentos; não altera citizens nem opt_in/category_opt_ins do RMI). nome/nomeSocial/dataNascimento no delta de atualizacao são ignorados. 202 com CPF mascarado; retry idempotente via updatedAt.



## OpenAPI

````yaml https://raw.githubusercontent.com/prefeitura-rio/app-rmi/refs/heads/main/docs/openapi-v3.json post /webhooks/salesforce/cidadao
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:
  /webhooks/salesforce/cidadao:
    post:
      tags:
        - salesforce
      summary: Webhook Salesforce cidadão
      description: >-
        JWT Keycloak com azp em SALESFORCE_WEBHOOK_CLIENTS. Body: cpf + evento
        (atualizacao default ou anonimizacao) + updatedAt opcional. Para
        atualizacao, dados é delta obrigatório (ausente=não alterar;
        null=limpar; \"\"=vazio). Para anonimizacao, dados é opcional e ignorado
        — o RMI limpa o espelho SF por inteiro (self_declared PII +
        salesforce_consentimentos; não altera citizens nem
        opt_in/category_opt_ins do RMI). nome/nomeSocial/dataNascimento no delta
        de atualizacao são ignorados. 202 com CPF mascarado; retry idempotente
        via updatedAt.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/handlers.SalesforceWebhookRequestSwagger'
        description: CPF, evento; dados obrigatório só em atualizacao
        required: true
      responses:
        '202':
          description: Job enfileirado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.SalesforceWebhookResponse'
        '400':
          description: >-
            CPF inválido, dados ausentes/grandes (atualizacao), updatedAt longo
            ou evento inválido
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrorResponse'
        '401':
          description: JWT inválido ou ausente
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrorResponse'
        '403':
          description: azp do JWT não está em SALESFORCE_WEBHOOK_CLIENTS
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrorResponse'
        '503':
          description: Integração Salesforce não configurada
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    handlers.SalesforceWebhookRequestSwagger:
      type: object
      properties:
        cpf:
          type: string
          example: '52998224725'
        dados:
          $ref: '#/components/schemas/handlers.SalesforceWebhookDados'
        evento:
          type: string
          enum:
            - atualizacao
            - anonimizacao
          example: atualizacao
        updatedAt:
          type: string
          example: '2026-08-31T17:33:49Z'
    handlers.SalesforceWebhookResponse:
      type: object
      properties:
        cpf:
          type: string
        evento:
          type: string
        message:
          type: string
        status:
          type: string
    handlers.ErrorResponse:
      type: object
      properties:
        error:
          type: string
    handlers.SalesforceWebhookDados:
      type: object
      properties:
        accountId:
          type: string
        canalOrigem:
          type: string
        canalUltimaModificacao:
          type: string
        cidade:
          type: string
        complemento:
          type: string
        consentimento:
          type: array
          items:
            $ref: '#/components/schemas/clients.SalesforceConsentimento'
        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.