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

# Get a company by CNPJ

> Gets one establishment of Brazil's public company registry by its full CNPJ.

The data is Brazil's public company registry. Most of it comes from Receita Federal's monthly open data; when the stored record is missing, out of date or has no partners, it may be refreshed from the registry in real time before the answer is sent, so a company opened after the last monthly release can be found too. `refDate` is the month of the registry data the record reflects. The data is the same for every organization — nothing in it belongs to yours.

Besides the registry's codes, the answer carries the text of two of them: `statusReasonDescription` and `legalNatureDescription`. A document that is not a valid CNPJ is answered as not found, like one the registry doesn't have.


## 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. Every endpoint requires a bearer token in the
    Authorization header (Authorization: Bearer <token>) unless its page states
    otherwise; see the Authentication guide. That requirement is not repeated
    per endpoint. Generated by tools/openapi from code (routes + security) and
    the hand-written spec (request/response bodies). Confidence tiers:
    generated:typed=37 copied:manual=0 unknown=0.
servers:
  - url: https://api.registry.v2.portao3.com.br/
    description: production
  - url: https://api.registry.dev.3pers.com.br/
    description: development
security: []
tags:
  - name: Customers
  - name: Companies
  - name: People
  - name: Products
  - name: Suppliers
paths:
  /realms/{realmId}/organizations/{organizationId}/companies/{document}:
    get:
      tags:
        - Companies
      summary: Get a company by CNPJ
      description: >-
        Gets one establishment of Brazil's public company registry by its full
        CNPJ.
      operationId: getRealmsByRealmIdOrganizationsByOrganizationIdCompaniesByDocument
      parameters:
        - name: realmId
          in: path
          required: true
          description: |-
            ID of your realm.

            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: f495ff0c-ab54-4f99-8e92-ca8682e4de9b
        - name: organizationId
          in: path
          required: true
          description: |-
            ID of the organization making the request.

            Format: `UUID`
          schema:
            type: string
            format: uuid
          example: c4bd3f21-dfbd-44e8-8055-68ba15bed410
        - name: document
          in: path
          required: true
          description: >-
            CNPJ of the establishment: 14 characters, the first 12 digits or
            letters and the last 2 digits. Dots, dashes and spaces are ignored.
            A path can't carry the `/` of a formatted CNPJ, so send the 14
            characters alone or the mask without the slash.
          schema:
            type: string
          example: '11222333000181'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  _id:
                    type: string
                    description: Same value as `document`.
                    example: '11222333000181'
                  document:
                    type: string
                    description: >-
                      CNPJ of the establishment: 14 characters (the first 12
                      digits or letters, the last 2 digits), without formatting.
                    example: '11222333000181'
                  companyDocument:
                    type: string
                    description: >-
                      The first 8 characters of the CNPJ, which identify the
                      company: every establishment of one company shares them.
                    example: '11222333'
                  branchNumber:
                    type: string
                    description: >-
                      The 4 characters after the company's 8: `0001` is the
                      headquarters.
                    example: '0001'
                  branchType:
                    type: string
                    enum:
                      - HEADQUARTERS
                      - BRANCH
                    description: '`HEADQUARTERS` or `BRANCH`.'
                    example: HEADQUARTERS
                  tradingName:
                    type: string
                    description: Trade name of the establishment.
                    example: EXEMPLO MERCADO
                  status:
                    type: string
                    enum:
                      - ANNULLED
                      - ACTIVE
                      - ACTIVE_IRREGULAR
                      - SUSPENDED
                      - INAPT
                      - CLOSED
                    description: >-
                      Registration status: `ACTIVE`, `ACTIVE_IRREGULAR`
                      (operating, with a pending irregularity at Receita
                      Federal), `SUSPENDED`, `INAPT` (ineligible), `CLOSED`
                      (deregistered) or `ANNULLED`.
                    example: ACTIVE
                  statusDate:
                    type: string
                    format: date-time
                    description: When the registration status last changed.
                    example: '2015-03-12T00:00:00.000Z'
                  statusReason:
                    type: string
                    description: >-
                      Code of the reason for the registration status, from
                      Receita Federal's table. The company read adds its text as
                      `statusReasonDescription`.
                    example: '00'
                  specialStatus:
                    type: string
                    description: >-
                      Special situation of the company, as published by Receita
                      Federal.
                    example: RECUPERACAO JUDICIAL
                  specialStatusDate:
                    type: string
                    format: date-time
                    description: When the special situation began.
                    example: '2022-06-01T00:00:00.000Z'
                  foundingDate:
                    type: string
                    format: date-time
                    description: When the establishment started its activities.
                    example: '2015-03-12T00:00:00.000Z'
                  mainActivity:
                    type: string
                    description: 'Main economic activity: a 7-digit CNAE code.'
                    example: '4712100'
                  secondaryActivities:
                    type: array
                    items:
                      type: string
                      example: '4721102'
                    description: |-
                      Secondary economic activities: 7-digit CNAE codes.

                      ---

                      Example: `["4721102","4722901"]`
                  email:
                    type: string
                    description: E-mail address of the establishment, in lower case.
                    example: contato@exemplo.com.br
                  phoneNumber:
                    type: string
                    description: >-
                      Main phone number, in international format (`+` followed
                      by digits). Absent when the published number can't be
                      converted to it.
                    example: '+551133334444'
                  secondaryPhoneNumber:
                    type: string
                    description: Secondary phone number, in international format.
                    example: '+551155556666'
                  fax:
                    type: string
                    description: Fax number, in international format.
                    example: '+551177778888'
                  address:
                    type: object
                    properties:
                      street:
                        type: string
                        description: Street, with its type (such as `RUA` or `AVENIDA`).
                        example: AVENIDA PAULISTA
                      number:
                        type: string
                        description: Street number.
                        example: '1578'
                      complement:
                        type: string
                        description: Extra address detail.
                        example: ANDAR 3
                      neighborhood:
                        type: string
                        description: Neighborhood.
                        example: BELA VISTA
                      city:
                        type: string
                        description: City name.
                        example: SAO PAULO
                      cityCode:
                        type: string
                        description: >-
                          Code of the city in Receita Federal's municipality
                          table.
                        example: '7107'
                      state:
                        type: string
                        description: Two-letter code of the Brazilian state.
                        example: SP
                      postalCode:
                        type: string
                        description: Postal code (CEP), 8 digits.
                        example: '01310200'
                    description: Address of the establishment.
                  foreignCity:
                    type: string
                    description: City of an establishment based abroad.
                    example: LISBOA
                  country:
                    type: string
                    description: >-
                      Country of an establishment based abroad, as a two-letter
                      ISO 3166-1 code. Absent when the published country has no
                      single ISO equivalent; `countryCode` keeps the published
                      value.
                    example: PT
                  countryCode:
                    type: string
                    description: >-
                      Country code of an establishment based abroad, as
                      published by Receita Federal (a 3-digit code of its own
                      country table).
                    example: '607'
                  legalName:
                    type: string
                    description: Legal name (razão social) of the company.
                    example: EXEMPLO COMERCIO DE ALIMENTOS LTDA
                  legalNature:
                    type: string
                    description: >-
                      Legal nature of the company: a 4-digit code from Receita
                      Federal's table. The company read adds its text as
                      `legalNatureDescription`.
                    example: '2062'
                  size:
                    type: string
                    enum:
                      - NOT_INFORMED
                      - MICRO
                      - SMALL
                      - OTHER
                    description: >-
                      Size of the company: `MICRO`, `SMALL`, `OTHER` (any
                      larger) or `NOT_INFORMED`.
                    example: SMALL
                  capital:
                    type: number
                    description: Share capital, in cents of BRL.
                    example: 50000000
                  responsibleQualification:
                    type: string
                    description: >-
                      Qualification code of the person responsible for the
                      company, from Receita Federal's qualification table.
                    example: '49'
                  federativeEntity:
                    type: string
                    description: >-
                      Federative entity responsible for the company. Only public
                      bodies have one.
                    example: UNIAO
                  shareholders:
                    type: array
                    items:
                      type: object
                      properties:
                        documentType:
                          type: string
                          enum:
                            - CNPJ
                            - CPF
                            - FOREIGN
                          description: >-
                            Kind of partner: `CNPJ` for a company, `CPF` for a
                            person or `FOREIGN` for a foreign partner.
                          example: CPF
                        name:
                          type: string
                          description: Name of the partner.
                          example: MARIA DA SILVA
                        document:
                          type: string
                          description: >-
                            Document of the partner: a CNPJ, or a CPF — in full
                            when the record was refreshed in real time,
                            otherwise partly masked as published in the monthly
                            data (`***123456**`). Absent for a foreign partner.
                          example: '***123456**'
                        qualification:
                          type: string
                          description: >-
                            Qualification code of the partner, from Receita
                            Federal's qualification table (`49` is
                            partner-administrator, `22` partner).
                          example: '49'
                        joinedAt:
                          type: string
                          format: date-time
                          description: When the partner joined the company.
                          example: '2015-03-12T00:00:00.000Z'
                        country:
                          type: string
                          description: >-
                            Country of a foreign partner, as a two-letter ISO
                            3166-1 code. Absent when the published country has
                            no single ISO equivalent; `countryCode` keeps the
                            published value.
                          example: US
                        countryCode:
                          type: string
                          description: >-
                            Country code of a foreign partner, as published by
                            Receita Federal (a 3-digit code of its own country
                            table).
                          example: '249'
                        ageRange:
                          type: string
                          description: >-
                            Age range of a person partner, as the code published
                            by Receita Federal: `0` not applicable, `1` up to 12
                            years, `2` 13 to 20, `3` 21 to 30, `4` 31 to 40, `5`
                            41 to 50, `6` 51 to 60, `7` 61 to 70, `8` 71 to 80,
                            `9` over 80.
                          example: '5'
                        legalRepresentative:
                          type: object
                          properties:
                            document:
                              type: string
                              description: >-
                                CPF of the representative: in full when the
                                record was refreshed in real time, otherwise
                                partly masked as published in the monthly data
                                (`***123456**`).
                              example: '***123456**'
                            name:
                              type: string
                              description: Name of the representative.
                              example: JOAO PEREIRA DA SILVA
                            qualification:
                              type: string
                              description: >-
                                Qualification code of the representative, from
                                Receita Federal's qualification table.
                              example: '17'
                          description: The partner's legal representative, when it has one.
                      required:
                        - documentType
                      description: A partner or shareholder of the company.
                    description: Partners and shareholders of the company, sorted by name.
                  simples:
                    type: object
                    properties:
                      optIn:
                        type: boolean
                        description: Whether the company is currently opted in.
                        example: true
                      optInDate:
                        type: string
                        format: date-time
                        description: When the company opted in.
                        example: '2016-01-01T00:00:00.000Z'
                      optOutDate:
                        type: string
                        format: date-time
                        description: When the company opted out, if it did.
                        example: '2020-12-31T00:00:00.000Z'
                    required:
                      - optIn
                    description: >-
                      Whether the company opted into the Simples Nacional tax
                      regime.
                  mei:
                    type: object
                    properties:
                      optIn:
                        type: boolean
                        description: Whether the company is currently opted in.
                        example: true
                      optInDate:
                        type: string
                        format: date-time
                        description: When the company opted in.
                        example: '2016-01-01T00:00:00.000Z'
                      optOutDate:
                        type: string
                        format: date-time
                        description: When the company opted out, if it did.
                        example: '2020-12-31T00:00:00.000Z'
                    required:
                      - optIn
                    description: >-
                      Whether the company is registered as an individual
                      microentrepreneur (MEI).
                  refDate:
                    type: string
                    description: >-
                      Month of the registry data this record reflects, as
                      `YYYY-MM`: the monthly release that last updated it, or
                      the month it was refreshed in real time.
                    example: 2026-08
                  createdAt:
                    type: string
                    format: date-time
                    description: When this record was first added to the registry.
                    example: '2026-07-14T09:00:00.000Z'
                  updatedAt:
                    type: string
                    format: date-time
                    description: When this record last changed.
                    example: '2026-08-18T09:00:00.000Z'
                  statusReasonDescription:
                    type: string
                    description: Text of `statusReason`.
                    example: SEM MOTIVO
                  legalNatureDescription:
                    type: string
                    description: Text of `legalNature`.
                    example: Sociedade Empresária Limitada
                required:
                  - _id
                  - branchNumber
                  - branchType
                  - companyDocument
                  - document
                  - refDate
                  - status
                description: >-
                  One establishment of a company, with the text of its coded
                  fields.
        '404':
          description: >-
            `COMPANY_NOT_FOUND` — The registry has no establishment with this
            CNPJ, or the document is not a valid CNPJ.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - COMPANY_NOT_FOUND
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - REGISTRY
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: COMPANY_NOT_FOUND
                origin: REGISTRY
                message: Company not found
        '422':
          description: >-
            `BAD_REQUEST` — A path parameter is not valid; `fields` lists each
            one.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - BAD_REQUEST
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - REGISTRY
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                  fields:
                    type: array
                    description: >-
                      One entry per invalid request field (validation errors
                      only).
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                          description: >-
                            Path of the invalid field, e.g. `label` or
                            `values[0].value`.
                          example: label
                        message:
                          type: string
                          description: Why the field was rejected.
                          example: label is required
                        code:
                          type: string
                          description: >-
                            `<FIELD>_<REASON>` — e.g. `LABEL_REQUIRED`,
                            `TYPE_ONE_OF`, `VALUES_VALUE_TYPE_ERROR`.
                          example: LABEL_REQUIRED
                        values:
                          type: array
                          items:
                            type: string
                          description: >-
                            The accepted values, when the field is an
                            enumeration.
                      required:
                        - field
                        - message
                        - code
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: BAD_REQUEST
                origin: REGISTRY
                message: >-
                  Bad Request: Your request is invalid or incomplete. Please
                  make sure you are requesting with the right fields.
                fields:
                  - field: organizationId
                    message: Invalid UUID
                    code: ORGANIZATIONID_UUID
        '503':
          description: >-
            `COMPANY_LOOKUP_UNAVAILABLE` — The establishment is not stored yet
            and the real-time registry could not be reached. Try again later.
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: >-
                      Identifier of the request that failed. Quote it when
                      contacting support.
                    example: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                  code:
                    type: string
                    enum:
                      - COMPANY_LOOKUP_UNAVAILABLE
                    description: >-
                      Stable, machine-readable error code. Branch on this, never
                      on `message`.
                  origin:
                    type: string
                    enum:
                      - REGISTRY
                    description: Service that produced the error.
                  message:
                    type: string
                    description: >-
                      Human-readable explanation. Its wording may change without
                      notice.
                required:
                  - traceId
                  - code
                  - origin
                  - message
              example:
                traceId: 1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b
                code: COMPANY_LOOKUP_UNAVAILABLE
                origin: REGISTRY
                message: Company lookup unavailable

````

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