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

# /realms/{realmId}/organizations/{organizationId}/companies/{document}



## OpenAPI

````yaml /api-reference/registry.openapi.json get /realms/{realmId}/organizations/{organizationId}/companies/{document}
openapi: 3.0.3
info:
  title: Registry
  version: 1.0.0
  description: >-
    Portão 3 registry API. Generated by tools/openapi from code (routes +
    security) and the hand-written spec (request/response bodies). Confidence
    tiers: generated:typed=10 copied:manual=0 unknown=6.
servers:
  - url: https://api.registry.v2.portao3.com.br/
    description: production
  - url: https://api.registry.dev.3pers.com.br/
    description: development
security:
  - bearerAuth: []
tags:
  - name: Customer Billing
  - name: Customers
  - name: Companies
paths:
  /realms/{realmId}/organizations/{organizationId}/companies/{document}:
    get:
      tags:
        - Companies
      summary: /realms/{realmId}/organizations/{organizationId}/companies/{document}
      operationId: getRealmsByRealmIdOrganizationsByOrganizationIdCompaniesByDocument
      parameters:
        - name: realmId
          in: path
          required: true
          schema:
            type: string
        - name: organizationId
          in: path
          required: true
          schema:
            type: string
        - name: document
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  _id:
                    type: string
                    description: Collection primary key — same value as `document`.
                  document:
                    type: string
                    description: >-
                      Full CNPJ, 14 uppercase alphanumeric chars (digits-only
                      until 2026-07). Collection `_id`.
                  companyDocument:
                    type: string
                    description: >-
                      cnpj_basico — first 8 chars; groups every establishment of
                      one company.
                  branchNumber:
                    type: string
                    description: cnpj_ordem — 4 chars ("0001" = headquarters).
                  branchType:
                    type: string
                    enum:
                      - HEADQUARTERS
                      - BRANCH
                    description: identificador_matriz_filial — 1 matriz / 2 filial
                  tradingName:
                    type: string
                  status:
                    type: string
                    enum:
                      - ANNULLED
                      - ACTIVE
                      - SUSPENDED
                      - INAPT
                      - CLOSED
                    description: >-
                      situacao_cadastral — 01 NULA / 02 ATIVA / 03 SUSPENSA / 04
                      INAPTA / 08 BAIXADA
                  statusDate:
                    type: string
                    format: date-time
                  statusReason:
                    type: string
                    description: RF motivo code — description via RF_MOTIVO_DESCRIPTIONS.
                  specialStatus:
                    type: string
                  specialStatusDate:
                    type: string
                    format: date-time
                  foundingDate:
                    type: string
                    format: date-time
                  mainActivity:
                    type: string
                    description: >-
                      CNAE fiscal principal — 7-digit code; description via the
                      `cnaes` collection.
                  secondaryActivities:
                    type: array
                    items:
                      type: string
                  email:
                    type: string
                  phoneNumber:
                    type: string
                    description: >-
                      E.164 when repairable (commons normalizePhone), else
                      omitted.
                  secondaryPhoneNumber:
                    type: string
                  fax:
                    type: string
                  address:
                    type: object
                    properties:
                      street:
                        type: string
                      number:
                        type: string
                      complement:
                        type: string
                      neighborhood:
                        type: string
                      city:
                        type: string
                      cityCode:
                        type: string
                        description: >-
                          RF municipality code (TOM, 4 digits) — kept so the
                          source value survives the name resolution.
                      state:
                        type: string
                      postalCode:
                        type: string
                    description: >-
                      One document per ESTABLISHMENT (full 14-char CNPJ) in the
                      `companies` collection — Estabelecimentos + Empresas +
                      Sócios + Simples grouped into a single read model (the
                      approved grouping): company-level fields
                      (Empresas/Sócios/Simples, keyed by the 8-char
                      `companyDocument`) are denormalized onto every
                      establishment of that company so the list filters
                      (mainActivity, status, legalName, legalNature) hit ONE
                      collection with ordinary indexes.


                      Field names follow identity's Organization/Shareholder
                      conventions (legalName, tradingName, mainActivity,
                      foundingDate, address.*) — never the RF portuguese names.


                      Everything here is RF public data — the ONLY writer is the
                      monthly import (no write endpoints); `refDate` records the
                      dataset month a doc was last touched by.
                  foreignCity:
                    type: string
                    description: Only for establishments domiciled abroad.
                  country:
                    type: string
                    enum:
                      - AD
                      - AE
                      - AF
                      - AG
                      - AI
                      - AL
                      - AM
                      - AO
                      - AQ
                      - AR
                      - AS
                      - AT
                      - AU
                      - AW
                      - AX
                      - AZ
                      - BA
                      - BB
                      - BD
                      - BE
                      - BF
                      - BG
                      - BH
                      - BI
                      - BJ
                      - BL
                      - BM
                      - BN
                      - BO
                      - BQ
                      - BR
                      - BS
                      - BT
                      - BV
                      - BW
                      - BY
                      - BZ
                      - CA
                      - CC
                      - CD
                      - CF
                      - CG
                      - CH
                      - CI
                      - CK
                      - CL
                      - CM
                      - CN
                      - CO
                      - CR
                      - CU
                      - CV
                      - CW
                      - CX
                      - CY
                      - CZ
                      - DE
                      - DJ
                      - DK
                      - DM
                      - DO
                      - DZ
                      - EC
                      - EE
                      - EG
                      - EH
                      - ER
                      - ES
                      - ET
                      - FI
                      - FJ
                      - FK
                      - FM
                      - FO
                      - FR
                      - GA
                      - GB
                      - GD
                      - GE
                      - GF
                      - GG
                      - GH
                      - GI
                      - GL
                      - GM
                      - GN
                      - GP
                      - GQ
                      - GR
                      - GS
                      - GT
                      - GU
                      - GW
                      - GY
                      - HK
                      - HM
                      - HN
                      - HR
                      - HT
                      - HU
                      - ID
                      - IE
                      - IL
                      - IM
                      - IN
                      - IO
                      - IQ
                      - IR
                      - IS
                      - IT
                      - JE
                      - JM
                      - JO
                      - JP
                      - KE
                      - KG
                      - KH
                      - KI
                      - KM
                      - KN
                      - KP
                      - KR
                      - KW
                      - KY
                      - KZ
                      - LA
                      - LB
                      - LC
                      - LI
                      - LK
                      - LR
                      - LS
                      - LT
                      - LU
                      - LV
                      - LY
                      - MA
                      - MC
                      - MD
                      - ME
                      - MF
                      - MG
                      - MH
                      - MK
                      - ML
                      - MM
                      - MN
                      - MO
                      - MP
                      - MQ
                      - MR
                      - MS
                      - MT
                      - MU
                      - MV
                      - MW
                      - MX
                      - MY
                      - MZ
                      - NA
                      - NC
                      - NE
                      - NF
                      - NG
                      - NI
                      - NL
                      - 'NO'
                      - NP
                      - NR
                      - NU
                      - NZ
                      - OM
                      - PA
                      - PE
                      - PF
                      - PG
                      - PH
                      - PK
                      - PL
                      - PM
                      - PN
                      - PR
                      - PS
                      - PT
                      - PW
                      - PY
                      - QA
                      - RE
                      - RO
                      - RS
                      - RU
                      - RW
                      - SA
                      - SB
                      - SC
                      - SD
                      - SE
                      - SG
                      - SH
                      - SI
                      - SJ
                      - SK
                      - SL
                      - SM
                      - SN
                      - SO
                      - SR
                      - SS
                      - ST
                      - SV
                      - SX
                      - SY
                      - SZ
                      - TC
                      - TD
                      - TF
                      - TG
                      - TH
                      - TJ
                      - TK
                      - TL
                      - TM
                      - TN
                      - TO
                      - TR
                      - TT
                      - TV
                      - TW
                      - TZ
                      - UA
                      - UG
                      - UM
                      - US
                      - UY
                      - UZ
                      - VA
                      - VC
                      - VE
                      - VG
                      - VI
                      - VN
                      - VU
                      - WF
                      - WS
                      - YE
                      - YT
                      - ZA
                      - ZM
                      - ZW
                  countryCode:
                    type: string
                  legalName:
                    type: string
                  legalNature:
                    type: string
                    description: >-
                      natureza_juridica 4-digit code — description via
                      RF_NATUREZA_DESCRIPTIONS.
                  size:
                    type: string
                    enum:
                      - NOT_INFORMED
                      - MICRO
                      - SMALL
                      - OTHER
                    description: >-
                      porte — 00/empty NÃO INFORMADO / 01 ME / 03 EPP / 05
                      DEMAIS
                  capital:
                    type: number
                    description: >-
                      capital_social in integer CENTAVOS (fleet money
                      convention).
                  responsibleQualification:
                    type: string
                    description: >-
                      RF qualification code of the person responsible for the
                      company.
                  federativeEntity:
                    type: string
                    description: ente_federativo_responsavel — public bodies only.
                  shareholders:
                    type: array
                    items:
                      type: object
                      properties:
                        documentType:
                          type: string
                          enum:
                            - CNPJ
                            - CPF
                            - FOREIGN
                          description: identificador_de_socio — 1 PJ / 2 PF / 3 estrangeiro
                        name:
                          type: string
                        document:
                          type: string
                          description: >-
                            CNPJ, masked CPF (`***123456**`) or absent (foreign
                            partner).
                        qualification:
                          type: string
                          description: >-
                            RF qualification code — description via
                            RF_QUALIFICACAO_DESCRIPTIONS.
                        joinedAt:
                          type: string
                          format: date-time
                        country:
                          type: string
                          enum:
                            - AD
                            - AE
                            - AF
                            - AG
                            - AI
                            - AL
                            - AM
                            - AO
                            - AQ
                            - AR
                            - AS
                            - AT
                            - AU
                            - AW
                            - AX
                            - AZ
                            - BA
                            - BB
                            - BD
                            - BE
                            - BF
                            - BG
                            - BH
                            - BI
                            - BJ
                            - BL
                            - BM
                            - BN
                            - BO
                            - BQ
                            - BR
                            - BS
                            - BT
                            - BV
                            - BW
                            - BY
                            - BZ
                            - CA
                            - CC
                            - CD
                            - CF
                            - CG
                            - CH
                            - CI
                            - CK
                            - CL
                            - CM
                            - CN
                            - CO
                            - CR
                            - CU
                            - CV
                            - CW
                            - CX
                            - CY
                            - CZ
                            - DE
                            - DJ
                            - DK
                            - DM
                            - DO
                            - DZ
                            - EC
                            - EE
                            - EG
                            - EH
                            - ER
                            - ES
                            - ET
                            - FI
                            - FJ
                            - FK
                            - FM
                            - FO
                            - FR
                            - GA
                            - GB
                            - GD
                            - GE
                            - GF
                            - GG
                            - GH
                            - GI
                            - GL
                            - GM
                            - GN
                            - GP
                            - GQ
                            - GR
                            - GS
                            - GT
                            - GU
                            - GW
                            - GY
                            - HK
                            - HM
                            - HN
                            - HR
                            - HT
                            - HU
                            - ID
                            - IE
                            - IL
                            - IM
                            - IN
                            - IO
                            - IQ
                            - IR
                            - IS
                            - IT
                            - JE
                            - JM
                            - JO
                            - JP
                            - KE
                            - KG
                            - KH
                            - KI
                            - KM
                            - KN
                            - KP
                            - KR
                            - KW
                            - KY
                            - KZ
                            - LA
                            - LB
                            - LC
                            - LI
                            - LK
                            - LR
                            - LS
                            - LT
                            - LU
                            - LV
                            - LY
                            - MA
                            - MC
                            - MD
                            - ME
                            - MF
                            - MG
                            - MH
                            - MK
                            - ML
                            - MM
                            - MN
                            - MO
                            - MP
                            - MQ
                            - MR
                            - MS
                            - MT
                            - MU
                            - MV
                            - MW
                            - MX
                            - MY
                            - MZ
                            - NA
                            - NC
                            - NE
                            - NF
                            - NG
                            - NI
                            - NL
                            - 'NO'
                            - NP
                            - NR
                            - NU
                            - NZ
                            - OM
                            - PA
                            - PE
                            - PF
                            - PG
                            - PH
                            - PK
                            - PL
                            - PM
                            - PN
                            - PR
                            - PS
                            - PT
                            - PW
                            - PY
                            - QA
                            - RE
                            - RO
                            - RS
                            - RU
                            - RW
                            - SA
                            - SB
                            - SC
                            - SD
                            - SE
                            - SG
                            - SH
                            - SI
                            - SJ
                            - SK
                            - SL
                            - SM
                            - SN
                            - SO
                            - SR
                            - SS
                            - ST
                            - SV
                            - SX
                            - SY
                            - SZ
                            - TC
                            - TD
                            - TF
                            - TG
                            - TH
                            - TJ
                            - TK
                            - TL
                            - TM
                            - TN
                            - TO
                            - TR
                            - TT
                            - TV
                            - TW
                            - TZ
                            - UA
                            - UG
                            - UM
                            - US
                            - UY
                            - UZ
                            - VA
                            - VC
                            - VE
                            - VG
                            - VI
                            - VN
                            - VU
                            - WF
                            - WS
                            - YE
                            - YT
                            - ZA
                            - ZM
                            - ZW
                        countryCode:
                          type: string
                          description: >-
                            Raw RF country code — kept even when unmappable to
                            the Countries enum.
                        ageRange:
                          type: string
                          description: RF age-range code "0".."9" (faixa_etaria).
                        legalRepresentative:
                          type: object
                          properties:
                            document:
                              type: string
                              description: Masked CPF as published by RF (`***123456**`).
                            name:
                              type: string
                            qualification:
                              type: string
                              description: >-
                                RF qualification code — description via
                                RF_QUALIFICACAO_DESCRIPTIONS.
                      required:
                        - documentType
                  simples:
                    type: object
                    properties:
                      optIn:
                        type: boolean
                      optInDate:
                        type: string
                        format: date-time
                      optOutDate:
                        type: string
                        format: date-time
                    required:
                      - optIn
                  mei:
                    type: object
                    properties:
                      optIn:
                        type: boolean
                      optInDate:
                        type: string
                        format: date-time
                      optOutDate:
                        type: string
                        format: date-time
                    required:
                      - optIn
                  refDate:
                    type: string
                    description: Dataset month ("2026-08") that last touched this doc.
                  sourceHashes:
                    type: object
                    properties:
                      establishment:
                        type: string
                      company:
                        type: string
                      shareholders:
                        type: string
                      simples:
                        type: string
                    description: >-
                      Per-source-file content hashes (raw CSV line) — the
                      monthly delta gate: an unchanged row is skipped instead of
                      rewritten (see infra/rf/importer).
                  createdAt:
                    type: string
                    format: date-time
                  updatedAt:
                    type: string
                    format: date-time
                  statusReasonDescription:
                    type: string
                  legalNatureDescription:
                    type: string
                required:
                  - _id
                  - branchNumber
                  - branchType
                  - companyDocument
                  - document
                  - refDate
                  - status
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````